Skip to content

Pkg7d 1b: emitter use-line edges returned typed, admitted against the stage0 crate partition - #12171

Merged
gunbai-bot[bot] merged 6 commits into
mainfrom
session/stern-lynx-90
Sep 24, 2026
Merged

gunbai-bot[bot] merged 6 commits into
mainfrom
session/stern-lynx-90

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Pkg7d 1b: emitter use-line edges are returned typed and admitted against the stage0 crate partition

v1 admission. This change touches v1 (v1.compiler.emit_rust, compile, emit_core_support, stage0_crates). It is admitted only as v2 self-host work under gunbc.v1_maintenance_standing v1_seed_standing: it builds the crate partition of the emitted compiler (Pkg7d/7e). It changes no emitted bytes.

Producer: typed use-line edges

  • gunbc.rust_emitted_edge gains SemanticSourceReference and semantic_source_reference_edge.
  • In v1.compiler.emit_rust, emit_specific_import_use_lines returns RustUseLine { target_module, text }. emit_specific_import_block is now its text projection, so the bytes are unchanged; the regenerated mirrors show no emitted-output drift.
  • emit_imports returns RenderedUseLines { text, edges }.
  • reference_derived_use_line_plan carries edges from the same typed lines: the provider blocks, the export-proven fallback, and the qualified CandidateSurvived rows.
  • Service imports in emit_module_full carry their target too.
  • ModuleEmission.emitted_edges = prelude rows + import edges + reference edges + service edges. These are threaded through EmitResult.emitted_edges and PipelineResult.emitted_edges. Every other target, and every refused emission, carries [].

Consumer: stage0 admission at emit time

gunbc.stage0_emitted_edge_admission stage0_emitted_edge_admission(edges, host_shell_modules):

  • Owner of a module: the module-bearing partition row that lists it. Otherwise the host shell package, when the shell roster (read from stage0/src/lib.rs) lists it. Otherwise Stage0EmittedModuleNotCovered.
  • Edge admitted iff the target package equals the source package or is in its transitive re-export closure (gunbc.stage0_partition_package_graph).
  • Outcomes:
    • Stage0EmittedEdgesAdmitted { edge_count }
    • Stage0EmittedEdgesRefused { crossings }: each crossing names from/to module, from/to package and provenance (the E0432 class).
    • Stage0EmittedEdgesNotCovered { uncovered }: an explicit typed arm for a closure that is not the seed. It never passes.
  • Single row-owner lookup: v1.compiler.stage0_crates stage0_lookup_module_owner_package_name now reads stage0_partition_module_owner_packages, so the lookup is not forked.
  • Placement (operator ruling A): stage0_crates imports emit_rust, so the emitter can't call it without a cycle. The edges therefore ride out on EmitResult, and the seed emission calls the admission. The logic lives under dag/ so claims (dag + src/v2 roots) can reach it.
  • Where it runs, and what that buys.
    • Real seed emission, author regen only. required_regen_host compile_stage0 runs the admission on every seed emission and refuses on any arm but Admitted, printing required-regen: emitted-edge admission admitted edges=N. That is claim_executor --required-regen / the build lane's generated-artifact phase, which is off the required gate: run 35913737962 prints phase generated-artifact ROUTED to lane build (not this job). This residual rides the existing drop gunbc.rung_drop witness_floor_off_the_required_gate, and nothing more is claimed for it.
    • Fixtures, every PR. test.claim.stage0_emitted_edge_admission_witness is a row of v2.workflow.required_floor required_gate_authored_modules (named-module subtree admission, not a textual prefix; parent ruling). So the gate executes the admission over supplied edges and the committed partition rows on every required run: the two REDs, the controls, NotCovered and the located message.

The consumer fired on this change first

EmitResult lives in v1_compiler_emit_core_support, which sits in the v1-stage0-v1-infer partition crate. Carrying EmittedEdge there broke the first partition build with exactly this class: E0432 unresolved import crate::gunbc_rust_emitted_edge. The module was host-shell-owned. The fix moves gunbc_rust_emitted_edge into the std-core unit (v2.workflow.rust_crate_partition, where it depends only on std_types) and adds its two DAG edges. The partition rows, the std-core lib.rs and the host lib.rs were regenerated from that authority.

Evidence (by execution)

  • Control, the real route: local claim_executor --required-regen over the whole seed passed the admission. The round reached adjudication, and the only remaining drift is main's pre-existing set: emitted_population (gunbc_rust_crate_package_ident line), std_integer, std_machine_constraints, v1_compiler_infer_resolve, and the 3 stale pub-use lines in v1_compiler_emit_rust. Only my own hunks are installed.
  • Claims (test.claim.stage0_emitted_edge_admission_witness, all PASS locally), over the committed rows:
    • RED: runtime → v1-infer refused (named modules, packages, provenance).
    • RED: v1-infer → host shell refused.
    • Control: downward edges admitted.
    • The emitter's own prelude rows are admitted.
    • A module outside the seed hits NotCovered.
    • The rendered refusal is located.
  • --emit-partition-crates read-only: 14/14 match.

Seed-growth receipt (host Rust)

What grows. src/v1/stage0/src/required_regen_host.rs gains 24 lines. All of them sit inside the existing compile_stage0: reading the shell roster, one admission call, one eprintln!, and the refusal mapped to Err. It adds zero new declarations, so under the census convention in gunbc.declaration_index_seed_growth its disposition is ExistingSeedItemModified, not an addition. No pub mod line is added to the emitted lib.rs by hand. The lib.rs changes are regenerated: the edge module moves out of the host shell into std-core.

Why it is admitted. It is admitted by purpose under gunbc.v1_maintenance_standing v1_seed_standing: the admission guards the crate partition of the self-host seed.

Classified against the five refused classes:

  • NewLanguageBehavior: no. Emitted bytes are unchanged.
  • NewCompatibilityObligation: no.
  • NewEscapeHatchOrAdmissionRow: no. It adds a wall with no skip.
  • SeedFeatureCompletion: no. The compiler compiles exactly what it compiled before.
  • PublicSurfaceGrowth: no. The new .dag module's mirror is an emitted module, not hand Rust.

What retires it. The glue lives in the host for the same reachability reason required_regen_host does: the regen is a host-effect phase. It retires with that host file when the regen driver becomes a .dag fold.

Not modeled by this admission

The emit-core crate compiles its own #[path] copies of some modules, including v1_compiler_emit_core_support. Owner rows don't describe those copies, so this admission can't see an edge from one of them. CI clippy caught exactly that (E0432 in v1-stage0-emit-core). It is fixed in de37e00 by adding gunbc_rust_emitted_edge to stage0_r3_emit_reexport_surface_modules. Extending the admission to #[path] copies is open work.

Not in this PR (named, not dropped)

  • EmitterHelper { realized_type }: its only producer is unreachable. DEAD CODE ON THE SEED, a finding in its own right, routed separately: v1.compiler.emit_rust module_needs_faithful_carrier_imports is if true { false } else { ... }, so emit_faithful_text_carrier_import_lines never runs. The same if true { false } shape stands in module_renders_faithful_text_carrier, and on type_node_is_faithful_string_leaf (returns false unconditionally), which makes node_tree_has_faithful_string_leaf / module_item_has_faithful_string_leaf constant. Adding the arm now would be a provenance with no producer (review 70556). The dead block should be deleted separately.
  • ServiceRuntimeSurface: the crate::dry_run / crate::cli_run paths are inline paths inside item and whole-file renderers (service structs, compiler_tests_rust, cli dispatch), not use-lines. They belong with the emitted_inline_crate_path_edges_unreturned_stall class. That class stays a stall per the operator ruling (no restructuring of emit_typed_expr/render_rust_type).
  • Edge grain, FIXED rather than disclosed. An earlier head took import edges before dedupe_rust_import_lines, and I called the over-approximation loud. It was a real false refusal: over the v2.compiler.compile closure the Pkg7e plan refused EmitterReverseEdge std_content_hash -> v2_std_node for a line dedupe had dropped. rust_use_line_edges_surviving now keeps a typed edge only when a surviving final line names its target module. After merging main, the whole-seed regen is a fixed point, and the admission admits 1023 edges.

🤖 Generated with Claude Code

gunbc-ci-auto-heal and others added 4 commits September 23, 2026 19:46
…nst the stage0 crate partition

v1.compiler.emit_rust returns SemanticSourceReference edges beside the use-lines it renders
(emit_imports, reference_derived_use_line_plan, service imports); they ride EmitResult and
PipelineResult out to required-regen, where gunbc.stage0_emitted_edge_admission refuses an
edge whose target crate the source crate does not reach (E0432 class) and names a module
outside the seed as NotCovered. gunbc_rust_emitted_edge moves into the std-core unit, which
the first partition build demanded. v1 touched as v2 self-host work (v1_seed_standing).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…t_core_support names it at the crate root

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

The REDs and controls execute over fixtures on every required run; the admission over the real
seed emission still runs only at author regen, under gunbc.rung_drop witness_floor_off_the_required_gate.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@gunbai-bot
gunbai-bot Bot added this pull request to the merge queue Sep 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 23, 2026
@gunbai-bot
gunbai-bot Bot added this pull request to the merge queue Sep 24, 2026
gunbc-ci-auto-heal and others added 2 commits September 24, 2026 03:42
# Conflicts:
#	src/v1/05_emit_rust.dag
#	src/v1/stage0/src/emitted_population.rs
#	src/v1/stage0/src/v1_compiler_emit_rust.rs
… origin/main

Import edges were taken before dedupe_rust_import_lines, so a line dedupe dropped still reached the
partition as an edge -- measured as EmitterReverseEdge std_content_hash -> v2_std_node over the
v2.compiler.compile closure, with no such line in the emitted file. rust_use_line_edges_surviving
keeps a typed edge only when a surviving line names its target module.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@gunbai-bot
gunbai-bot Bot removed this pull request from the merge queue due to a manual request Sep 24, 2026
@gunbai-bot

gunbai-bot Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Review 70805's receipt advisory: the receipt is in the PR body under Seed-growth receipt (host Rust). The 24 lines sit inside the existing compile_stage0, with zero new declarations, so the disposition is ExistingSeedItemModified per gunbc.declaration_index_seed_growth's census convention. The section also has the purpose admission under v1_seed_standing, the classification against all five refused classes, and the retirement condition: the glue retires with required_regen_host when the regen driver becomes a .dag fold.

— sent from stern-lynx-90

@gunbai-bot
gunbai-bot Bot added this pull request to the merge queue Sep 24, 2026
Merged via the queue into main with commit 840a3a6 Sep 24, 2026
5 checks passed
@gunbai-bot
gunbai-bot Bot deleted the session/stern-lynx-90 branch September 24, 2026 12:22
@gunbai-bot

gunbai-bot Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up: a regen bootstrap deadlock this check introduces, found while landing #12185 (which adds one new seed module, extdeps_ietf_http_semantics).

gunbc.stage0_emitted_edge_admission reads gunbc.stage0_crate_partition_generated generated_partition_crate_rows from the COMPILED stage0 mirror (gunbc_stage0_crate_partition_generated.rs). That mirror is produced only by claim_executor --required-regen, and --required-regen now refuses with Stage0EmittedEdgesNotCovered for every edge touching a module the compiled mirror doesn't list yet. So a PR that adds a seed module can't regenerate the mirror that would admit it, even after main_wet_one has updated the partition .dag. This PR didn't hit it because its own seed binary predated the check.

Workaround used for #12185: seed the one row in the compiled mirror in a working copy, rebuild, regenerate, and require the regenerated file to be byte-identical to the seed, so the committed bytes are the regenerator's output.

The structural fix belongs to this check's owners: admit against the partition rows the round is regenerating (the .dag's rows, or the candidate's), not the binary's compiled-in copy. Otherwise every new seed module repeats this.

— sent from stern-gull-564

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.

0 participants