GitNexus/gitnexus/test/integration
Gergo Magyar 41662dca38 test(scope-resolution): pin local-namespace-import behavior + document empirical finalize hoisting
Codex round-3 adversarial review raised three concerns about
scope-resolution passes assuming module-scope semantics that would
contradict `pythonImportOwningScope`'s documented per-scope contract.
Empirical verification via scope-dump probes resolved each:

Plan: docs/plans/2026-04-21-003-fix-codex-round3-scope-aware-resolution-plan.md

1. Function- and class-local namespace imports: VERIFIED WORKING.
   `def outer(): import svc as s; s.call()` and `class A: import mod;
   def use(self): mod.helper()` both emit CALLS edges with reason
   "scope-resolution: namespace-receiver". finalize-algorithm hoists
   the ImportEdges onto `indexes.imports[moduleScope]` regardless of
   where the `import` statement appears, so collectNamespaceTargets'
   module-scope read finds them.

2. Imported return-type propagation module-scope-only: VERIFIED
   WORKING (already pinned in round 2). `from svc import get_user`
   inside a function body lands in indexes.bindings[moduleScope], so
   propagateImportedReturnTypes' module-scope read still finds it.

3. Nested method-local defs stamped as class members: VERIFIED FALSE.
   The scope extractor creates nested Function scopes for inner
   `def`s; `def helper` inside `def save` inside `class User` lives
   in helper's own Function scope whose parent is save's Function
   scope (NOT the Class scope). populateClassOwnedMembers'
   `parentScope.kind === 'Class'` branch correctly skips it;
   helper.ownerId stays undefined.

Instead of implementing speculative scope-aware refactors that the
tests would pass regardless, this commit:

- Adds regression fixtures and integration assertions that pin each
  working behavior. If finalize routing ever changes to honor the
  hook's per-scope contract, these assertions flip red and signal the
  need for the scope-chain-aware refactor.
- Adds defensive JSDoc to the three flagged call sites
  (collectNamespaceTargets, propagateImportedReturnTypes,
  populateClassOwnedMembers) documenting the empirical invariant so
  future reviewers don't re-derive Codex's theoretical concern
  without the benefit of the probe.

Files:
- Two new fixtures under test/fixtures/lang-resolution/ covering the
  function-local and class-body namespace-import patterns.
- Two new describe blocks in test/integration/resolvers/python.test.ts
  (3 assertions, positive-pin intent).
- Defensive comments in namespace-targets.ts, imported-return-types.ts,
  and scope-resolution/scope/walkers.ts.

Verification: 204/204 test/integration/resolvers/python.test.ts both
REGISTRY_PRIMARY_PYTHON=0 and =1. tsc clean.
2026-04-21 10:54:01 +01:00
..
group feat: cross-repo impact analysis (#794) — @repo MCP routing + group resources (#984) 2026-04-20 11:55:07 +01:00
resolvers test(scope-resolution): pin local-namespace-import behavior + document empirical finalize hoisting 2026-04-21 10:54:01 +01:00
api-impact-e2e.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
augmentation.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
class-impact-all-languages.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
cli-e2e.test.ts feat(cli): analyze --name <alias> + duplicate-name guard for the repo registry (#955) 2026-04-19 07:23:48 +01:00
cross-file-binding.test.ts fix: resolve C/C++ cross-file calls through transitive #include chains (#816) 2026-04-14 09:39:17 +01:00
csv-pipeline.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
enrichment.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
expo-routes.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
filesystem-walker.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
has-method.test.ts feat(cpp): C/C++ MethodExtractor config with pure virtual detection (#617) 2026-04-01 18:07:11 +01:00
heritage-extractor-wiring.test.ts feat(ingestion): language-agnostic heritage extractor with config+factory pattern (#890) 2026-04-17 17:51:17 +01:00
hooks-e2e.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
ignore-and-skip-e2e.test.ts Extract registries into model/ module with SemanticModel interface (#786) 2026-04-12 01:06:55 +01:00
java-class-impact.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
lbug-core-adapter.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
lbug-lock-retry.test.ts fix(lbug): retry on DB lock with session-safe cleanup (#325) 2026-03-22 18:21:21 +09:00
lbug-pool-stability.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
lbug-pool.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
lbug-vector-extension.test.ts fix: load VECTOR extension during DB init for semantic search (#782) 2026-04-11 12:17:40 +01:00
local-backend-calltool.test.ts feat(search): per-phase timing instrumentation for the query pipeline (#953) 2026-04-18 16:30:07 +01:00
local-backend.test.ts feat: METHOD_IMPLEMENTS edges, overload disambiguation, MethodExtractor unification (#574) (#642) 2026-04-04 18:41:47 +01:00
orm-dataflow.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
parsing.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
pipeline-graph-golden.test.ts fix(test): isolate cli-e2e from shared mini-repo fixture (#954) 2026-04-18 12:54:59 +01:00
pipeline.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
qualified-class-lookups.test.ts Extract registries into model/ module with SemanticModel interface (#786) 2026-04-12 01:06:55 +01:00
query-compilation.test.ts [dart] Add call patterns for await, cascade, lambda, and widget-tree contexts (#801) 2026-04-13 11:21:11 +01:00
search-core.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
search-pool.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
server-analyze.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
setup-skills.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
shape-check-regression.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
skills-e2e.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
staleness-and-stability.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
tree-sitter-languages.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
worker-pool.test.ts fix: keep worker warnings non-terminal (#261) 2026-04-17 06:46:31 +01:00