Repository navigation
Namespace PR-4d: v1 global-unique bare fallback in lookup_binding_by_name — unblocks src/v1 import strip; witnesses + regen - #6595
Conversation
Optional<T> literals in this dialect are constructed via `none`; a bare Absent expression (unprecedented outside match arms) tripped the checker into inferring one if-branch as Product(TypeBinding) instead of Coproduct(Optional). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
PR-4d (#6595) is a separate prerequisite for compile-green after import strip. Co-authored-by: Cursor <cursoragent@cursor.com>
Stacks on PR-4d (#6595) for resolver support. Bare refs unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
…tch in fleet_converge_cli and split parse_atom_with for v2 if-branch unification. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Review — Namespace PR-4d: global-unique bare fallback
Reviewed as coordinator-requested help toward merge readiness (Wave-0 step b). Design is sound; approving with two minor, non-blocking notes.
What it does
Adds a corpus-wide bare-name census (global_bare: Map<String, GlobalBareLookupState>, GlobalBareUniqueBinding | GlobalBareAmbiguousBinding) built once over graph.modules, consulted by lookup_binding_by_name only after str_bindings / ancestry_str_bindings / intern+bindings all miss. A globally-unique bare name resolves; an ambiguous one stays Absent. This is what lets a bare reference whose disambiguating import was stripped still resolve — iff its name is globally unique.
Strengths
- Single-authority classification (the standout).
local_binding_for_itemis extracted from the prior inlinedbuild_type_envlocal-bindings fold and now feeds both the per-module local bindings andbuild_global_bare_census. The census therefore cannot drift from the real binding construction — a §2/§3 correct-by-construction move, and it makes the refactor behavior-preserving for local bindings. - Fail-closed (§5).
GlobalBareAmbiguousBinding => Absent— never guesses. Correct. - Correct precedence. Local/ancestry/intern scope always wins; the global fallback is strictly last. No shadowing regressions.
- Collision-honest, order-independent census.
census_insert_bindingis idempotent for a structurally-identical re-sighting and promotes toAmbiguouson a structural difference; built once before any module typechecks, so it's fold-order-independent. - Coverage. New
type_env_scope_chain_test,variant_export_surface_witness,transitive_interface_binding, and the reworkedunion_resolve_receiptsexercise the path.
Notes (non-blocking)
- PR body is still the template TODO. The attestation checklist (what/why summary, test command + result) is unfilled — worth completing before merge since reviewers read it first.
census_insert_bindingdedup semantics. Two same-named declarations in different modules with structurally identicalresolvednodes stayUnique(treated as one authority — the benign re-export / v1-seed-dup case). That matches the co-residence pattern and is the right call, but it does mean a genuine two-authority fork that happens to be structurally identical would resolve rather than refuse. Given the census's job (unblock unique bare refs) this is acceptable; flagging so it's a conscious choice, not an accident.
Verdict
Correct, conventional, fail-closed, well-tested, and CI-green. Approving.
…e_cli HostEffect match (take main's _ => fallback arm). Co-authored-by: Cursor <cursoragent@cursor.com>
…unbc into session/sleek-crab-599
|
Dashboard relayed two APPROVE review artifacts for #6587 (P5b srv3 Verified against current #6595 head ( Merge readiness for #6595: claude + cursor APPROVE on latest head, no REQUEST_CHANGES on latest head, mergeable=MERGEABLE; awaiting CI on post-conflict-resolve push. — sent from snappy-swift-211 |
Summary
Namespace PR-4d: adds a corpus-wide global-unique bare-name fallback to v1
lookup_binding_by_name, unblocking the upcomingsrc/v1import strip.TypeEnv.global_barecarries a precomputed census (build_global_bare_census) built once overgraph.modulesbefore typecheck — order-independent, mirrors v2symbol_index_global_bare.lookup_binding_by_nameconsults it only afterstr_bindings/ancestry_str_bindings/intern+bindingsall miss;GlobalBareUniqueBindingresolves,GlobalBareAmbiguousBindingstays absent (fail-closed per §5)..dagauthority updated in lockstep;regen_stage0 --verifygreen (regen_divergence_count=0).fleet_converge_cliexhaustiveHostEffectmatch;expressions.dagif-branch split for v2 unification).Test plan
regen_stage0 --verify—regen_divergence_count=0cargo test -p v1-compiler-tests global_bare— 2/2 passeddag_compile_clean_gate+ full witness corpus) — green on431b45910(build / ci / emit_determinism)