Both LanguageProvider hooks were dead weight:
- `shouldShadow` had zero call sites — the interface declared it,
Python implemented a trivial always-true no-op, but no consumer
ever read it. The shadowing decision lives in pythonMergeBindings
and the central merge algorithm, not in a per-scope predicate.
- `shouldCreateScope` had one call site in pass1BuildScopes but the
only language implementing it (Python) always returned true. No
producer ever emits a `@scope.block` for Python, so the hook's
"declines to create" branch was unreachable. Other languages
didn't implement it at all.
Removing both:
- Drops the interface declarations in language-provider.ts.
- Drops `shouldCreateScope` from ScopeExtractorHooks Pick and from
the pass1BuildScopes conditional — the stack-based parent-resolve
loop becomes unconditional.
- Drops pythonShouldShadow / pythonShouldCreateScope from simple-hooks,
the Python index barrel, and the python.ts provider wiring.
- Drops the tests that exercised the removed hooks: one block-
suppression scenario in scope-extractor.test.ts, one shouldCreateScope
test in parse-worker-scope-integration.test.ts, and the
pythonShouldShadow / pythonShouldCreateScope always-true assertions
in python-hooks.test.ts. pythonBindingScopeFor's delegate-to-default
test is preserved in its own describe block.
Shadowing itself is unchanged: pythonMergeBindings still runs, LEGB
ordering still applies, wildcard transparency is still handled via
the merge precedence rules. The hook API just no longer has a
vestigial per-scope toggle we decided not to use.
Verification: 204/204 test/integration/resolvers/python.test.ts both
REGISTRY_PRIMARY_PYTHON=0 and =1. 335/335 scope-resolution + graph
unit tests (was 339, net -4 after removing the hook-specific
assertions). tsc clean.
CI run 24666612657 failed on three jobs. Fixes:
quality/format:
- Prettier --check flagged 3 files after the accumulated branch work.
Ran prettier --write from repo root (CI's invocation cwd) to apply:
simple-hooks.ts, resolve-references.ts, python-hooks.test.ts.
tests/{ubuntu,macos,windows} — 9 assertion failures, all traceable to
Python landing in MIGRATED_LANGUAGES (default-on registry-primary):
- registry-primary-flag.test.ts (3 tests): the 'returns false by
default' / 'primaryLanguages empty' / 'Python mid-process
mutation' assertions were written in Ring 2 when MIGRATED_LANGUAGES
was empty. Rewrote to assert MIGRATED_LANGUAGES membership is the
default, use Java (unmigrated) for the no-stale-cache test, and
verify env overrides work in both directions (migrated-off,
unmigrated-on).
- call-processor.test.ts (6 tests in SM-10 + D2-widen blocks):
these exercise the LEGACY call-resolution DAG on .py fixtures.
processCalls now gates Python out (isRegistryPrimary === true by
default), returning 0 edges. Added REGISTRY_PRIMARY_PYTHON=false
override in the relevant beforeEach + restore in afterEach, so
the legacy DAG runs for these test-local fixtures without
affecting the production-default behavior.
Local verification: 4126/4126 unit tests pass, prettier clean.
P2:
- WASM dual-ownership invariant documented on ASTCache dispose:
a Tree must live in AT MOST ONE disposing ASTCache. Native
tree-sitter today is unaffected; WASM adoption would require
tree.copy() or a non-disposing secondary cache.
- mro-processor C3 ordering test: pins EXTENDS-before-IMPLEMENTS
parent grouping for classes with interleaved edge additions.
Asserts exact MRO ['Base', 'Iface'] — a revert to single-loop
insertion-order iteration would produce ['Iface', 'Base'] and
fail loudly.
- cached-tree parity test: emitPythonScopeCaptures(src, path, T)
returns identical CaptureMatch[] to emitPythonScopeCaptures(src,
path). Pins the cache-hit path's correctness so a regression
that silently returns stale captures would break the test.
P3:
- Dev-mode cache counters moved from captures.ts to cache-stats.ts.
Production hot-path module no longer carries the module-global
export surface; PROF gating behavior preserved.
- ParseOutput field rename astCache → scopeTreeCache. Clarifies
that the surfaced cache is the persistent cross-phase one, not
the chunk-local astCache parse-impl clears between chunks.
Single consumer (scopeResolutionPhase) updated; no other readers.
- ASTCacheReader interface extracted. scopeResolutionPhase now
reads the phase dep via a shared type instead of a hand-rolled
inline structural shape that could drift from ASTCache's contract.
- graph.ts dual-index invariant enforced through writeRel/deleteRel
private helpers instead of duplicated add/delete at 3 mutation
sites. Adding a new mutation method only needs to call the
helpers — forgetting to update one index becomes structurally
impossible.
Tests: 382/382 unit (incl. 2 new), 191/191 python integration both
flag paths. tsc clean.