GitNexus/gitnexus/test/fixtures/cross-file-binding
Gergo Magyar 18197d739a fix(ingestion): SCC-ordered cross-file return-type propagation + multi-hop re-export resolution
Fix CI failures on PR #1050 (TypeScript registry-primary migration) by
making `propagateImportedReturnTypes` deterministic via reverse-
topological SCC ordering and updating the multi-hop re-export contract
to match `followReexportChain` behavior.

Why: the legacy pass mirrored an intermediate ref instead of the
terminal type when an importer was processed before its source module
had its own typeBindings chain-followed (4-file alias chain regression
in `ts-simple` fixture: `models.User -> service.user -> app.user`
collapsed to `getUser` instead of `User`). Reverse-topological walk of
`indexes.sccs` (leaves first) lets every importer see the source's
already-followed terminal type in a single pass.

Changes:
- `imported-return-types.ts`: rewrite to walk SCCs leaves-first, chain-
  follow the source module's typeBindings BEFORE mirroring, and chain-
  follow the importer's typeBindings AFTER mirroring. Cyclic SCCs
  reach a partial fixpoint (no convergence guarantee, ts-circular only
  asserts no-throw).
- `finalize-algorithm.ts`: docstring update on `FinalizeFile.localDefs`
  to reflect that `followReexportChain` resolves multi-hop re-exports
  through barrels even when intermediates do not surface the name -
  surfacing is now a static optimization, not a correctness requirement.
- `contract/scope-resolver.ts` Invariant I3: explicitly document the
  SCC ordering requirement.
- `pipeline/run.ts`: split PROF timer into `finalize` and `propagate`
  so the pass's cost is observable independently.
- `ARCHITECTURE.md` Performance notes: describe SCC-ordered propagation.
- `imported-return-types.ts`: expand chain-depth comment (2x effective
  depth from pre/post follow), add multi-ref break rationale, add
  `ts-simple` motivating-fixture pointer.

Tests:
- `finalize-algorithm.test.ts`: add 4 cases (3-hop chain, cyclic
  re-export visited-set guard, wildcard re-export fall-through,
  multi-source first-match-wins); fix misleading shared nodeId in the
  thick variant; rename and update the multi-hop test for the new
  contract (transitiveVia assertion on the thin variant).
- `imported-return-types.test.ts` (NEW): unit tests for the SCC pass
  pinning topological collapse, local-annotation guard, missing-source
  skip, and cyclic-SCC no-throw.
- `cross-file-binding.test.ts` + `ts-deep-alias-chain` fixture (NEW):
  5-file integration regression guard for SCC-ordered propagation
  through 4 module boundaries.

Validation: 865 scope-resolution + cross-file tests pass on Windows;
typecheck clean across both packages; only pre-existing Swift overload
failures remain (verified on PR base commit, environmental).

Made-with: Cursor
2026-04-24 18:26:15 +01:00
..
c-cross-file/src fix: resolve C/C++ cross-file calls through transitive #include chains (#816) 2026-04-14 09:39:17 +01:00
cpp-consumer-before-provider feat(SM-15): Wire BindingAccumulator into processCallsFromExtracted for cross-file return type propagation (#763) 2026-04-10 10:29:31 +01:00
cpp-cross-file feat: implement cross-file binding propagation for multiple languages 2026-03-21 07:47:04 +00:00
csharp-consumer-before-provider feat(SM-15): Wire BindingAccumulator into processCallsFromExtracted for cross-file return type propagation (#763) 2026-04-10 10:29:31 +01:00
csharp-cross-file feat(type-resolution): per-language cross-file binding tests + resolver fixes 2026-03-20 15:38:27 +00:00
go-consumer-before-provider feat(SM-15): Wire BindingAccumulator into processCallsFromExtracted for cross-file return type propagation (#763) 2026-04-10 10:29:31 +01:00
go-cross-file feat: implement cross-file binding propagation for multiple languages 2026-03-21 07:47:04 +00:00
java-consumer-before-provider feat(SM-15): Wire BindingAccumulator into processCallsFromExtracted for cross-file return type propagation (#763) 2026-04-10 10:29:31 +01:00
java-cross-file feat(type-resolution): per-language cross-file binding tests + resolver fixes 2026-03-20 15:38:27 +00:00
js-consumer-before-provider feat(SM-15): Wire BindingAccumulator into processCallsFromExtracted for cross-file return type propagation (#763) 2026-04-10 10:29:31 +01:00
js-cross-file/src feat(type-resolution): per-language cross-file binding tests + resolver fixes 2026-03-20 15:38:27 +00:00
kotlin-consumer-before-provider feat(SM-15): Wire BindingAccumulator into processCallsFromExtracted for cross-file return type propagation (#763) 2026-04-10 10:29:31 +01:00
kotlin-cross-file feat(type-resolution): per-language cross-file binding tests + resolver fixes 2026-03-20 15:38:27 +00:00
php-consumer-before-provider feat(SM-15): Wire BindingAccumulator into processCallsFromExtracted for cross-file return type propagation (#763) 2026-04-10 10:29:31 +01:00
php-cross-file feat(type-resolution): per-language cross-file binding tests + resolver fixes 2026-03-20 15:38:27 +00:00
py-consumer-before-provider/src feat(SM-15): Wire BindingAccumulator into processCallsFromExtracted for cross-file return type propagation (#763) 2026-04-10 10:29:31 +01:00
py-cross-file/src feat(type-resolution): per-language cross-file binding tests + resolver fixes 2026-03-20 15:38:27 +00:00
rb-consumer-before-provider feat(SM-15): Wire BindingAccumulator into processCallsFromExtracted for cross-file return type propagation (#763) 2026-04-10 10:29:31 +01:00
rb-cross-file feat: implement cross-file binding propagation for multiple languages 2026-03-21 07:47:04 +00:00
rs-consumer-before-provider/src feat(SM-15): Wire BindingAccumulator into processCallsFromExtracted for cross-file return type propagation (#763) 2026-04-10 10:29:31 +01:00
rs-cross-file/src feat: implement cross-file binding propagation for multiple languages 2026-03-21 07:47:04 +00:00
ts-circular/src feat(type-resolution): Phase 14 — cross-file binding propagation 2026-03-20 09:31:20 +00:00
ts-consumer-before-provider/src feat(SM-15): Wire BindingAccumulator into processCallsFromExtracted for cross-file return type propagation (#763) 2026-04-10 10:29:31 +01:00
ts-deep-alias-chain/src fix(ingestion): SCC-ordered cross-file return-type propagation + multi-hop re-export resolution 2026-04-24 18:26:15 +01:00
ts-reexport/src feat(type-resolution): Phase 14 — cross-file binding propagation 2026-03-20 09:31:20 +00:00
ts-return-type/src feat(type-resolution): Phase 14 enhancements — single-pass seeding, Tarjan's SCC, cross-file return types 2026-03-20 12:00:36 +00:00
ts-simple/src feat(type-resolution): Phase 14 — cross-file binding propagation 2026-03-20 09:31:20 +00:00