Repository navigation
Conversation
…e grammar errors
`pip install "graphifyy[postgres]"` — the command the README gives —
installs the psycopg driver but not the tree-sitter-sql grammar.
`introspect_postgres` reconstructs the catalog as DDL and hands it to
`extract_sql()`, which without that grammar returns `{"error": ..., nodes:
[], edges: []}`. `introspect_postgres` returned that dict unchanged, so
the CLI printed "PostgreSQL: 0 nodes, 0 edges" and exited 0.
Reproduced on postgres:17-alpine with graphifyy 0.9.48: a database with
3 tables, foreign keys, a view and a function reported 0 nodes and
exited 0 — indistinguishable from an empty database.
Two lines of fix:
- the `postgres` extra now lists `tree-sitter-sql` alongside `psycopg`,
so the documented install works;
- a grammar error from `extract_sql` raises with the install hint instead
of being reported as an empty database.
The `sql` and `all` extras already carried the grammar, which is why this
went unnoticed — only the `postgres` extra was short.
Tests: 9 covering the empty-result surfacing and the existing catalog paths.
There was a problem hiding this comment.
Graphify reviewed this change.
Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.
Formal verification. No changes could be formally verified in this run.
Graphify review — findings
Adds tree-sitter-sql to the postgres extra so --postgres introspection actually has the SQL grammar it feeds reconstructed DDL into. Makes introspect_postgres raise an ImportError with the pip install 'graphifyy[postgres]' hint when extract_sql reports a missing-grammar error, instead of silently returning an empty graph and printing "PostgreSQL: 0 nodes" as if the database had no tables.
Worth a look
- introspect_postgres now raises ImportError for any extract_sql error —
graphify/pg_introspect.py:160· Escalate · medium- agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 379 functions depend on the 224 functions this change touches.
Health — this change adds coupling hotspots:
- new:
dispatch_command()— 2 callers, 122 callees - new:
test_poisoned_manifest_is_healed()— 0 callers, 6 callees
Verification — 379 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 229 function(s) in the blast radius were not formally verified this run
Formal verification
Could not verify: Could not verify introspect\_postgres.
The verifier did not have enough to check introspect\_postgres, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: not verifiable: all 24 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous (mostly ProgrammingError — names the real obstacle, not a sampling gap)
· 2 more finding(s) on lines outside this diff (see the check run).
|
Re "introspect_postgres now raises ImportError for any extract_sql error" ( The
Data-dependent failures cannot reach it: tree-sitter is error-tolerant, so malformed SQL yields ERROR nodes in the tree rather than raising, and on this path the DDL arrives in-memory ( The one cosmetic wrinkle is that a case-3 failure would carry the |
|
Shipped in v0.9.50 via authorship-preserving cherry-pick so you keep contributor-graph credit. Thanks @Azeem1985! Release: https://github.com/Graphify-Labs/graphify/releases/tag/v0.9.50 |
|
Thanks — confirmed both halves are in the v0.9.50 tag (the extra carries the grammar, and grammar errors now surface as |
Replaces #3048. Same fix, but that PR was opened from a branch carrying our whole fork — 62 files and 41 commits for a change that is two lines plus a test. Nobody should have to review that, and I am sorry for sending it in that shape. This branch is cut from
v8and carries only the fix. #3048 is being closed with a pointer here.Fixes #3047.
The defect
pip install "graphifyy[postgres]"— the command the README gives — installspsycopgbut nottree-sitter-sql.introspect_postgres()reconstructs the catalog as DDL text and hands it toextract_sql(). Without the grammar,extract_sql()returns{"error": ..., "nodes": [], "edges": []}.introspect_postgres()returned that dict through unchanged, so the CLI printed:and exited 0 — indistinguishable from pointing at an empty database.
Reproduced
postgres:17-alpine, graphifyy 0.9.48, installed exactly as documented. Database with 3 tables, foreign keys between them, one view and one function. Result:0 nodes, 0 edges, exit 0.The change
pyproject.toml: thepostgresextra now liststree-sitter-sqlalongsidepsycopg[binary], so the documented install works.graphify/pg_introspect.py: a grammar error coming back fromextract_sqlraisesImportErrorwith the install hint, instead of being reported as an empty database.The
sqlandallextras already carried the grammar — onlypostgreswas short, which is probably why this went unnoticed. The second half is there because even with the extra fixed, an environment that has the driver and not the grammar should say so rather than report zero.Diff
4 files:
pyproject.toml(+5/-1),graphify/pg_introspect.py(+8),tests/test_pg_introspect.py(+20),CHANGELOG.md(+4). 9 tests pass.