mirror of
https://github.com/garrytan/gbrain.git
synced 2026-07-27 22:15:33 +00:00
Root cause of #2189's opaque per-file crash: putPage's INSERT … ON CONFLICT DO UPDATE … RETURNING can yield 0 rows when brain-local DB state (e.g. a BEFORE trigger) suppresses the write, and rowToPage(rows[0]) then died with "undefined is not an object (evaluating 'row.deleted_at')". Both engines now throw a descriptive error naming the slug + source_id so the failure is diagnosable per-file instead of an anonymous TypeError. Also lands the salvageable parts of community PR #2586 (takeover): the "failed to parse / fix the frontmatter" copy misclassified runtime import errors as YAML problems — reworded to "failed to import" — plus its first-code-sync PGLite smoke test. New regression test reproduces the exact 0-row RETURNING state via a suppressing trigger: fails pre-fix with the reported crash signature, passes with the guard. Co-authored-by: javieraldape <javieraldape@users.noreply.github.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>