Commit graph

192 commits

Author SHA1 Message Date
Gergő Magyar
b2c72997ea
fix(scope): reduce memory for terminal import misses (#3741)
* fix(scope): reduce memory for terminal import misses

* fix(review): cover external imports and cache isolation

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-27 15:41:48 +00:00
Gergő Magyar
afea705e36
test(mcp): retain paired performance measurements (#3730)
Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-27 07:32:26 +00:00
Gergő Magyar
c417ccfc81
perf(ingestion): reduce indexing overhead and declaration memory (#3726)
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Gitleaks / gitleaks (push) Waiting to run
Publish / Classify release event (push) Waiting to run
Publish / RC guard (marker + release-PR skip) (push) Blocked by required conditions
Publish / ci (push) Blocked by required conditions
Publish / Publish to npm (push) Blocked by required conditions
Publish / Build & Push RC Docker images (push) Blocked by required conditions
Scorecard / Scorecard analysis (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-cli) (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-web) (push) Waiting to run
* refactor(ingestion): share callable declaration facts

Reuse pure parameter and signature facts between structure and scope
extraction, with tree-owned caches and read-only parameter contracts.
Preserve provider-specific wrappers and consumer projections.

Add characterization tests, real-worker parity checks, and reproducible
performance measurements. Keep the overall indexing effect explicit.

Refs #3723

* fix(bench): create result files exclusively

Address CodeQL review feedback on #3726. Use a private default directory and an exclusive file handle so existing files and symlinks cannot be overwritten.

* perf: speed analyzer identity guard probes

* perf(ingestion): reuse callable type and overload facts

* ci: retain callable time and memory benchmarks

* chore: use established CI performance measurements

* fix(bench): check callable baseline in CI

* perf(ingestion): guard callable scaling and reuse export checks

* fix(ci): budget for callable scaling matrix

* refactor(ingestion): simplify callable handling

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-26 15:13:48 +00:00
Andrey Golanov
63f2f8e590
fix(ingestion): retain named class-expression owners (#3725)
* fix(ingestion): retain class-expression owners

Keep named JS/TS expressions, members and scope declarations on matching
graph identities. Distinguish expressions that reuse a local class name.
Avoid root enumeration when no file-scope types are configured.

1088 focused tests pass. Full suite: 28407 passed, one pre-existing
SSH-signing-sensitive golden failure, 91 skipped.

* fix(ingestion): preserve type-alias owners

Keep method-local type-alias member edges on the existing simple
TypeAlias IDs when JS/TS class qualification is enabled. Otherwise
native COPY drops both method and property relationships.

Cover TS, TSX and Vue workers plus direct native-persistence reads.

Refs #3725

* fix(bench): align JS/TS capture baselines

Record the fingerprints introduced by qualified class and member identities. Same-corpus comparisons attribute every changed byte to the new qualified-name tags; removing those tags restores both previous hashes. Keep capture counts and scaling budgets unchanged.

---------

Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-26 07:57:55 +00:00
samuel mbabhazi
9772bcd24f
feat(api_impact): list the callers of the requesting function as indirect consumers (#3720)
* feat(api_impact): list the callers of the requesting function as indirect consumers

The FETCHES edge is file-level, so api_impact saw only the file that sends
the request. The files that call its request function never mention the URL
and were missing from the report (#3644).

The edge's reason now names the callables whose spans contain the request
sites, one `|via:<id>` field each, under the containment rule the R3-6 sink
set already uses; that rule moves into EnclosingCallableIndex so both stay
one. Several sites of one file for one route now share the edge instead of
colliding on its id. api_impact follows the CALLS edges into those callables
one level up and reports the callers as `indirectConsumers`, apart from the
direct consumers and outside the risk level. Direct consumer files and the
handler file are left out. An index built before the attribution carries no
field. Expo navigation sites carry their real line so they attribute to the
component that contains them.

Closes #3644

* fix(api_impact): attribute a request site by its AST enclosing callable

A helper defined on the line of the request has the smaller span, so the
line-only lookup named it and the callers of the real requesting function
vanished from indirectConsumers. The parser now records the enclosing
callable of each fetch site and of each wrapper call (through the call's
position), and attribution prefers that identity; the span lookup remains
for sites found by text scan. The same preference applies to the R3-6 sink
set. A real analyze of the fixture followed by api_impact pins the helper
case and the wrapper case.

* test(bench): rebaseline receiver resolution for the indirect-consumers fixture

The api-impact-indirect-consumers fixture adds three receiver-unresolved
sites to the corpus: two `.then(...)` calls on the untyped return of
`fetch(...)` and of the local wrapper `apiFetch(...)`, and one
`req.query.path` read inside an inline Express handler with an untyped
`req`. Call drops 138 -> 140, reads 30 -> 31, all kinds 168 -> 171. No
shape-arm state and no existing site changed.

* fix(api_impact): preserve module-scope request attribution

Keep AST-confirmed module scope distinct from missing attribution for direct
fetches, HTTP clients, and wrapper calls. Prevent overlapping callable spans
from inventing indirect consumers or process sinks.

Preserve span fallback for callable forms the generic identity walk cannot
name. Add eight regression cases, including real analyze/api_impact coverage.
Rebaseline receiver-resolution counts for the two then calls and one property
read added by this PR's existing fixtures; shape expectations are unchanged.

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
2026-10-25 18:29:09 +00:00
Gergő Magyar
ee7eff97f7
fix(ci): rebalance native tests and stabilize flaky gates (#3719)
* fix(ci): stabilize timing gates and artifact uploads

* fix(ci): rebalance undercharged native test shards

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-25 09:38:21 +00:00
Gergő Magyar
36227d93d1
perf: benchmark scope resolution and remove redundant allocation (#3711)
* fix(java): bound imported return-type propagation

* fix(java): preserve inherited return types

* perf: benchmark scope-resolution allocation in CI

Measure all supported languages with real parsing and resolution, and
require stable graphs and measured binding budgets in CI.

Keep transitive Java factory calls without re-copying dependency tables,
and build shared re-export closures only when a lookup needs them.

* test: cover scope benchmark CI dependency

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-24 22:04:46 +01:00
Gergő Magyar
d8a256a03a
fix(taint): avoid false positives for guarded Git arguments (#3703)
* fix(taint): refine values after accepted guards

Preserve bounded value restrictions through local flows and function
summaries. Check the complete command against the modeled sink use
before suppressing a finding. Unknown paths and exhausted budgets
retain conservative findings.

Refs #3490

* fix(taint): preserve guard proof identities

Reject destructured/rest formals before they inherit a whole-argument
proof, and include transitive alias uses in bounded guard certificates.

Add worker regressions, argument-heavy scaling coverage and global
refinement fallback diagnostics.

Refs #3703

* perf(cfg): reuse scope and argument facts

Reduce duplicate native AST reads and allocation in TypeScript CFG collection
while preserving argument forwarding and malformed-input recovery.

Add regression cases and a portable paired benchmark with recorded results.

* test(cfg): distinguish validator cases

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-24 15:37:26 +01:00
Gergő Magyar
48f108a58a
docs: simplify guides and verify receiver gaps (#3694)
* docs: align resolution architecture and roadmap

* docs: add language ingestion gap inventories

* test: audit receiver gap targets and coverage

Check exact declaration IDs, expose the Dart await wrong-owner edge, and execute previously excluded C++, Rust, PHP, Dart and Vue shapes. Refresh the baseline and all language inventories from fresh measurements; call-drop counts remain unchanged.

* docs: focus roadmap and shorten project README

Keep the resolution roadmap limited to future work and acceptance criteria. Move detailed editor, CLI, MCP, deployment and wiki instructions into linked guides, preserve their command examples, and correct stale onboarding claims.

* docs: correct setup and audit descriptions

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-23 09:06:03 +01:00
Gergő Magyar
bbbc1b49e3
test(bench): type the JS, Ruby and PHP receiver shapes; mark C dispatch N/A (#3498) (#3663)
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Gitleaks / gitleaks (push) Waiting to run
Publish / RC guard (marker + release-PR skip) (push) Blocked by required conditions
Publish / ci (push) Blocked by required conditions
Publish / Publish to npm (push) Blocked by required conditions
Publish / Classify release event (push) Waiting to run
Publish / Build & Push RC Docker images (push) Blocked by required conditions
Scorecard / Scorecard analysis (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-cli) (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-web) (push) Waiting to run
* test(bench): type the JS, Ruby and PHP receiver shapes; mark C dispatch N/A

Several shape-arm rows were measuring their fixtures instead of the receiver
spelling.

The JavaScript and Ruby rows had no types anywhere, so each chain cell said
"this code is untyped" and could only flip by guessing from a method name.
They now carry JSDoc and YARD types, the way plain JS and Ruby carry types.
Each row keeps one untyped control as a new extra id, `untypedChain`, so
`plainChain` and the other canonical ids mean the same thing in every row.
Ruby names each function's parameter after its cell, because YARD `@param`
bindings land on the Module scope. A probe showed an untyped `svc` resolving
through a sibling's tag.

PHP `plainDeepChain` and `optionalChain` went through the unannotated
`getUser()`, so they measured the missing return type rather than their own
spelling. They now use `getUserTyped()`, and `arrowCallChain` stays the
unannotated control. `indexElement` gains PHPDoc `@param User[] $repos`.

The C structs lived in `models.h`, which the C++ provider owns, so C never saw
them. They now live in `main.c`. All three measured C cells called through a
function-pointer field. That field has no graph node and no static callee, so
the cells could never resolve and are now N/A.

Shape-arm movement, every target checked:
- javascript: plainChain, plainDeepChain, optionalChain, awaitParen
  VISIBLE-GAP -> RESOLVES; untypedChain new, VISIBLE-GAP; indexElement
  stays VISIBLE-GAP (no JS elementTypeOf)
- ruby: plainChain, optionalChain VISIBLE-GAP -> RESOLVES; plainDeepChain
  VISIBLE-GAP -> INVISIBLE-GAP (base types, untyped attr_reader step);
  untypedChain new, VISIBLE-GAP; indexElement stays INVISIBLE-GAP
- php: plainDeepChain, optionalChain INVISIBLE-GAP -> RESOLVES
- c: plainDeepChain, indexElement VISIBLE-GAP -> N/A; fieldReceiverCall
  INVISIBLE-GAP -> N/A

The count arm and every other language's cells are unchanged. No resolver
code changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: correct typed shape benchmark states

* docs: qualify Ruby typed shape owner claims (#3663)

The receiver shape gate matches member names only, so the Ruby
plainChain/optionalChain owner (User.save) is a probe observation, as
already stated for the JavaScript and PHP rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: drop unverified #3609 tracking claims (#3663)

#3609 does not document the Ruby YARD @param scope leak or C header
struct visibility, so say both are not yet filed separately.

Also carry the BASELINE.md notes that came from the pre-rebase merge commits
(main c30449394 and stack parent #3667), which the linear replay onto the
rebased walker drops: the post-#3659 and #3667-stack integration notes and
the Ruby indexElement wording on the walker parent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 00:05:10 +00:00
Gergő Magyar
09b7a5b174
fix(ingestion): read more receiver-chain spellings (#3498) (#3667)
* fix(ingestion): name chain steps without their explicit type arguments

C#, C++ and Rust put explicit type arguments inside the callee node, not
beside it as TypeScript, Java and Kotlin do. The receiver-chain walk read
the callee's text, so `svc.GetTyped<User>().Save()` built the step
`GetTyped<User>`, which matches no member, and C++ built `getTyped<User>`.
Rust's `svc.get_typed::<User>()` wraps the whole field access in a
`generic_function`, so the walk found neither a name nor the inner
receiver and built no chain at all.

The walk now peels these callee nodes (C# `generic_name`, C++
`template_method`, `template_function` and `dependent_name`, Rust
`generic_function`) before it reads the step name and the receiver. It is
a node-type table next to the existing ones; nothing branches on a
language. Type arguments choose an instantiation, never a member, so the
name loses nothing.

Shape arm: csharp and rust `explicitTypeArgs` go from VISIBLE-GAP to
RESOLVES, to `User.Save`/`User.save`. cpp `explicitTypeArgs` keeps its drop: the step
is now `getTyped`, but `template <typename T> T* getTyped()` has no
return type until `T` is substituted, which is separate work.

baseline.json and BASELINE.md record the move; the count arm and a
corpus A/B against main are unchanged.

The chain wire format is unchanged, so the receiver-chain codec version
stays at 2. Parse caches need no manual bump: the parse-cache identity
hashes every file under `core/ingestion`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ingestion): read receiver chains through C# `!` and Swift `(x)`

The chain walk peels wrappers that denote exactly their operand, so the
chain's base is `svc` rather than `svc!` or `(svc)`. Two spellings of that
were missing.

C#'s null-forgiving `svc!` is a `postfix_unary_expression`, so
`svc!.GetUser().Save()` built `2|svc!|cGetUser`, whose base binds nothing.
It now joins the `!`-gated entry Swift and Kotlin already use. The same
node type carries `x++` and `x--`, and the `!` gate leaves those alone.

Swift has no parenthesized-expression node: `(await svc.getUserAsync())`
and `(holder)` parse as a one-element `tuple_expression`, and the walk
stopped there. `(await svc.getUserAsync()).save()` built no chain, and
`(holder).repo.save()` built one whose base `(holder)` binds nothing. A new gate peels a tuple only when it is exactly `(`,
one element, `)`. That excludes Rust's real one-element tuple `(svc,)`,
Swift's labelled `(x: svc)`, and every tuple of two or more.

Shape arm: csharp `nonNullAssert` goes from VISIBLE-GAP to RESOLVES
(`User.Save`). Swift
`awaitParen` now builds `2|svc|cgetUserAsync|a`, but it was already a
VISIBLE-GAP and stays one: Swift return types live on the Module scope,
and the fold looks there only after the Swift/Dart hoist change lands.
Swift `(holder).repo.save()` now resolves to `User.save`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ingestion): walk C# null-conditional access in receiver chains

C# parses `svc?.GetUser()` as a `conditional_access_expression` whose
receiver sits in a `condition` field and whose member sits in a
`member_binding_expression` child. The chain walk read it like any other
callee: it named the step `.GetUser` and found no inner receiver, so
`svc?.GetUser().Save()` built no chain and could never resolve. As a
receiver (`user?.Address.Save()`, `repos?[0].Save()`) the node stopped
the walk, and its whole text became the base.

A node-type table now says where a conditional access keeps its receiver.
As a callee, the walk names the step from the member binding; an element
binding (`handlers?[0]()`) names no member. As a receiver, a member
binding becomes a field step and an element binding becomes an index step.

Shape arm: csharp `optionalChain` goes from VISIBLE-GAP to RESOLVES
(`User.Save`). `svc?.GetTyped<User>().Save()` also resolves, through the
type-argument peel from the earlier commit. `repos?[0].Save()` now
records its miss, which was silent before: `User[] repos` has no type
binding yet. `user?.Address.Save()` already resolved through the
receiver-text cascade; a resolver row pins it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ingestion): read Ruby and Swift subscripts as index steps

Two grammars spell a subscript as something the chain walk did not
recognise.

Ruby's `repos[0]` is an `element_reference`, which was missing from the
subscript table, so the walk stopped there. The receiver has no `.` or
`(` either, so the call vanished: no edge and no drop.

Swift has no subscript node at all. `repos[0]` parses as a
`call_expression` whose `call_suffix` holds `value_arguments`, the same
as a call, except that the list is delimited by `[`/`]` instead of
`(`/`)`. Walked as a call, it named no member, and `holder.users[0]`
named `users` as if it were a method. A call node whose suffix argument
list opens with `[` is now read as an index step. The opening token is
the only thing that tells the two apart, and `svc.getUser(0)` stays a
call.

Shape arm: ruby `indexElement` goes from INVISIBLE-GAP to VISIBLE-GAP.
`repos` is untyped, so there is nothing to fold, but the miss is now
counted. swift `indexElement` builds `2|repos|i` and records its miss
too, going from INVISIBLE-GAP to VISIBLE-GAP; resolving it needs a
Swift `elementTypeOf` hook from a separate change. So does
`holder.users[0].save()`, which now builds `2|holder|fusers|i` instead
of a call step named `users`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: clarify receiver walker review limits

* test: pin receiver-chain walker control spellings (#3667)

- Kotlin calls share Swift's `call_suffix → value_arguments`; pin that a
  parenthesized and a generic Kotlin call stay call steps, never index steps.
- Pin that a Swift trailing-closure call stays a call step.
- Pin that C# `GetTyped<T>()` and C++ `ns::getTyped<T>()` without a member
  receiver are named for the member and mint no chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: skip Swift chain rows when its grammar is unavailable (#3667)

The walker rows loaded the optional vendored Swift grammar at module scope,
so a host without its prebuild failed to collect every other language's
test in the file. Gate Swift on isLanguageAvailable and report its rows
as skipped; every other row still runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: expect Swift awaitParen through hoisted returns (#3667)

Rebased onto #3666, whose hoisted Swift return types let the walker's
`(x)` chain resolve awaitParen to User.save. This carries the content the
replaced merge commits held: the walker row now expects that edge and no
drop, the receiver baseline marks swift awaitParen RESOLVES, and
BASELINE.md keeps the measured main and stack integration notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(bench): label parent-only awaitParen note and drop issue claim (#3667)

The #3666 section said Swift awaitParen still needed a fix. That holds for
#3666 alone; combined with this walker it resolves to User.save with no
drop, while dart nonNullAssert stays unsupported. Also stop calling the
generic-arity limitation tracked by #3609, a general triage tracker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 23:33:50 +00:00
Gergő Magyar
cc0b5d54f7
fix(swift,dart): type chained receivers through hoisted return types (#3498) (#3666)
* fix(swift,dart): type chained receivers through hoisted return types (#3498)

Swift and Dart hoist every method's return-type binding out of the class
body onto the Module scope, as C# does, but neither set
hoistTypeBindingsToModule. The receiver walk therefore never looked
there, and svc.getUser().save() had no receiver type. Both now set it.

The flag alone was not safe. The hoisted bindings are keyed by bare
method name, so with class A { getUser() -> User } and
class B { getUser() -> Admin } in one file the Module scope keeps only
B's entry, and a.getUser().save() resolved to Admin.save. C# and
TypeScript already do this on main.

So there is a new ScopeResolver toggle, hoistedTypeBindingsRequireOwner,
which Swift and Dart also set. With it, the walk accepts a hoisted
binding only when its declaration anchor encloses the declaration of a
member of that name owned by the receiver's class. Otherwise it keeps
climbing, and declines if nothing passes. The four walk-ups in
compound-receiver.ts now share one helper.

The toggle is opt-in. With the guard on everywhere, TypeScript loses
correct edges where two same-named methods happen to return the same
type (11 rows in inferred-field-receiver-matrix), because the Module map
cannot hold both. Swift and Dart never had those edges.

Bench: swift plainChain, plainDeepChain, optionalChain and nonNullAssert
(INVISIBLE-GAP) and dart plainChain, plainDeepChain and optionalChain
(VISIBLE-GAP) now RESOLVE with correct targets. No other cell and no
count-arm figure moves. The inferred-field matrix gains correct
Inner.compute edges for Swift (3 rows) and Dart (7 Alien rows).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scope): guard hoisted return ownership

* fix(scope): gate hoisted return replay checks

* fix(scope): preserve parameterized return replay

Keep exact callee return facts when ancestor candidates have matching
known parameter types, while refusing same-owner overload ties.

Refs #3666

* fix(scope): preserve known variadic return replay

Compare complete captured parameter vectors across distinct ancestor
owners, including variadic methods with unknown numeric arity. Keep
unknown Swift parameter slots instead of compressing them away.

Refs #3666

* test(swift): retain reviewed receiver fixtures

* fix(scope): retain unknown overload candidates

Keep unknown parameter slots possible without hiding conversion overloads.
Check return-owner precision without requiring valid calls to stay unresolved.

Refs #3498

* fix(scope): preserve conversion suppression

Keep explicit empty conversion results final when parameter metadata is
unknown. Add exact positive controls for receiver-fixture liveness.

Refs #3498

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 22:52:11 +00:00
Gergő Magyar
673dc6968e
fix(rust): see through Box, Rc and Arc on struct field types (#3498) (#3665)
* fix(rust): see through Box, Rc and Arc on struct field types (#3498)

The struct-field normalizer in rust/range-binding.ts cut a type at its
first `<`. A `repo: Box<User>` field was typed `Box`, so `self.repo.save()`
bound nothing. It also stripped a leading `&` but not a lifetime, so a
borrowed field, which always carries one (`&'a User`), came out as
`'a User`.

Box, Rc and Arc auto-deref on a method call, so the field now takes their
first type argument: bare or path-qualified (`std::rc::Rc<User>`), and
nested (`Rc<Box<User>>`). Borrows with a lifetime or `mut` are stripped,
and `Box<dyn Trait>` reduces to the trait through the stripDynBound helper
that parameters already use (#2604).

RefCell, Cell, Mutex, RwLock, Option and Vec are deliberately left alone.
A method on the inner type needs `.borrow()`, `.get()`, `.lock()`,
`.read()`, a match or an index first, so the receiver really is the
wrapper, and a direct call through one must not bind.

Shape arm: rust `decoratedFieldType` moves INVISIBLE-GAP -> RESOLVES, with
the edge on `User::save`. The corpus has no smart-pointer or borrowed
struct field, so the count arm and every other cell are unchanged, and the
corpus edge (2838) and drop (192) sets match main exactly. Scope-capture
fingerprints are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(rust): keep opaque pointer fields wrapped

* fix(rust): refuse opaque macro expansions

* test(rust): pin pointer wrapper targets and opacity limits (#3665)

- Assert a same-file Box keeps its own save target while User.save stays
  unbound (review thread on custom same-named wrappers).
- Pin the documented workspace-wide recall limit: an unrelated unresolved
  import or macro_rules! keeps an otherwise valid pointer field wrapped.
- Drop per-case logging and group the opaque/expansion cases in describe
  blocks.
- Collapse the stacked pointer-field receipts in BASELINE.md into one
  current section listing every workspace-wide refusal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore: preserve Rust integration notes

* test(rust): assert complete pointer targets

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 21:19:27 +00:00
Gergő Magyar
af5fd9665c
fix(csharp): bind nullable field types for receiver resolution (#3498) (#3664)
* fix(csharp): bind nullable field types for receiver resolution (#3498)

A C# field written `User? repo;` got no type binding. Its type is a
`nullable_type` node, and the field_declaration rules only matched
identifier, generic_name and qualified_name types. Parameters, properties,
method returns and foreach variables already have a nullable_type rule, so
fields were the odd one out: the class scope had no binding for `repo`,
and `this.repo.Save()` was dropped as receiver-unresolved.

Add the missing field rule. interpretCsharpTypeBinding already strips the
`?`, so the field binds `User`, as the property spelling does.

Shape arm: csharp `decoratedFieldType` moves VISIBLE-GAP -> RESOLVES, with
the edge on `User.Save`. No corpus fixture declares a nullable field, so
the count arm and every other cell are unchanged, and the corpus edge
(2838) and drop (192) sets match main exactly. Scope-capture fingerprints
are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(csharp): preserve nullable field ownership

* fix(csharp): refuse unowned nullable types

* test(csharp): guard nullable-member fixture cleanup (#3664)

Address nexus-check review on resolvers/csharp.test.ts:1471: skip the
temp-root removal when mkdtempSync never ran, so a setup failure is not
masked by a secondary rmSync(undefined) TypeError. Matches the guard in
csharp-nullable-field-review.test.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(bench): scope nullable wrapper claim to what the code does (#3664)

The ownership-controls note said the nullable-field marker preserves
custom generic wrappers. Its only control, Custom.List<User>?, passes
through the qualified-type refusal instead. State that unqualified
wrappers keep the wrapper type (no native control yet) and that
qualified spellings, custom wrappers included, stay unbound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore: preserve C# integration notes

* fix(csharp): preserve generic argument qualifiers

Ignore comments when checking outer nullable-field qualification.

Refs #3664

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 20:05:33 +00:00
Abhigyan Patwari
36e16434ea
fix(php): type locals from namespaced-function factory calls (#3498) (#3662)
* fix(php): type locals from namespaced-function factory calls

`namespace App; use App\Mod as rp; $x = rp\make(); $x->m()` left `$x`
untyped although `make` is declared `: C` in `namespace App\Mod`, and the
inline `rp\make()->m()` recorded a drop. The query matched only an
unqualified callee (`function: (name)`), so a `qualified_name` callee minted
neither a call site nor a result binding; `\App\Mod\make()`, `Mod\make()`
and `namespace\make()` failed the same way, and nothing could have expanded
the path anyway: functions were never indexed by fully qualified name.

- A `qualified_name` / `relative_name` callee is captured as a free call
  (tail name, written path as `@reference.qualified-name`) and as a
  call-result binding that keeps the whole path, leading `\` included.
- New `php/qualified-function.ts` expands that path by PHP's name rules:
  `\` is absolute, `namespace\` is the file's namespace, and a qualified
  head goes through the file's class/namespace `use` table, else the file's
  namespace. It indexes every `Function` def by lower-cased FQN per pass and
  answers only when exactly one def declares the name.
- PHP implements `resolveQualifiedCallee` and `resolveQualifiedFreeCall`
  with that one resolution, so a call's type and its CALLS edge agree.
  `Qff\Decoy\make` in the fixture is never picked.
- A receiver bound to an in-program namespaced function with no return type
  (`$x = rp\untyped()`) now records a `receiver-unresolved` drop.

A full lang-resolution A/B against the parent removes no CALLS/ACCESSES edge
and no drop. It adds 20 edges, all inside the new
php-qualified-function-factory fixture, and 2 drops (its two untyped sites).
The PHP capture golden gains the new fixture only. Existing fixtures' digests
are byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(php): bind use-function imports outside PSR-4 by fully qualified name

`use function App\Mod\make; $x = make(); $x->m()` typed nothing, and the
call itself had no CALLS edge, when `make` is declared outside any PSR-4
path: loaded through composer `autoload.files`, or in a project with no
composer.json. Import resolution finds a function only through a PSR-4
directory or a file named after it, so the import bound nothing (or, with a
PSR-4 directory that holds other files, resolved to one that declares no
`make`). In the new fixture, `namedCall` even picked up another `make`'s
return type, mirrored by name from a sibling file, and emitted a wrong
`QffGadget.ping` edge.

After namespaces are known, a `use function A\f` whose module scope binds
nothing for its local name is bound to the one workspace function named
`A\f`, through the same per-pass FQN index as qualified callees. The fully
qualified name is the function's identity, so this guesses nothing; a
resolved import or a local declaration is left alone, and two declarations
of one name bind nothing. The IMPORTS edge is unchanged: finalize has no
namespaces yet.

Lang-resolution A/B against the parent: one wrong edge removed
(`namedCall -> QffGadget.ping`), two correct fixture edges added
(`namedCall -> make`, `namedCall -> QffWidget.ping`), and four correct
edges the combined corpus lacked because its merged composer configs map
`App\` to many fixtures: php-calls `create_user -> write_audit`,
php-overload-dispatch `run -> format_text` and `run -> format_text_padded`,
php-use-function-const `Calculator.process -> formatName`. Each FQN is
declared once in the corpus. Drops are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(bench): rebaseline php captures and receiver counts

- receiver-resolution: the new php-qualified-function-factory fixture's two
  untyped sites (`$x = rp\untyped(); $x->ping()` and inline
  `rp\untyped()->ping()`) are each one call drop: call drops 154 -> 156,
  all kinds 224 -> 226. No other drop moves in a same-corpus A/B, and
  shape-arm cells are unchanged.
- scope-capture (php): corpus growth only. The query now captures
  qualified function callees, but no existing fixture has one: parking the
  new fixture reproduces the prior fingerprint byte-for-byte. It adds 96
  capture groups and 9 fixture entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(php): fail closed on qualified calls the path cannot resolve

A qualified call site was named by its tail (`count` for `\count($x)`),
so when `resolveQualifiedFreeCall` refused the path, the free-call pass
fell through to its simple-name tiers and could bind a same-named
function in the caller's namespace: `\count($x)` -> a user `Qff\Ext\count`,
`\Vendor\Pkg\make()` -> `Qff\Ext\make`, and a twice-declared
`\Qff\Dup\make()` the same way. Before this branch such calls minted no
site at all, so these were new wrong edges.

The site is now named by its whole written path, the same text it carries
as `@reference.qualified-name`. The provider hook still resolves it by
PHP's name rules. Every simple-name tier (scope chain, implicit `this`,
global unique-name fallback) looks up a name with a `\` in it and finds
nothing, so a refused path (builtin, uninstalled package, ambiguous name,
multi-namespace file) leaves the call unresolved. This change is PHP-only.

Lang-resolution A/B against the parent: no edge or drop removed. Added
edges: the three new fixture functions' `new QffWidget()` calls. No edge
from builtinCall, vendorCall or ambiguousCall. Versus the pre-branch base:
29 edges added (25 in the fixture, plus the 4 `use function` edges from
4781ace51), 0 removed, 2 drops added. Receiver counts unchanged. The PHP
golden changes only the new fixture's files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(bench): rebaseline php captures for fail-closed qualified calls

scope-capture (php): a qualified function call site is now named by its
whole path, and the php-qualified-function-factory fixture gains four
files (src/Ext/Calls.php, src/Ext/Shadows.php, lib/dup-a.php,
lib/dup-b.php). Only that fixture moves. Parking it reproduces the
pre-branch fingerprint byte-for-byte. fixture_count 152 -> 156,
capture_groups_fp 2338 -> 2381. receiver-resolution is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(php): preserve qualified identifier bytes

Keep PHP labels and ASCII-only name matching through qualified factories.
Decline names shortened by native non-ASCII whitespace parsing.
Correct fixture comments and give parameterized cases unique audit IDs.

* fix(php): preserve reviewed merge resolutions

* test(php): align golden with fixture comment

The corrected factory annotation comment is included in captured function
text; keep its fine golden digest aligned with the reviewed fixture.

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:55:04 +00:00
Abhigyan Patwari
e7ef82dfcb
fix(kotlin): type locals from package-qualified factory calls (#3660)
* fix(scope): follow namespace factory return types and record untyped drops

`import mod as rp; x = rp.make(); x.m()` lost the receiver type even when
`make` is declared `-> C`: `x` was bound to the raw dotted name `rp.make`,
and nothing followed a dotted name to a function's return type. The inline
`rp.make().m()` failed the same way in the compound resolver, which read
`ns.f()` only as a construction.

Resolve `ns.f` to `f`'s return annotation when `ns` is a namespace import,
the fact `propagateImportedReturnTypes` already mirrors for a named import.
The post-finalize chain follow uses it for bindings and the compound
resolver for inline calls. Only sites that emitted nothing change: the
full lang-resolution corpus emits the identical 2,838 CALLS/ACCESSES edges.

Record the drops that left `impact` at "exact":
- a plain receiver bound to a namespace function with no usable return type
  (`x = ns.untyped()`);
- an outer call whose `file:line:col` key a resolved inner site already
  claimed (`ns.untyped().m()`, `s.repo.Delete(id)`). Only a duplicate
  capture of the same member hides a drop now.

Receiver baseline: call drops 128 -> 151, reads 44 -> 48, ten shape-arm
cells INVISIBLE-GAP -> VISIBLE-GAP; every new drop has no CALLS edge to its
member (BASELINE.md lists them). The python.factory-qualified accuracy gap
is removed; the python-scope fingerprint and capture golden gain the new
fixture only.

Fixes #3498

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(dart): type locals from prefixed-import factory calls

`import 'mod.dart' as rp; final x = rp.make(); x.m()` gave `x` no type:
local call inference accepted only a bare callee (`Callee()`), and the
prefix-stripping type normalizer would have reduced `rp.make` to `make`.

Bind a local initialized by exactly `prefix.member(...)` (direct or
awaited) to the dotted callee and keep its prefix, so the shared chain
follow types it from the namespace function's return annotation. Only
call-derived bindings keep the prefix; annotated `prefix.Type` spellings
are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(zig): type locals from namespace-module factory calls

`const rp = @import("mod.zig"); const x = rp.make(); x.m()` bound `x` to
the namespace handle `rp` itself: the call-return rule reads a non-value
head as the type being constructed (`Counter.init()`), and import bindings
are not values. The member name was gone before the shared chain follow
could use the new namespace return-type lookup.

For a module-level handle on a lowercase file (a namespace module, by Zig
convention), bind the dotted callee `rp.make` so the shared chain follow
types it from `make`'s return annotation. File-struct handles
(`@import("Page.zig")`, any spelling of the handle) keep naming the
struct, so `Page.init()` is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(bench): rebaseline captures and receiver counts for Dart and Zig

- receiver-resolution: the Dart fixture's untyped factory adds one call
  drop (151 -> 152); every typed form in the Dart and Zig fixtures resolves.
- scope-capture (dart): two existing dart-method-enrichment locals
  initialized by `obj.method()` / `Type.method()` gain a call-derived
  binding, plus the new fixture's captures. A full lang-resolution A/B
  emits the identical edges outside the new fixtures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scope): bind same-namespace inheritance bases before sibling visibility exists

Cause: same-package / same-namespace visibility (`populateNamespaceSiblings`)
is populated after the inheritance pre-pass and `buildMro`. A base written
without an import (`class C extends B`, B in another file of the package)
could bind only through the workspace-unique simple-name fallback, which any
other package declaring a `B` defeats: no EXTENDS edge, an empty MRO, and
lost calls through inherited members. In the combined lang-resolution corpus
`java-grandparent-resolution` `c.greet().save()` dropped because
`java-unrelated-method-collision` declares default-package A and B.

Moving the sibling hook ahead of the pre-pass was measured and rejected. It
retargeted correct edges and minted wrong ones, because the sibling channels
carry candidates the pre-pass must not see: C# global-namespace types are
consulted at every scope (same-file `Cat : Animal` bound another fixture's
global Animal), namespace buckets merge across source roots with no
proximity order (PHP, C#), and a qualified `extends app.base.Box` bound
through a same-package `app.Box`.

Fix: an optional `ScopeResolver.resolveImplicitInheritanceBase`, consulted by
the pre-pass only when the shared chain bound nothing, the base was written
bare (no qualifier, name capture at the start of the base expression), and
no import claims the name. It adds edges and never retargets one.
`resolveSameNamespaceInheritanceBase` picks the candidate in the deriving
class's namespace, nearest by shared path prefix, refusing a tie. Java and
Kotlin answer from their package facts, C# from the exact `namespacePrefix`.

Corpus A/B (main vs this, same corpus): EXTENDS/IMPLEMENTS +42, all within
their own fixture, 0 removed. CALLS: six `super.save()` edges keep their
target but are now MRO-dispatched (`global`, as in isolation), one moves off
another fixture's BaseModel.Save onto its own, and 7 are new (both
grandparent `greet` calls, a default-method `validate`, the new fixtures).
Receiver bench: call drops 128 -> 127, all kinds 192 -> 191, shape arm
unchanged. Scope-capture fingerprints re-baselined for the added fixtures
only (parked, --check passes on the old ones).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(java): resolve a duplicated package+type import to the importer's own root

Cause: `buildJavaPackageIndex` kept the first file declaring each
package+type. One repository can hold several build modules or sample
projects that each declare `models.User`, so every `import models.User;`
bound whichever copy was parsed first, a wrong IMPORTS edge at full
confidence that carries the receiver types behind it. In the combined
lang-resolution corpus 24 fixtures declare `models.User`, and e.g.
`java-heritage` UserService.processUser called
`java-assignment-chain/models/User.save`.

Fix: the index keeps every declaring file in a sparse `duplicateTypes` map
(only colliding pairs, so a normal workspace pays nothing), and a type import
resolves to the declaring file sharing the longest leading path with the
importer (its own module or source root). A tie, or an unknown importer,
refuses rather than guessing. Wildcard imports are unchanged.

Corpus A/B (previous commit vs this, same corpus): 40 CALLS edges that
crossed into another fixture's User/Repo/Address/UserService are gone, 55
CALLS/ACCESSES edges now land in their own fixture (0 cross-fixture), and
`java-parent-resolution` User IMPLEMENTS Serializable moves off
`java-heritage` onto its own interface. Receiver-unresolved drops unchanged;
import-target and receiver benches pass. Scope-capture java fingerprint
re-baselined for the added fixture only (parked, --check passes on the old
one).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(scope): expose the position a receiver-chain fold reaches

`foldReceiverChain` answers "which class", so a chain whose last step is
declared as a type the program does not contain (`Dictionary<string,
User>`, `String`) reads only as a miss. That miss is informative to the
receiver-origin classifier: every hop was typed by a program declaration
and the last one names a library type.

Extract the fold loop into `foldReceiverChainState` and export
`foldReceiverChainPosition`, which returns the final position including
one whose declared type named no class, and reports nothing to
`recordReceiverType`. `foldReceiverChain` keeps its behaviour: it now
wraps the same loop and makes the receiver-type report from the final
state, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scope): classify library-rooted receiver drops from provider evidence

`classifyReceiverOrigin` had one source of positive external evidence,
`LanguageProvider.isBuiltInName`. That set also filters callee names out
of the call graph, so it could not grow to cover host globals, stdlib
imports or library-typed values without dropping real edges, and every
such drop hedged `impact()` to `lower-bound`. It also read a base name as
evidence even where the program bound that name itself: a parameter
named `console` with an unresolved type, or an unresolved import of a
built-in spelling from the program's own module, came back `external`.

Add two provider data hooks read only by the classifier:
`externalReceiverNames` (globals, platform roots, library types) and
`isExternalModuleSpecifier` (import specifiers reserved for the runtime
or stdlib). The classifier now answers `external` when:
- the base is unbound at the site and is a built-in or listed name;
- the base is bound only by imports that resolved to no program file and
  all name a library module;
- the receiver chain folds, through declarations each owner makes, to a
  position declared as a library type (`this.data.Keys` with
  `Dictionary<string, User> data`), and the program declares nothing by
  the dropped member's name (an extension method or trait impl could be
  the real target). The fold skips ancestor-hoisted bindings, which can
  lend another class's member type to the step.
A base the program binds (a parameter, a local, a resolved import, an
import from a non-library module) never takes a name-based verdict. The
in-program arms are unchanged and still win first. No drop is added or
removed and no edge changes.

Java supplies its reserved `java` package root for both hooks: the JVM
refuses to define classes under `java.*`, so `java.util.Optional.of(...)`
and `import java.util.Map` are rooted in the platform. Without the
specifier hook, the stricter import rule would have demoted the existing
`import java.util.List; List.of(...)` verdict to unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(typescript): name JavaScript host globals as the program boundary

`document.body.appendChild(...)`, `window.history.pushState(...)` and
`Buffer.from(raw).toString()` were recorded `unknown`: none of
`document`, `window`, `Buffer`, `process` or `globalThis` is in
`BUILT_INS`, and they cannot be added there because that set also
filters callee names, so `process` would drop every call to a program
function named `process`. Each drop hedged `impact()` to `lower-bound`
although no program node could have been the target.

List the host objects in `EXTERNAL_RECEIVER_NAMES` and supply it to the
TypeScript, JavaScript and Vue providers as `externalReceiverNames`. A
name counts only where the program binds nothing by it and declares
nothing by it, so a `document: Doc` parameter, an untyped `window`
parameter, a local `navigator` and a program `class Buffer` keep their
verdicts. `location`, `history`, `self` and `crypto` stay out: they are
ordinary local names.

Corpus: 5 call drops move from unknown to external. `process.env.*`
(3 reads) stays in-program there because three fixtures declare a
top-level `function process()`, one of them in a global script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(python): name standard-library imports as the program boundary

`os.environ.setdefault(...)` after `import os`, and
`Path(__file__).resolve()` after `from pathlib import Path`, were
recorded `unknown`. The imports resolve to no file in the program, but an
unresolved import alone cannot be told apart from an in-program module
the resolver missed, and nothing said that `os` and `pathlib` belong to
the interpreter.

Supply `isExternalModuleSpecifier` from a curated set of standard-library
modules, matched on the specifier's first segment (`os.path` -> `os`).
A relative specifier never matches. The classifier still requires the
import to have resolved to no program file, so a local `os.py` that the
resolver finds wins, and a parameter named `os` is the program's own.
Generic nouns an application plausibly uses for its own modules
(`types`, `queue`, `signal`, `secrets`, `string`, `email`, `http`, ...)
are left out. Third-party packages are not listed: an unresolved
`fastapi` import stays `unknown`.

Corpus: 4 call drops move from unknown to external
(`os.environ.setdefault` x3, `Path(__file__).resolve()`).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(zig): name @import("std") and @import("builtin") as the program boundary

`std.sort.pdq(...)` and `const Allocator = std.mem.Allocator;` were
recorded `unknown`: `std` is bound by `const std = @import("std")`, an
import the resolver deliberately leaves external, and nothing told the
classifier that the module is the standard library rather than an
in-program file it failed to find.

Supply `isExternalModuleSpecifier` for the two module names Zig
reserves: `std` and the compiler-generated `builtin`. Exact names only,
so `@import("std.zig")` (a file path) stays `unknown`, as does `root`
(the program's own root module) and any module `build.zig` names.

Corpus: 9 drops move from unknown to external: `std.sort.pdq` (2 calls,
2 reads), `std.mem.Allocator` (1 read), and the
`zig-qualified-literal` literals `std.Thread.Mutex{}` and
`std.mem.Allocator{...}` (2 calls, 2 reads). The last four are that
fixture's edge negative control (`useExternal` must emit no edge, which
still holds); their receiver is std, so `external` is the right origin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(csharp): name the System namespace and Dictionary as the program boundary

`System.Console.WriteLine(...)` was recorded `unknown`: `Console` is in
`BUILT_INS` but the chain base is `System`, which is not, and `this.data.Keys`
with `Dictionary<string, User> data` was recorded `in-program` because
the base `this` resolves to a program class even though the member lives
on a BCL type.

Supply `externalReceiverNames` with `System` (the BCL root namespace),
`Dictionary` (the one collection capture does not reduce to its element,
because it takes two type arguments) and `string` (a keyword alias that
no program can declare). The base check covers `System.Console`; the
chain fold reaches `Dictionary<string, User>` through the program's own
field declaration. A program `class System`, a field of a program type,
and an extension method the program declares on `Dictionary` all keep
their verdicts.

Corpus: 3 call drops move from unknown to external
(`System.Console.WriteLine`). The two `this.data.Keys/Values` reads in
`csharp-nested-member-foreach` stay in-program there: the fixture's
global-namespace `App` is one of several in the merged corpus, so `this`
binds another fixture's `App` and the fold declines. Analysed alone,
both read `external`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(kotlin): name java.lang.System and the platform roots as the program boundary

`System.out.println(...)` in Kotlin was recorded `unknown`: Kotlin's
`BUILT_INS` lists stdlib function names, not `System`, which Kotlin/JVM
imports by default from `java.lang`.

Supply `externalReceiverNames` with `System` and the package roots no
program can declare into (`java`, refused by the JVM; `kotlin`, reserved
by the compiler for the standard library), and `isExternalModuleSpecifier`
for imports under those roots. A program `object System` keeps the
receiver `in-program`.

Corpus: 1 call drop moves from unknown to external
(`kotlin-object-literal-scope` `System.out.println`, whose decoy
`println` on the enclosing object still gets no edge).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(bench): rebaseline receiver-origin buckets for library receivers

The preceding commits label library- and runtime-rooted drops `external`
instead of `unknown`. Call drops by origin move from 55 in-program, 44
external and 29 unknown to 55, 62 and 11. Total drops (192), call drops
(128), every per-extension and per-shape count, and every shape-arm
state are unchanged; a same-corpus A/B against main keeps all 2,838
CALLS/ACCESSES edges byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(rust): type locals from module-qualified factory calls

`mod modx; use crate::modx as rp; let x = rp::make(); x.m()` left `x`
untyped although `make` is declared `-> C`. The call-return rule kept only
the text before the first `::` (the `Foo::new()` idiom), so `x` was bound
to the module `rp` and the function name was lost. `modx::make()` and
`crate::modx::make()` failed the same way, and the inline `rp::make().m()`
failed in the compound resolver, which cannot split a `::` path. With a
`let modx = Other;` in scope, `modx::make()` even typed `x` as `Other` and
emitted a wrong `Other.m` edge.

- Rust keeps the whole callee path when every segment is lower-case: a
  module function, by rustc's lint-enforced casing. `Foo::new()` and
  `Self::new()` still read as the type.
- New `ScopeResolver.resolveQualifiedCallee` hook. The shared chain follow,
  the compound call branch and the drop recorder hand a callee text no
  scope binds to the provider, which returns the callable it names; the
  shared side reads that callable's return annotation by definition
  identity and never splits the path. Rust answers with the module-tree
  walk behind `resolveQualifiedFreeCall`, so a call's type and its CALLS
  edge come from the same resolution.
- A receiver bound to an in-program module function with no return
  annotation (`x = rp::untyped()`) records a `receiver-unresolved` drop,
  as #3498 does for `ns.untyped()`.
- `rp::make()` did not resolve as a call either: the module-name filter
  rejected the alias `rp`, and under Cargo the import binds the module's
  `mod modx;` declaration rather than `modx.rs`. The `use` candidate now
  admits an alias that names a module and reads a module from its
  top-level declaration.

A full lang-resolution A/B against the parent emits identical CALLS and
ACCESSES edges outside the new fixture, except one new correct edge:
`rust-ambiguous` `main -> models::Handler.handle`, typed from
`let h = services::create_handler()`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(bench): rebaseline rust captures and receiver counts

- receiver-resolution: the new rust-qualified-factory-return fixture's two
  untyped sites (`x = rp::untyped(); x.m()` and inline
  `modx::untyped().m()`) are each a call and a callee-position read drop:
  call drops 152 -> 154, reads 48 -> 50, all kinds 220 -> 224. No other
  drop moves in a same-corpus A/B, and shape-arm cells are unchanged.
- scope-capture (rust): corpus growth only. emitRustScopeCaptures is
  untouched, and parking the new fixture reproduces the prior fingerprint
  byte-for-byte; it adds 131 capture groups and 3 fixture entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scope): ask resolveQualifiedCallee about dotted callee paths

A dotted call-return binding (`x -> com.acme.mod.make`) whose head no
namespace import binds came back from followChainPostFinalize untouched.
The dotted branch tried only namespaceCallReturnType, which needs a
two-segment path headed by a namespace import. The inline
`com.acme.mod.make().m()` failed the same way in the compound resolver: once
the object part resolved to no class and named no namespace import, the call
branch returned nothing. A language whose package paths are dotted and never
imported (Kotlin) could type neither form.

Both sites now pass the dotted text to the provider's resolveQualifiedCallee
after their own lookups miss, as they already did for undotted callees, and
read the returned callable's return annotation by definition identity. The
contract documents the two new consult points, and says that a provider must
refuse a path whose head the call site can see as a value or type.

No provider answers dotted text yet: Rust's hook reads only `::` paths. No
edge moves, and the Rust, Python, Dart and Zig resolver suites pass
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(kotlin): type locals from package-qualified factory calls

`val x = kqfmod.make(); x.m()` left `x` untyped although `make` is declared
`: C`. `com.acme.mod.make()` failed the same way, and the inline
`kqfmod.make().m()` dropped. Three gaps lined up:

- the constructor-inferred query matches only a bare callee;
- the navigation-call inference handles only typed locals and same-file
  classes;
- nothing resolved a package name, because Kotlin imports declarations, not
  packages, so no import edge names `kqfmod`.

The named-import form (`import kqfmod.make; make()`) already worked.

- The local-assignment synthesis binds `x` to the whole callee path when the
  callee is a dotted path of plain names. The head must be lower-case and
  must not be declared or imported in the file as a value or type. A
  `@type.qualified-callee` marker stops interpretKotlinTypeBinding from
  reducing the path to the function name. Typed-local and same-file-class
  receivers (`repo.find()`, `Logger.create()`) are tried first, so they keep
  their meaning.
- New Kotlin resolveQualifiedCallee. The package is everything before the
  last segment. A package spans files, and across them it must declare
  exactly one top-level function with that name. The index of package facts
  and module bindings is built once per pass. The hook refuses overloads. It
  also refuses a head the call site can see: anything the lexical claim walk
  finds, plus top-level names in same-package sibling files and star-imported
  packages, which that walk misses.
- An untyped package function (`val x = kqfmod.untyped()`) now records a
  receiver-unresolved drop instead of an exact miss.

New fixture kotlin-package-qualified-factory covers:

- single- and multi-segment packages, and inline calls;
- the untyped drop and the named-import control;
- local, parameter, property, import, star-import and same-package values
  named like the package;
- overloads, and companion/object member calls.

A full lang-resolution A/B against the parent emits identical CALLS/ACCESSES
edges and drops outside the new fixture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(bench): rebaseline kotlin captures and receiver counts

- receiver-resolution: the new kotlin-package-qualified-factory fixture
  records six drops, all in app/Callers.kt. Two are call drops on untyped
  receivers: `x.m()` on `val x = kqfmod.untyped()` and the inline
  `kqfmod.untyped().m()`. The other four come from `com.kqfacme.deep.make()`
  in deepCall and inlineDeep: each is a call drop plus a read drop on the
  `deep` receiver path. Call drops 154 -> 158, reads 50 -> 52, all kinds
  224 -> 230. A same-corpus A/B shows no other drop change. Shape-arm cells
  are unchanged.
- scope-capture (kotlin): moving the new fixture out of the corpus
  reproduces the prior fingerprint byte-for-byte. Base and new emitters
  differ by exactly six matches over the same corpus, all of them in the
  new fixture. Synthetic counts are unchanged, and scaling is 1.039 < 1.5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(scope): reuse qualified call file sets

* docs(scope): clarify finalized type refinement

* test(kotlin): sync measured capture counts

* fix(rust): scope generic alias parameters

* fix(scope): respect base candidate visibility

* test(scope): preserve library member collision hedge

* fix(scope): cover more library receiver evidence

* fix(vue): classify imported runtime receivers

* fix(scope): match written JVM base arity

* fix(kotlin): refuse unproven package receivers

* fix(kotlin): prove companion receiver headers

* test(kotlin): complete JVM scope fixtures

* fix(kotlin): unify package receiver shadow checks

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:49:06 +00:00
Abhigyan Patwari
c30449394b
fix(scope): bind same-package inheritance bases when the simple name is reused elsewhere (#3659)
* fix(scope): bind same-namespace inheritance bases before sibling visibility exists

Cause: same-package / same-namespace visibility (`populateNamespaceSiblings`)
is populated after the inheritance pre-pass and `buildMro`. A base written
without an import (`class C extends B`, B in another file of the package)
could bind only through the workspace-unique simple-name fallback, which any
other package declaring a `B` defeats: no EXTENDS edge, an empty MRO, and
lost calls through inherited members. In the combined lang-resolution corpus
`java-grandparent-resolution` `c.greet().save()` dropped because
`java-unrelated-method-collision` declares default-package A and B.

Moving the sibling hook ahead of the pre-pass was measured and rejected. It
retargeted correct edges and minted wrong ones, because the sibling channels
carry candidates the pre-pass must not see: C# global-namespace types are
consulted at every scope (same-file `Cat : Animal` bound another fixture's
global Animal), namespace buckets merge across source roots with no
proximity order (PHP, C#), and a qualified `extends app.base.Box` bound
through a same-package `app.Box`.

Fix: an optional `ScopeResolver.resolveImplicitInheritanceBase`, consulted by
the pre-pass only when the shared chain bound nothing, the base was written
bare (no qualifier, name capture at the start of the base expression), and
no import claims the name. It adds edges and never retargets one.
`resolveSameNamespaceInheritanceBase` picks the candidate in the deriving
class's namespace, nearest by shared path prefix, refusing a tie. Java and
Kotlin answer from their package facts, C# from the exact `namespacePrefix`.

Corpus A/B (main vs this, same corpus): EXTENDS/IMPLEMENTS +42, all within
their own fixture, 0 removed. CALLS: six `super.save()` edges keep their
target but are now MRO-dispatched (`global`, as in isolation), one moves off
another fixture's BaseModel.Save onto its own, and 7 are new (both
grandparent `greet` calls, a default-method `validate`, the new fixtures).
Receiver bench: call drops 128 -> 127, all kinds 192 -> 191, shape arm
unchanged. Scope-capture fingerprints re-baselined for the added fixtures
only (parked, --check passes on the old ones).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(java): resolve a duplicated package+type import to the importer's own root

Cause: `buildJavaPackageIndex` kept the first file declaring each
package+type. One repository can hold several build modules or sample
projects that each declare `models.User`, so every `import models.User;`
bound whichever copy was parsed first, a wrong IMPORTS edge at full
confidence that carries the receiver types behind it. In the combined
lang-resolution corpus 24 fixtures declare `models.User`, and e.g.
`java-heritage` UserService.processUser called
`java-assignment-chain/models/User.save`.

Fix: the index keeps every declaring file in a sparse `duplicateTypes` map
(only colliding pairs, so a normal workspace pays nothing), and a type import
resolves to the declaring file sharing the longest leading path with the
importer (its own module or source root). A tie, or an unknown importer,
refuses rather than guessing. Wildcard imports are unchanged.

Corpus A/B (previous commit vs this, same corpus): 40 CALLS edges that
crossed into another fixture's User/Repo/Address/UserService are gone, 55
CALLS/ACCESSES edges now land in their own fixture (0 cross-fixture), and
`java-parent-resolution` User IMPLEMENTS Serializable moves off
`java-heritage` onto its own interface. Receiver-unresolved drops unchanged;
import-target and receiver benches pass. Scope-capture java fingerprint
re-baselined for the added fixture only (parked, --check passes on the old
one).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scope): respect base candidate visibility

* fix(scope): match written JVM base arity

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 12:45:11 +00:00
Abhigyan Patwari
169aa5d960
fix(scope): label library-rooted receiver drops as external from provider evidence (#3658)
* refactor(scope): expose the position a receiver-chain fold reaches

`foldReceiverChain` answers "which class", so a chain whose last step is
declared as a type the program does not contain (`Dictionary<string,
User>`, `String`) reads only as a miss. That miss is informative to the
receiver-origin classifier: every hop was typed by a program declaration
and the last one names a library type.

Extract the fold loop into `foldReceiverChainState` and export
`foldReceiverChainPosition`, which returns the final position including
one whose declared type named no class, and reports nothing to
`recordReceiverType`. `foldReceiverChain` keeps its behaviour: it now
wraps the same loop and makes the receiver-type report from the final
state, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scope): classify library-rooted receiver drops from provider evidence

`classifyReceiverOrigin` had one source of positive external evidence,
`LanguageProvider.isBuiltInName`. That set also filters callee names out
of the call graph, so it could not grow to cover host globals, stdlib
imports or library-typed values without dropping real edges, and every
such drop hedged `impact()` to `lower-bound`. It also read a base name as
evidence even where the program bound that name itself: a parameter
named `console` with an unresolved type, or an unresolved import of a
built-in spelling from the program's own module, came back `external`.

Add two provider data hooks read only by the classifier:
`externalReceiverNames` (globals, platform roots, library types) and
`isExternalModuleSpecifier` (import specifiers reserved for the runtime
or stdlib). The classifier now answers `external` when:
- the base is unbound at the site and is a built-in or listed name;
- the base is bound only by imports that resolved to no program file and
  all name a library module;
- the receiver chain folds, through declarations each owner makes, to a
  position declared as a library type (`this.data.Keys` with
  `Dictionary<string, User> data`), and the program declares nothing by
  the dropped member's name (an extension method or trait impl could be
  the real target). The fold skips ancestor-hoisted bindings, which can
  lend another class's member type to the step.
A base the program binds (a parameter, a local, a resolved import, an
import from a non-library module) never takes a name-based verdict. The
in-program arms are unchanged and still win first. No drop is added or
removed and no edge changes.

Java supplies its reserved `java` package root for both hooks: the JVM
refuses to define classes under `java.*`, so `java.util.Optional.of(...)`
and `import java.util.Map` are rooted in the platform. Without the
specifier hook, the stricter import rule would have demoted the existing
`import java.util.List; List.of(...)` verdict to unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(typescript): name JavaScript host globals as the program boundary

`document.body.appendChild(...)`, `window.history.pushState(...)` and
`Buffer.from(raw).toString()` were recorded `unknown`: none of
`document`, `window`, `Buffer`, `process` or `globalThis` is in
`BUILT_INS`, and they cannot be added there because that set also
filters callee names, so `process` would drop every call to a program
function named `process`. Each drop hedged `impact()` to `lower-bound`
although no program node could have been the target.

List the host objects in `EXTERNAL_RECEIVER_NAMES` and supply it to the
TypeScript, JavaScript and Vue providers as `externalReceiverNames`. A
name counts only where the program binds nothing by it and declares
nothing by it, so a `document: Doc` parameter, an untyped `window`
parameter, a local `navigator` and a program `class Buffer` keep their
verdicts. `location`, `history`, `self` and `crypto` stay out: they are
ordinary local names.

Corpus: 5 call drops move from unknown to external. `process.env.*`
(3 reads) stays in-program there because three fixtures declare a
top-level `function process()`, one of them in a global script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(python): name standard-library imports as the program boundary

`os.environ.setdefault(...)` after `import os`, and
`Path(__file__).resolve()` after `from pathlib import Path`, were
recorded `unknown`. The imports resolve to no file in the program, but an
unresolved import alone cannot be told apart from an in-program module
the resolver missed, and nothing said that `os` and `pathlib` belong to
the interpreter.

Supply `isExternalModuleSpecifier` from a curated set of standard-library
modules, matched on the specifier's first segment (`os.path` -> `os`).
A relative specifier never matches. The classifier still requires the
import to have resolved to no program file, so a local `os.py` that the
resolver finds wins, and a parameter named `os` is the program's own.
Generic nouns an application plausibly uses for its own modules
(`types`, `queue`, `signal`, `secrets`, `string`, `email`, `http`, ...)
are left out. Third-party packages are not listed: an unresolved
`fastapi` import stays `unknown`.

Corpus: 4 call drops move from unknown to external
(`os.environ.setdefault` x3, `Path(__file__).resolve()`).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(zig): name @import("std") and @import("builtin") as the program boundary

`std.sort.pdq(...)` and `const Allocator = std.mem.Allocator;` were
recorded `unknown`: `std` is bound by `const std = @import("std")`, an
import the resolver deliberately leaves external, and nothing told the
classifier that the module is the standard library rather than an
in-program file it failed to find.

Supply `isExternalModuleSpecifier` for the two module names Zig
reserves: `std` and the compiler-generated `builtin`. Exact names only,
so `@import("std.zig")` (a file path) stays `unknown`, as does `root`
(the program's own root module) and any module `build.zig` names.

Corpus: 9 drops move from unknown to external: `std.sort.pdq` (2 calls,
2 reads), `std.mem.Allocator` (1 read), and the
`zig-qualified-literal` literals `std.Thread.Mutex{}` and
`std.mem.Allocator{...}` (2 calls, 2 reads). The last four are that
fixture's edge negative control (`useExternal` must emit no edge, which
still holds); their receiver is std, so `external` is the right origin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(csharp): name the System namespace and Dictionary as the program boundary

`System.Console.WriteLine(...)` was recorded `unknown`: `Console` is in
`BUILT_INS` but the chain base is `System`, which is not, and `this.data.Keys`
with `Dictionary<string, User> data` was recorded `in-program` because
the base `this` resolves to a program class even though the member lives
on a BCL type.

Supply `externalReceiverNames` with `System` (the BCL root namespace),
`Dictionary` (the one collection capture does not reduce to its element,
because it takes two type arguments) and `string` (a keyword alias that
no program can declare). The base check covers `System.Console`; the
chain fold reaches `Dictionary<string, User>` through the program's own
field declaration. A program `class System`, a field of a program type,
and an extension method the program declares on `Dictionary` all keep
their verdicts.

Corpus: 3 call drops move from unknown to external
(`System.Console.WriteLine`). The two `this.data.Keys/Values` reads in
`csharp-nested-member-foreach` stay in-program there: the fixture's
global-namespace `App` is one of several in the merged corpus, so `this`
binds another fixture's `App` and the fold declines. Analysed alone,
both read `external`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(kotlin): name java.lang.System and the platform roots as the program boundary

`System.out.println(...)` in Kotlin was recorded `unknown`: Kotlin's
`BUILT_INS` lists stdlib function names, not `System`, which Kotlin/JVM
imports by default from `java.lang`.

Supply `externalReceiverNames` with `System` and the package roots no
program can declare into (`java`, refused by the JVM; `kotlin`, reserved
by the compiler for the standard library), and `isExternalModuleSpecifier`
for imports under those roots. A program `object System` keeps the
receiver `in-program`.

Corpus: 1 call drop moves from unknown to external
(`kotlin-object-literal-scope` `System.out.println`, whose decoy
`println` on the enclosing object still gets no edge).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(bench): rebaseline receiver-origin buckets for library receivers

The preceding commits label library- and runtime-rooted drops `external`
instead of `unknown`. Call drops by origin move from 55 in-program, 44
external and 29 unknown to 55, 62 and 11. Total drops (192), call drops
(128), every per-extension and per-shape count, and every shape-arm
state are unchanged; a same-corpus A/B against main keeps all 2,838
CALLS/ACCESSES edges byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(scope): preserve library member collision hedge

* fix(scope): cover more library receiver evidence

* fix(vue): classify imported runtime receivers

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 12:14:28 +01:00
Abhigyan Patwari
65b101407e
fix(rust): type locals from module-qualified factory calls (#3657)
* fix(scope): follow namespace factory return types and record untyped drops

`import mod as rp; x = rp.make(); x.m()` lost the receiver type even when
`make` is declared `-> C`: `x` was bound to the raw dotted name `rp.make`,
and nothing followed a dotted name to a function's return type. The inline
`rp.make().m()` failed the same way in the compound resolver, which read
`ns.f()` only as a construction.

Resolve `ns.f` to `f`'s return annotation when `ns` is a namespace import,
the fact `propagateImportedReturnTypes` already mirrors for a named import.
The post-finalize chain follow uses it for bindings and the compound
resolver for inline calls. Only sites that emitted nothing change: the
full lang-resolution corpus emits the identical 2,838 CALLS/ACCESSES edges.

Record the drops that left `impact` at "exact":
- a plain receiver bound to a namespace function with no usable return type
  (`x = ns.untyped()`);
- an outer call whose `file:line:col` key a resolved inner site already
  claimed (`ns.untyped().m()`, `s.repo.Delete(id)`). Only a duplicate
  capture of the same member hides a drop now.

Receiver baseline: call drops 128 -> 151, reads 44 -> 48, ten shape-arm
cells INVISIBLE-GAP -> VISIBLE-GAP; every new drop has no CALLS edge to its
member (BASELINE.md lists them). The python.factory-qualified accuracy gap
is removed; the python-scope fingerprint and capture golden gain the new
fixture only.

Fixes #3498

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(dart): type locals from prefixed-import factory calls

`import 'mod.dart' as rp; final x = rp.make(); x.m()` gave `x` no type:
local call inference accepted only a bare callee (`Callee()`), and the
prefix-stripping type normalizer would have reduced `rp.make` to `make`.

Bind a local initialized by exactly `prefix.member(...)` (direct or
awaited) to the dotted callee and keep its prefix, so the shared chain
follow types it from the namespace function's return annotation. Only
call-derived bindings keep the prefix; annotated `prefix.Type` spellings
are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(zig): type locals from namespace-module factory calls

`const rp = @import("mod.zig"); const x = rp.make(); x.m()` bound `x` to
the namespace handle `rp` itself: the call-return rule reads a non-value
head as the type being constructed (`Counter.init()`), and import bindings
are not values. The member name was gone before the shared chain follow
could use the new namespace return-type lookup.

For a module-level handle on a lowercase file (a namespace module, by Zig
convention), bind the dotted callee `rp.make` so the shared chain follow
types it from `make`'s return annotation. File-struct handles
(`@import("Page.zig")`, any spelling of the handle) keep naming the
struct, so `Page.init()` is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(bench): rebaseline captures and receiver counts for Dart and Zig

- receiver-resolution: the Dart fixture's untyped factory adds one call
  drop (151 -> 152); every typed form in the Dart and Zig fixtures resolves.
- scope-capture (dart): two existing dart-method-enrichment locals
  initialized by `obj.method()` / `Type.method()` gain a call-derived
  binding, plus the new fixture's captures. A full lang-resolution A/B
  emits the identical edges outside the new fixtures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(rust): type locals from module-qualified factory calls

`mod modx; use crate::modx as rp; let x = rp::make(); x.m()` left `x`
untyped although `make` is declared `-> C`. The call-return rule kept only
the text before the first `::` (the `Foo::new()` idiom), so `x` was bound
to the module `rp` and the function name was lost. `modx::make()` and
`crate::modx::make()` failed the same way, and the inline `rp::make().m()`
failed in the compound resolver, which cannot split a `::` path. With a
`let modx = Other;` in scope, `modx::make()` even typed `x` as `Other` and
emitted a wrong `Other.m` edge.

- Rust keeps the whole callee path when every segment is lower-case: a
  module function, by rustc's lint-enforced casing. `Foo::new()` and
  `Self::new()` still read as the type.
- New `ScopeResolver.resolveQualifiedCallee` hook. The shared chain follow,
  the compound call branch and the drop recorder hand a callee text no
  scope binds to the provider, which returns the callable it names; the
  shared side reads that callable's return annotation by definition
  identity and never splits the path. Rust answers with the module-tree
  walk behind `resolveQualifiedFreeCall`, so a call's type and its CALLS
  edge come from the same resolution.
- A receiver bound to an in-program module function with no return
  annotation (`x = rp::untyped()`) records a `receiver-unresolved` drop,
  as #3498 does for `ns.untyped()`.
- `rp::make()` did not resolve as a call either: the module-name filter
  rejected the alias `rp`, and under Cargo the import binds the module's
  `mod modx;` declaration rather than `modx.rs`. The `use` candidate now
  admits an alias that names a module and reads a module from its
  top-level declaration.

A full lang-resolution A/B against the parent emits identical CALLS and
ACCESSES edges outside the new fixture, except one new correct edge:
`rust-ambiguous` `main -> models::Handler.handle`, typed from
`let h = services::create_handler()`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(bench): rebaseline rust captures and receiver counts

- receiver-resolution: the new rust-qualified-factory-return fixture's two
  untyped sites (`x = rp::untyped(); x.m()` and inline
  `modx::untyped().m()`) are each a call and a callee-position read drop:
  call drops 152 -> 154, reads 48 -> 50, all kinds 220 -> 224. No other
  drop moves in a same-corpus A/B, and shape-arm cells are unchanged.
- scope-capture (rust): corpus growth only. emitRustScopeCaptures is
  untouched, and parking the new fixture reproduces the prior fingerprint
  byte-for-byte; it adds 131 capture groups and 3 fixture entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(scope): reuse qualified call file sets

* docs(scope): clarify finalized type refinement

* fix(rust): scope generic alias parameters

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 09:05:48 +00:00
Abhigyan Patwari
a09f76be39
fix(cpp): type receivers declared or produced through qualified names (#3656)
* fix(cpp): resolve qualified receiver types by namespace, not by tail

Cause: a C++ receiver declared with a qualified type (`rp::C x = ...`,
`void f(a::Config c)`, `rp::Box<int> b`) typed nothing. The capture keeps
the qualifier, but the shared receiver lookups read a qualifier only as a
`.` namespace-import handle, and C++ has neither: `#include` binds no
handle and the index keys `rp::C` under `C`. The two places that did type
qualified spellings — the `auto x = ns::T{}` brace-init rule and qualified
member fields — reduced them to their tail, which binds the NEAREST
same-named class: `auto x = rp::C{}` reached a global `C` through another
include, and `a::Config` inside a `namespace b` declaring its own Config
reached `b::Config` (both confident wrong CALLS edges).

Fix: a ScopeResolver opt-in, `resolveQualifiedTypeSpellings`, that C++
sets. When a qualified declared or return type binds nothing,
`resolveClassBindingForName` and the compound resolver's return-type lookup
fall back to `resolveQualifiedInheritanceBase` — the route qualified base
classes and qualified type references already take: the qualifier is
matched against the candidate's namespace and a tie resolves nothing. It
runs after every existing lookup and after the template-argument match, so
it adds edges and never retargets one. The brace-init rule now captures the
whole qualified_identifier, and non-generic qualified member fields keep
their qualifier, so both resolve through the same route; generic members
stay tail-reduced because specialization matching keys on the bare base
name.

Corpus A/B (lang-resolution, all languages): no edge outside the new
fixture moved; drops unchanged. bench/scope-capture cpp re-baselined (one
brace-init capture text, plus the new fixture).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cpp): bind qualified declarations that have no initializer

Cause: `rp::C x;` and `rp::C* x = nullptr;` emitted no type binding at
all. The plain-declaration annotation rules accept only a bare
`type_identifier` or `template_type`, and tree-sitter-cpp parses a
qualified type as a `qualified_identifier` wrapping one of those, so the
receiver of `x.m()` was untyped (no edge, and no drop either). The
initialized form `rp::C x = ...` was already captured by the `type: (_)`
assignment rule.

Fix: two @type-binding.annotation rules on the OUTER qualified_identifier
(plain declarator, and pointer inside an init_declarator) — the qualified
twins of the bare rules, one pattern per declarator shape like the
qualified member-field rules, with no node-type alternation. The spelling
is kept as written and resolved by the qualifier-aware route from the
previous commit.

Capture diff over the cpp corpus: 29 added @type-binding.annotation
matches on qualified locals, nothing removed or changed. Corpus A/B: no
edge or drop outside the new fixture moved. bench/scope-capture cpp
re-baselined.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cpp): record return types of header function prototypes

Cause: only function DEFINITIONS (and in-class method prototypes)
recorded a return type. A free-function prototype — `D makeD();`,
`namespace rp { C make(); }` — recorded none, and the usual layout is
"header declares, .cpp defines": the .cpp is never included, so an
includer saw no return fact at all and `auto x = makeD(); x.m()` /
`makeD().m()` typed nothing (the inline form recorded a drop, the bound
form not even that).

Fix: @type-binding.return rules for a prototype with a plain or pointer
return. In a function body the same syntax declares a block-scope
function (the most vexing parse, `D x();`), whose binding would be
hoisted to the module and type every undeclared `x` in the file, so
captures.ts keeps a prototype match only at namespace scope — the
translation unit or a namespace / extern "C" body, through preprocessor
conditionals (include guards), single-declaration extern "C" and
template prefixes. A prototype declared in a namespace keeps its binding
in that namespace instead of the module: the binding's scope is also
where its type is looked up, and from the module a global `Widget` in
the same header won over `rp::Widget`. Callers read namespace members by
definition identity, which joins in any scope, and namespace members are
never mirrored to includers by bare name anyway.

A reference return (`D& f();`) gets no rule: such a function is not
declared as a Function at all (no declaration pattern), so a return fact
would have nothing to attach to.

Capture diff over the cpp corpus: one added match outside the new
fixture (cpp-return-type's header prototype, same type as its
definition); the gate drops only the fixture's deliberate `E y();`.
Corpus A/B: no edge or drop outside the fixture moved.
bench/scope-capture cpp re-baselined.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scope): type an inline call receiver from its callee's own return type

Cause: the compound resolver's free-call branch (`make().m()`) read the
callee's return type BY NAME from the caller's scope chain, while the
chain follow that types the bound form (`auto x = make(); x.m()`) reads
it BY DEFINITION IDENTITY (`producerTypeRef`). A callee that arrives by a
channel nothing mirrors a return binding through — a C++ using-directive
— therefore typed the bound form and dropped the inline one.

Fix: when the name read finds nothing, fall back to the return type the
callee's definition declares, via `producerTypeRef` (now exported from
imported-return-types.ts; the only change there). Only for a callee the
name actually BINDS at the call: `findExportedDefByName` falls back to the
first workspace callable of that name, and reading a return type off that
guess is not evidence. Measured: without the binding check the corpus
gained 15 non-C++ edges (Go range/chain factories, Swift call results),
all reached through that workspace-name guess and one of them provably
wrong (swift-return-type's `user.save()` bound to another fixture's
User); with it, no edge outside the new fixture moves.

Corpus A/B: edges and drops outside the fixture identical to main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cpp): type receivers produced by a qualified factory callee

Cause: `auto x = rp::make(); x.m()` bound `x` to the literal type `auto`
— the bare `auto x = f()` constructor rule matches only an identifier
callee, so the generic assignment rule captured the placeholder — and
`rp::make().m()` reached the compound resolver as the free call
`rp::make`, whose name binds nothing. Neither had any route from the
qualified callee to its definition, so both typed nothing (`auto x =
rp::C()` likewise).

Fix:
- captures.ts promotes `auto x = ns::f()` / `auto x = ns::T()` (a
  qualified_identifier whose innermost name is a plain identifier) to
  @type-binding.constructor with the whole callee as the type, the
  qualified twin of the bare rule; template factories keep their own
  rule. interpret.ts drops any leftover `auto` / `decltype(auto)` binding,
  which named no type.
- New ScopeResolver hook `splitQualifiedCallee` maps a callee spelling onto
  the receiver/member pair the language's qualified CALL captures use (C++:
  innermost scope segment, `a:🅱️:make` -> `b` / `make`), so shared code
  never splits on `::`. The compound resolver's free-call branch, when the
  callee's name binds nothing, resolves the definition through the existing
  `resolveQualifiedReceiverMember` hook — the answer the call itself got —
  and reads that definition's own return type by identity
  (`producerTypeRef`). `auto x = rp::C()` resolves through the
  qualified-type route instead.

Capture diff over the cpp corpus: one changed match outside the new
fixture (cpp-method-enrichment `auto category = Animal::classify(...)`
now binds the callee instead of `auto`; a class static method, which the
namespace lookup does not answer, so it stays untyped as before). Corpus
A/B: no edge or drop outside the fixture moved. bench/scope-capture cpp
re-baselined. The new cpp-captures rows also pin the namespace-scope gate
on prototype return types from the earlier commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cpp): bind qualified receiver owners

Preserve complete namespace qualifiers and declaration-owned return facts. Resolve inline namespace and chained alias types without borrowing unrelated functions or classes; cover review collision and header-order cases.

* fix(cpp): honor qualified type visibility

Carry header alias activation positions through include chains. Refuse unresolved type-owned qualifiers without rejecting value names, and align the lexical-ownership fixture with the scope-index contract.

* style(cpp): format inline namespace lookup

* fix(cpp): preserve factory lookup position

Keep later local type declarations from hiding an earlier namespace
factory. Name overload and class-factory recall limits explicitly.

Refs #3656

* fix(cpp): expand factory return aliases

Apply the provider qualified-type hook in producer-return lookup.
Keep authoritative refusals and the original declaration context.

Refs #3656

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:21:37 +00:00
Abhigyan Patwari
caacc3bac2
fix(csharp): rank global-namespace types below the file's own namespaces (#3655)
* fix(csharp): rank global-namespace types below the file's own namespaces

C# global-namespace types were stored in the scope-independent
workspaceFqnBindings channel. lookupNameClaim returns that channel at
every scope, while namespace siblings are consulted only at the module
scope. A type name looked up inside a method therefore stopped at the
first global type with that name. The walk never reached the file's own
or same-namespace declaration. On the merged lang-resolution corpus this
caused four field-chain drops in csharp-field-types and
csharp-deep-field-chain. It also bound calls to other fixtures' global
types. For example, csharp-hello's Demo.Greeter.Main called
csharp-optional-params' Greeter.

The C# hook now stores global types in namespaceFqnBindings under the
'' key. Each file's accessibility list follows C# name lookup: the
declared namespace, the using targets of that declaration, the enclosing
namespaces, then the global namespace. The compilation unit's using
targets come after it. A using after a file-scoped namespace belongs to
that namespace. Shared walker logic is unchanged (comments only); PHP's
FQN keys still use workspaceFqnBindings.

Corpus A/B against main: the four drops resolve and no drop is added.
Wrong cross-fixture edges are retargeted or removed. One global-namespace
fixture now types `this` as its own class and reaches a duplicated global
User. Receiver bench call drops 128 -> 125, all-kind 192 -> 188
(baseline and BASELINE.md updated; the old note that these sites
declined on ambiguity was wrong).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(csharp): initialize voucher fixture payee

* test(csharp): refresh initialized payee captures

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 06:35:08 +00:00
Abhigyan Patwari
2b44565534
fix(resolution): correct receiver drops and property ownership (#3653)
Some checks are pending
Gitleaks / gitleaks (push) Waiting to run
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Publish / Classify release event (push) Waiting to run
Publish / RC guard (marker + release-PR skip) (push) Blocked by required conditions
Publish / ci (push) Blocked by required conditions
Publish / Publish to npm (push) Blocked by required conditions
Publish / Build & Push RC Docker images (push) Blocked by required conditions
Scorecard / Scorecard analysis (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-web) (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-cli) (push) Waiting to run
* fix(js): withdraw receiver drops for object-literal key writes a later pass answers

The JS capture makes the enclosing object literal the receiver of each key
it writes (`return { wickRatio: row.a }`). Case 0 of the receiver-bound pass
treats any receiver text holding `.` or `(` as a compound expression, and a
literal holding `row.a`, `0.5` or `...seed` does, so the fold failed and the
site was recorded as a `receiver-unresolved` drop. The return-shape and
unique-name passes run later and answered 17 of these 19 writes with an
ACCESSES edge, but nothing withdrew the earlier drop.

Both passes now report the sites they emitted an edge for, keyed by file,
position, site kind and member name (position alone is shared by `a.b` and
`a.b.c()`), and run.ts withdraws the matching `receiver-unresolved` drops
once they have run. A site they leave unanswered keeps its drop.

The other two writes, in `SignalService.make()`, had no edge at all: the
own-return-shape tier read the caller's owner qualifier as
`SignalService.make#0`, so it never matched the method's keys
(`SignalService.make.secretFlag`) and three same-named candidates were
refused. The qualifier is now the qualified name after `<Label>:<file>:`
without the `#<arity>` suffix. It also stops cutting a positioned id
(`outer.parse@25:2`) down to its column.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(js): type a static field from its initializer for class-level receivers

`Config.DEFAULT.validate()` with `static DEFAULT = new Config()` produced no
CALLS edge. JS and TS keep a static field's type binding out of the class
scope on purpose: the scope has one binding map for static and instance
members, so the static binding would retype an instance field of the same
name. The class-level receiver route (`declaredTypeOfClassLevelField`) reads
the static Property node instead, but only its annotation-derived
`declaredType`, and an unannotated field has none. The type had nowhere to
live.

The field extractor now records `initializerType` for a field that declares
no type and is initialized by `new X()` / `new ns.X()` (the same two shapes
the scope queries bind), the parse worker stamps it on the Property node, and
the class-level route falls back to it after `declaredType`. The binding still
never enters the shared class-scope map, so the instance-twin hazard does not
return.

This resolves one hop: `Host.q.m()` now reaches `Alien.m`. A longer chain off
the field still goes through the compound fold, which types a field step only
from the class-scope map, so it stays unresolved. The matrix known-gap row
`static-read-without-a-twin-loses-its-type` flips to a positive row for TS,
with a JS twin added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(js): keep CommonJS module.exports declarations out of receiver drops

`module.exports.arrowRequest = (url) => fetch(url)` declares this module's
`arrowRequest` export; the CJS capture rules already bind it like
`exports.memberRequest = …`. The same line also yields a write reference
whose receiver is `module.exports`, and because that text has a dot the
receiver-bound pass folded it as a compound value, failed, and recorded the
declaration as a `receiver-unresolved` write. The bare `exports.x = …`
spelling never reached that path.

A new ScopeResolver hook, `isModuleExportAssignment`, lets a language say a
write site is a module-export declaration. The receiver-bound pass consults
it only at the drop guard, after every case has failed, so it records no
drop and changes nothing else: the site is not marked handled, no edge is
added, and the existing module-level write edge stays. The JS and TS
resolvers implement it for a receiver of exactly `module.exports` (from the
minted chain, or the text when no chain was minted) when `module` resolves
to nothing in scope. A `module` parameter, as in a UMD wrapper, or a write
into a value hanging off the export object still records its drop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ts): record an owned-`this` chain receiver as owned-but-unbound

`this.route.go()` inside an object-literal method was filed as a generic
`receiver-unresolved` drop (or, depending on site order, as nothing). The
method scope owns `this` and gives it no type, which the pass detects with
`isReceiverOwnedButUnbound`, but that check was handed the whole receiver
text `this.route`. No scope owns a chain, so the call fell through to Case 0,
whose fold cannot type an owned `this` either.

The check now receives the receiver's base (from the minted chain, else the
text before the first `.`/`(`), the same base the `suppressReceiverLookup`
check already used. The call is recorded as `receiver-owned-but-unbound`,
its real reason, and still emits no edge: the dynamic-this negative control
holds. On the fixture corpus this moves only that site; no edge changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(resolution): preserve receiver ownership

Bind a return key's declaration write by exact file and position so
unrelated input accesses keep their ordinary candidate ranking. Stop at
untyped static overrides and resolve constructor initializers as values.

Preserve the combined drop guards after rebasing onto main, cover the
binding regressions, and refresh the receiver baseline after #3654.

Key answered sites by their full range to retain repeated-name outer
reads. Keep owned-but-unbound calls in the persisted completeness signal.

* fix(resolution): address feedback (#3653)

Classify module-export declarations using captured module kind before
suppressing receiver drops. Match same-named field metadata by source
position, including declarations on one line.

Require reference kinds in suppression assertions and guard temporary
fixture cleanup. Cover the reported failures with regression tests.

* perf(parser): index repeated field declarations

Sort private field buckets once and use binary search to avoid
quadratic scans while preserving declaration disambiguation.

* fix(ingestion): preserve capture metadata

Record module kind from the parsed tree on worker and main-thread paths.
Match Ruby field metadata at the accessor call instead of its argument.

* fix(ingestion): harden capture metadata

Keep Ruby reader/writer properties writable. Walk module-kind ASTs iteratively so deep expressions cannot abort extraction.

* test(ingestion): clarify worker metadata scope

* docs(ingestion): state capture metadata effects

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 05:59:59 +01:00
Gergő Magyar
d57f570dff
refactor(ingestion): colocate import resolution rules (#3670)
* refactor(ingestion): remove dormant import resolvers

Remove the unused LanguageProvider importResolver contract, factory and strategy chain. Keep active scope resolver helpers and their semantic tests.

Verified 5,309 corpus edges unchanged, 7,411 focused tests, typechecks, build and resolver benchmarks. Full local suite is still running; graph analysis remains partial on deleted and comment-only regions.

* refactor: colocate language import helpers

Keep import policy beside language resolvers and share only generic
indexes. Pass the existing ordered candidates explicitly so lookup
behavior and cache identities stay unchanged.

* fix: defer MCP imports and narrow Python paths

* fix(python): prefer packages in relative imports

* test(python): pin package-first import lookup

* test(python): use a valid parent-relative import

---------

Co-authored-by: Gergely Magyar <magyargergo@users.noreply.github.com>
Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-22 03:49:35 +00:00
Abhigyan Patwari
f6e42092b3
fix(zig): resolve import-alias, forwarding-constructor, anonymous-container and type-application receivers (#3652)
* fix(zig): bind the module of a one-member @import alias as a receiver

`const X = @import("f.zig").X;` reads `X` off an `@import(...)` receiver.
The named-import rule claims that builtin, so the inline-import branch
skipped it and never emitted the receiver-keyed namespace binding the deep
form (`@import("lib.zig").B.work`) and member-call receivers already get.
Every such read was recorded as a receiver-unresolved drop; the ones whose
alias shares the member's name only produced an edge through the lexical
read fallback, and a renaming alias (`const Gauge = ...DEFAULT_NS;`)
produced nothing.

`isZigInlineImportReceiver` now also accepts the value read of a keyword
one-member import declaration (never a type annotation), and a claimed
builtin that is a receiver gets the namespace binding instead of being
dropped. The named import itself is unchanged, so `Gauge` stays an import
binding. Clears the 9 F-A rows of the #3498 drop triage; the reads now
resolve through the written module (`import-resolved`).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(zig): type a forwarding type constructor as the type it forwards to

`fn Bridge(comptime T: type) type { return Builder(T); }` (Lightpanda's
`js.Bridge(T)`) names no container of its own. `zigReturnTypeIsNominal`
drops `type` returns and `zigTypeConstructorOf` only names a container
returned directly, so a receiver typed `Bridge(X)` reached a Function that
owns no members and every call on it was lost.

A type constructor whose body is a single `return <TitleCase call>` (and
whose callee is not one of its own parameters) now binds `Bridge ↦ Builder`
through its return-type binding. The binding is declared in Bridge's own
scope, so a chain followed from an importer still looks `Builder` up where
it is visible. The new aliases.zig `b12` case (a named import of the
forwarding constructor, bound and inline spellings) resolves into
generic.zig's Builder. The namespace-qualified spelling of the #3498 F-B
rows (`generic.Bridge(Local)`) additionally needs the `ns.f` return-type
fold, which this binding feeds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(zig): resolve a member read off an anonymous container in place

`struct { fn lessThan ... }.lessThan` (the comparator handed to
`std.sort.pdq`) and `const byteSize = struct { fn it ... }.it;` read a fn
value off an anonymous container. The receiver capture was the container's
whole body, which names nothing, so each read was a receiver-unresolved
drop and the qualified-argument value reference declined. The only edge
came from the lexical read fallback at the site's anchor, which starts at
`struct` and therefore inside the container's own Class scope: the
container "accessed" its own fn.

A reference group whose receiver is a container node now carries the
identity that container is minted under (`Sorter.sortBoth$1`, via
`zigContainerName`), and its site anchor moves to the member, which is
evaluated in the enclosing scope. The reads resolve as ACCESSES from the
fn that evaluates them (and, for the pdq argument, a value-ref USES); no
CALLS edge. Clears the 3 F-C rows of the #3498 drop triage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(zig): type a type-constructor call used as a receiver

`Stack(u8).init()` calls `init` on the TYPE `Stack(u8)`. The free-call
branch of `resolveCompoundReceiverClass` found `fn Stack`, found no return
binding (it returns `type`), and fell into the construction path, which
declines for a language without `constructionSyntax`. The call and its
callee-position read were dropped, while the bound form
`var t = Stack(u8).init(); t.top()` resolved.

Add a language-neutral `ScopeResolver.isTypeApplicationCall(callee)` hook.
When it answers true, the construction path types the receiver as the
class the callee names (direct or namespace-qualified), exactly as a bare
construction does; the callee's return-type binding still wins. Zig answers
with `isZigTypeConstructorCallee`, the text twin of
`isZigTypeConstructorCall` (a TitleCase last identifier). Clears the
2 F-D rows of the #3498 drop triage (main.zig:42 call + read).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(bench): re-baseline receiver resolution for the Zig receiver fixes

The four Zig fixes clear 14 receiver-unresolved sites in the corpus:
all-kind drops 192 -> 178, reads 44 -> 31, calls 128 -> 127 (Zig 11 -> 10,
no-chain 27 -> 26, in-program 55 -> 54). Nine one-member `@import(...).X`
reads, three anonymous-container reads and the `Stack(u8).init()` call and
read now resolve. Writes and every shape-arm state are unchanged; no new
drop was introduced. BASELINE.md records the per-site breakdown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(zig): keep type applications lexical

* fix(zig): bind typed inline imports

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 01:24:26 +00:00
Abhigyan Patwari
2b6542737a
fix(go): resolve imports within selected modules (#3654)
* fix(go): resolve imports against every go.mod in the repository

The Go resolver read only the repository-root go.mod, and its import
target ignored the importing file. With no root go.mod, every import took
the GOPATH suffix match down to a two-segment tail. Two modules'
`internal/repository` then both answered `.../internal/repository`, and a
module whose directory differs from its path (`/vN`, `services/orders`
for `github.com/acme/orders`) resolved to nothing. With a root go.mod,
imports of a nested module were not the root's and dropped, while the
root module's own packages matched any directory ending in the package
path, including nested modules' trees.

Capture every go.mod and go.work from the scan's path list, as Dart does
for pubspec.yaml; standalone and rename callers rescan with the same
walker. For each import, the module whose path is the longest
`/`-prefix owns it. The package is the exact directory under that
module's root, unless a nested go.mod removes the directory from the
module. Several go.mod files declaring one path are disambiguated by the
importer's own module, then by its go.work `use` list, else left
unresolved. Unowned imports from inside a module stay unresolved; the
GOPATH suffix match remains only for importers outside every module.

In the combined lang-resolution corpus, no CALLS or ACCESSES edge is
removed or retargeted against the parent commit, and 70 are added outside
the two new fixtures. Drops are unchanged at 179: these sites were
silent. The import-target bench's go arm now passes no module config,
and its answers and fingerprint are unchanged. The scope-capture go
fingerprint moves for the new fixtures only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(go): look up an importer's module only when a path is contested

`locateGoImport` walked to the importer's nearest `go.mod` and `go.work` for
every import, though most imports (standard library, dependencies) are owned
by no in-repo module and need neither, and every candidate package directory
repeated the same ownership walk. The walks are now lazy (only a module path
several `go.mod` files declare consults them) and memoized per directory on
the config's index, and a path with no backslash skips the normalizing
replace. The Go package index is fetched once per import instead of per
candidate directory.

Behavior-preserving: the lang-resolution corpus emits the identical 3,002
CALLS/ACCESSES edges before and after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(go): surface go.mod read failures instead of dropping the module

Go's workspace capture skipped any manifest it could not read and turned a
failed standalone scan into "no modules". Either one silently erases a module
boundary: its imports then resolve against the enclosing module or fall back
to GOPATH suffix matching, the misresolution this capture exists to remove,
and a rename refresh compares a different config against its preview's.
`captureResolutionConfig` requires capture failures to throw.

- A manifest that fails to read now throws; the standalone scan propagates
  its error.
- Manifests skipped on purpose stay skipped, named in one place: symlinks,
  which can point outside the repository (Dart's manifest capture excludes
  them too), non-files, files over the source-file size cap, and files gone
  since the scan listed them.
- Manifests are read 32 at a time; capture blocks the scan, and k8s-style
  trees have hundreds of go.mod files.

Tests: data-driven rows for each skipped shape, a go.mod that fails to read,
and a standalone scan of a non-directory root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(bench): re-measure Go counts and fingerprint on top of #3651

Rebased onto main after #3651. Import resolution across every go.mod clears
the 13 Go call drops left in the combined corpus (go-chain-call,
go-grouped-type-decl, go-interface-field-dispatch,
go-pointer-receiver-field-chain): call drops 148 -> 135, all kinds 208 -> 195,
.go call drops 14 -> 1. No drop added; shape-arm states unchanged.

The scope-capture go fingerprint moves for the two new fixtures only: parking
them restores main's acee4449f691d9138e68e7b2b19da863fc2c89b0e9846acdf10e93d76b2eec78
byte-for-byte.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(go): read go.mod through one handle so it cannot change mid-check

CodeQL flagged the manifest read as a file-system race: `lstat` checked the
path and `readFile` then opened it again, so a different file could be read
than the one checked. The manifest is now opened once (O_NOFOLLOW refuses a
leaf symlink, O_NONBLOCK keeps a FIFO from hanging) and its type, size and
contents all come from that handle, the way Dart's manifest reader works. A
platform without O_NOFOLLOW still refuses a link after the open.

The read-permission test is POSIX-only: permission bits do not block reads
on Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(go): skip the unreadable-go.mod test as root; correct a fixture comment

Review follow-up for #3654.

- The permission test asserted EACCES on a mode-000 go.mod, which root can
  still open. It now skips for root as well as on Windows.
- The orders-service ledger fixture said it shares its method names with
  billing's; only Save is shared. The comment says so, in the same two
  lines. Comment text is part of the Go captures, so the golden gains the
  new text and the scope-capture go fingerprint moves:
  3ba3b6e1551311ddb0e9330c939ac995856b487303b6f64bc89da3689a6d9d2c ->
  b1dfa8e1a8d92fd9d5779a02bc4bd99f54ec87adae4a326be08b74cb48fd5ef3, with
  fixture and group counts unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(go): enforce module visibility (#3654)

Limit local providers to the importing module and peers selected by its
nearest go.work. Treat failed package-qualified receiver lookup as final
for direct calls, field chains, and method values so bare-name fallback
cannot recreate calls into independent modules.

Add import/call boundary regressions and remeasure receiver drops. The
same-corpus comparison removes exactly two false calls and adds no edges.

Validation: 7,263 resolver tests, both typechecks, lint, and import-target,
scope-capture, and receiver baseline checks pass. Two parser-identity
checks affected by local snapshot/build drift pass after freezing inputs
and rebuilding. The full local run continues; final CI remains required.

* fix(go): reject ambiguous package providers (#3654)

Check all selected module prefixes for package presence. Preserve a shorter-only provider and refuse imports supplied by multiple modules. Cover all four presence cases and correct the receiver suppression comment.

Note: the full local suite hit a host GLIBCXX_3.4.31 failure in parse-cache-identity-package.test.ts; focused Go tests and both TypeScript checks pass.

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 18:24:18 +00:00
Abhigyan Patwari
ab0b03846d
fix(go): type receivers through package-qualified declared types (#3651)
`normalizeGoTypeName` cuts the package qualifier from field, parameter and
local types, so `*models.User` is stored as `User` and the bare lookup either
refuses the name or binds the wrong package once two packages declare a
`User`. A new optional `ScopeResolver.qualifiedTypeLookupSpelling` hook
recovers `models.User` from the written spelling; receiver typing (compound
receivers, simple bindings and callable-value-flow method values) tries it
first, grounded on the qualifier's import with the unique-name fallback off,
and falls back to the bare lookup on any miss. The qualifier is read from the
module scope so `vault *vault.Vault` cannot shadow its import, and a chain
step keeps a binding's own written spelling so a binding whose type the step
replaced never borrows another binding's package.

Corpus A/B against main: no edge removed or retargeted outside the new
fixture; 19 Go edges added and 13 Go drops cleared. Receiver bench: call drops
153 -> 148, all kinds 221 -> 208.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 12:37:02 +00:00
Abhigyan Patwari
278863068f
fix(scope): follow namespace factory return types and record untyped drops (#3648)
`ns.make()` now takes `make`'s return annotation from the namespace's module,
in both the bound (`x = rp.make()`) and inline (`rp.make().m()`) forms, for
every language whose provider records return annotations; Dart binds its
prefixed-call locals so the same lookup applies. The lookup fails closed
whenever it cannot prove the fact: the return must be anchored on a
module-level Function of that name (TS/Dart hoist method returns, Go binds
package-scope methods), the namespace must bind the module it targets
(`import pkg.sub`), and a dotted return is not followed further. The
namespace-name set is built from finalized import edges, never a
`scopeTree.byId` walk, so it is safe under GITNEXUS_DISK_SCOPE_INDEX=1.

Calls the analyzer cannot type are recorded as receiver-unresolved drops
instead of exact misses: a receiver bound to an untyped namespace call, and
an outer call that shares its start position with an inner one (site
identity is now `receiver.member`).

Corpus A/B against main: identical CALLS/ACCESSES edges outside the new
fixtures. Receiver bench: call drops 128 -> 153, reads 44 -> 48.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 10:24:26 +00:00
Abhigyan Patwari
9df1e98350
fix(routes): scope inline Express handlers and report api_impact lower bound (#3643)
* fix(routes): scope inline Express handlers and report api_impact lower bound

Inline Express handlers are anonymous Function nodes named by position, but
the route facts only recorded a handler name for bare identifiers. Routes
with inline handlers therefore had no handlerSymbolId: every route in a file
got the union of its handlers' response keys and every flow starting there.

Record the positional name for inline handlers, read response keys from the
resolved handler when a file registers several routes, and let processes
link exactly by handlerSymbolId as they already do for named handlers.

Count, per route, the files that pass its URL to a callee not proven to be
a fetch wrapper (excluding proven consumers and the route's own file). The
count is stored as Route.unverifiedConsumers; api_impact reports
epistemic: 'lower-bound' with that count when it is non-zero. Older indexes
without the column fall back to the previous query.

Closes #3488

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(routes): match unverified consumers once per URL

Memoize route matching per distinct fetch URL, skip the proven-consumer
scan when no unproven call matches a route, and build the Route query's
optional columns from a list instead of two booleans.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(group): keep inline handlers attributed to their registrar

Inline Express handlers now carry their positional Function name in the
route facts so ingestion can resolve a handlerSymbolId. Group HTTP
contracts read the same facts, but that name is a graph identity rather
than a symbol name the contract lookup can match, so the provider lost its
enclosing-registrar attribution. Ignore the name for inline handlers there.

Rebaseline the two bench guards the branch moved:
- emit-persistence: route.csv gains the header-only unverifiedConsumers
  field; stripping it restores the prior fingerprint exactly.
- receiver-resolution: the new fixture's req.query.path read on an untyped
  inline-handler parameter adds one receiver-unresolved read (191 -> 192).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
2026-10-20 17:44:08 +01:00
Abhigyan Patwari
faa453c528
fix: reduce MCP token overhead and correct cost comparisons (#3645)
Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-20 16:04:10 +01:00
Gergő Magyar
01af833875
fix(scope): preserve lexical bindings in HTTP wrapper detection (#3632)
* docs(scope): clarify lexical binding ownership and wrapper provenance

Checkpoint for #3630. Publishing the implemented source, regression tests, and benchmark harness as a draft PR; full-suite and final scaling validation remain in progress.

* fix(scope): publish #3630 docs/plans

* fix(scope): publish #3630 gitnexus/bench/lexical-binding-provenance

* fix(scope): publish #3630 gitnexus/bench/lexical-binding-provenance/fixtures

* fix(scope): publish #3630 gitnexus/bench/lexical-binding-provenance/results

* fix(scope): publish #3630 gitnexus/src/core/ingestion

* fix(scope): publish #3630 gitnexus/src/core/ingestion/languages/typescript

* fix(scope): publish #3630 gitnexus/src/core/ingestion/languages

* fix(scope): publish #3630 gitnexus/src/core/ingestion/pipeline-phases

* fix(scope): publish #3630 gitnexus/src/core/ingestion/route-extractors

* fix(scope): publish #3630 gitnexus/src/core/ingestion/workers

* fix(scope): publish #3630 gitnexus/test/fixtures/lang-resolution/fetch-wrapper-target-identity/lib

* fix(scope): publish #3630 gitnexus/test/fixtures/lang-resolution/fetch-wrapper-target-identity

* fix(scope): publish #3630 gitnexus/test/fixtures/lang-resolution/fetch-wrapper-target-identity/packages/http

* fix(scope): publish #3630 gitnexus/test/fixtures/lang-resolution/fetch-wrapper-target-identity/packages/http/src

* fix(scope): publish #3630 gitnexus/test/fixtures/lang-resolution/fetch-wrapper-target-identity/server

* fix(scope): publish #3630 gitnexus/test/fixtures/lang-resolution/fetch-wrapper-target-identity/web

* fix(scope): publish #3630 gitnexus/test/integration/resolvers

* fix(scope): publish #3630 gitnexus/test/unit

* fix(scope): publish #3630 gitnexus/test/unit/group

* fix(scope): publish #3630 gitnexus/test/unit/scope-resolution

* fix(scope): publish #3630 gitnexus/test/unit/scope-resolution/typescript

* fix(scope): publish #3630 gitnexus-shared/src/scope-resolution

* fix(scope): treat wrapped assignment targets as writes

`(app) = new Map()`, `(app as T) = x` and `app! = x` assign the same binding as
`app = x`, but route-fact invalidation and the shared pattern walker stopped at
the wrapper, so Express provenance survived the write and produced a false
route. Recurse through parenthesized, as/satisfies and non-null targets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(routes): resolve wrappers through overloads, declarator lists and barrels

Three wrapper shapes lost their identity:

- Bodyless overload signatures were indexed as separate definitions sharing
  the implementation's binding, so the binding looked ambiguous and both local
  and imported calls were rejected. Signatures now declare no callable.
- Facts for `const base = 0, request = (url) => fetch(url)` followed the first
  declarator. The captured name now selects its own declarator.
- An import resolved to a workspace barrel stopped at index.ts. Workers now
  record named, star and imported-then-exported re-exports, and resolution
  follows them to the declaring module: local and named exports shadow
  `export *`, star exports never carry `default`, and conflicting star exports
  block the name. No repository-wide name fallback is restored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(scope): assert closure ownership against the declaration

The closure-write assertion compared one lookup with itself, which also passes
when both are undefined. Compare it with the outer declaration and the shadowing
parameter, and keep the memoization check explicit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(routes): share lexical helpers and release per-file HTTP contexts

- Share binding keys, parameter patterns and transparent expression wrappers
  from lexical-bindings instead of four local copies; drop the unused
  moduleStem export; name the inferred-source predicates in lookup.
- Key the per-file HTTP context by its tree rather than its ParsedFile.
  Workers retain ParsedFiles for the whole chunk, which kept every file's AST
  and traversal maps alive until the chunk flushed.
- Index re-exports by name, memoize barrel walks per starting export, and keep
  facts without import targets as-is instead of copying them.
- Move TS-only wrapper cases into the TS describe.each instead of branching
  inside the per-language loop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(routes): keep wrapper identity for HOCs, CommonJS, object keys and fetch packages

Four definition shapes that main linked by name lost their wrapper identity:

- `const load = useCallback((url) => fetch(url))` and curried HOCs produced no
  facts because definition lookup stopped at the call; it now follows the
  callable argument, as the structural definition capture does.
- `module.exports = { request }`, `exports.x = …` and `module.exports.x = …`
  were not exports, so destructured `require` callers missed the wrapper.
  CommonJS export assignments are recorded when `module`/`exports` are the
  unshadowed globals, including functions defined inline in the export object.
- An object-literal key or method name was resolved as a lexical binding and
  collided with a same-named module wrapper. Only binding identifiers now name
  a definition's binding.
- `import fetch from 'node-fetch'` no longer counted as fetch. Imports of known
  fetch implementations (node-fetch, cross-fetch, isomorphic-fetch, the fetch
  member of undici and whatwg-fetch) are fetch evidence again; parameters and
  other local names still are not.

Reference identifiers are also resolved only when their name is bound to a
callable or class region; other identifiers cannot add a reachability edge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(routes): drive the forwarding fallback case from data and cover re-export merges

Replace the boolean-switched forwarding fallback case with table rows instead
of branching inside the test, and assert that barrel re-export facts survive
worker sub-batch merges.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(bench): reject stale or dirty call-graph exports

The committed comparison named a candidate revision that is not on this branch,
and nothing stopped it. Comparison now requires both exports to come from clean
checkouts and the candidate export to come from the checkout running the
comparison.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(bench): regenerate the call-graph comparison on the reviewed head

Clean baseline 565e50276 and clean candidate 8a5f7b738 on the frozen 432-file
corpus (fingerprint 88be1faf...): exactly one CALLS target changes, the
annotated closure probe `declaredOwner.writeAndRead` now calls `Base.m`
instead of `Foo.m`. The other 431 CALLS and all 11 METHOD_OVERRIDES edges are
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(bench): emit export provenance and review notes from the comparison

The comparison report carried export provenance and the expected-change
explanation only as hand-added fields, which a regeneration dropped. Emit
both exports' revisions, dirty flags and fingerprints, the unchanged CALLS
and METHOD_OVERRIDES counts, and an optional `--note` explanation directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(bench): record calibrated scaling reports and the regenerated comparison

Duration-calibrated-v2 runs (5 warmups, 15 measured batches, 500 ms pilot
target) pinned to the same CPU, baseline then candidate back to back:

- Baseline 565e50276 exceeds the 1.8 normalized ceiling on six arms at 4x
  input: position-index 7.92, position-deep-completed 4.65, nested-helpers
  4.82, nested-helper-chain 14.05, reverse-chain 4.31, name-collisions 2.61
  (medians).
- Candidate 94f1a055b passes --check: every arm stays at or below 1.32 at 4x
  for both minimum and median, with correct semantic guards on every arm.

The comparison is regenerated from clean exports with its provenance and
review note emitted by the tool: one expected CALLS target change, 431 CALLS
and 11 METHOD_OVERRIDES unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(scope): replace recursion with explicit stacks in new traversals

The binding work added five recursive traversals whose depth follows input
shape: region summaries (callable nesting), barrel resolution (re-export
chain length), pattern binding names (destructuring depth), route-fact write
invalidation (pattern depth), and the position index's max-end tree. Each
now uses an explicit stack with the same visiting order and results.

Regression cases cover the inputs the recursive versions could not handle:
a 20,000-deep destructuring pattern and a 50,000-module re-export chain both
threw RangeError before this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(routes): avoid a full-tree script walk when building lexical bindings

Route-fact extraction ran 1.78x slower than main on a 512-function file
(87 ms vs 49 ms) because createLexicalBindings walked every AST node in script
to detect collapsed parameter/body environments, which only functions with
parameter defaults or computed keys can have.

- Find functions with the native type search, skip plain parameter lists
  without any subtree search, and walk only the formals and bodies of the
  rest. Detection is unchanged, except that functions inside syntax-error
  regions are now also checked, which can only add fail-closed ambiguity.
- Read each node's id and start position once per lookup instead of
  repeatedly crossing into native getters.

The same extraction now takes about 56 ms against 51 ms on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(routes): walk wrapper evidence with a tree cursor

The wrapper context visited every node through namedChildren, which
materializes each child as a SyntaxNode and records a parent edge by node
id. A tree cursor reads node types and offsets natively, so only the node
types the handlers inspect become SyntaxNodes. Declared identifiers are
keyed by start offset, and the walk records the ancestor facts later
queries need (stored binding, default export, declarator of a name)
instead of a parent map.

On the 512-wrapper scaling input, context construction drops from about
58 ms to 48 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(bench): regenerate the call-graph comparison on the cursor walk

The candidate export at 6061ca71b has the same fingerprint as the previous
candidate: the traversal rewrite changes no edge. The one expected target
change and the 431 unchanged CALLS and 11 METHOD_OVERRIDES remain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(bench): record final scaling reports on the cursor walk

Baseline 565e50276 and candidate 61de364ff ran back to back on CPU 23
with the duration-calibrated-v2 protocol. Every candidate check stays at
or below a 1.32 normalized factor against the 1.8 ceiling; the baseline
fails six of nine arms. Workload fingerprints agree except the documented
name-collision false positive in the baseline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(plan): checkpoint the final review, scaling and suite results for #3630

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(routes): treat export aliases of one wrapper as one star-export target

Star-export candidates were deduplicated by the resolved export name, so
`export { request, request as send }` reached through two barrels counted
as two targets and blocked the import, dropping the consumer's FETCHES
edge. Candidates are now keyed by the declaration each export name names,
matching ECMAScript ResolveExport's binding comparison; distinct
declarations exported under the same name stay ambiguous.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(bench): regenerate scaling and call-graph reports on the alias fix

Baseline 565e50276 and candidate 4d62bd045 ran back to back on CPU 23.
Every candidate check stays at or below 1.22 against the 1.8 ceiling;
the baseline still fails six of nine arms. The CALLS/METHOD_OVERRIDES
export is unchanged (fingerprint 4db24f57), so the comparison only
records the new candidate revision.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(plan): record the export-alias fix and the regenerated reports for #3630

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scope): keep the type a write gives an undeclared name

A constructor write to a name no scope declares (`client = new ApiClient()`
in sloppy JavaScript) declares nothing, so the lookup stays absent. The
carried constructor fact was dropped on that exit, which lost the receiver
type main had inferred for later reads in the writing scope. The absent
result now carries it, and findReceiverTypeBinding uses it before the
namespace fallbacks. Only complete-claim providers carry such a fact.

Tests pin the carried type per inferred source, the undeclared write, and
preservePosition across a module redirect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(routes): close the wrapper identity gaps found in review

- CommonJS wrappers captured as their assignment (`exports.x = function`,
  `module.exports.x = () =>`) produce facts again: findFunction follows the
  assignment's right side.
- Name-only fallback considers only definitions that can be the target: an
  unresolvable import names a module-level export, an undeclared global a
  top-level function. Nested and unexported helpers no longer erase a
  wrapper's edges.
- Only possible wrappers and module-level functions are emitted, and the
  routes phase builds the index only when routes and candidate calls exist.
- A rebound binding (later assignment, `var` initializer over a function
  declaration, reassigned export) proves no wrapper across files.
- `(<T>x) = ...` is a write; transparent wrappers skip type arguments.
- Calls inside recovered syntax are still collected; instance-field
  initializers resolve after the module body, so a later declaration is
  visible.
- Local exports are always recorded, so a star export conflicting with a
  non-callable export is ambiguous, and fully resolved barrel frames are
  shared across walks.
- HTTP hooks run per file under a guard; a failing file or one without a
  ParsedFile still records its function names so fallback declines.
- namesFetch is iterative, large patterns no longer spread into push, the
  facts cache is keyed by the name node, and the provider context cache
  checks its ParsedFile.

Tests cover each case; the behavior rows fail on the previous source.
The TS-only call cases no longer branch inside the test file, call targets
are asserted exactly, the function-type list is drift-checked, and the
persistence test joins the cross-platform worker list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(routes): describe wrapper fallback, barrel and recall boundaries

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(bench): count the new CommonJS fixture's dropped write site

`lib/cjs-member.js` in the fetch-wrapper target-identity fixture writes
`module.exports.arrowRequest`, a member write whose receiver is not typed.
That adds one `receiver-unresolved` write (190 -> 191 all-kind drops,
19 -> 20 writes). Call drops and shape-arm states are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(bench): regenerate scaling and call-graph reports on the review fixes

Baseline 565e50276 and candidate 528ea1478 ran back to back on CPU 23.
Every candidate check stays at or below 1.27 against the 1.8 ceiling; the
baseline still fails six of nine arms. The CALLS/METHOD_OVERRIDES export
is unchanged (fingerprint 4db24f57), so the comparison only records the
new candidate revision.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(plan): checkpoint the review fixes and regenerated reports for #3630

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(routes): share CommonJS checks and trim per-node work

- `isCommonJsGlobal`/`isModuleExports` in lexical-bindings replace the two
  copies in fetch-wrapper and framework-route-facts (both resolve the same
  scope from the same start position).
- LEXICAL_FUNCTION_TYPES is derived from the TypeScript FUNCTION_NODE_TYPES
  instead of a third hand-kept copy; the drift test still pins it.
- `unwrap` reads UNWRAPPED_TYPES, the set the cursor walk mirrors, and the
  class-body region is no longer shadowed under the name `deferred`.
- framework-route-facts reads each node's type once per loop iteration.
- The position index returns the latest-starting scope when it already
  contains the point, before the max-end tree search; that entry is the
  search's rightmost match.
- carried() returns a shared empty set for argument forms that cannot carry
  a value, the resolution file set is built without intermediate arrays,
  and the routes phase reads the call list once.

No behavior change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(bench): regenerate scaling and call-graph reports on the refactor

Baseline 565e50276 and candidate 3db8657ba ran back to back on CPU 23.
Every candidate check stays at or below 1.32 against the 1.8 ceiling; the
baseline still fails six of nine arms. The CALLS/METHOD_OVERRIDES export
is unchanged (fingerprint 4db24f57). The later main merge (e2a92dab8)
touches no measured file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(plan): checkpoint the simplification pass and its reports for #3630

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Address PR review feedback (#3632)

- Destructuring defaults (`{ fetch = globalThis.fetch } = {}`, renamed,
  array and local forms) are alias evidence for their leaf binding and
  no longer count a second initialization, which also invalidated
  bindings like `[send = other] = values`.
- `export default (request)` records the default export: the value is
  unwrapped before the identifier check.
- The HTTP fallback records and the collapsed-environment test row now
  say what they stand for.

Regression rows cover each form in JS, TS and TSX and fail on the
previous source; two fixture consumers cover imported wrappers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(bench): refresh lexical binding reports after review fixes

Regenerate clean baseline and candidate measurements at c263c4f72.
All candidate scaling checks pass, the semantic delta remains one CALLS
target, and receiver-resolution counts match the existing baseline.

* docs(plan): checkpoint refreshed review-fix measurements

Record c263c4f72 review fixes, the regenerated scaling and semantic
results, and the passing receiver and CI checks.

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 11:36:06 +01:00
samuel mbabhazi
0e7b3d6fad
fix(mcp): report cross-function explain lines 1-based (#3635)
* fix(mcp): report cross-function explain lines 1-based

The interprocedural branch of explain passed the endpoints' and hops'
graph startLine through unchanged. Those are 0-based (tree-sitter rows),
so every cross-function source, sink and hop sat one line above the
function's declaration in an editor, while the intra-procedural findings
of the same response were already 1-based. source.line, sink.line and
hops[].line now go through toDisplayLine like context, query and impact
(#2377), and the response note says these are declaration lines.

The interproc integration block asserts the exact fixture lines: handle on
line 7 of source.ts, runIt on line 6 of sink.ts.

Fixes #3491

* fix(review): remove repaired accuracy allowance

---------

Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-20 08:54:52 +01:00
gitnexus-release-bot[bot]
47d63a0601
chore(vendor): update tree-sitter-dart to 1.0.0-g0038280 (#3633)
* chore(vendor): update tree-sitter-dart to 1.0.0-g0038280

* chore(vendor): rebuild native prebuilds (tree-sitter-dart)

Built by https://github.com/abhigyanpatwari/GitNexus/actions/runs/39212887661

* fix(dart): use native extension type parsing

The upgraded grammar parses extension types directly. The compatibility
rewrite loses generic extension bodies and implements clauses, so capture
the native nodes and register their member ownership instead.

Refresh the Dart capture fingerprint after comparing the old grammar and
emitter over the same fixture corpus. Keep the scaling budget unchanged.

Refs #3633

* chore(vendor): rebuild native prebuilds (tree-sitter-dart)

Built by https://github.com/abhigyanpatwari/GitNexus/actions/runs/39239767139

* fix: repair Dart parity and checkpoint regressions

Remove Dart from the preprocessing fixture inventory after retiring its
hook. Use the parsed body boundary when reading extension-type heritage
so named-record representations retain their implements clauses.

Seed the WAL recovery fixture with the normal checkpoint threshold, then
force one-byte checkpoints only for the deliberately blocked write.
Require an actual error exit instead of accepting a subprocess timeout.

Refs #3633

* chore(vendor): rebuild native prebuilds (tree-sitter-dart)

Built by https://github.com/abhigyanpatwari/GitNexus/actions/runs/39248441688

---------

Co-authored-by: gitnexus-release-bot[bot] <gitnexus-release-bot[bot]@users.noreply.github.com>
Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-19 15:41:34 +01:00
Abhigyan Patwari
565e50276d
fix(routes): resolve Express registrations made through helper parameters (#3629)
* fix(routes): resolve Express registrations made through helper parameters (#3487)

#3603 made Express receivers provenance-proven, which removed the receiver-
name false positives but also every registration on a function parameter:
a parameter has no binding value, so `app.get(...)` inside a helper never
resolved. On GitNexus's own server that dropped `* /api/mcp`
(`mountMCPEndpoints(app, ...)`) and `GET /` (`registerWebUI(app, ...)`),
and the two SSE progress routes registered by
`mountSSEProgress(app, '/api/.../progress', jobs)` were never found at all
(#3487, item a).

Named function values in the route facts now carry an identity and the
binding id of each parameter (a TypeScript `this` parameter takes no
position, and a parameter written anywhere in the body, nested closures
included, takes none either). Calls to plain functions and to namespace or
default import members are recorded as invocations, keeping only the
arguments that can carry an allocation or a literal path; arguments after a
spread have no position. The resolver resolves a registration whose
receiver, literal path or mounted child is a parameter through each call
site of its function, once per site and in the helper's file. This is one
hop only: a site argument that is itself a parameter does not resolve. When
no call site is recorded, the call is evaluated as written, so an unknown
mount path still suppresses its child router instead of exposing its paths
at the root.

Only calls whose callee is named like a function that registers on its
parameters are evaluated, which keeps resolution at its previous cost on
repositories with many helper calls. A function value's invalidation key now
includes its identity, so a property write on one function
(`Button.displayName = ...`) no longer disables every other. The group
layer shares the resolver, so it gets the same routes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(routes): forward mounted-child parameters and aliased helper imports

Review follow-ups for the helper-parameter forwarding:

- A helper that forwards only its mounted router (`function mountChild(child)
  { app.use('/api', child) }`) was never resolved, because the forwarded
  function was chosen from the receiver and path alone. Any parameter among
  the receiver and arguments now selects it, as long as all come from one
  function.
- A helper called through an aliased import (`{ mountSSEProgress as
  mountProgress }`) was filtered out before its call sites were recorded,
  since the filter compared only the local name. It now also accepts the
  imported name.
- A write to a same-named local declared in a nested block (`{ let app;
  app = other; }`) discarded the outer parameter. A write to a binding that
  a nested block, function or catch clause declares no longer counts.
- The fixture's `registerWebUI` uses its static directory.

The release tool-accuracy gate now passes `routes.helper-registration`, so
its known-gap allowance is removed. Its expected file moves from the caller
(`api.ts`) to the helper (`progress.ts`): an Express route belongs to the
file of its `app.get` call, which is also where its handler and response
keys are, as for every directly registered route.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(routes): treat destructuring reassignment as a parameter write

`[app] = [other]` reassigns `app`, but the write check compared the whole
target text (`[app]`) with the parameter name, so the parameter stayed
forwardable and later registrations used the call-site argument. A
destructuring target now writes each name it binds; a member target still
writes only a property. Also drops an unused local flagged by CodeQL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(routes): follow helpers exported under another name

`export { mountRoutes as setup }` records the export as a binding, so the
call-site filter knew the helper only as `mountRoutes` and skipped callers
importing `setup`. An export of a binding to a named function now adds its
exported name too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
2026-10-18 22:13:10 +01:00
Abhigyan Patwari
aa33a6e94c
fix(routes): link base-URL fetch calls made through wrapper chains (#3628)
* fix(routes): link base-URL fetch calls made through wrapper chains (#3488)

GitNexus's own web client calls `fetchWithTimeout(`${_backendUrl}/api/repos`)`,
which reaches fetch through `resilientFetch` and a local `fetchImpl` alias.
`api_impact` found none of those consumers, for three independent reasons:

- normalizeFetchURL rejected any URL that did not start with `/`, so a
  leading base-URL binding dropped the call. It now strips a leading
  `${...}` run followed by `/`, with the same rules as the group layer's
  consumer normalizer (#3111); the helper moves to route-path.ts so both
  layers share it. A path whose every segment is a param (`${base}/${id}`,
  `${base}/${id}.json`) is rejected, since it would match every route of
  that depth. Interpolations are collapsed brace-balanced before the query
  split, so `${repo ? `?repo=${repo}` : ''}` no longer ends the path, and
  one glued to the last static segment is treated as a query or suffix.
- The wrapper call collector required a `/`-leading literal, so the same
  template never became a wrapper candidate.
- Wrapper detection only looked five AST levels deep for a call to an
  identifier named `fetch`. Arrow-const wrappers sit deeper than that, and
  `resilientFetch` calls an alias of `globalThis.fetch`. Detection now walks
  the whole definition and accepts `globalThis`/`window`/`self.fetch` and
  aliases whose value names fetch (through `??`, `||`, `?:`), read from the
  AST rather than the text. It records whether the first parameter reaches
  fetch's URL argument and which callees receive that parameter. The routes
  phase closes the wrapper set over that forwarding: `fetchWithTimeout` is a
  wrapper because it forwards its URL to `resilientFetch`. A callee declared
  in the caller's file or imported from a relative module must carry a URL
  in exactly that module; a package-imported name is followed only when
  every recorded function of that name carries one. A fetch caller whose
  first parameter is not the URL (`track(event)`) or a same-named function
  elsewhere (an IPC `request(channel)`) lends nothing.

When `[param]` matches several sibling routes (`/api/analyze/upload` and
`/api/analyze/:jobId`), the fetch now links to the route whose segments
match by kind instead of the first one registered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(routes): match wrapper calls by declaring module and decline ambiguous fetch matches

Review follow-ups for #3488:

- A propagated wrapper's name went into a repo-wide set, so a literal call
  to an unrelated same-named function in another module was taken as a
  fetch. Wrapper call candidates now carry the module declaring a bare
  callee when the file declares or imports it relatively, and must reach a
  wrapper defined in exactly that module. Package and member callees keep
  the name match.
- An alias declared in a nested helper (`const fetchImpl = globalThis.fetch`)
  marked an outer call to a same-named parameter as a fetch. An alias now
  counts only where its declaring function encloses the call.
- A first parameter redeclared inside the function (`{ const url = ...;
  fetch(url) }`) was taken as the URL. A shadowed parameter is no longer
  followed.
- A fetch whose `[param]` ties between sibling static routes
  (`/api/kinds/foo`, `/api/kinds/bar`) linked to the first registered one.
  A tie now links none.
- The fixture's `resilientFetch` returns the last response instead of
  rejecting with `undefined`, and its client encodes the repo query value.

The release tool-accuracy gate now passes `api.template-wrapper`, so its
known-gap allowance is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(routes): keep call-site wrapper names and ignore helpers that never run

- A wrapper call through a renamed relative import (`import { request as
  send }`) stored the exported name, so a configured `fetchWrappers` entry
  naming the call-site `send` no longer matched. The call keeps its
  call-site name and carries the declared name separately for the module
  lookup.
- A nested helper bound to a local that is never referenced again (`const
  later = () => resilientFetch(url)`) made its enclosing function forward
  its URL. Calls inside such a helper are ignored; a helper that is called
  or passed on, such as a retry callback, still counts.
- The fixture's `resilientFetch` no longer retries after a timeout or abort.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(routes): let a nested parameter shadow a fetch alias

A function parameter between a fetch alias and a call shadows the alias
there (`function send(fetchImpl) { return fetchImpl(event) }` beside an
outer `const fetchImpl = globalThis.fetch`), so that call no longer marks
the enclosing function as a fetch wrapper. The fixture's retry helper also
stops returning a stale 5xx response after a later attempt throws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(routes): drop fetch aliases whose name is redeclared with another value

A block that redeclares an alias name with a non-fetch value (`{ const
fetchImpl = other; fetchImpl('/x') }`) let the inner call read as a fetch.
A name declared anywhere in the function with a value that does not name
fetch is no longer an alias, which covers every block-scoped shadow without
lexical scope tracking.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(routes): ignore uncalled nested declarations and shadowed global objects

- An uncalled nested `function helper() { fetch('/x') }` made its enclosing
  function a fetch wrapper. Nested function declarations that are never
  referenced are now ignored, as unused function-valued locals already were.
- `window.fetch(url)` through a parameter or local named `window` (or
  `self`, `globalThis`) was read as the platform fetch. Such a root is now
  that value's method. A bare `fetch` parameter is still taken as fetch,
  since injecting a fetch implementation is the common reason for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(bench): refresh the receiver-resolution baseline for the fetch fixture

The new `fetch-base-url-wrapper` fixture in `test/fixtures/lang-resolution`
adds one unresolved TypeScript chain-field call to the committed check
corpus (127 to 128 call drops). Regenerated with
`measure.mjs --update-baseline` after a fresh build and cleared parse caches;
no other counter moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
2026-10-18 22:11:37 +01:00
azizur100389
702c917377
fix(python): retain nullable factory receiver types (#3595)
* fix(python): retain nullable factory receiver types

* test(accuracy): remove repaired Python gap allowances

* test(bench): refresh Python capture fingerprint

* fix(python): type `None or call()` assignments like `call() or None`

`None or make_user()` always evaluates to the call, but only the
`call() or None` order matched, so the variable lost the factory's
return type. Add the mirrored boolean pattern, matching the two
conditional-expression orders the PR already supports.

Fixture gains `none_or` (resolves to User.save) and `none_and` (stays
unresolved: `None and x` is always None). The capture golden changes only
for the edited fixture, and the python-scope baseline is re-recorded
(`measure.mjs --check` passes, scaling 1.021).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 15:39:40 +01:00
Gergő Magyar
18128f9347
test(embeddings): cover CodeEmbedding scans after delete and re-create (#3569, #3474) (#3623)
LadybugDB 0.18.3 (shipped in 1.6.12 and 1.6.13-rc.57) misreads string
columns after a selective write. The CodeEmbedding table is affected by
the embedding writeback's own statements, without any COPY: after
per-node DELETE + CREATE and a checkpoint, 3,936 of 8,192 tuples scan
wrong and the {nodeId} lookup misses a retained row. On a released
build this makes unchanged nodes look new (re-embedding) and puts blank
or truncated ids into the CodeEmbedding key ("duplicated primary key").
The 0.21.1 engine on main fixes it.

- reproduce-search.cjs gains an `embedding` scenario using the
  production CREATE / DELETE-by-nodeId statements; it fails on 0.18.3
  and passes on 0.21.1. The vitest wrapper runs it with the other
  scenarios; per-scenario expectations are now data, not branches.
- incremental-method-integrity runs both analyses with a deterministic
  loopback embedding endpoint and asserts that only the edited file is
  re-embedded and every other CodeEmbedding row (4,096+) is unchanged
  from a cold reader.

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 11:01:04 +01:00
Gergő Magyar
bd20dde825
fix(taint): report inline and factory handler flows (#3612)
* fix(taint): cover inline and returned handlers (U8)

Join expression-handler CFG summaries to distinct graph functions without changing existing anonymous-owner identities. Keep named function expressions private to their lexical scope.

Related: #3489

* fix(ci): encode inline handler taint paths (U8)

Use codec-safe generated display names while preserving positional function identity. Verify persisted hop continuity and remove the repaired inline-flow accuracy allowance.

* fix: keep anonymous names unbound (U8)

* test: pin inline callback captures (U8)

* ci: run inline taint guard (U8)

* test: align inline handler contracts (U8)

Pin callback-owned call edges while preserving nested callable IDs and module-level HOC attribution. Assert repaired inline flows and the retained captured-closure limitation.

* ci: run native inline proofs on all OSes (U8)

Register real-worker identity/CFG and persisted explain cases on the existing Windows/macOS matrix. Charge explicit scheduling estimates without changing watchdogs or runtime behavior.

* test(taint): reject all enclosing factory sources

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-17 20:22:58 +00:00
Gergő Magyar
30676685e0
fix(rename): apply the exact reviewed edit plan (#3617)
* fix(rename): bind apply to reviewed plans (U7)

Retain exact semantic edits behind single-use preview tokens and reject
source, target, inventory and graph drift before application. Preserve
explicit partial-write accounting and keep large unedited sources covered
with hashes instead of retained text.

Refs #2973

* fix(rename): cover unindexed sources (U7)

Address PR #3617 review by binding every supported source to streamed byte
hashes and canonical targets, including tracked and untracked files absent
from the graph. Keep the exact reviewed edits and bound evidence memory.

Use conventional even-sample medians and extend the existing CI benchmark
to capture and validate unindexed sources without relaxing timing gates.

Note: pre-existing packed Tree-sitter GLIBCXX_3.4.31 host failure in
parse-cache-identity-package.test.ts is not addressed by this PR.

* fix(rename): preserve lazy startup (U7)

Keep language providers off the MCP startup path; load their existing
classification only when rename inventory is requested. The existing
12 startup closure checks now pass.

Address PR #3617 review by including token validation in reviewed apply
timing and growing indexed evidence before preview, preserving the
20MiB controls under a 256MiB native pool. Migrate dispatch and retention
tests to the preview token contract, keeping write-failure oracles.

Note: pre-existing auto-sync /tmp fixture security and installed ARM64
grammar-header failures remain outside this PR; the packed Tree-sitter
GLIBCXX_3.4.31 host failure also reproduces on unchanged main.

* test(rename): always remove apply fixture (U7)

Own the temporary directory from creation in an outer finally so setup
and preview assertions cannot bypass cleanup. Keep spy restoration in
its inner finally and preserve all write-failure assertions.

Address PR #3617 cleanup feedback.

* fix(rename): retain targets and config evidence

* test(rename): verify approved physical output

* test(rename): cover native filesystem matrix

* test(rename): align preview contract fixtures

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-17 19:38:01 +01:00
Gergő Magyar
f43834e814
fix(indexing): converge coverage around directory symlinks (#3616)
* fix(indexing): converge coverage around directory symlinks (U5)

* style(bench): format symlink baseline (U4)

* ci: run directory symlink coverage benchmark

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-17 19:37:45 +01:00
Gergő Magyar
9b04fbe627
fix(embeddings): budget generated inputs and isolate rejections (#3615)
* fix(embeddings): budget generated inputs and isolate rejections (U4)

* test(embeddings): require pending retry request

* fix(embeddings): preserve Unicode in context

* ci: run generated embedding input budget guard

* test(embeddings): run input isolation on native OSes

* fix: retain container identity after long prefixes

* test: distinguish generated input cases

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-17 19:37:30 +01:00
Gergő Magyar
e6ae04ed84
fix(embeddings): reject corrupt identities before mutation (#3614)
* fix(embeddings): reject corrupt identities before mutation (U2)

* fix(embeddings): preserve exact Unicode keys (U2)

* fix(storage): validate identities before opening CSVs

* fix(embeddings): validate caches before mutation

* ci: gate native embedding identity benchmark

* test(embeddings): run identity proofs on native OSes

* docs: describe CSV identity validation pass

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-17 18:45:28 +01:00
Gergő Magyar
c8629f1b6c
fix(storage): preserve published graph on rebuild failure (#3613)
* fix(storage): preserve published graph on rebuild failure (U1)

* test(storage): strengthen publication review coverage (U1)

* test(storage): align publication evidence (U1)

* fix(storage): retain completed recovery archives

* fix(storage): preserve quarantines before cache reads

* ci: run staged publication benchmark guard

* fix(ci): declare WAL replay probe determinism

Document that the bounded recovery read drains and discards its rows. Only WAL replay success is observed; row identity and query behavior are unchanged. The existing 21 query-determinism checks pass.

* test(storage): cover publication across platforms

* test(ci): exclude POSIX suite from Windows estimates

* test: allow native publication retry to finish

* test: verify Windows incremental recovery

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-17 18:45:11 +01:00
Gergő Magyar
22a7608b7c
feat(cache): derive parser and PDG cache identities automatically (#3606) 2026-10-17 07:38:45 +03:00
Gergő Magyar
cae60c2bd4
fix(mcp): reject corrupt query identities and refresh index metadata (#3571)
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Gitleaks / gitleaks (push) Waiting to run
Publish / Classify release event (push) Waiting to run
Publish / RC guard (marker + release-PR skip) (push) Blocked by required conditions
Publish / ci (push) Blocked by required conditions
Publish / Publish to npm (push) Blocked by required conditions
Publish / Build & Push RC Docker images (push) Blocked by required conditions
Trivy Image Scan / Trivy (gitnexus-cli) (push) Waiting to run
Scorecard / Scorecard analysis (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-web) (push) Waiting to run
* fix(mcp): reject corrupt query identities and refresh index metadata

* fix(mcp): preserve reader and search integrity

Keep replaced readers unknown until matching metadata is published.
Defer shared-handle refresh until other consumers release the old graph
to avoid rebuilding connections against the same stale generation.

Propagate identity corruption after both hybrid search lanes settle,
so the sibling cannot query after its database session is released.
Select the regressions for the OS matrix and retain Python coverage
without optional Swift grammars.

Validation: 393 focused tests, nine native generation tests and ten
race executions across five fresh processes pass. Build and source/test
typechecks pass. The early full run passed 26,096 tests and failed eight:
seven reproduce on baseline; the mixed-source publication case passes
in clean reruns. Windows/macOS native execution remains for CI.

Graph analysis maps all edited production symbols; coverage remains
partial for the anonymous FTS test callback, manually reviewed.

Refs #3571

* fix(lbug): bump @ladybugdb/core to 0.21.2 to stop doubled rows after delete and re-copy

LadybugDB 0.21.0 and 0.21.1 return every row of a table that spans more
than one native vector twice once the incremental writeback has DETACH
DELETEd it and a COPY into an earlier table has run. NodeGroup::scan let a
morsel that ended before the group's first live row wrap an unsigned
subtraction and rescan to the end of the group (LadybugDB #1085, fixed in
0.21.2). No primary key error fires. The identity guard from #3442 stops
the run with "unexpected or duplicate ID", so a Swift edit that pulls every
importer into the write set failed on repos with more than 2048 structs.
Only unreleased main was affected: 1.6.12 ships 0.18.3.

Pin 0.21.2 in package.json, update the six @ladybugdb/core entries in the
lockfile, and move coreVersion in the vendored FTS manifest. The FTS
extension stays at 0.21.0 because no v0.21.1 or v0.21.2 artifact is
published; the pairing assertion and its unit tests pass.

Add a regression to the delete-nodes-for-files suite: 2049 structs with
CONTAINS edges are loaded, every file is deleted, the graph is loaded
again, and each id and edge must appear exactly once.

Verification (Linux, Node 22.18):
- lbug-delete-nodes-for-files: 11/11 on 0.21.2. With the 0.21.1 native
  packages swapped in, the new test fails with 4098 rows instead of 2049.
- Reporter recipe end to end on the built CLI: incremental analyze exits 0
  with no duplicate ids on a Swift-heavy fixture and on a 70-file Python
  fixture, with and without FTS. On 0.21.1 the Swift fixture exits 1.
- A 0.21.1-written database opens and reads under 0.21.2.
- prettier, eslint and typecheck:tests are clean on the changed files.
- The full lbug-db project had not finished when this was committed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* test(fts): say what the Windows warm-session branch covers

On Windows the repair step calls poolClose, which removes the pool entry
before the in-place writer opens. The step therefore checks the backend's
cached capability state, not a live pool connection. The comment now says so
instead of implying the pool stays warm. No behavior change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* revert: take the @ladybugdb/core 0.21.2 bump out of this PR

Reverts 0cdc3dfe3. The bump fixes LadybugDB 0.21.0 and 0.21.1 returning every
row of a large table twice after a delete and re-copy, but on Windows it
crashes the vendored FTS extension, which is still the v0.21.0 build: four of
eight Windows shards failed with exit code 3221225477 (0xC0000005) in tests
that load libfts and build an FTS index. All eight passed on 9d79092ab with
core 0.21.1. A Windows extension is only published for v0.21.0, not for
v0.21.1 or v0.21.2.

The bump moves to its own draft PR (#3578) until a matching Windows
extension exists. This PR returns to its original query-integrity and
index-freshness scope.

Restores gitnexus/package.json, the six @ladybugdb/core entries in
package-lock.json, the coreVersion in vendor/lbug-fts/manifest.json, and
removes the regression test that belongs with the bump. All four files are
identical to origin/main (1b4e3f0a8) after this commit.

Verification:
- git diff origin/main for the four files is empty.
- fts-artifact-coverage and vendored-extension-path unit tests pass (31),
  and assert-publish-fts-coverage reports core 0.21.1 paired with extension
  0.21.0.
- The graph check on the staged revert was partial, because it only deletes
  test code. The forward change was gated clean: 4 files, 6 symbols, all in
  that test, no affected processes.
- Windows CI has not run on this commit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 15:06:26 +01:00
Gergő Magyar
8fa8e64388
fix(rename): extend safe refactoring and flow coverage across languages (#3557) 2026-10-13 08:38:17 +03:00
Gergő Magyar
191a954bf6
fix(python): resolve calls through module-returning accessors (#3542)
Some checks failed
Trivy Image Scan / Trivy (gitnexus-cli) (push) Has been cancelled
Trivy Image Scan / Trivy (gitnexus-web) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Gitleaks / gitleaks (push) Has been cancelled
Publish / Classify release event (push) Has been cancelled
Scorecard / Scorecard analysis (push) Has been cancelled
Publish / RC guard (marker + release-PR skip) (push) Has been cancelled
Publish / ci (push) Has been cancelled
Publish / Publish to npm (push) Has been cancelled
Publish / Build & Push RC Docker images (push) Has been cancelled
* test(accuracy): retire repaired Python accessor gaps

* fix(python): connect module accessor resolution

* fix(python): resolve calls through module-returning accessors

Bind `_pc().target()` and `m = _pc(); m.target()` to the module's
function when a local accessor returns an imported module, and count
capped-out dropped names in the impact lower bound.

Closes #3497

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(python): share module-accessor position key (#3542)

- Reuse the capture-side positionKey in the receiver namespace resolver
  instead of a second line:col helper plus an inline template.
- Note why the synthetic { moduleScope, scopes: [] } input is sufficient
  for createNamespaceTargetCache (sealed disk-backed ParsedFile shape).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(python): reuse subtype-dispatch positionKey (#3542)

- Export the existing line:col positionKey from subtype-dispatch instead of
  defining an identical copy in module-accessors, so both Python capture
  side channels key positions through one helper.
- Apply prettier to the Function-scope indexing line.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ci): unique test titles and rebaseline Python benches (#3542)

- impact-epistemic-lower-bound: `%j` rendered null, NaN and Infinity all as
  `null`, so the test-completeness audit rejected the duplicate identities.
  Use `%s` so every parameterized case has a distinct title.
- python-scope: capture fingerprint changes with the new module-accessor
  capture facts (golden captures were already updated).
- receiver-resolution: +4 Python call drops (125 -> 129). The two-step
  `x = f(); x.m()` form is now counted as an unresolved call instead of
  vanishing: fastapi-depends `router.get/post` (unknown, x3) and
  python-method-chain-binding `user.get_city()` (in-program; `User` has no
  `get_city`, so the site is genuinely unresolvable).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-10 18:41:51 +01:00
Gergő Magyar
999cc9f913
fix(deps): upgrade native tree-sitter to 0.25.1 (#3531)
* fix(deps): upgrade native tree-sitter to 0.25.1

* fix(tree-sitter): preserve sync loading and update verified capture baselines

Route C# scope queries through the synchronous native grammar loader so the compiled analyze module remains require-compatible on Node 22.18. Refresh only the audited empty-Python-module and renamed-PHP-fixture captures, and pin the runtime assertion to 0.25.1.

Validated 479 targeted tests, all 16 scope-capture benchmark cases, Python capture/import guards, compiled C# worker parsing, build, typecheck and formatting. Performance budgets are unchanged.

* fix(tree-sitter): refresh upstream vendors and preserve parser semantics

* fix(ci): refresh prebuilds and support Windows ARM

Refresh macOS, Linux ARM, and Windows x64 grammar binaries from the successful native CI builds. Pin node-gyp 12.4.0 so the Windows ARM jobs recognize Visual Studio 2026.

Use local Git filtering for E2E to avoid PR-files API timeouts on generated parser diffs.

Validation: 143 focused tests, Actionlint, and all 16 scope-capture benchmark checks passed. Full npm test run started; native database suites still running.

* fix(ci): refresh Windows ARM grammar prebuilds

Import all seven Windows ARM grammar artifacts from successful native build run 37965761760. Artifact filenames and SHA-256 hashes verified; all 42 native build jobs passed.

Validation: 31 prebuild coverage tests passed.

* fix(bench): stabilize scope capture timing guard

Warm each input size seven times and use 21 median samples while retaining isolated timing blocks. Yield between languages so native finalizers release allocations outside the measured sections. Keep all fixture sizes, fingerprints, scaling formulas, and budgets unchanged.

Validation: all 16 language guards passed with a 2 GB heap limit (1.38 deep-chain ratio; 1518 MB peak RSS). Linear and quadratic controls passed their expected guard outcomes. Formatting and graph change analysis passed. Full npm test is running without failures so far.

* fix(parser): reduce TypeScript capture traversal cost

* fix(test): await parser worker readiness before teardown

* fix(parser): load C# synchronously in workers

* fix(grpc): resolve native proto detections against their own file

With the native proto grammar active, sibling .proto files that declare
the same short service name under different packages tied in the
directory-based resolveProtoConflict heuristic and both providers were
dropped. A proto-origin detection already knows its defining file, so
use that file's entry before falling back to the heuristic.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(packaging): assert native grammars load from the installed tarball

The packaged-install smoke only ran `gitnexus --version`, so a grammar
that failed to load from the published package (bundled runtime, patched
peer manifests, vendored prebuilds, C# sync loader, Protobuf wrapper)
would ship silently; the dev-tree ABI smoke also accepts vendored
grammars that report unavailable. Parse a sample for every registered
grammar plus the native Protobuf plugin from the installed package, on
the main thread and in a worker thread.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(tree-sitter): track compatibility workarounds instead of 0.25 readiness

The daily readiness report still targeted tree-sitter@0.25.0, so after the
upgrade it would keep reporting "Blocked" and never close its tracking issue.
Repurpose it to track what we carry for the bundled runtime: derive the target
from the package.json pin, list each pack-time peer patch from
prepare-tree-sitter-bundle.cjs with its drop condition (bump, wait for an
upstream release, transitive, or intentionally pinned), and reword the
buckets. The workflow adopts the issue opened under the old title.

Also update the grammar-update-monitor header and auto-PR text, which still
described the 0.21.1 runtime and a tree-sitter-c hold.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(dart): assert both nested labels target the loop; fix Zig call-shape doc

The nested-label CFG test only jumped to `outer` and checked reachability,
which still passes when a jump is retargeted to the inner loop (its exit
reaches the outer header). Jump to both labels and assert the exact
`continue` edges; dropping the inner label now fails the test.

Update the Zig callable-flow comment: call_expression now wraps actuals in a
required `arguments:` field.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-10 13:07:59 +03:00
Gergő Magyar
4756e8a820
fix(release): gate publication on accuracy and paired evaluation (#3503)
* test(release): add fixed-answer native tool accuracy

* fix(release): gate stable artifacts on pinned paired evaluations

Apply review findings #1-4: gate Docker publication, grade in-flight retries, preserve repository context, and execute negative controls in CI.

* fix(eval): verify native context and resolve harness security findings

Inspect Claude's first startup reminder for ordinary repository guidance.
Bound launcher-option matching and escape Markdown backslashes and pipes.
Exclude only the parsed synthetic accuracy corpus from CodeQL; keep the
benchmark harness and evaluator under security analysis.

Validated focused Python and TypeScript regressions plus core typecheck.

* fix(eval): wake the EC2 runner and prove paired evaluator execution

Bootstrap the existing dedicated instance from a protected hosted job, bound
native runner pickup, and stop only instances started by this run. Keep paid
sessions inside the fixed stop window and add a runner-only dispatch.

Require a contained six-cell prepare/session/oracle/report canary in CI,
including a failed repair that remains in the measured denominator.

* fix(ci): reuse existing configuration and disambiguate accuracy cases

Remove the new AWS credential/settings path and release opt-in variable. Bound native runner pickup with the existing GitHub token and retain private EventBridge startup until its existing mechanism can be reused. Reuse current workflow environment names and evolution schedule controls.

Name malformed-observation cases explicitly so the execution audit distinguishes null from missing and actually tests invalid arrays.

* fix(review): isolate release builds and preserve benchmark evidence

* fix(release): gate RC publication on paired quality and manage EC2 lifecycle

* fix(ci): clarify release shell redirects and build script

* fix(eval): remove temporary patch sinks after capture

* fix(bench): retire tool-accuracy allowances repaired on main

Main at 50aa4be3b repaired three #3487 route checks (#3505) and all four
#3499 Python scope checks (#3502, #3504). The ratchet correctly failed the
merged head with stale allowances, so remove them and keep the fixed answers
as release protection: 18/31 pass, 13 recorded gaps remain.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(release): gate RCs on accuracy only and keep paid runs for stable

Follow the cost split proposed in discussion #3493: fixed-answer tool
accuracy on every RC, paired agent runs before stable releases and on a
weekly schedule against the latest RC.

RC publication no longer prepares a bundle, calls release-evaluation.yml
and waits for a paid run of up to 21 hours on the shared EC2 lock. Every
release attaches this run's accuracy report; stable npm publication still
requires exact-commit paired evidence. release-evaluation.yml drops its
workflow_call path and the now-unused candidate bundle module.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(release): address PR #3503 review feedback

- Page through recent release-evaluation runs instead of reading only
  the newest 50, so valid stable evidence cannot be pushed off page one.
- Bound each runner-pickup jobs request by the remaining deadline.
- Replace non-finite floats at any depth in failure receipts so the
  incomplete report still serializes with allow_nan=False.
- Clarify that the summary.cap case has 501 names over 1001 sites.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(review): harden candidate build and close review gaps

- Mount the candidate checkout's .git read-only inside the build sandbox,
  so lifecycle scripts cannot plant git config (e.g. core.fsmonitor) that
  host git later runs in that checkout during actions/checkout cleanup.
  The real-Bubblewrap canary now also attempts that write.
- Type tool-accuracy observations instead of using explicit any.
- Cover the fail-closed branches reviewers found untested: unsafe or
  missing evidence artifacts, mismatched task pins, malformed repo/SHA,
  an instance that stops again during bootstrap, and unbalanced GitNexus
  guidance markers.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(release): describe RC accuracy gate and stable evidence step

- CONTRIBUTING now states that RCs are gated by CI (including the
  fixed-answer tool-accuracy check) without a paid run, and that stable
  publication needs a passing Release evaluation for the exact commit
  within seven days.
- The oracle-control fixture passes tarfile's data filter only where it
  exists (3.11.4+), matching the declared Python 3.11 floor.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(bench): pin tool-accuracy fixture line anchors in one place

run.ts bucketed rename edits and explain findings by line literals that
expectations.ts duplicated. Export FIXTURE_ANCHORS (file, line, pinned text)
from expectations.ts, build the fixed answers and run.ts classifiers from it,
and fail loudly (runner and unit test) when a fixture line no longer holds
the pinned text. Expected answers and observations are unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(bench): fail closed when ripgrep is missing from the tool-accuracy run

rename's text-search pass shells out to rg and only logs a degraded warning
when it is absent, so a runner without ripgrep scored a degraded rename
(homonym.ts:1 missing) and still passed. Check rg --version before indexing,
record it in accuracy.json source.externalTools, and install ripgrep in the
ci-tests tool-accuracy job and the docker release-gate (same if: condition).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(eval): split baseline guidance, share bwrap preamble, drop dead bare option, harden patch cleanup

- Move the baseline (no-GitNexus) guidance scrubbing out of proposer_sandbox.py
  into baseline_guidance.py, with its unit tests.
- Expose real_directory, runtime_mount_args and bwrap_base_args publicly so
  release_build no longer imports private helpers or re-assembles the shared
  bubblewrap preamble; the candidate build command is byte-identical.
- Remove the unused run_claude `bare` parameter and its --bare/--tools branches.
- capture_patch: a failed temporary-directory removal no longer discards the
  read patch or replaces an earlier error; it is attached as a note, or warned
  on stderr when there was no earlier error.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ec2-runner): keep stop observing through transient describe failures

- stop() treats a failed or timed-out describe-instances call as unknown
  state and keeps observing until the stop deadline; a persistent failure
  is still raised at the deadline with the last command error. Unusable
  states and identity mismatches still fail at once (new CommandError
  subclass separates command failures from semantic ones).
- Readiness CLI has one paid mode: --job-name NAME. --evolve is removed;
  skill evolution passes its job name, and tests tie the watchdog command
  to the paid job's actual name in both EC2 workflows.
- Jobs-API requests never get a timeout larger than the remaining pickup
  budget (previously rounded up to 1s past the deadline).
- Document that the shared concurrency group keeps only one pending run,
  so a queued release evaluation can be replaced and must be confirmed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(eval): record verified EC2 lifecycle configuration

The README still described the AWS settings as assumed and unverified.
The OIDC role, environment settings and runner_only lifecycle were
configured and verified live on 2026-10-09.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(release-eval): grade both runtimes against one pinned task toolchain

Candidate and stable each staged task dependencies (node_modules,
gitnexus-shared/dist) from their own runtime checkout, so the same v1.6.12
task source was graded with different TypeScript, Vitest and LadybugDB
versions and a per-task solve delta also measured dependency drift.

- Check out and build the pinned task commit once (tasks-base) and point
  every task's repo at it for both runtimes; the runtime under test reaches
  sessions only through --gitnexus-root. prepare requires --task-repo at the
  single pinned task commit (new task-sha subcommand resolves it).
- Retain sandbox_dependency_content_digest per measured row and make
  release_gate fail when any task's cells, across candidate and stable, do not
  share one recorded dependency digest.
- Move the task-pin comparison into validate_report(task_pins=...) and use
  it from release_report check and release_gate.
- Cover the gate CLI with a missing and a corrupt candidate report.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(ci): warn that a pending release evaluation can be replaced

GitHub keeps one pending run per concurrency group, so a newer queued
EC2 run cancels a pending release evaluation. Operators must confirm the
startup job ran before relying on the evidence.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(eval): prove hidden oracles against the grading toolchain

Release evaluation now grades every task with dependencies built at the
pinned task commit (TypeScript 5.9.3, Vitest 4.1.11), but the oracle
controls still ran against the current checkout's toolchain. The Ubuntu
containment job now builds the pinned task toolchain and points the
controls at it. All seven controls pass locally against that build.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(ci): pin the duplicated EC2 lifecycle jobs together

Both EC2 workflows carry their own copy of the live-verified start,
check, readiness and stop jobs. A reusable workflow would change that
verified job structure, so instead a test requires the copies to stay
identical apart from the job display name and the paid-job dependency.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(release-eval): accept stable evidence only from main's current evaluator

Stable publish validated downloaded agent evidence against the release
commit's eval/ tree and never tied a report to the run that produced it.
Evidence from an older evaluator stayed acceptable for seven days after
graders changed, while task changes on main made every fresh evaluation
mismatch the tag. The first invalid artifact also hid older valid runs.

The composite action now extracts eval/ from main's head and runs the
validator there with locked base dependencies only (no dev extras or
project build). A report counts only when its harness_sha is the head_sha
of its trusted main run and the compare API shows no change under eval/,
the release-evaluation workflow or the pinned agent CLI between that
harness and the evaluator; a missing, diverged or 300-file comparison
fails closed. Runs are tried newest first, rejected runs are skipped
with a bounded reason list, every gh call has a timeout, and task pins
use validate_report's task_pins check.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(eval): break the sandbox import cycle and resolve code-scanning alerts

- baseline_guidance is now pure text handling with its own GuidanceError;
  the baseline mount builder lives in proposer_sandbox again and converts
  that error to SandboxError, so imports run one way only.
- task_assets uses the public real_directory name; the unused private
  alias is gone.
- The oracle-control fixture always extracts with tarfile's data filter
  and skips on Pythons that lack it, instead of extracting unfiltered.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(release-eval): run candidate lifecycle scripts offline; reject smuggled report fields

- build_candidate now downloads locked dependencies with --ignore-scripts,
  then runs every lifecycle script (dependency installs, prepare, build)
  in a fresh network namespace, so candidate code cannot reach host-local
  services. Verified locally that the current head and the pinned task
  commit build this way; the real-Bubblewrap canary now asserts only
  loopback is visible to a lifecycle script.
- validate_report requires the evidence document to equal its
  field-whitelisted rebuild, so per-run or top-level fields outside the
  published schema are rejected before the publisher copies the file.
- The sandbox test suite also covers a no-GitNexus sandbox refusing
  unbalanced guidance markers.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(eval): describe the offline candidate lifecycle

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(release-eval): pin downloads to the npm registry; require dependency binding

Address review feedback on PR #3503:
- The candidate's online install phase now refuses lockfile entries that
  resolve outside https://registry.npmjs.org/ (other than in-checkout
  workspace links) and refuses shipped .npmrc files, so a candidate
  cannot steer npm at loopback, private or metadata endpoints.
- Every measured row must carry a 64-hex task-dependency digest, so a
  single report cannot be accepted with its grading toolchain unbound.
- Oversized JSON integers mark a measurement untrustworthy instead of
  crashing report generation.
- Baseline guidance stripping recognises headings with up to three
  leading spaces (CommonMark).
- Remove a stale comment about the old private helper name.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(eval): parse CommonMark ATX headings; compare evidence by exact JSON

- Baseline guidance stripping now parses headings as CommonMark ATX
  headings (0-3 leading spaces, optional closing # run, tabs), so a
  GitNexus section heading like '## GitNexus rules ##' is removed too.
- Evidence validation compares the serialized rebuild with the report,
  so a retyped value (true for 1, 2.0 for 2) no longer passes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(eval): drop continuations of every CommonMark list item in baseline guidance

A removed GitNexus instruction left its indented continuation behind when
the item used '+' or an ordered marker (1. / 1)). The scrubber now
recognises every CommonMark list-item marker.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(eval): isolate candidate MCP from agent task writes (#3503)

Run MCP in a nested Bubblewrap boundary with read-only task, graph,
registry and runtime mounts, private state and isolated processes/network.
Keep task writes on the agent's built-in tools and remove mutating MCP grants.

Add startup/tool mutation canaries and preserve explicit unsafe diagnostics.

Validation: focused pytest 138 passed, 16 skipped. Full locked evaluator
996 passed, 29 skipped; real containment canaries require Ubuntu CI.
Note: eight pre-existing comparator-reuse failures reproduce on the
unchanged head due to missing os.supports_dir_fd support. One process-control
timeout failed in the full run and passed alone and on the unchanged head.

* fix(eval): close baseline mount overlap and test symlink evidence (#3503)

Reject supplied no-MCP mounts that cover forbidden GitNexus paths, including ancestor mounts and lexical aliases. Keep ordinary dependency mounts available.

Exercise evidence symlink rejection with a real valid-report target and retain dangling-link coverage.

Validation: 1026 evaluator tests passed, 29 skipped; targeted mount tests 36 passed and evidence tests 34 passed. Removing the symlink guard in memory makes the repaired regression fail. Ruff and diff checks passed.

Note: eight pre-existing comparator-reuse failures remain in this environment because os.supports_dir_fd lacks the required os.lstat support.

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-10 08:26:08 +01:00
Gergő Magyar
82347f0f07
fix(scope): resolve local imports by lexical ownership (#3532) 2026-10-10 08:13:55 +03:00
azizur100389
50aa4be3b2
fix(routes): prefer production handlers and preserve app.all (#3505)
Some checks failed
Trivy Image Scan / Trivy (gitnexus-cli) (push) Has been cancelled
Trivy Image Scan / Trivy (gitnexus-web) (push) Has been cancelled
Gitleaks / gitleaks (push) Has been cancelled
Publish / Classify release event (push) Has been cancelled
Scorecard / Scorecard analysis (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Publish / Build & Push RC Docker images (push) Has been cancelled
Publish / RC guard (marker + release-PR skip) (push) Has been cancelled
Publish / ci (push) Has been cancelled
Publish / Publish to npm (push) Has been cancelled
2026-10-08 23:53:55 +03:00