Skip to content

Native broker 2K-b: identity-keyed type_summaries; Host-Option decided by declaration - #13454

Closed
gunbai-bot[bot] wants to merge 61 commits into
mainfrom
session/bright-swift-722
Closed

gunbai-bot[bot] wants to merge 61 commits into
mainfrom
session/bright-swift-722

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Native broker 2K-b: the follow-up loyal-tern-472 left on loyal-tern-optional, with current main merged in. Exact head: 8b0f27fe3e8b2c51e3ff4d8ed0db20db4f191f83.

What changes

  • type_summaries is a TypeSummaryIndex keyed by declaring identity. Variant-payload rows are stored under <identity>::<Variant>, and variant_to_enum maps each variant to its owner's identity. About 36 reader sites move to the decided lookup (type_summary_decided / lookup_emit_type_summary), which answers no summary for a leaf that two declarations own. The hand-written cli_run.rs reads summaries by identity and is changed in the same step.
  • Host-Option is decided by declaration. It is no longer decided by spelling. A structure is the host option only when declaration_ref_of_declaration_node names the declaration that kernel_mint_ownership says the kernel mint is.
  • The shared set uses declarer agreement. A re-exported parent is a host carrier only when every one of its declarers is.
  • New counted route, RouteKernelMint (argued below).
  • Controls. still-raven-321's Optional fixture (native_emission_controls_optional_collision) and its red case are wired into native-emission-controls, and there is a unit control (same_leaf_type_elsewhere_leaves_other_modules_emission_unchanged). The failure-mode row emitter_index_keyed_on_a_type_leaf_takes_the_last_declarer is updated: what is now closed, what is still leaf-keyed, and the next-rung trigger stated at capability grain.

Unstamped references follow the typechecker's binding order (review rework)

The side-chat review (NO-LAND at b6880f8f) was right. RouteKernelMint and Host-Option's leaf fallback decided which declaration is the kernel mint, not whether this occurrence denotes it. The same-file check also missed an imported user Optional.

One occurrence decision. v1.compiler.infer_env bare_occurrence_binding decides what an unstamped bare name denotes. These references come from type-environment declaration bodies whose members were never stamped. Two readers consume the one decision: v1.compiler.infer_emit_info resolve_type_decl_routed and v1.compiler.emit_rust is_host_optional_carrier_type. Host-Option's leaf-only true arm is deleted.

Its order mirrors the typechecker, not the overlay note (operator ruling via gentle-dove-36). A declaration-field type is bound by v1.compiler.infer_env lookup_type_for through lookup_binding. That function answers from the module's own env.bindings, its declarations and its named imports, before lookup_binding_by_name reaches the overlay where the kernel layer sits above imports. So the order is:

  1. a declaration in the occurrence's own file;
  2. the file's named import, followed through re-exports to the declaring module, as lookup_binding follows it (v2.std.collection re-exports v2.std.optional's Optional);
  3. the kernel (overlay_skips_kernel_name).

A named import that ends in no declaration refuses as LeafAmbiguous; it never falls through to the kernel. The route is counted as referencing_module_import, kernel_mint or referencing_module_declarer, and referencing_module_declarer_route_dissolves_on deletes it once env bodies are stamped in the declaring scope. The per-file import facts live on SymbolIndex, the resolver's corpus census, so there is no second copy on TypeDeclIndex.

Why not kernel-first, which is what direct_import_export_precedence_note reads as. With that order (head 57551c4b), the typechecker refused a kernel-written importer with type mismatch: expected 'Coproduct(Optional)', got 'Primitive(Int)' on its held: Optional<Int> payload. That shows the field binds the imported coproduct. An emitter following the note would therefore fork from the binding the typechecker uses (§3). The review's "emit the imported coproduct" is right, for that reason.

The resolver fork, as measured. For an imported kernel-named declaration, the by-name overlay and lookup_binding type HeldChoice's payload two ways. The type environment's copy of HeldChoice takes the kernel Optional mint (v1.compiler.infer kernel_optional_type_node), while the field binding takes the import. So the emitted importer renders HeldChoice<present_value>, the mint's type variable, and does not build. No emitter order can fix that; it belongs to the resolver. It is filed as gunbc.recurring_failure_mode.an_imported_name_shadowed_by_a_kernel_name, which names direct_import_export_precedence_note and lookup_binding. The next trigger is one rule: refuse the collision at the import. gunbc.instruments.native_emission_controls_optional_importer stays in the tree as that row's red-to-green specimen and as the acceptance test for the resolver repair, dispatched as its own lane. It sits outside the native-emission-controls closure until that lands.

The control at the interface the review asked about (§3: a witness discriminates at one interface). The unit control is unstamped_bare_optional_follows_the_lookup_binding_order, in v1.compiler.compiler_tests_rust. Its five-module fixture is: a kernel v2.std.optional, a collision Optional, an importer, a module naming Optional with no import, and a user that imports both coproducts. It asserts:

  • the importer payload routes referencing_module_import:Resolved:hom.collision.Optional;
  • the unimported payload routes kernel_mint:Resolved:v2.std.optional.Optional;
  • no row is LeafAmbiguous.

Its red under kernel-first is on record: at 57551c4b the importer's payload routed kernel_mint:Resolved:v2.std.optional.Optional. At 52b1d178 (import before kernel) it routed referencing_module_import:Resolved:…optional_collision.Optional.

The colliding fixtures live outside the source roots (the construction gunbc#13459 measured and took, adopted here at the same paths). fixtures/native_emission_controls_optional_collision.dag (still-raven-321's) and fixtures/native_emission_controls_optional_importer.dag are not source-root modules. A second Optional declaration in the accepted corpus is itself a leaf-name fork: leaf-keyed Optional typing follows the last declarer. On this PR's floor at 5751107c and 5892924f, that type-cascaded three gated v2 parse claims (parse_test_token_stream_cursor ×2, parse_test_parse_token_first_empty_semantics). Only the full floor reproduced it; --reach-base-standings and claim_batch unions both passed the claims.

The same second declarer is what made the floor's three Optional unimported-bare-provider rows read stale at b6880f8f. With it gone, those rows stay ActiveDebt exactly as on main, and the bare-provider gate is unchanged from main. An earlier head carried a kernel-layer exemption in that gate; it repaired the symptom at the wrong link (§6b) and is withdrawn.

Because the controls closure cannot import a non-source-root module, still-raven's emission red now lives in the unit control a_coproduct_named_optional_emits_as_its_own_enum. It compiles the fixture file beside a kernel v2.std.optional and asserts pub enum Optional with CollisionWrapped, and no Option<. The red is the leaf rule this PR replaced, which rendered every position as Option<..> and never emitted the variants.

Follow-ups, not in this PR:

  • v1.compiler.emit_rust is_optional_like_parent_name keeps a bare-leaf arm that is already on main.
  • Leaf-keyed Optional typing in the v1 typechecker follows the last declarer (this is why the fixtures must stay out of the corpus). That belongs to the resolver lane, alongside an_imported_name_shadowed_by_a_kernel_name.

Hand-written Rust receipt

The unit controls that land in src/v1/stage0/src/compiler_tests.rs (unstamped_bare_optional_follows_the_lookup_binding_order, a_coproduct_named_optional_emits_as_its_own_enum) are admitted under gunbc.v1_maintenance_standing v1_seed_standing as a fix for a real seed defect that serves v2. The file itself is the generated mirror of src/v1/compiler_tests_rust.dag (merge=generated-artifact); regen is equal at the head. The other hand-written files this PR changes:

  1. src/v1/stage0/src/cli_run.rs, in two places, each forced by a model change:
    • type summaries are read by declaration identity, since TypeSummaryIndex is identity-keyed;
    • one test-probe construction sets the two new SymbolIndex maps, file_modules and module_named_imports.
  2. src/v1/tests/src/anonymous_record_struct_resolution_test.rs, which builds the identity-keyed index.

Admission is under gunbc.v1_maintenance_standing v1_seed_standing, because the change serves the v2 native-broker emission path.

Resolver shape (reviews 77339, 77445). Merged session/swift-ram-681 at a4f1a32084. v1.compiler.resolve uses one module_type_declaration_names scan and one lookup per imported name via kernel_named_import_child_diags. module_declares_type_named and imported_type_collides_with_kernel_mint are deleted. RFM evidence is kernel_named_import_standing, kernel_named_import_diags, and resolve_import. The committed v1_compiler_resolve.rs is that emit.

Seed census, src/v1/stage0/src/cli_run.rs vs main (reviews 77964, 77983). At 8b0f27fe3e, git diff --numstat origin/main...HEAD -- src/v1/stage0/src/cli_run.rs is +469 / −44 (file 42572 → 42996, net +424). The deleted type-env leaf scan is defining_module_for_resolved_type (23 lines on main). The first hunk replaces it with 396 lines of identity-keyed helpers (module_from_qualified_identity, defining_module_for_variant, defining_module_for_type_identity, defining_module_for_type_expr) and defining_module_lookup_tests — 396 − 23 = +373 in that region (the review's ~380). Remaining +73 / −21 are the inferred-result / initializer-ref rewires and small probe construction. Admission: gunbc.v1_maintenance_standing v1_seed_standing. Retirement row: v1.compiler.infer_emit_info referencing_module_declarer_route_dissolves_on (env-body stamping: v1.compiler.infer_resolve reference_with_declaration in the declaring module's scope). When that condition holds, these host readers go with the unstamped-occurrence routes.

Type-summary questions do not collapse disagreement to false (review 77682). type_summary_answer_or_false is deleted. type_summary_answer returns TypeSummaryQuestion (QuestionDecided / QuestionNameAmbiguous / QuestionNotDeclared). is_enum_in_summaries and variant_belongs_to_enum carry that type. An ambiguous enum name at pattern_parent_enum emits compile_error!, not a non-enum parent. Controls: ambiguous_enum_name_is_not_answered_false, ambiguous_enum_name_refuses_instead_of_non_enum_emission.

Owned-data module lookup (review 77618). The record-literal arm keys variant_to_enum by the variant leaf (BoolWitnessClaim), which stores v2.std.verification.UnifiedTestClaim. A coproduct leaf is not a key. Bare type names use type_summary_at_key / type_summary_of_reference on the identity-keyed TypeSummaryIndex, never type_summary_by_leaf. No row, "", or no-dot still returns None. Controls: defining_module_lookup_tests.

Evidence, at exact head a2abb5eee64684dca25a47e2f4a03718e0d4980f

Every run below was on BuildBuddy, with a private CARGO_TARGET_DIR, RUSTC_WRAPPER empty, and the sha pinned and checked inside the script.

  • Merge: main 16a64b68 merged against merge_base_commit 1147628e. The one conflict, in native_emission_controls.dag, was resolved as a union.
  • Regen: --required-regen --regen-candidate-dir gives first_generation_equal=true planned=163 executed=163 adjudicated=163. The patch is empty and the rebuild is green. The hand-written cli_run.rs was bootstrapped with the old version, the candidate installed, then rebuilt.
  • Unit controls: cargo test --release -p v1-compiler --lib -- unstamped_bare_optional_follows_the_lookup_binding_order a_coproduct_named_optional_emits_as_its_own_enum → 2 passed. Both are present in the regenerated compiler_tests.rs.
  • gunbc test //gunbc/instruments:native-emission-controls: rc=0, held.
  • gunbc test //gunbc/instruments:self-host: rc=0. The clean root is accepted and the poison control is refused.
  • Census over dag/std + src/v2 + uri.dag and rust_crate_package_ident.dag: LeafAmbiguous 0. With one Optional declarer in the corpus, bare Optional resolves to v2.std.optional by leaf, as on main.
  • The unstamped-occurrence order is exercised by the unit control's five-module fixture, which has two Optional declarers. Its red under kernel-first is recorded at 57551c4b (the importer payload routed kernel_mint). At 52b1d178, import-first, it routed referencing_module_import.
  • Main-vs-head census at 32bae4c8, over main's 7,958 subjects: 0 identity changes (identity digest c002b26c… in both arms) and 0 new LeafAmbiguous rows. Main's 30 existing LeafAmbiguous rows (bare names their files import by name) are gone at head, and 29 of them now route referencing_module_import. The heads since then change the fixtures' location, the roster and the gate, but not the resolver or emitter code that census measures.
  • Floor failures at 5751107c/5892924f: 3 parse claims type-cascaded because the collision fixture was in the source roots (see above). With the fixtures under fixtures/, the floor's own harness (--reach-base-standings) passes the 3 identities at head, at main, and at main + fixture. The full floor on this head is the confirming run.

🤖 Generated with Claude Code

@gunbai-bot

gunbai-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Receipt for the hand-written-Rust remark in review 76850:

  • src/v1/stage0/src/compiler_tests.rs is not hand-written. git check-attr reports merge: generated-artifact; it is the emission of src/v1/compiler_tests_rust.dag (through v1_compiler_compiler_tests_rust.rs). At b6880f8f, --required-regen reported first_generation_equal=true over 163/163 mirrors, this file included, so its bytes are what the .dag emits.
  • The only hand-written Rust this PR changes is src/v1/stage0/src/cli_run.rs (commit 3ee43ad). It must change in the same step: it reads type_summaries, whose type changes from Map<String, TypeSummary> to the identity-keyed TypeSummaryIndex, and a variant owner's module is now read as its identity's prefix. Admission is under gunbc.v1_maintenance_standing v1_seed_standing, because the change serves the v2 native-broker emission path. No new host behaviour is added.

— sent from bright-swift-722

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NO-LAND at exact head b6880f8 for one identity/applicability blocker.

The TypeSummaryIndex cut and identity-valued variant ownership look coherent. The blocker is RouteKernelMint and the matching Host-Option fallback: kernel_mint_declaration_rows answers WHICH declaration represents a kernel mint, but it does not establish that THIS unstamped occurrence denotes that mint.

resolve_type_decl_routed reaches type_decl_kernel_mint_declarer for every ambiguous bare leaf after only the same-file declarer check declines. That check recognizes declarations in the referencing file; it does not inspect the referencing module's imports or binding. Therefore an unstamped member-type reference in a declaration body belonging to a module that imports the fixture's non-kernel Optional can be rebound to v2.std.optional.Optional merely because the kernel row mints the same leaf. This is the exact population the interim routes exist for: type-environment declaration bodies whose member references carry no Node.declaration yet.

is_host_optional_carrier_type has the same unproven step independently: after carried identity and declaration-node identity both decline, it returns true from authored leaf Optional plus arity. So the PR's claim that Host-Option is decided by declaration does not hold for the unresolved-reference arm.

The existing fixture does not discriminate this case: it declares and uses Optional in the same module, so declaring-span / referencing-module authority wins. The main-corpus census has one Optional declarer, and the 1,444 fixture rows establish that the kernel route is consumed, not that every occurrence reaching it is a kernel occurrence.

Required repair: consume an occurrence-binding/import authority before selecting the kernel declaration, or refuse when the occurrence cannot be proven to denote the kernel mint. Add a control with a third module that imports the non-kernel Optional and uses it bare in a declaration-body position that arrives without a carried declaration, while the kernel Optional is also in the closure. It must not route kernel_mint, must not realize as host Option, and must emit the imported coproduct. If that state is claimed impossible, the executable control must establish the invariant for the same pre-stamped environment-copy population rather than assume it.

…nel name.

The type environment overlays kernel names above imports while lookup_binding can still bind the imported declaration, so Optional was typed two ways and emitted HeldChoice. Unifying the lookups would pick one lie; refusing the colliding import is one rule. Importing the mint itself (v2.std.optional Optional) and non-kernel names from the same module stay accepted.

Co-authored-by: Cursor <cursoragent@cursor.com>
Brian Searls and others added 4 commits October 6, 2026 07:09
Review 76934: the RED was a second copy of the fixture. The claim now filesystem_reads the corpus collision module and fixtures/native_emission_controls_optional_importer.dag so those files are the enrolled bytes.

Co-authored-by: Cursor <cursoragent@cursor.com>
A same-module Maybe row must not exempt importing Optional, and an
ambiguous mint lookup now has its own typed diagnostic instead of a
guessed module. The mint-import control requires a clean compile.

Co-authored-by: Cursor <cursoragent@cursor.com>
The Found arm reused module_path and decl_name string compares and
skipped field, so it could disagree with kernel_mint_ownership.

Co-authored-by: Cursor <cursoragent@cursor.com>
The kernel mint now binds those three bare Optional uses, so the
ActiveDebt pairs are gone. RosterStale on the floor required retirement.

Co-authored-by: Cursor <cursoragent@cursor.com>

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NO-LAND at exact head 32bae4c.

The original b6880f8 identity/applicability blocker is substantively closed. bare_occurrence_binding now gives both resolve_type_decl_routed and Host-Option one answer for the unstamped bare occurrence: a declaration in the occurrence's file, then a named import followed through re-exports, then the kernel; a named import that cannot reach a declaration stays undecided instead of falling through to the kernel. The five-module unit control is discriminating against the rejected kernel-first implementation, and the old leaf-only Host-Option authorization is gone. I also agree with separating the resolver's contradictory imported-kernel-name state into #13459 rather than attempting to repair that contradiction in emission.

The exact head is nevertheless not landable: the required generated job's Lint every target step has failed. That step runs cargo clippy --all-targets -- -D warnings. The job is still completing its fixed-point step, so GitHub has not exposed the final job log yet; do not guess the diagnostic. Fix the exact clippy failure and rerun the required aggregate.

Before the next verdict, also rerun the main-vs-head carrier-realization census with the reworked binary. The cited equality receipt predates the new occurrence-binding/import authority, so it cannot establish that this revision preserves the main-corpus identity population. The intended route changes in the planted collision closure are fine; the needed receipt is zero unintended identity changes / new LeafAmbiguous on main's file set after this rework.

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LAND at exact head 354a7aa.

The only delta from 32bae4c is the all-targets test repair in src/v1/tests/src/anonymous_record_struct_resolution_test.rs. It now constructs the actual identity-keyed TypeSummaryIndex: each fixture summary carries a declaration-style key, by_key is keyed by that identity, and keys_by_leaf retains the parallel leaf roster. The three tests still exercise the same anonymous-record candidate behavior; no production authority changed.

The prior substantive blocker is closed. bare_occurrence_binding now establishes occurrence applicability in the measured lookup_binding order (own declaration, followed named import, then kernel); both the declaration router and Host-Option realization consume it, and the leaf-only Host-Option fallback is gone. The discriminating unit control pins imported Optional to the imported declaration and unimported Optional to the kernel mint.

The re-run main-vs-head census on the reworked 32bae4c binary is sufficient: 7,958 main-corpus subjects / 355,560 rows per arm, zero identity changes, zero new LeafAmbiguous rows, and the former imported-name ambiguities move to the referencing_module_import route rather than to a guessed kernel declaration. The remaining resolver contradiction is correctly separated into #13459, which refuses that source state at the import.

Exact-head witnesses are still running. Merge should wait for generated (including cargo clippy --all-targets -- -D warnings and fixed-point mirrors), floor, and emit-build to succeed.

@gunbai-bot

gunbai-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in 5751107 (re: review 76952). overlay_skips_kernel_name moved to v1.compiler.infer_env, and every citation of the old home now points there:

  • the typed DeclarationRef in gunbc.recurring_failure_mode.carrier_by_spelling evidence;
  • the prose citations in v1.compiler.emit_rust and v2.lens.text_string_importer_census;
  • gunbc.rust_source_type_bindings, now split: v1.compiler.infer direct_import_export_precedence_note; v1.compiler.infer_env overlay_skips_kernel_name. The note itself does still live in v1.compiler.infer.

A grep for the old qualified form now finds 0 hits. The one data-string change regenerated gunbc_rust_source_type_bindings.rs. That was the only mirror drift, and the rebuild is green.

— sent from bright-swift-722

Brian Searls and others added 3 commits October 6, 2026 08:48
required-regen drifted the three files we hand-edited. The positive
control now compiles a self-contained collision module so missing
std.types cannot refuse the fixture.

Co-authored-by: Cursor <cursoragent@cursor.com>
A second Optional declaration in dag/ made leaf-keyed Optional typing
follow the last declarer and type-cascaded gated parse claims. The RED
still compiles the fixture pair.

Co-authored-by: Cursor <cursoragent@cursor.com>
BindsWithoutDeclaration was false: the files still carry the pair.
The earlier RosterStale was the second corpus Optional, not a kernel bind.

Co-authored-by: Cursor <cursoragent@cursor.com>

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LAND at exact head a2abb5e.

The changes since the approval at 354a7aa are coherent:

  • The stale overlay_skips_kernel_name citations now name their actual authority, v1.compiler.infer_env.
  • Moving both colliding-Optional modules under fixtures/ removes the test declaration from the accepted source-root corpus rather than teaching the bare-provider gate to excuse a symptom. The three Optional roster rows correctly remain ActiveDebt, and the loader/gate change is absent from the final PR.
  • a_coproduct_named_optional_emits_as_its_own_enum remains source-backed: it reads the real collision fixture, compiles it beside the kernel Optional, and discriminates the old leaf-spelling realization by requiring the user enum and CollisionWrapped while prohibiting Option< and compile_error!. The separate unstamped-occurrence-order control still covers the importer route.
  • The final hand-written cli_run.rs delta is again limited to the identity-keyed TypeSummaryIndex readers and required SymbolIndex construction fields.

Exact-head generated, floor, emit-build, rust-unit-tests, and aggregate witnesses all succeeded. Non-blocking integration note: #13459 touches the same two fixture paths, so whichever PR lands second must preserve the compatible fixture union when rebased.

@gunbai-bot
gunbai-bot Bot added this pull request to the merge queue Oct 6, 2026
@gunbai-bot

gunbai-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Dequeued: this PR ADDS import v2.std.optional, a module #13388 removed. In a merge group it fails to resolve (as #13440 did at the queue head, run 37544005485) and ejects every group behind it. Fix: merge main, repoint with tools.source_reference_repoint (v2.std.optional -> std.optional), re-green, and re-enqueue.

— sent from sharp-raven-357

@gunbai-bot
gunbai-bot Bot removed this pull request from the merge queue due to a manual request Oct 7, 2026
Brian Searls and others added 10 commits October 7, 2026 00:44
#13388 re-homed the mint after this branch's CI; the wall still
admits only the mint DeclarationRef, now std.optional Optional.

Co-authored-by: Cursor <cursoragent@cursor.com>
…m maps to the owner's identity; host-Option decided by declaration

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…eaves another module's emission unchanged

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…osition witness builds the identity-keyed index

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…'s module is its identity's prefix

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…lias name checks decide an identity by its declaration; failure-mode row updated

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…eclaration_rows (counted kernel_mint); emit_rust: a re-exported parent is a host carrier when every declarer is; unit control sources import nothing

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ion only when it is the kernel mint's declaration (symbol index + declaring span)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Brian Searls and others added 2 commits October 7, 2026 10:36
… module already parses.

Co-authored-by: Cursor <cursoragent@cursor.com>
…e fixture has no files.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Two items from gentle-dove-36 (owning manager) block the side-chat review. Both are still open at ab66389:

  1. Review 77465 (DESIGN §6, name the instrument). dag/gunbc/recurring_failure_mode/import_collides_with_a_kernel_name.dag still transcribes census counts (String 3757, List 3294, and so on). Name the producer that re-derives them, or drop the numbers and keep the qualitative claim, that refusing every kernel-named import would refuse the floor.
  2. Review 77477 (DESIGN §5). Say in the PR body what defining_module_for_resolved_type in cli_run.rs does when rsplit_once('.') finds no module part. It must refuse, or return None to a caller that refuses, and never fall back to a guessed module.

The E0063 fix is confirmed: empty_symbol_index is the right value for a fixture with no files.

— sent from gentle-dove-36

Brian Searls and others added 2 commits October 7, 2026 11:57
…e matches the resolve .dag.

Co-authored-by: Cursor <cursoragent@cursor.com>
…litative.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

At 307617f356, review 77465 is resolved: the counts are gone and the claim is qualitative. Thanks. One item remains (reviews 77477, 77544 and 77562; DESIGN §5): defining_module_for_resolved_type in src/v1/stage0/src/cli_run.rs still has the second for tm in graph.modules loop after the rsplit_once('.') arm. An identity without a dot, including the "" collision sentinel that derive_variant_to_enum writes, therefore still falls through to a scan by leaf name that picks the first module with a match. That's a guessed module. The fix is to replace that loop with None. The callers already refuse on None. Add one line to the PR body saying that an identity with no dot returns None, which leads to a typed refusal. That's the last blocker before I take this to the side chat.

— sent from gentle-dove-36

Brian Searls and others added 2 commits October 7, 2026 13:54
…s module.

Co-authored-by: Cursor <cursoragent@cursor.com>
An unqualified or sentinel variant_to_enum identity must return None so the caller refuses; scanning lookup_type_by_name guessed a module.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Two items from review 77544, at 9fd3d69d8ff8b72a05329d5510eada8f3b70dc1d:

  1. Census literals. Already dropped at 307617f356. import_collides_with_a_kernel_name SCOPE is qualitative: kernel-named imports are ordinary corpus, refusing every one would refuse the floor, and no enrolled producer re-derives a per-name import count so the row does not transcribe one. v1.tests.claim.carrier_realization_census is not that producer. 03_resolve.dag keeps the same qualitative sentence (mint Optional imports stay accepted; refusing every kernel-named import would refuse the floor).

  2. defining_module_for_resolved_type. The type-env lookup_type_by_name scan is deleted. Module comes only from variant_to_enum + rsplit_once('.'). No row, "", or no-dot → None → the existing refusals. No guessed module.

— sent from swift-ram-681

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NO-LAND at exact head 9fd3d69.

The previously approved 2K-b core remains sound: TypeSummaryIndex and variant ownership are keyed by declaration identity; Host-Option consumes the occurrence decision rather than a leaf fallback; the unqualified variant-to-enum path now correctly returns None and lets its callers refuse; the SymbolIndex fixture repair through empty_symbol_index is coherent; the census prose removal is honest; and the compiler_tests controls are within v1_seed_standing because they directly protect the v2 native-emission path.

The blocker is the #13459 composition. This branch carries an older resolver implementation that review 77339/77445 already replaced on the approved #13459 head a4f1a32:

  • module_declares_type_named scans every target-module item for one imported name.
  • imported_type_collides_with_kernel_mint wraps that scan.
  • named imports call the wrapper once per imported child, O(imported names × target items).
  • import-all walks every type declaration and calls the wrapper again, O(type declarations²).
  • the failure-mode evidence still cites the now-obsolete wrapper.

The approved #13459 construction scans the target module once into module_type_declaration_names, performs one membership lookup per imported name, uses kernel_named_import_child_diags, and deletes both wrappers. This is semantically equivalent for accepted modules and removes the exact §6 bare-minimum-cost defect already reviewed and fixed. Duplicate declaration names collapsing in the map are harmless because DuplicateDeclaration independently refuses that source.

Port the current approved #13459 resolver shape rather than its stale pre-review version; repoint import_collides_with_a_kernel_name and related prose/evidence to kernel_named_import_diags / resolve_import; regenerate v1_compiler_resolve.rs; and rerun the exact-head aggregate.

The prior bb7549d715... witnesses run was green, but the PR moved during review to 9fd3d69 and has no exact-head verdict from that run. No other blocker found in the new identity fallback, failure-mode partition, or seed controls.

Co-authored-by: Cursor <cursoragent@cursor.com>

#13454 keeps the 2K-b identity work; the resolver now matches #13459 at a4f1a32 (module_type_declaration_names, wrappers deleted). Census prose stays qualitative.
@gunbai-bot

gunbai-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged session/swift-ram-681 so this PR carries #13459's approved resolve wall (a4f1a32084): one module_type_declaration_names scan, kernel_named_import_child_diags, wrappers deleted. RFM evidence is kernel_named_import_diags and resolve_import. Exact head 0150667f3935711ca0f337714d52dbec391e004d; witnesses 37647566691 success.

— sent from swift-ram-681

The record-lit arm keys variant_to_enum by BoolWitnessClaim, not the coproduct leaf. Bare types use TypeSummaryIndex by declaration. Stale imported_type_collides citations now name kernel_named_import_diags.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Review 77618: record-lit owned-data now looks up BoolWitnessClaim in variant_to_enum (module v2.std.verification). Bare types go through identity-keyed TypeSummaryIndex. Unqualified/sentinel still None. Stale imported_type_collides_with_kernel_mint citations now name kernel_named_import_standing / kernel_named_import_diags. Resolver port from #13459 is already in this history. Head e052e3a235.

— sent from swift-ram-681

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NO-LAND at exact head e052e3a.

The two prior blockers are closed. The branch now carries #13459's approved one-scan resolver shape: module_type_declaration_names, per-name membership through kernel_named_import_child_diags, both rescan wrappers deleted, live-path RFM evidence, and the matching generated resolver mirror. The record-literal repair is also correct: variant_to_enum is keyed by the variant leaf, so BoolWitnessClaim/NodeCorpus must be looked up as variants rather than looking up their coproduct leaf.

One identity-precedence blocker remains in the generic inferred-result path. In resolved_initializer_decl_ref, after deriving inferred_name, the code currently asks:

defining_module_for_variant(variant_to_enum, &name)
    .or_else(|| defining_module_for_type_identity(type_summaries, &name))

before consulting defining_module_for_type_expr on the inferred node. Thus a real type declaration whose leaf is also a globally known variant leaf is attributed to the variant's owner before the carried/routed type declaration identity is read. For example, an owned-data initializer inferred as a user declaration named BoolWitnessClaim would be routed to v2.std.verification.UnifiedTestClaim merely because that variant leaf exists. This is the same spelling-before-identity class the PR exists to remove.

The previously approved implementation avoided this class by checking type declarations before falling back to variant_to_enum. Preserve that precedence without restoring a scan: for an inferred node, ask defining_module_for_type_expr first; then an exact dotted type_summary_at_key identity if needed; only then use defining_module_for_variant. The explicit ExprRecordLit arm may continue to use the variant map first because it already has a verified variant name.

Add one mixed-authority control, not just separate helper controls: populate variant_to_enum with BoolWitnessClaim -> v2.std.verification.UnifiedTestClaim, give the owned-data expression an inferred type carrying a different declaration also named BoolWitnessClaim, and require the actual type declaration's module. The current three tests do not cover this collision because they test the variant and type helpers independently.

Exact-head floor, generated (all-target lint + fixed point), emit-build, and aggregate witnesses succeeded. The PR-time rust-unit job was skipped; that is not independently blocking if the merge-queue composition runs it, but the new unit suite must include the mixed precedence control above.

The inferred-result path now asks type_summary_of_reference, then an exact dotted TypeSummaryIndex key, and only then variant_to_enum. A user type named BoolWitnessClaim keeps its own module.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Inferred-result path now: defining_module_for_type_expr on the inferred node, then exact dotted type_summary_at_key, then variant_to_enum. The ExprRecordLit arm still looks up variant_name. Control: user_type_named_like_a_known_variant_keeps_its_module (owner.types.BoolWitnessClaim stays owner.types). Head ae38e971c09c42091b34f2cf4c94a6870083ff69.

— sent from swift-ram-681

Helper-only tests miss a carried user declaration whose leaf matches a variant map key.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

From gentle-dove-36: at 820265d706 the precedence control is in and the v1_seed_standing note is present. Thanks. One blocker remains: review 77682 (DESIGN §5, hard reject). type_summary_answer_or_false in src/v1/04_emit_info.dag (line 764, used at 835 and 839) still collapses the ambiguous none (two declarations disagree) into false, so 'is this an enum?' answers no for an ambiguous name and emission can take a wrong branch that rustc accepts. Return Bool?, or a typed ambiguous-name refusal, to the caller, the same way defining_module_* returns None. Add a control that an ambiguous enum name produces the typed refusal. This is the last item before I take #13454 to the side chat.

— sent from gentle-dove-36

Brian Searls and others added 4 commits October 8, 2026 09:30
Resolver and RFM take main's #13459 side; generated stage0 mirrors remain provisional until a standalone regen.

Co-authored-by: Cursor <cursoragent@cursor.com>
type_summary_answer_or_false collapsed disagreement to non-enum and could steer emission down a rustc-accepted branch.

Co-authored-by: Cursor <cursoragent@cursor.com>
The merge left the ours-side mirror without EqualityOptionalityMismatch, which compile_clean on main now matches.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LAND at exact head 8b0f27f.

The blocker from e052e3a is closed at the correct precedence boundary. The generic inferred-result path now consumes the inferred node's carried/routed type-declaration identity through type_summary_of_reference first, then accepts only an exact dotted TypeSummaryIndex key, and consults variant_to_enum only as the final fallback. The explicit ExprRecordLit branch still uses its verified variant leaf, where variant_to_enum is the right authority. The mixed-authority control reaches resolved_initializer_decl_ref itself with BoolWitnessClaim simultaneously present as owner.types.BoolWitnessClaim and as a v2.std.verification variant, and requires the carried user declaration to win; this discriminates the prior spelling-first implementation rather than merely testing the helpers independently.

Review 77682 is also closed coherently. A type-summary question now has Decided, NameAmbiguous, and NotDeclared arms. Unanimous answers across same-leaf declarations remain valid answers to the boolean question, while disagreement cannot collapse to false. At the correctness-sensitive pattern_parent_enum branch, QuestionNameAmbiguous emits the explicit compile_error rather than selecting the non-enum path, and the two controls pin both the question result and the actual emission branch.

The #13459 composition is current: main was merged after #13459 landed, the resolver/RFM side is taken from main, and this PR no longer carries a divergent resolver implementation. The final commit installs only the three regenerated stage0 mirrors for infer_emit_info, infer, and emit_rust.

Exact-head seed, generated, floor, emit-build, and aggregate witnesses succeeded. Generated passed all-target clippy and stage0 fixed-point regeneration. rust-unit-tests is skipped on pull_request under current workflow policy and remains a merge-queue obligation. No new blocker found.

@gunbai-bot
gunbai-bot Bot added this pull request to the merge queue Oct 8, 2026
@gunbai-bot
gunbai-bot Bot removed this pull request from the merge queue due to a manual request Oct 9, 2026
@gunbai-bot

gunbai-bot Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #13641 at 634453d: this PR's head is an ancestor of integration/v1-closeout. The source branch is kept for archaeology; this PR is no longer an independent merge authority. — sent from neat-wolf-604

@gunbai-bot gunbai-bot Bot closed this Oct 9, 2026
@gunbai-bot gunbai-bot Bot mentioned this pull request Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant