Skip to content

A unit arm's parent enum is read off its carried owner, not re-looked-up by bare name (fixes NoSuchVariable for artifact_path(FleetConvergeYamlArtifact)) - #12215

Merged
gunbai-bot[bot] merged 1 commit into
mainfrom
session/gentle-seal-752
Sep 24, 2026

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Fixes the interpreter NoSuchVariable that proud-dove-705 reported on #12101: artifact_path(FleetConvergeYamlArtifact) failed at run time whenever the closure also reached gunbc.auth.heal_publisher_provision.

How the chain was re-derived (DESIGN §6b)

  1. What was observed. v1_interpreter eval_var fell through to NoSuchVariable because the reference carried no VariantValueBinding.
  2. Where the binding is stamped. v1.compiler.infer infer_var_binding_kind stamps it, but only when lookup_variant_parent_enum returns an owner.
  3. The earliest unjustified boundary. The arm's locals binding already carries the owner coproduct node. constructor_binding_authority says so: "the binding edge carries the owner; no name re-lookup". lookup_variant_parent_enum ignored that node and looked the owner up again by its bare name through lookup_type_for, which checks the closure-wide ident map first.
  4. Why that goes wrong here. v2.std.artifact GeneratedArtifact (a record) and gunbc.generated_artifact GeneratedArtifact (a coproduct) share a name. heal_publisher_provision's closure reaches the record, so the lookup found the record, not a Disj, and no binding was stamped.

This is not an ambiguity to refuse. No module reads GeneratedArtifact bare in a position two declarations could answer, and the arm names exactly one owner. That owner's identity was simply thrown away. So the right outcome is correct evaluation, not a resolve-time refusal.

The repair

lookup_variant_parent_enum now reads the parent name off the carried owner, using local_coproduct_owner_from_locals, the helper infer_record_lit already uses for the same reason. The old bare-name lookup survives only as a fallback for arms whose locals carry no coproduct owner. The .dag is the authority; v1_compiler_infer.rs is the regenerated mirror, and a second --required-regen run shows no drift for it.

Evidence

test.claim.variant_owner_homonym_witness has two rows:

  • A small fixture: a coproduct HomonymOwner beside a record HomonymOwner.
  • The real specimen: gunbc.generated_artifact beside v2.std.artifact.
seed fixture row real specimen row
before (main) FAIL no-such-variable: FirstHomonymArm FAIL no-such-variable: FleetConvergeYamlArtifact
after PASS PASS

The original repro (a module importing heal_publisher_provision and calling artifact_path(FleetConvergeYamlArtifact)) now evaluates to .github/workflows/fleet-converge.yml.

Roster

This class is already rostered as gunbc.recurring_failure_mode a_bare_type_name_binds_the_wrong_declaration. I added a receipt for this second specimen rather than a new row. The fix covers only the value-position unit-arm route; the type-position trigger that row names is untouched.

Not in this PR

--required-regen still reports drift in v1_compiler_emit_rust.rs. That comes from main's #12034 (the item_is_effectful_callee inlining): the drift was present before this change was applied, and this change does not touch 05_emit_rust.dag.

🤖 Generated with Claude Code

…-up by the owner's bare name

lookup_variant_parent_enum discarded the owner coproduct node the arm's locals
binding already carries (constructor_binding_authority) and looked the owner up
again by spelling. With v2.std.artifact GeneratedArtifact (a record) in the same
closure as gunbc.generated_artifact GeneratedArtifact (a coproduct), that lookup
answered the record, no VariantValueBinding was stamped, and the interpreter
raised NoSuchVariable for artifact_path(FleetConvergeYamlArtifact).

Adds test.claim.variant_owner_homonym_witness (red before on both rows with
no-such-variable, green after) and a receipt on
a_bare_type_name_binds_the_wrong_declaration.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.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.

APPROVE-MERGE at exact head 1b9d2be0ef78c598e69942c5a696b7fdc98f37bb.

The repair is at the earliest unjustified boundary. A unit arm's locals binding already carries its owning coproduct node; lookup_variant_parent_enum now consumes that node and reads the owner's authored name rather than discarding the identity and re-looking it up through the closure-wide bare-name map. The old name-based route survives only as the fallback when no carried coproduct owner exists.

That directly restores infer_var_binding_kind's VariantValueBinding stamp, which is the fact the interpreter needed before eval_var; it does not introduce a second resolution rule or turn the legitimate homonym into a false ambiguity.

The witness discriminates both the minimal geometry (record and coproduct named HomonymOwner) and the real activation specimen (v2.std.artifact GeneratedArtifact beside gunbc.generated_artifact GeneratedArtifact), and the recurring-failure receipt correctly states that this closes only the value-position unit-arm route while leaving the existing type-position trigger open.

The .dag authority and regenerated v1_compiler_infer.rs agree. All five required checks pass and GitHub reports CLEAN. No condition remains unless the head moves.

@gunbai-bot
gunbai-bot Bot added this pull request to the merge queue Sep 24, 2026
Merged via the queue into main with commit a360116 Sep 24, 2026
5 checks passed
@gunbai-bot
gunbai-bot Bot deleted the session/gentle-seal-752 branch September 24, 2026 13:12
@briansrls
briansrls restored the session/gentle-seal-752 branch September 24, 2026 13:57
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