test(goldens): add Kotlin parser golden for graph-content coverage - #1618
Shashankss1205 merged 1 commit into
Conversation
|
@rrodriguesNutrium is attempting to deploy a commit to the shashankss1205's projects Team on Vercel. A member of the Team first needs to authorize it. |
Kotlin had no golden despite sample_project_kotlin existing in fixtures, so nothing asserted on the Kotlin graph's contents. The goldens are the only tests in the repo that check real graph output end to end. Everything else asserts on the parser's return dict built from hand-written fixtures -- which is how the is_dependency bug fixed in CodeGraphContext#1609 stayed invisible while the suite was green. Baseline captures 216 nodes / 278 edges, with is_dependency=False on all 50 Function nodes and decorators populated on 5. The absolute repo root inside each `uid` is normalised to <REPO_ROOT> so the fixture carries no developer's home directory. `uid` is listed in the test's VOLATILE_NODE_KEYS and is never compared, so this does not affect the assertion. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
6f4d6f4 to
8f6fd10
Compare
Shashankss1205
left a comment
There was a problem hiding this comment.
Approving — and this PR caught my broken environment, which is worth recording.
It failed for me initially on exactly one property:
Function:copyWhenGreater ... EdgeCases.kt:ln_31
Expected: end_line 35, source = full function body
Actual: end_line 31, source = signature only
That's the generic-constraint function with a multi-line where T : CharSequence, T : Comparable<T> clause. Your golden was right and my venv was wrong:
tree-sitter-language-pack 0.13.0 (my stale venv) -> end_line = 31
tree-sitter-language-pack 1.14.3 (pyproject pin) -> end_line = 35
Root cause: my venv had codegraphcontext 0.4.16 metadata installed, whose old pin (tree-sitter-language-pack<1.0.0) held the grammar back even though the .pth correctly pointed at src/. So source changes were live but dependency pins were eight months stale. Fixed on my side; filed as #1625 so the next person gets a loud failure instead of a silent behavioural difference.
After upgrading to the pinned grammar this passes, and where-clause functions are exactly the kind of edge case a golden should be pinning.
tests/integration/ 45 passed (44 + this new golden)
tests/unit/ 1209 passed
Second time today a Kotlin PR of yours was judged wrongly by my environment (see #1610) — thanks for the fixtures that made it obvious.
Conflict in test_database_kuzu_kotlin_metadata.py was additive: this branch's two write_binds_links tests vs main's three write_inheritance_links probe tests (CodeGraphContext#1617). Kept all five. Also regenerates the Kotlin golden added in CodeGraphContext#1618, since this branch adds AndroidHilt.kt to that fixture project. The diff is purely additive -- 24 new nodes, zero missing -- and the refreshed golden now pins both BINDS edges (@BINDS and @provides). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Kotlin has no golden, despite
tests/fixtures/sample_projects/sample_project_kotlin/existing. So nothing asserts on the Kotlin graph's contents.That matters more than a single missing language, because
test_parser_goldens.pyis the only place in the repo that checks real graph output — source → index → export → diff. Every other test asserts on the parser's return dict, built from hand-written fixtures.That gap is not theoretical: it is exactly how the
is_dependencybug you fixed in #1609 stayed invisible.find_dead_codereturned[]for every project, in every language, on every backend, while the suite was green — because hand-built fixtures supply the very key the real writer omitted. A golden would have caught it on the first run.The baseline
216 nodes / 278 edges, generated with
--update-goldensso the format comes from the same code that consumes it.Sanity-checked before committing, because a golden bootstrapped from broken output would permanently enshrine the bug as expected behaviour:
is_dependencyon Function nodesFalse× 50 — not null, i.e. captures #1609's fixdecoratorsis_composableVerified green twice consecutively; a golden that is not deterministic is worse than none.
Note on the environment
While generating this I lost several hours to a failure mode worth knowing about: FalkorDB Lite runs its storage in a worker subprocess with a timing-sensitive startup, and under CPU contention it fails to come up, indexing exits 0 with an empty graph, and the golden diff then reports every node as missing. I wrongly concluded the whole suite was broken. On an idle machine all of them pass.
#1616 adds a guard that makes that case fail with a clear message instead of a phantom regression. This PR does not depend on it, but they are complementary.
Test fixtures only — no source changes.