Skip to content

Go parser + reachability: fix 3 finder bugs#109

Open
gadievron wants to merge 6 commits into
masterfrom
pr/go-and-reachability
Open

Go parser + reachability: fix 3 finder bugs#109
gadievron wants to merge 6 commits into
masterfrom
pr/go-and-reachability

Conversation

@gadievron

Copy link
Copy Markdown
Collaborator

Go parser + reachability: fix 3 finder bugs

Local-only branch pr/go-and-reachability off master 368b559. One of a coordinated 7-PR set fixing parser/reachability bugs found by the OpenAnt finder. File-disjoint from the other 6 PRs (no merge collision; any order).

Addresses 3 finder bug-ids (3 distinct fixes; 0 ride a same-PR canonical).

Bugs fixed

  • [4] inert-main-reachability-seed (c/go/reachability_seeding) — Fixes BUG-002 (previously logged; was fixed only on an unmerged branch, still live on master 368b559)
  • [5] go-camelcase-schema-drift (go/schema_field_drift) — Fixes BUG-007 (previously logged; was fixed only on an unmerged branch, still live on master 368b559)
  • [19] go-dataflow_loss-220-alias (go/dataflow_loss) — genuinely-new (no prior logged entry)

Dedup status (independent + judge, from raw)

1 genuinely-new · 2 duplicate-of-curated (cross-ref above) · 0 covered-by-curated · 0 intra-PR-duplicate. All re-confirmed STILL PRESENT on pristine master 368b559 (git show 368b559:).

Tests

Verified GREEN in isolation off pristine 368b559: 14 passed (entry_point + go schema, incl. go-main end-to-end) + go test ok. New per-bug regression tests + a test_<lang>_schema_completeness.py field-contract guard.

Notes

  • TDD per bug (RED→GREEN); independent + judge verified each fix from raw against master.
  • No behavior change outside the listed parser(s).

🤖 Generated with Claude Code

gadievron and others added 5 commits June 9, 2026 23:40
… (BUG-NEW 4)

Local-only finder-fixes-54. 5 tests; 33 passed (detector+reachability), no regress.
ENTRY_POINT_TYPES omitted 'main', and _get_entry_point_reasons gated the unit-type
signal solely on that set, so a silent main (no decorator/input pattern) accumulated
zero reasons -> never seeded -> its callees fell out of the reachable set. Added 'main'
to ENTRY_POINT_TYPES + a defensive name=='main' fallback. Language-agnostic; for Go this
also requires the BUG-5 camelCase normalization (separate commit) so unitType is read.
Judge: AGREE / SHIP-AS-IS.
Local-only; not pushed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

(cherry picked from commit 95a708fb2d2bdaff619d24c3883aafb3072b601b)
… snake_case (BUG-NEW 5)

Local-only finder-fixes-54. 3 tests; 143 passed, 31 skipped, no regress.
The Go binary emits camelCase FunctionInfo keys (unitType/startLine/filePath/...) while
every Python consumer reads snake_case -> Go func records had unit_type=None, silently
disabling ALL unit_type-based logic for Go (entry-point seeding, reachability, by-type
stats). Root: the two normalization blocks in test_pipeline.py normalized the WRONG way
(emitting camelCase, stale "detector expects camelCase" comment) while EntryPointDetector
reads snake. Added a shared idempotent normalize_go_function_records() (camel->snake,
already-snake passes through) at both call_graph.json build + reachability-filter boundaries.
END-TO-END verified (real Go binary): a silent func main() now seeds reachability via
unit_type:main and its helper is reachable (the [4]+[5] payoff).
Deliberately NOT touched: the analyzer_output.json camelCase surface (consumed camelCase by
repository_index.py/tools.py — a separate intentional contract). Consumer-check corrected the
deep-investigation's "likely non-bug" verdict: [5] is a REAL bug on the call_graph surface.
Local-only; not pushed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

(cherry picked from commit c33c35ab16e099b72a36464f26b98359cee79bc2)
…n schema

Re-verification (independent + judge) of the shipped [5] go-camelCase fix. Confirmed
correct on the call_graph.json surface (real bug; analyzer_output.json camelCase is a
separate intentional contract, untouched). Gap closed: normalize_go_function_records
omitted parameters/returns/is_async (present in Go FunctionInfo); added them with the
isAsync->is_async fallback (defense-in-depth — no live consumer reads them yet, but the
record now matches the snake-case shape). +2 unit tests (camel->snake full schema +
idempotency, no Go toolchain needed). go parser suite: 9 passed.
Local-only; not pushed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

(cherry picked from commit 908384050b46c9c5afb2d59cc36cba406045c415)
…l routing (BUG-NEW 19)

Local-only finder-fixes-54. go test ./... green (3 new go tests); binary rebuilt (go build -o go_parser .).
[19] f := helper; f() dropped the edge — collectFuncValueAliases now tracks a SINGLE
unconditional name:=<ident> binding and rewrites f() to its target before the builtins
filter (reassigned/conditional/non-ident RHS -> dropped, no false edge). DEEPER bug found
+ fixed (the reported baseline 'direct helper() resolves' was FALSE): resolveCalls routed
every call into the method branch via "" == callerInfo.ClassName, so top-level calls
produced 0 edges, masking the alias bug — guarded the routing to require a non-empty
class match. Scope widened by that one routing line (flagged for the judge).
Method-value alias (m := obj.M) = the distinct BUG-044, correctly dropped (out of scope).
Local-only; not pushed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

(cherry picked from commit 52440afa1887427c79efe64676477c010f0420bc)
Local-only; not pushed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gadievron

Copy link
Copy Markdown
Collaborator Author

Merge-order note (not a defect — flagging for landing order)

Two files overlap earlier PRs; both want a union:

Reverses the earlier "rebuild go_parser binary" approach in this PR. The binary is in
.gitignore but was tracked since the initial commit; committing it makes it drift stale
on every source change. Untrack it — CI builds it on every run and the dev pipeline
rebuilds when absent. Compile on demand, no committed artifact.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
gadievron added a commit that referenced this pull request Jun 17, 2026
The binary is in .gitignore but was tracked since the initial commit, drifting stale on
every source change. Untrack it so it stays ignored; CI builds it every run and the dev
pipeline rebuilds when absent. Keeps the stack consistent with the same cleanup on the
go-parser PRs (#109, #126) — compile on demand, no committed artifact.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant