GitNexus/gitnexus/bench/tool-accuracy
Gergő Magyar b5b4f13f2c
fix(java): resolve overloads by JLS phases (#3791)
* docs(plans): add Java overload repair plan

* fix(java): resolve overloads by JLS phases

Select complete overload families before shared pruning so strict,
loose and variable-arity applicability preserve Java call targets.
Keep unsupported or ambiguous families terminal and persist their
omission boundaries so impact counts cannot imply complete coverage.

Preserve declared return types, synthetic members and bounded runtime
dispatch. Memoize inheritance walks to avoid exponential diamond work.

Fixes #3789

* refactor(java): simplify overload capture paths

Reuse record accessor captures and require suppression identity context.
Remove redundant cache-layout assertions and test-history comments.
Populate real overload receipts in the accuracy fixture so its exact
control matches the production metadata contract.

* docs: remove implementation plan from PR

Exclude the planning document from the published change.

* fix(java): honor enclosing protected access

* docs(mcp): qualify overload coverage (#3791)

* perf(java): bound overload ingestion costs

Index method facts and lexical bindings, and avoid repeated native child and callable-definition scans. Add measured cold, warm, and edited scaling checks at 128, 512, and 2048 units.

Refs #3789

* refactor(java): simplify overload lookup state

Index diagnostic candidates once to bound lookup work linearly,
preserving scope and first-match precedence. Keep local bindings
out of the field index and remove redundant metadata.

Refs #3789

* fix(java): correct replay diagnostics and CI

Repeated impact queries exhausted the persistence test's 128 MiB buffer
pool. Give the reader 512 MiB and reject partial results before checking
callers.

Coalesce receiver replay diagnostics by full source-site identity while
compacting resolved drops in one linear pass. This removes 51 duplicate
receipts without merging distinct calls at the same start position.

Refresh the Java capture fingerprints after attributing every difference
to return types, var initializers, and seven new fixture files. Keep the
1.5 scaling budget. Receiver calls move 140 -> 141: two new fixture sites
and one existing chain newly resolved. Shape states are unchanged; origin
counts reflect selected return types instead of earlier guesses.

Refs #3789

* ci(java): enforce overload scaling benchmark

Run the 54-analysis correctness and scaling check in the existing
scope-resolution benchmark job. Upload its report with that job's
measurements so regressions fail CI instead of relying on manual runs.

Refs #3789

* test(java): clarify overload coverage (#3791)

Separate unmodeled call-argument coverage from Java accessibility and
confirm the accessible Object overload with an executed javac oracle.

Give incomplete-attribution cases distinct titles: JSON formatting drops
undefined properties and made three test identities collide in CI.

* perf(scope): skip unmatched value names

Reject impossible callable names before parsing definition positions or
allocating positional keys. Keep the exact file/line/name admission and
ambiguity rules unchanged.

The callable-value-flow benchmark overhead drops from 1.747-1.883 locally
to 1.210-1.271, below the unchanged 1.9 budget. Target fingerprints and
cardinalities are identical.

Refs #3791

* fix(java): resolve types from static imports

Map package-qualified model names to scope-index keys before resolving
explicit static member-type imports. Preserve uncertainty for missing
or conflicting imports.

Verify Number selection after boxing long and preserve the imported
source type identity, with an executed javac oracle for both targets.

Refs #3791

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-11-01 11:08:00 +00:00
..
fixtures fix(rename): extend safe refactoring and flow coverage across languages (#3557) 2026-10-13 08:38:17 +03:00
.gitignore fix(release): gate publication on accuracy and paired evaluation (#3503) 2026-10-10 08:26:08 +01:00
expectations.ts fix(routes): resolve Express registrations made through helper parameters (#3629) 2026-10-18 22:13:10 +01:00
known-gaps.json fix(taint): avoid false positives for guarded Git arguments (#3703) 2026-10-24 15:37:26 +01:00
README.md fix(taint): avoid false positives for guarded Git arguments (#3703) 2026-10-24 15:37:26 +01:00
run.ts fix(java): resolve overloads by JLS phases (#3791) 2026-11-01 11:08:00 +00:00
score.ts fix(release): gate publication on accuracy and paired evaluation (#3503) 2026-10-10 08:26:08 +01:00

Deterministic tool accuracy

This small release corpus implements the cheap tool-level checks proposed in discussion #3493, comment 18772530. The fixed answers come from local fixture source and public issue repros; the current engine output never defines the expected answer.

With the repository's dependencies installed, run from gitnexus/:

node --import tsx bench/tool-accuracy/run.ts --check --out bench/tool-accuracy/results
npm test -- test/unit/tool-accuracy-score.test.ts

The runner uses the real runPipelineFromRepo, CSV/database loader, metadata writer and LocalBackend.callTool. It indexes one small temporary TS/Python repository with PDG enabled and one parser worker. Community/process discovery is unnecessary for these checks and is disabled. Native parser workers require the normal build produced by npm ci; run npm run build after worker changes. The registry, database and fixture copy are isolated and removed after the run. Fixture code is parsed, never executed. Extension installation is disabled, accidental JavaScript fetches fail, and neither embeddings nor paid models run.

accuracy.json contains source SHA, working-tree status, fixture SHA-256, issue IDs, expected/actual answers, precision/recall and raw tool outputs. accuracy.md gives the same fixed-answer verdicts and concise failed answers. --out selects a report directory. Without --check, valid observations can be reported while a new fixed-answer failure is investigated; execution/output errors always exit nonzero. --check additionally enforces the regression gate.

Fixture / checks Public repro Fixed-answer contract
rename/ #3486 All three Writer.close references; zero edits to comments, strings or unrelated homonyms; typed DeferredWriter.flush parameters refuse without edits or source changes.
src/server/, test/stub.test.ts #3487 Server beats a same-path test stub; app.all has method *; Map.get is absent; helper-registered literal route is present.
src/web/ #3488 Both the base-URL template passed to a configured wrapper and a direct literal fetch link their consumer files.
src/security.ts, src/server/inline.ts #3489, #3490, #3491 Named and inline unsafe handlers reach the sink; guarded and constant commands have zero taint; statement and function-hop lines are 1-based.
pkg/ #3497 Direct, chained module-return helper and local module-return helper resolve to the same target.
mod.py, callers.py #3498 Direct, conditional, boolean and module-qualified annotated factories resolve to C.m.
nested*.py, local_import.py #3499 Imports resolve within their lexical scopes; unrelated nested declarations and sibling-local imports cannot capture bare calls.
summary.py, 501 deterministic drop records #3497 Production summarizeUnresolvedReceivers retains 500 names and reports one omitted name; querying a capped-out name requires lower-bound, while a complete empty summary permits exact.

The 501-name case supplies known suppressed outcomes to the production summary writer, persists its actual output as metadata and calls real impact. It tests the cap/consumer contract without requiring 501 parser fixtures. It does not claim parser coverage for those synthetic records. Python checks read actual context.outgoing.calls symbol UIDs, preserving lexical/class ownership.

Rename's positive fixtures construct each Writer receiver directly, including the imported class. A separate DeferredWriter.flush fixture exercises a typed parameter: a TypeScript annotation alone cannot prove which structurally compatible runtime object owns the method. The public rename tool (dry_run: true) must refuse it with planning_status: "unsupported" and code: "ambiguous_reference", zero edits, and unchanged source files. This safety check has no known-gap allowance. Fixture line anchors are updated together; the three exact semantic answers and the same-named method/function, comment and string controls remain required. The runner validates v2 semantic provenance, exact UTF-16 spans and before/after source lines, then scores the whole after line. Semantic rename does not use ripgrep or text-search edits.

Known gaps and repairs

The initial source baseline is dd096e690c06e5d54ab3595c63b83f15e04b6191: 11/31 fixed answers pass, 20 fail. Main at 50aa4be3b2c2c9a1561fc44878e5d8f87b99d16e repaired three #3487 route checks and all four #3499 checks, and their allowances were removed: 18/31 pass, 13 fail. The JSON report records every desired and actual answer independently of gate status. Inline-callback taint now passes and its allowance is removed. Guard taint now passes for the modeled immutable SHA predicate and Git data-argument use (#3490), and its allowance is removed. The current corpus passes 32/32 fixed answers with no known-gap allowances. Unsupported guard forms remain conservative findings; this does not claim complete guard coverage.

known-gaps.json is an explicit, reviewed list of failing check IDs with issue, reason and observed baseline answers. There is no wildcard, skip, automatic baseline-update command or production-engine fix in this corpus. The gate:

  • Rejects new failing checks, unknown/malformed allowances and missing/malformed tool outputs, exceptions, truncation and incomplete fixture extraction.
  • Rejects a previously correct fact disappearing or a new incorrect fact appearing inside an existing gap. Partial repairs can still proceed.
  • Rejects a passing check whose allowance remains: remove the allowance in the PR that repairs the case, so the fixed answer protects future releases.

Changing a fixture requires reviewing its fixed answers and the line anchors in FIXTURE_ANCHORS (expectations.ts); the runner and a unit test fail when an anchor no longer matches its fixture line. Broadening an allowance requires review of the actual repro; never change an expected answer simply to match current output.