From ed3da18e7c49b6295da52ab63285bf836429c9c2 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 19 Aug 2026 22:24:36 +0000 Subject: [PATCH 01/10] stage0 crate layout: register the unregistered seed files and declare the behavioral-receipt seed oracles --- .../stage0_rust_source_lifecycle_scaffold.dag | 28 -------- .../self_host/stage0_crate_layout.dag | 70 ++++++++++++++++--- 2 files changed, 62 insertions(+), 36 deletions(-) diff --git a/dag/gunbc/stage0_rust_source_lifecycle_scaffold.dag b/dag/gunbc/stage0_rust_source_lifecycle_scaffold.dag index 7f617644d88..d5f501767d3 100644 --- a/dag/gunbc/stage0_rust_source_lifecycle_scaffold.dag +++ b/dag/gunbc/stage0_rust_source_lifecycle_scaffold.dag @@ -482,18 +482,10 @@ fn path_matches_discovery_prefix_hint(path: String) -> Bool { ) } -data residue_cssl_assembly_reason: String = "hand-retained cssl seed-linked closure assembly kernel — not regen-emitted; counted scaffold until harness consolidation emits it" - -data residue_cssl_assembly_dissolution: DissolutionCondition = unbound_dissolution(description: "dissolve-on: cssl_seed_linked_closure_assembly.rs migrates to generated_stage0_files membership or a typed emit producer row deletes the hand file") - data residue_module_path_index_reason: String = "hand_maintained_stage0_dirs lists module_path_index/ but file membership is not enumerated by any join authority yet" data residue_module_path_index_dissolution: DissolutionCondition = unbound_dissolution(description: "dissolve-on: module_path_index/*.rs paths derive from hand_maintained_stage0_dirs + host census, or the directory dissolves into generated emit") -data residue_frontier_module_gap_reason: String = "frontier module with behavioral receipt roster row but not yet on hand_maintained_stage0_filenames / generated_stage0_files join" - -data residue_frontier_module_gap_dissolution: DissolutionCondition = unbound_dissolution(description: "dissolve-on: the module basename appears on hand_maintained_stage0_filenames() or generated_stage0_files and this residue row deletes") - data residue_stage0_core_lib_reason: String = "src/v1/stage0_core/src/lib.rs exists on disk but is absent from stage0_partition_crate_rows — authority contradiction surfaced for operator resolution" data residue_stage0_core_lib_dissolution: DissolutionCondition = unbound_dissolution(description: "dissolve-on: stage0_partition_crate_rows enrolls src/v1/stage0_core OR the crate deletes") @@ -509,11 +501,6 @@ fn residue_row(path: String, reason: String, dissolution: DissolutionCondition) } data rust_source_lifecycle_residue_rows: List = [ - residue_row( - path: "src/v1/stage0/src/cssl_seed_linked_closure_assembly.rs", - reason: residue_cssl_assembly_reason, - dissolution: residue_cssl_assembly_dissolution - ), residue_row( path: "src/v1/stage0/src/module_path_index/mod.rs", reason: residue_module_path_index_reason, @@ -529,21 +516,6 @@ data rust_source_lifecycle_residue_rows: List = [ reason: residue_module_path_index_reason, dissolution: residue_module_path_index_dissolution ), - residue_row( - path: "src/v1/stage0/src/v2_compiler_compile.rs", - reason: residue_frontier_module_gap_reason, - dissolution: residue_frontier_module_gap_dissolution - ), - residue_row( - path: "src/v1/stage0/src/v2_compiler_program_assembly.rs", - reason: residue_frontier_module_gap_reason, - dissolution: residue_frontier_module_gap_dissolution - ), - residue_row( - path: "src/v1/stage0/src/v2_compiler_source_authority.rs", - reason: residue_frontier_module_gap_reason, - dissolution: residue_frontier_module_gap_dissolution - ), residue_row( path: "src/v1/stage0_core/src/lib.rs", reason: residue_stage0_core_lib_reason, diff --git a/src/v2/compiler/self_host/stage0_crate_layout.dag b/src/v2/compiler/self_host/stage0_crate_layout.dag index 323df39686e..2aaa4adea0e 100644 --- a/src/v2/compiler/self_host/stage0_crate_layout.dag +++ b/src/v2/compiler/self_host/stage0_crate_layout.dag @@ -31,6 +31,29 @@ type SeedRetainedSupportDirRegistration { basename: String } +// THREE INTRINSIC ROWS ADDED 2026-08-19, AND THEIR ABSENCE WAS NOT A LAYOUT DETAIL -- +// it was the reason `claim_executor --required-regen` produced no verdict at all on main. +// The regen host classifies the committed stage0 population by COMPLEMENT: every `.rs` under +// src/v1/stage0/src that is not on HAND_MAINTAINED_STAGE0_FILES is presumed to be output of the +// stage0 emit (`required_regen_host` `committed_generated_basenames`). So a hand-authored file +// that nobody registered here does not surface as an unregistered hand file -- it surfaces as a +// generated file the emitter failed to produce, and `validate_compared_populations` refuses the +// whole run before any byte is compared. Measured on e0c5e25444: eight names in +// `committed_not_emitted`, not one of them an emission defect. +// +// None of the three is `pub mod`: `required_regen_host` is declared inside `cli_run`, +// `bootstrap_stage0_crate_layout_generated` inside `required_regen_host`, and +// `cssl_seed_linked_closure_assembly` is reached by `#[path]` from the `cssl_assemble` bin -- +// so registering them changes lib.rs by nothing and changes the regen population by everything. +// +// SIX EXISTING ROWS ALSO FLIPPED TO `has_pub_mod: true` in the same edit, for the reason stated +// on the scaffold registrations below: they are seed oracles that live shims import from the seed +// crate, and a module the crate does not declare cannot be imported from it. +// +// `bootstrap_stage0_crate_layout_generated` is generated, but by THIS module's own emitter rather +// than by the stage0 emit plan, so it is correctly outside the regen population. That it rides on +// a list named for hand maintenance is a residual conflation, recorded in the closing block of +// this module rather than fixed silently here. data seed_retained_intrinsic_registrations: List = [ SeedRetainedIntrinsicRegistration { basename: "v1_interpreter", has_pub_mod: true, is_dir: false }, SeedRetainedIntrinsicRegistration { basename: "bounded_shell_host_drain", has_pub_mod: false, is_dir: false }, @@ -50,12 +73,15 @@ data seed_retained_intrinsic_registrations: List = [ SeedRetainedScaffoldRegistration { basename: "usv_pilot_v2_std_algebra" }, SeedRetainedScaffoldRegistration { basename: "usv_pilot_v2_std_collection" }, @@ -73,7 +108,10 @@ data seed_retained_scaffold_registrations: List List { @@ -211,6 +249,22 @@ fn hand_maintained_stage0_filenames() -> List { concat(seed_retained_intrinsic_stage0_files(), seed_retained_scaffold_stage0_files()) } +// THE EXCLUSION LIST IS NAMED FOR ONE OF ITS THREE REASONS, and that conflation is what let the +// gap above stay invisible. `HAND_MAINTAINED_STAGE0_FILES` is consumed by `required_regen_host` as +// "the files the stage0 emit does not produce", and membership now has three distinct causes: +// hand-authored Rust with a migration trigger (the intrinsic rows), hand-retained seed oracles and +// pilots awaiting their flip (the scaffold rows), and one file generated by a DIFFERENT authority +// (`bootstrap_stage0_crate_layout_generated`, emitted by this module). Only the first is literally +// hand-maintained. The consequence is not cosmetic: because the consumer classifies by complement, +// the only way to learn that a row is missing is a refused regen run naming it, which is exactly +// how these were found -- and a reader checking whether a file "should be hand-maintained" asks a +// question the list cannot answer for two of its three populations. +// +// NOT FIXED HERE, deliberately. Splitting the reasons means a per-row typed cause and a renamed +// emitted constant, which is a change to what the regen host reads; landing it in the same diff +// that first gives regen a verdict would mean the verdict and its input population changed +// together, and neither could be attributed. Next step: one typed `Stage0ExclusionCause` per row, +// projected into the same constant, with the regen host reading the cause rather than the name. data construction_justification: ConstructionJustification = ConstructionJustification { class: WallAfterGrounding { dissolves_to: RealizationDispatch } } From 8153e17ef292753f8a06a1658b17f54465015041 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 19 Aug 2026 23:50:51 +0000 Subject: [PATCH 02/10] Regenerate the crate-layout artifacts from the corrected authority; widen the registry-overlap pin to its predicted second member --- dag/gunbc/stage0_crate_layout_generated.dag | 21 ++++++++++++++++--- ...source_lifecycle_scaffold_witness_test.dag | 17 +++++++++++++-- ...bootstrap_stage0_crate_layout_generated.rs | 8 ++++++- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/dag/gunbc/stage0_crate_layout_generated.dag b/dag/gunbc/stage0_crate_layout_generated.dag index 2e5f8c9bd10..12359db43fa 100644 --- a/dag/gunbc/stage0_crate_layout_generated.dag +++ b/dag/gunbc/stage0_crate_layout_generated.dag @@ -4,7 +4,7 @@ import std.types { List, String } data stage0_crate_layout_generated_note: String = "Generated by gunbc stage0_crate_layout_emit — do not hand-edit. Authority: v2.compiler.self_host.stage0_crate_layout; regen via dag/tools/generated_artifact_gate.dag main_wet." -data generated_pub_mod_block: String = "\n#[macro_use]\npub mod v1_interpreter_dispatch_generated;\npub mod v1_interpreter;\npub mod cli_run;\npub mod codex_app_server_stdio_session;\npub mod coproduct_reflection;\npub mod data_initializer_identity;\npub mod resolved_graph_cache;\npub mod shared_typecheck_store;\npub mod recorded_fixture;\npub mod derived_realization_schedule;\npub mod expected_red_roster_join;\npub mod memory_governor;\npub mod module_path_index;\npub mod usv_pilot_v2_std_algebra;\npub mod usv_pilot_v2_std_collection;\npub mod usv_pilot_v2_std_node;\npub mod v2_compiler_resolve;\npub mod v2_compiler_program_partition;\npub mod v2_compiler_tokenize;\npub mod v2_compiler_infer;" +data generated_pub_mod_block: String = "\n#[macro_use]\npub mod v1_interpreter_dispatch_generated;\npub mod v1_interpreter;\npub mod cli_run;\npub mod codex_app_server_stdio_session;\npub mod coproduct_reflection;\npub mod data_initializer_identity;\npub mod resolved_graph_cache;\npub mod shared_typecheck_store;\npub mod recorded_fixture;\npub mod derived_realization_schedule;\npub mod expected_red_roster_join;\npub mod memory_governor;\npub mod module_path_index;\npub mod v2_compiler_body_producer;\npub mod v2_compiler_normalize;\npub mod v2_compiler_target_carriers;\npub mod v2_compiler_discovery_enumeration;\npub mod v2_compiler_parse_engine_hooks;\npub mod v2_compiler_use_site_verdict;\npub mod usv_pilot_v2_std_algebra;\npub mod usv_pilot_v2_std_collection;\npub mod usv_pilot_v2_std_node;\npub mod v2_compiler_resolve;\npub mod v2_compiler_program_partition;\npub mod v2_compiler_tokenize;\npub mod v2_compiler_infer;\npub mod v2_compiler_compile;\npub mod v2_compiler_program_assembly;\npub mod v2_compiler_source_authority;" data generated_pub_mod_basenames: List = [ "v1_interpreter", @@ -19,6 +19,12 @@ data generated_pub_mod_basenames: List = [ "expected_red_roster_join", "memory_governor", "module_path_index", + "v2_compiler_body_producer", + "v2_compiler_normalize", + "v2_compiler_target_carriers", + "v2_compiler_discovery_enumeration", + "v2_compiler_parse_engine_hooks", + "v2_compiler_use_site_verdict", "usv_pilot_v2_std_algebra", "usv_pilot_v2_std_collection", "usv_pilot_v2_std_node", @@ -26,7 +32,10 @@ data generated_pub_mod_basenames: List = [ "v2_compiler_program_partition", "v2_compiler_tokenize", "v2_compiler_infer", - "v1_interpreter_dispatch_generated" + "v1_interpreter_dispatch_generated", + "v2_compiler_compile", + "v2_compiler_program_assembly", + "v2_compiler_source_authority" ] data generated_stage0_filenames: List = [ @@ -53,6 +62,9 @@ data generated_stage0_filenames: List = [ "v2_compiler_discovery_enumeration.rs", "v2_compiler_parse_engine_hooks.rs", "v2_compiler_use_site_verdict.rs", + "required_regen_host.rs", + "bootstrap_stage0_crate_layout_generated.rs", + "cssl_seed_linked_closure_assembly.rs", "usv_pilot_v2_std_algebra.rs", "usv_pilot_v2_std_collection.rs", "usv_pilot_v2_std_node.rs", @@ -60,7 +72,10 @@ data generated_stage0_filenames: List = [ "v2_compiler_program_partition.rs", "v2_compiler_tokenize.rs", "v2_compiler_infer.rs", - "v1_interpreter_dispatch_generated.rs" + "v1_interpreter_dispatch_generated.rs", + "v2_compiler_compile.rs", + "v2_compiler_program_assembly.rs", + "v2_compiler_source_authority.rs" ] data generated_stage0_dirs: List = [ diff --git a/dag/test/claim/stage0_rust_source_lifecycle_scaffold_witness_test.dag b/dag/test/claim/stage0_rust_source_lifecycle_scaffold_witness_test.dag index 9be034394bc..18431c0c96e 100644 --- a/dag/test/claim/stage0_rust_source_lifecycle_scaffold_witness_test.dag +++ b/dag/test/claim/stage0_rust_source_lifecycle_scaffold_witness_test.dag @@ -404,8 +404,21 @@ test fn scaffold_generated_artifact_emit_authority_ref_populated() -> Bool { && generated_artifact_emit_authority_ref.decl_name == "artifact_generate" } -test fn scaffold_generated_artifact_layout_overlap_repo_paths_is_exactly_v1_interpreter_dispatch() -> Bool { - generated_artifact_layout_overlap_repo_paths() == [v1_interpreter_dispatch_generated_repo_path] +// THE SECOND INSTANCE THIS JOIN ALWAYS PREDICTED. `generated_artifact_disposition_derivation_note` +// already names `bootstrap_stage0_crate_layout_generated.rs` (Stage0CrateLayoutGeneratedRsArtifact) +// as the second registry member the overlap surfaces, and the repo-path constant for it has been +// declared beside `v1_interpreter_dispatch_generated_repo_path` all along -- what was missing was +// its layout membership, which landed 2026-08-19 when the crate-layout authority stopped omitting +// the three files that made `--required-regen` refuse. So this pin widens from one path to two +// because the population caught up with the note, not because the invariant weakened: the claim is +// still an exact identity join against a closed registry, and a third overlap would still red. +// +// Both members remain generated -- the overlap is precisely the set of layout members whose +// CONTENTS come from the artifact registry rather than from a hand, which is why +// `derived_hand_maintained_disposition_repo_paths()` subtracts it. +test fn scaffold_generated_artifact_layout_overlap_repo_paths_is_exactly_the_two_registry_members() -> Bool { + generated_artifact_layout_overlap_repo_paths() + == [bootstrap_stage0_crate_layout_generated_repo_path, v1_interpreter_dispatch_generated_repo_path] } test fn scaffold_generated_artifact_layout_overlap_subset_of_hand_maintained_holds_green() -> Bool { diff --git a/src/v1/stage0/src/bootstrap_stage0_crate_layout_generated.rs b/src/v1/stage0/src/bootstrap_stage0_crate_layout_generated.rs index fbce6db1b48..f2d44733cdd 100644 --- a/src/v1/stage0/src/bootstrap_stage0_crate_layout_generated.rs +++ b/src/v1/stage0/src/bootstrap_stage0_crate_layout_generated.rs @@ -26,6 +26,9 @@ pub const HAND_MAINTAINED_STAGE0_FILES: &[&str] = &[ "v2_compiler_discovery_enumeration.rs", "v2_compiler_parse_engine_hooks.rs", "v2_compiler_use_site_verdict.rs", + "required_regen_host.rs", + "bootstrap_stage0_crate_layout_generated.rs", + "cssl_seed_linked_closure_assembly.rs", "usv_pilot_v2_std_algebra.rs", "usv_pilot_v2_std_collection.rs", "usv_pilot_v2_std_node.rs", @@ -33,7 +36,10 @@ pub const HAND_MAINTAINED_STAGE0_FILES: &[&str] = &[ "v2_compiler_program_partition.rs", "v2_compiler_tokenize.rs", "v2_compiler_infer.rs", - "v1_interpreter_dispatch_generated.rs" + "v1_interpreter_dispatch_generated.rs", + "v2_compiler_compile.rs", + "v2_compiler_program_assembly.rs", + "v2_compiler_source_authority.rs" ]; #[rustfmt::skip] From 1cac0ccc47c45d66d6db42d99b602d0e98878a5b Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Thu, 20 Aug 2026 00:06:14 +0000 Subject: [PATCH 03/10] required_regen_host: compare and digest against one basename key space, so regen stops refusing at the first file --- src/v1/stage0/src/required_regen_host.rs | 56 +++++++++++++++++++++--- 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/src/v1/stage0/src/required_regen_host.rs b/src/v1/stage0/src/required_regen_host.rs index 8eb8c176c7d..6d2065ad68d 100644 --- a/src/v1/stage0/src/required_regen_host.rs +++ b/src/v1/stage0/src/required_regen_host.rs @@ -351,11 +351,51 @@ fn is_hand_maintained_path(path: &str) -> bool { HAND_MAINTAINED_STAGE0_FILES.contains(&basename) } +/// The emitted map re-keyed by basename, refusing on a collision. +/// +/// THE EMIT AND THE COMMITTED TREE ARE TWO KEY SPACES, and every consumer here must be told +/// which one it is holding. `compile_stage0` returns emit-relative paths (`src/foo.rs`); +/// `committed_generated_basenames` returns bare basenames. `generated_basenames_from_emit` +/// already carried a comment recording that comparing the two spaces "made every file mismatch +/// in both directions" -- but only that one function was repaired. `compare_generated_surfaces` +/// and `tree_digest_from_map` kept looking up bare basenames in the emit-keyed map, so the +/// FIRST file they reached refused with `emit missing generated file compiler_tests.rs` and no +/// byte was ever compared. Measured 2026-08-19: with the population mismatch cleared, that +/// refusal is what regen returned instead of a verdict. +/// +/// One re-keying, consumed by both, rather than a `.get(name).or_else(get("src/" + name))` +/// fallback at each site: a per-site fallback is a second representation of the key space +/// (DESIGN section 3) and it silently succeeds when the two spaces disagree, which is exactly +/// the failure this function exists to make impossible. A basename collision refuses, because +/// two emitted files sharing a basename means the committed tree cannot be compared against +/// them by basename at all. +fn emitted_by_basename( + emitted: &HashMap, +) -> Result, String> { + let mut out: HashMap = HashMap::new(); + for (path, content) in emitted { + let basename = Path::new(path) + .file_name() + .and_then(|n| n.to_str()) + .unwrap_or(path.as_str()) + .to_string(); + if let Some(prior) = out.insert(basename.clone(), content.clone()) { + if prior != *content { + return Err(format!( + "refusal: emitted basename collision for {basename} — two emit paths differ under one basename" + )); + } + } + } + Ok(out) +} + fn compare_generated_surfaces( stage0_src: &Path, emitted: &HashMap, generated_basenames: &[String], ) -> Result { + let by_basename = emitted_by_basename(emitted)?; let mut drifted = Vec::new(); for basename in generated_basenames { let committed_path = stage0_src.join(basename); @@ -363,7 +403,7 @@ fn compare_generated_surfaces( &fs::read_to_string(&committed_path) .map_err(|e| format!("read committed {}: {e}", committed_path.display()))?, )?; - let candidate = emitted + let candidate = by_basename .get(basename) .ok_or_else(|| format!("emit missing generated file {basename}"))?; let candidate_norm = normalize_generated_source(candidate)?; @@ -382,12 +422,15 @@ fn verify_hand_maintained( stage0_src: &Path, work_dir: &Path, ) -> Result { + let by_basename = emitted_by_basename(emitted)?; let mut unverifiable = Vec::new(); for file_name in HAND_MAINTAINED_STAGE0_FILES { - let candidate = emitted - .get(&format!("src/{file_name}")) - .or_else(|| emitted.get(*file_name)); - let Some(candidate) = candidate else { + // The same single re-keying the two functions above use. This site previously carried the + // per-site `get("src/" + name).or_else(get(name))` fallback that `emitted_by_basename` + // exists to replace; it happened to be the one site where the fallback was written + // correctly, which is precisely why the class stayed invisible at the two sites where it + // was not. + let Some(candidate) = by_basename.get(*file_name) else { continue; }; let committed_path = stage0_src.join(file_name); @@ -503,9 +546,10 @@ fn tree_digest_from_map( if basenames.is_empty() { return Err("refusal: cannot compute candidate digest over empty population".to_string()); } + let by_basename = emitted_by_basename(emitted)?; let mut payload = String::new(); for name in basenames { - let content = emitted + let content = by_basename .get(name) .ok_or_else(|| format!("emit missing {name} for digest"))?; let norm = normalize_generated_source(content)?; From c9949a2880b7ebdbb5b782f12c4a446e5ef23b5c Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Thu, 20 Aug 2026 00:24:20 +0000 Subject: [PATCH 04/10] required_regen_host: locate every normalization refusal, and stop rustfmt-ing the emitted manifests --- src/v1/stage0/src/required_regen_host.rs | 40 +++++++++++++++++++----- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/src/v1/stage0/src/required_regen_host.rs b/src/v1/stage0/src/required_regen_host.rs index 6d2065ad68d..84dfeb9c3aa 100644 --- a/src/v1/stage0/src/required_regen_host.rs +++ b/src/v1/stage0/src/required_regen_host.rs @@ -400,13 +400,14 @@ fn compare_generated_surfaces( for basename in generated_basenames { let committed_path = stage0_src.join(basename); let committed = normalize_generated_source( + &format!("committed {basename}"), &fs::read_to_string(&committed_path) .map_err(|e| format!("read committed {}: {e}", committed_path.display()))?, )?; let candidate = by_basename .get(basename) .ok_or_else(|| format!("emit missing generated file {basename}"))?; - let candidate_norm = normalize_generated_source(candidate)?; + let candidate_norm = normalize_generated_source(&format!("emitted {basename}"), candidate)?; if committed != candidate_norm { drifted.push(basename.clone()); } @@ -461,7 +462,17 @@ fn write_emitted_tree(dest_src: &Path, emitted: &HashMap) -> Res if let Some(parent) = out_path.parent() { fs::create_dir_all(parent).map_err(|e| format!("create {}: {e}", parent.display()))?; } - let normalized = normalize_generated_source(content)?; + // ONLY RUST IS RUST-NORMALIZED. The emit produces the crate's manifests as well as its + // modules, and this loop used to hand every emitted artifact to rustfmt -- so writing the + // candidate tree died on a `Cargo.toml` with `error: expected item, found `[``, after + // compare and the digests had already succeeded. It surfaced only once the key-space + // repair let the run reach this far; before that, regen refused at the first comparison + // and never wrote a tree at all. + let normalized = if path.ends_with(".rs") { + normalize_generated_source(&format!("emitted {path}"), content)? + } else { + content.clone() + }; fs::write(&out_path, normalized) .map_err(|e| format!("write {}: {e}", out_path.display()))?; } @@ -530,7 +541,7 @@ fn tree_digest_for_basenames( let path = src_dir.join(name); let content = fs::read_to_string(&path) .map_err(|e| format!("read {label} {}: {e}", path.display()))?; - let norm = normalize_generated_source(&content)?; + let norm = normalize_generated_source(&format!("{label} {name}"), &content)?; payload.push_str(name); payload.push('\0'); payload.push_str(&digest_label(norm.as_bytes())); @@ -552,7 +563,7 @@ fn tree_digest_from_map( let content = by_basename .get(name) .ok_or_else(|| format!("emit missing {name} for digest"))?; - let norm = normalize_generated_source(content)?; + let norm = normalize_generated_source(&format!("emitted {name} (digest)"), content)?; payload.push_str(name); payload.push('\0'); payload.push_str(&digest_label(norm.as_bytes())); @@ -561,8 +572,15 @@ fn tree_digest_from_map( Ok(digest_label(payload.as_bytes())) } -fn normalize_generated_source(content: &str) -> Result { - normalize_generated_source_attempt(content) +/// Normalize one generated surface, naming the subject in every refusal. +/// +/// A LOCATED DIAGNOSTIC, because the unlocated one cost a measurement cycle. rustfmt reports +/// against ``, so an unparseable surface refused with `error: expected item, found `[`` +/// and no indication of WHICH file or WHICH side (committed or emitted) carried it -- a typed +/// failure with no subject, which DESIGN section 5 requires to be located. The subject is known +/// at every call site and is now threaded through. +fn normalize_generated_source(subject: &str, content: &str) -> Result { + normalize_generated_source_attempt(content).map_err(|e| format!("normalize {subject}: {e}")) } fn normalize_generated_source_attempt(content: &str) -> Result { @@ -604,7 +622,10 @@ fn normalize_with_workdir(content: &str, work_dir: &Path, label: &str) -> Result .output() .map_err(|e| format!("rustfmt {label}: {e}"))?; if !output.status.success() { - return Err(String::from_utf8_lossy(&output.stderr).to_string()); + return Err(format!( + "rustfmt {label}: {}", + String::from_utf8_lossy(&output.stderr) + )); } fs::read_to_string(&path).map_err(|e| format!("read normalized {label}: {e}")) } @@ -616,7 +637,10 @@ fn git_head_sha(workspace: &Path) -> Result { .output() .map_err(|e| format!("git rev-parse HEAD: {e}"))?; if !output.status.success() { - return Err(String::from_utf8_lossy(&output.stderr).to_string()); + return Err(format!( + "rustfmt {label}: {}", + String::from_utf8_lossy(&output.stderr) + )); } Ok(String::from_utf8_lossy(&output.stdout).trim().to_string()) } From dc56a270897fb0b5e24afef31168ad0edbd59095 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Thu, 20 Aug 2026 00:26:57 +0000 Subject: [PATCH 05/10] Fix a mis-scoped diagnostic label introduced with the located normalization refusals --- src/v1/stage0/src/required_regen_host.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v1/stage0/src/required_regen_host.rs b/src/v1/stage0/src/required_regen_host.rs index 84dfeb9c3aa..604777b842c 100644 --- a/src/v1/stage0/src/required_regen_host.rs +++ b/src/v1/stage0/src/required_regen_host.rs @@ -638,7 +638,7 @@ fn git_head_sha(workspace: &Path) -> Result { .map_err(|e| format!("git rev-parse HEAD: {e}"))?; if !output.status.success() { return Err(format!( - "rustfmt {label}: {}", + "git rev-parse HEAD: {}", String::from_utf8_lossy(&output.stderr) )); } From b39f03000c36e7c3796394389af4389b1c8f6c69 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Thu, 20 Aug 2026 00:35:03 +0000 Subject: [PATCH 06/10] Write the regen candidate at the crate root, so the emit's own src/ prefix is not nested twice --- src/v1/stage0/src/required_regen_host.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/v1/stage0/src/required_regen_host.rs b/src/v1/stage0/src/required_regen_host.rs index 604777b842c..fb677e2696f 100644 --- a/src/v1/stage0/src/required_regen_host.rs +++ b/src/v1/stage0/src/required_regen_host.rs @@ -96,8 +96,15 @@ pub fn run_required_regen( fs::remove_dir_all(&candidate_dir) .map_err(|e| format!("remove {}: {e}", candidate_dir.display()))?; } + // THE CANDIDATE IS WRITTEN AT THE CRATE ROOT, because the emit keys already carry their own + // `src/` prefix. Writing them under `candidate/src` nested that prefix a second time, so every + // generated module landed at `candidate/src/src/.rs` while `verify_candidate_tree` + // looked for `candidate/src/.rs` and found none of them -- the run then refused with + // "candidate tree has zero generated files" over a directory holding 41 entries. That is the + // same emit-path-vs-basename key-space confusion `emitted_by_basename` exists to end, in its + // third and last instance: two spaces, no single place saying which one a path is in. + write_emitted_tree(&candidate_dir, &emitted)?; let fresh_src = candidate_dir.join("src"); - write_emitted_tree(&fresh_src, &emitted)?; copy_hand_maintained_support(&stage0_src, &fresh_src)?; verify_candidate_tree(&fresh_src, &committed_basenames)?; From 66700e1b10da60f15208cc246516e6fad9ff1ecc Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Thu, 20 Aug 2026 00:42:47 +0000 Subject: [PATCH 07/10] Create the regen scratch directory before the hand-file comparison needs it --- src/v1/stage0/src/required_regen_host.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/v1/stage0/src/required_regen_host.rs b/src/v1/stage0/src/required_regen_host.rs index fb677e2696f..e0c590ddb8f 100644 --- a/src/v1/stage0/src/required_regen_host.rs +++ b/src/v1/stage0/src/required_regen_host.rs @@ -83,6 +83,14 @@ pub fn run_required_regen( } let sync = compare_generated_surfaces(&stage0_src, &emitted, &committed_basenames)?; + // The hand-file comparison normalizes through rustfmt on disk, so its scratch directory has + // to EXIST before it runs. It is handed `candidate_dir`, which at this point in the run is + // created only by the later `write_emitted_tree` -- so on a clean checkout every hand file + // reported `unverifiable: write .../committed.rs: No such file or directory`, an infra failure + // wearing the shape of a real finding, and `first_generation_equal` was false because of it. + // It only ever passed on a machine where a PREVIOUS run had left the directory behind. + fs::create_dir_all(&candidate_dir) + .map_err(|e| format!("create {}: {e}", candidate_dir.display()))?; let hand = verify_hand_maintained(&emitted, &stage0_src, &candidate_dir)?; let committed_digest = From 57d1c959ed53458a8e9fce7421e770d560eb284b Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Thu, 20 Aug 2026 00:43:39 +0000 Subject: [PATCH 08/10] Delete the two stale emitted orphans, converging the committed lib.rs onto its authority's output --- dag/gunbc/stage0_emit_plan_generated.dag | 27 +- ...ace_reference_derived_closure_admission.rs | 420 ------------------ ...pace_reference_derived_closure_contract.rs | 159 ------- src/v1/stage0/src/lib.rs | 2 - 4 files changed, 22 insertions(+), 586 deletions(-) delete mode 100644 src/v1/stage0/src/gunbc_namespace_reference_derived_closure_admission.rs delete mode 100644 src/v1/stage0/src/gunbc_namespace_reference_derived_closure_contract.rs diff --git a/dag/gunbc/stage0_emit_plan_generated.dag b/dag/gunbc/stage0_emit_plan_generated.dag index f829fd9128c..0aff4604c04 100644 --- a/dag/gunbc/stage0_emit_plan_generated.dag +++ b/dag/gunbc/stage0_emit_plan_generated.dag @@ -2,7 +2,28 @@ module gunbc.stage0_emit_plan_generated import std.types { List, String } -data stage0_emit_plan_generated_note: String = "Generated projection — do not hand-edit. Authority: gunbc.stage0_emit_plan over parse-derived regen source identities. DECLARED SCAFFOLD supply; dissolve-on: generated_artifact_gate accepts v2.compiler.source_authority.ModuleStorageIndex, then the host supply deletes. Regen via dag/tools/generated_artifact_gate.dag main_wet." +// THIS PROJECTION HAS NO PRODUCER, and the note below asserted one until 2026-08-20. Its named +// authority `gunbc.stage0_emit_plan` is DELETED -- `gunbc.generated_projection_paths` records the +// deletion in its own header ("One source remains after the stage0_emit_plan deletion") -- and +// `gunbc.roster_registry` still registers this roster `ByDerivation` from that dead module. So +// "regenerate via generated_artifact_gate main_wet" is false: main_wet leaves this file untouched, +// which is why two rows here survived the disappearance of the thing they describe. +// +// THE TWO ROWS REMOVED. `gunbc_namespace_reference_derived_closure_{admission,contract}.rs` were +// listed here as generated stage0 files and declared in the seed's lib.rs, but their `.dag` +// authorities under dag/gunbc are no longer reachable from the src/v1 import closure, so the emit +// has not produced them for some time and no Rust in the crate referenced them. They were the last +// two names in `--required-regen`'s population refusal. The removal is verified rather than +// asserted: with the two files deleted, the emitted lib.rs and the committed lib.rs differ by +// exactly the two `pub mod` lines this change also deletes and by nothing else (measured, remote +// runner, this branch) -- so the committed seed converges ONTO its authority's output here. +// +// EDITING A GENERATED FILE BY HAND IS NORMALLY THE ONE UNHEALABLE DRIFT CLASS, and this is stated +// rather than quietly done: with the generator deleted, this file is de facto hand-maintained and +// has been since that deletion. The honest repair is to restore a producer or to reclassify the +// roster, and neither is this change's subject; what this change refuses to do is leave a roster +// naming files that do not exist so that regen keeps refusing. +data stage0_emit_plan_generated_note: String = "Projection of the stage0 emit plan. ITS PRODUCER gunbc.stage0_emit_plan IS DELETED, so it is hand-maintained in fact (see the block above); main_wet does not rewrite it. DECLARED SCAFFOLD supply; dissolve-on: generated_artifact_gate accepts v2.compiler.source_authority.ModuleStorageIndex, then the host supply deletes. Regen via dag/tools/generated_artifact_gate.dag main_wet." data generated_stage0_files: List = [ "compiler_tests.rs", @@ -30,8 +51,6 @@ data generated_stage0_files: List = [ "extdeps_uri_path.rs", "extdeps_version.rs", "extdeps_version_semver.rs", - "gunbc_namespace_reference_derived_closure_admission.rs", - "gunbc_namespace_reference_derived_closure_contract.rs", "gunbc_rust_decl_type_overlay.rs", "gunbc_stage0_crate_layout_generated.rs", "gunbc_stage0_crate_partition_generated.rs", @@ -162,8 +181,6 @@ data generated_stage0_paths: List = [ "src/v1/stage0/src/extdeps_uri_path.rs", "src/v1/stage0/src/extdeps_version.rs", "src/v1/stage0/src/extdeps_version_semver.rs", - "src/v1/stage0/src/gunbc_namespace_reference_derived_closure_admission.rs", - "src/v1/stage0/src/gunbc_namespace_reference_derived_closure_contract.rs", "src/v1/stage0/src/gunbc_rust_decl_type_overlay.rs", "src/v1/stage0/src/gunbc_stage0_crate_layout_generated.rs", "src/v1/stage0/src/gunbc_stage0_crate_partition_generated.rs", diff --git a/src/v1/stage0/src/gunbc_namespace_reference_derived_closure_admission.rs b/src/v1/stage0/src/gunbc_namespace_reference_derived_closure_admission.rs deleted file mode 100644 index b236402d5f3..00000000000 --- a/src/v1/stage0/src/gunbc_namespace_reference_derived_closure_admission.rs +++ /dev/null @@ -1,420 +0,0 @@ -// Generated by v1 compiler -- do not edit. -// Source module: gunbc.namespace_reference_derived_closure_admission - -use self::ReferenceDerivedClosureAdmission::*; -use self::ReferenceDerivedClosureCapability::*; -use self::ReferenceDerivedClosureScenarioFailure::*; -use self::ReferenceDerivedClosureTrigger::*; -pub use crate::std_algebra::FreeMonoid; -pub use crate::std_occurrence_binding::OccurrenceBindingResult; -use crate::std_occurrence_binding::OccurrenceBindingResult::{ - OccurrenceAmbiguous, OccurrenceBound, OccurrenceUnbound, -}; -pub use crate::std_occurrence_binding_resolve::OccurrenceReferenceBindingOutcome; -use crate::std_occurrence_binding_resolve::OccurrenceReferenceBindingOutcome::OccurrenceReferenceBindingDecided; -use crate::std_reference_binding_observation::ReferenceBindingObservation::{ - DistinctHomonymObservation, DistinctHomonymProductionRefused, LaterDeclarationObservation, - LaterDeclarationProductionRefused, RepeatedMentionDependencyObservation, - SameFileNeighbourObservation, SameFileNeighbourProductionRefused, SiblingBranchObservation, - SiblingBranchProductionRefused, UnrelatedLoadedFileObservation, -}; -use crate::std_reference_binding_observation::StructuralBindingResolution::StructuralBindingResolved; -pub use crate::std_reference_binding_observation::{ - ReferenceBindingObservation, StructuralBindingResolution, -}; -use crate::std_types::Bool::*; -pub use crate::std_types::{Bool, FilePath, List}; -use crate::v1_rt; -use crate::v1_rt::{VecCompat, VecJoin}; -use crate::NonEmptyBTreeSet; -use crate::NonEmptyVec; -use im::{vector as vec, HashMap, OrdSet as BTreeSet, Vector as Vec}; -use std::rc::Rc; - -#[derive( - Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize, -)] -#[serde(tag = "_variant")] -pub enum ReferenceDerivedClosureCapability { - SameFileEarlierNeighbourVisible, - SiblingDecisionBranchExcluded, - LaterDeclarationExcluded, - DistinctSameSpelledDeclarationsPreserved, - RepeatedMentionsCollapseDependency, - UnrelatedLoadedFileExcluded, -} - -#[derive( - Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize, -)] -#[serde(tag = "_variant")] -pub enum ReferenceDerivedClosureScenarioFailure { - SameFileNeighbourMissing, - SiblingBranchLeaked, - LaterDeclarationLeaked, - DistinctDeclarationCollapsed, - RepeatedMentionDuplicatedDependency, - UnrelatedLoadedFileDependencyLeaked, -} - -#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] -pub struct ReferenceDerivedClosureAcceptanceReceipt { - pub capability: ReferenceDerivedClosureCapability, -} - -#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] -#[serde(tag = "_variant")] -pub enum ReferenceDerivedClosureAdmission { - ReferenceDerivedClosureEstablished { - receipt: Rc, - }, - ReferenceDerivedClosureRefused { - capability: ReferenceDerivedClosureCapability, - failure: ReferenceDerivedClosureScenarioFailure, - }, - ReferenceDerivedClosureUnavailable { - capability: ReferenceDerivedClosureCapability, - trigger: ReferenceDerivedClosureTrigger, - }, -} - -#[derive( - Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize, -)] -#[serde(tag = "_variant")] -pub enum ReferenceDerivedClosureTrigger { - P2aStructuralCandidateProducer7515, - P2aReferenceDependencyProjection7515, - P2aPoolIndependentDependencyProjection7515, -} - -pub fn file_present(xs: Rc>, wanted: String) -> bool { - { - let mut __found = false; - for x in xs.clone().iter().cloned() { - if (x.clone() == wanted.clone()) { - __found = true; - break; - } - } - __found - } -} - -pub fn established( - capability: ReferenceDerivedClosureCapability, -) -> Rc { - Rc::new( - ReferenceDerivedClosureAdmission::ReferenceDerivedClosureEstablished { - receipt: Rc::new(ReferenceDerivedClosureAcceptanceReceipt { - capability: capability.clone(), - }), - }, - ) -} - -pub fn refused( - capability: ReferenceDerivedClosureCapability, - failure: ReferenceDerivedClosureScenarioFailure, -) -> Rc { - Rc::new( - ReferenceDerivedClosureAdmission::ReferenceDerivedClosureRefused { - capability: capability.clone(), - failure: failure.clone(), - }, - ) -} - -pub fn binding_outcome_from_resolution( - resolution: Rc, -) -> Option> { - match (*resolution.clone()).clone() { - StructuralBindingResolution::StructuralBindingResolved { - binding_outcome: binding_outcome, - .. - } => Some(binding_outcome.clone()), - _ => None, - } -} - -pub fn assess_reference_binding_observation( - observation: Rc, -) -> Rc { - match (*observation.clone()).clone() { - ReferenceBindingObservation::SameFileNeighbourProductionRefused { gap: _, .. } => refused( - ReferenceDerivedClosureCapability::SameFileEarlierNeighbourVisible, - ReferenceDerivedClosureScenarioFailure::SameFileNeighbourMissing, - ), - ReferenceBindingObservation::SameFileNeighbourObservation { - neighbour, - resolution, - .. - } => { - match binding_outcome_from_resolution(resolution.clone()) { - None => refused( - ReferenceDerivedClosureCapability::SameFileEarlierNeighbourVisible, - ReferenceDerivedClosureScenarioFailure::SameFileNeighbourMissing, - ), - Some(binding_outcome) => { - match (*binding_outcome.clone()).clone() { - OccurrenceReferenceBindingOutcome::OccurrenceReferenceBindingDecided { - ref result, - .. - } => { - let OccurrenceBindingResult::OccurrenceBound { - binding: binding, .. - } = result.as_ref() - else { - unreachable!() - }; - if (binding - .candidate - .clone() - .containment - .clone() - .terminal - .clone() - .value - .clone() - == neighbour.value.clone()) - { - established(ReferenceDerivedClosureCapability::SameFileEarlierNeighbourVisible) - } else { - refused(ReferenceDerivedClosureCapability::SameFileEarlierNeighbourVisible, ReferenceDerivedClosureScenarioFailure::SameFileNeighbourMissing) - } - } - _ => refused( - ReferenceDerivedClosureCapability::SameFileEarlierNeighbourVisible, - ReferenceDerivedClosureScenarioFailure::SameFileNeighbourMissing, - ), - } - } - } - } - ReferenceBindingObservation::SiblingBranchProductionRefused { gap: _, .. } => refused( - ReferenceDerivedClosureCapability::SiblingDecisionBranchExcluded, - ReferenceDerivedClosureScenarioFailure::SiblingBranchLeaked, - ), - ReferenceBindingObservation::SiblingBranchObservation { - own_branch_declaration, - sibling_branch_declaration, - resolution, - .. - } => { - match binding_outcome_from_resolution(resolution.clone()) { - None => refused( - ReferenceDerivedClosureCapability::SiblingDecisionBranchExcluded, - ReferenceDerivedClosureScenarioFailure::SiblingBranchLeaked, - ), - Some(binding_outcome) => { - match (*binding_outcome.clone()).clone() { - OccurrenceReferenceBindingOutcome::OccurrenceReferenceBindingDecided { - ref result, - .. - } => { - let OccurrenceBindingResult::OccurrenceBound { - binding: binding, .. - } = result.as_ref() - else { - unreachable!() - }; - if ((binding - .candidate - .clone() - .containment - .clone() - .terminal - .clone() - .value - .clone() - == own_branch_declaration.value.clone()) - && (binding - .candidate - .clone() - .containment - .clone() - .terminal - .clone() - .value - .clone() - != sibling_branch_declaration.value.clone())) - { - established(ReferenceDerivedClosureCapability::SiblingDecisionBranchExcluded) - } else { - refused(ReferenceDerivedClosureCapability::SiblingDecisionBranchExcluded, ReferenceDerivedClosureScenarioFailure::SiblingBranchLeaked) - } - } - _ => refused( - ReferenceDerivedClosureCapability::SiblingDecisionBranchExcluded, - ReferenceDerivedClosureScenarioFailure::SiblingBranchLeaked, - ), - } - } - } - } - ReferenceBindingObservation::LaterDeclarationProductionRefused { gap: _, .. } => refused( - ReferenceDerivedClosureCapability::LaterDeclarationExcluded, - ReferenceDerivedClosureScenarioFailure::LaterDeclarationLeaked, - ), - ReferenceBindingObservation::LaterDeclarationObservation { resolution, .. } => { - match binding_outcome_from_resolution(resolution.clone()) { - None => refused( - ReferenceDerivedClosureCapability::LaterDeclarationExcluded, - ReferenceDerivedClosureScenarioFailure::LaterDeclarationLeaked, - ), - Some(binding_outcome) => match (*binding_outcome.clone()).clone() { - OccurrenceReferenceBindingOutcome::OccurrenceReferenceBindingDecided { - ref result, - .. - } => { - let OccurrenceBindingResult::OccurrenceUnbound { occurrence: _, .. } = - result.as_ref() - else { - unreachable!() - }; - established(ReferenceDerivedClosureCapability::LaterDeclarationExcluded) - } - _ => refused( - ReferenceDerivedClosureCapability::LaterDeclarationExcluded, - ReferenceDerivedClosureScenarioFailure::LaterDeclarationLeaked, - ), - }, - } - } - ReferenceBindingObservation::DistinctHomonymProductionRefused { gap: _, .. } => refused( - ReferenceDerivedClosureCapability::DistinctSameSpelledDeclarationsPreserved, - ReferenceDerivedClosureScenarioFailure::DistinctDeclarationCollapsed, - ), - ReferenceBindingObservation::DistinctHomonymObservation { - first_declaration, - second_declaration, - resolution, - .. - } => match binding_outcome_from_resolution(resolution.clone()) { - None => refused( - ReferenceDerivedClosureCapability::DistinctSameSpelledDeclarationsPreserved, - ReferenceDerivedClosureScenarioFailure::DistinctDeclarationCollapsed, - ), - Some(binding_outcome) => match (*binding_outcome.clone()).clone() { - OccurrenceReferenceBindingOutcome::OccurrenceReferenceBindingDecided { - ref result, - .. - } => { - let OccurrenceBindingResult::OccurrenceAmbiguous { - candidates: candidates, - .. - } = result.as_ref() - else { - unreachable!() - }; - if ((({ - let __fm = candidates.rest.clone(); - if __fm.is_empty() { - true - } else { - false - } - } && (first_declaration.value.clone() - != second_declaration.value.clone())) - && (candidates - .first - .clone() - .containment - .clone() - .terminal - .clone() - .value - .clone() - == first_declaration.value.clone())) - && (candidates - .second - .clone() - .containment - .clone() - .terminal - .clone() - .value - .clone() - == second_declaration.value.clone())) - { - established(ReferenceDerivedClosureCapability::DistinctSameSpelledDeclarationsPreserved) - } else { - refused(ReferenceDerivedClosureCapability::DistinctSameSpelledDeclarationsPreserved, ReferenceDerivedClosureScenarioFailure::DistinctDeclarationCollapsed) - } - } - _ => refused( - ReferenceDerivedClosureCapability::DistinctSameSpelledDeclarationsPreserved, - ReferenceDerivedClosureScenarioFailure::DistinctDeclarationCollapsed, - ), - }, - }, - ReferenceBindingObservation::RepeatedMentionDependencyObservation { - provider_file, - projected_dependencies, - .. - } => { - if (((projected_dependencies.clone().len() as i64) == 1) - && file_present(projected_dependencies.clone(), provider_file.clone())) - { - established(ReferenceDerivedClosureCapability::RepeatedMentionsCollapseDependency) - } else { - refused( - ReferenceDerivedClosureCapability::RepeatedMentionsCollapseDependency, - ReferenceDerivedClosureScenarioFailure::RepeatedMentionDuplicatedDependency, - ) - } - } - ReferenceBindingObservation::UnrelatedLoadedFileObservation { - provider_file, - unrelated_loaded_file, - projected_dependencies, - .. - } => { - if ((((projected_dependencies.clone().len() as i64) == 1) - && file_present(projected_dependencies.clone(), provider_file.clone())) - && !file_present( - projected_dependencies.clone(), - unrelated_loaded_file.clone(), - )) - { - established(ReferenceDerivedClosureCapability::UnrelatedLoadedFileExcluded) - } else { - refused( - ReferenceDerivedClosureCapability::UnrelatedLoadedFileExcluded, - ReferenceDerivedClosureScenarioFailure::UnrelatedLoadedFileDependencyLeaked, - ) - } - } - } -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -pub struct SameFileEarlierNeighbourVisible; -#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -pub struct SiblingDecisionBranchExcluded; -#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -pub struct LaterDeclarationExcluded; -#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -pub struct DistinctSameSpelledDeclarationsPreserved; -#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -pub struct RepeatedMentionsCollapseDependency; -#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -pub struct UnrelatedLoadedFileExcluded; -#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -pub struct SameFileNeighbourMissing; -#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -pub struct SiblingBranchLeaked; -#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -pub struct LaterDeclarationLeaked; -#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -pub struct DistinctDeclarationCollapsed; -#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -pub struct RepeatedMentionDuplicatedDependency; -#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -pub struct UnrelatedLoadedFileDependencyLeaked; -#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -pub struct P2aStructuralCandidateProducer7515; -#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -pub struct P2aReferenceDependencyProjection7515; -#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -pub struct P2aPoolIndependentDependencyProjection7515; diff --git a/src/v1/stage0/src/gunbc_namespace_reference_derived_closure_contract.rs b/src/v1/stage0/src/gunbc_namespace_reference_derived_closure_contract.rs deleted file mode 100644 index 885e2220890..00000000000 --- a/src/v1/stage0/src/gunbc_namespace_reference_derived_closure_contract.rs +++ /dev/null @@ -1,159 +0,0 @@ -// Generated by v1 compiler -- do not edit. -// Source module: gunbc.namespace_reference_derived_closure_contract - -use im::{vector as vec, HashMap, OrdSet as BTreeSet, Vector as Vec}; -use crate::v1_rt::{VecCompat, VecJoin}; -use std::rc::Rc; -use crate::v1_rt; -use crate::NonEmptyVec; -use crate::NonEmptyBTreeSet; -pub use crate::gunbc_namespace_reference_derived_closure_admission::{ReferenceDerivedClosureAdmission, ReferenceDerivedClosureCapability, ReferenceDerivedClosureTrigger}; -use crate::gunbc_namespace_reference_derived_closure_admission::ReferenceDerivedClosureAdmission::{ReferenceDerivedClosureEstablished, ReferenceDerivedClosureRefused, ReferenceDerivedClosureUnavailable}; -use crate::gunbc_namespace_reference_derived_closure_admission::ReferenceDerivedClosureCapability::{RepeatedMentionsCollapseDependency, UnrelatedLoadedFileExcluded, SameFileEarlierNeighbourVisible, SiblingDecisionBranchExcluded, LaterDeclarationExcluded, DistinctSameSpelledDeclarationsPreserved}; -use crate::gunbc_namespace_reference_derived_closure_admission::ReferenceDerivedClosureTrigger::{P2aStructuralCandidateProducer7515, P2aReferenceDependencyProjection7515, P2aPoolIndependentDependencyProjection7515}; -pub use crate::std_types::{Bool, List}; -use crate::std_types::Bool::*; - -pub fn namespace_reference_derived_closure_contract_note() -> String { - thread_local! { - static CACHED: String = { - "THE CLOSING CONDITION for roadmap node namespace-reference-derived-closure, transcribed at the node's own six-clause grain. Each clause is a closed capability and is established only by assessing the corresponding typed production observation: an earlier same-file neighbour is visible; a sibling decision branch is excluded; a later declaration is excluded; two distinct same-spelled declaration identities both survive for the canonical ambiguity fold; repeated mentions project one provider-file dependency; and an unrelated loaded file never enters that projection. The first four observations carry the result of the MERGED P1 resolve_reference_occurrence_binding kernel, so the check cannot substitute a second none/one/many decision. Missing, refused, and explicitly unavailable evidence all remain in the derived frontier; duplicate admissions cannot erase a missing capability, and zero progress is red.\n\nThis module deliberately does NOT derive visibility or dependencies. namespace_reference_derived_closure_acceptance_admissions carries six typed unavailable rows today: structural visibility/order/ambiguity wait on the P2a candidate producer in #7515, dependency dedupe waits on its binding projection, and pool-independent closure waits on that projection's Class-B wall. The fixture witnesses construct observations to prove this fold discriminates, but the quarantined closing witness consumes only the production-admission function; copying fixture observations into it would be specification-without-execution and would not satisfy the contract.".to_string() - }; - } - CACHED.with(|c: &String| c.clone()) -} - -pub fn namespace_reference_derived_closure_contract_dissolution_note() -> String { - thread_local! { - static CACHED: String = { - "DISSOLVES BY GREENING, never deletion. The implementation adds production-derived observations to namespace_reference_derived_closure_acceptance_admissions as each clause becomes executable. When all six establish, the unchanged closing witness greens; its QuarantineProbeExpectRed exclusion and known-red roster entry delete in the same change, promoting it to the ordinary discovery corpus as the permanent regression wall.".to_string() - }; - } - CACHED.with(|c: &String| c.clone()) -} - -pub fn reference_derived_closure_required_capabilities( -) -> Rc> { - Rc::new(vec![ - ReferenceDerivedClosureCapability::SameFileEarlierNeighbourVisible, - ReferenceDerivedClosureCapability::SiblingDecisionBranchExcluded, - ReferenceDerivedClosureCapability::LaterDeclarationExcluded, - ReferenceDerivedClosureCapability::DistinctSameSpelledDeclarationsPreserved, - ReferenceDerivedClosureCapability::RepeatedMentionsCollapseDependency, - ReferenceDerivedClosureCapability::UnrelatedLoadedFileExcluded, - ]) -} - -pub fn reference_derived_closure_missing_capabilities( - admissions: Rc>>, -) -> Rc> { - Rc::new({ - let mut __result = Vec::new(); - for required in reference_derived_closure_required_capabilities() - .iter() - .cloned() - { - if (!{ - let mut __found = false; - for admission in admissions.clone().iter().cloned() { - if match (*admission.clone()).clone() { - ReferenceDerivedClosureAdmission::ReferenceDerivedClosureEstablished { - receipt: receipt, - .. - } => (receipt.capability.clone() == required.clone()), - ReferenceDerivedClosureAdmission::ReferenceDerivedClosureRefused { - .. - } => false, - ReferenceDerivedClosureAdmission::ReferenceDerivedClosureUnavailable { - .. - } => false, - } { - __found = true; - break; - } - } - __found - } || { - let mut __found = false; - for admission in admissions.clone().iter().cloned() { - if match (*admission.clone()).clone() { - ReferenceDerivedClosureAdmission::ReferenceDerivedClosureEstablished { - receipt: _, - .. - } => false, - ReferenceDerivedClosureAdmission::ReferenceDerivedClosureRefused { - capability, - .. - } => (capability.clone() == required.clone()), - ReferenceDerivedClosureAdmission::ReferenceDerivedClosureUnavailable { - capability, - .. - } => (capability.clone() == required.clone()), - } { - __found = true; - break; - } - } - __found - }) { - __result.push(required); - } - } - __result - }) -} - -pub fn reference_derived_closure_closing_frontier_count( - admissions: Rc>>, -) -> i64 { - (reference_derived_closure_missing_capabilities(admissions.clone()).len() as i64) -} - -pub fn reference_derived_closure_closing_contract_holds( - admissions: Rc>>, -) -> bool { - (reference_derived_closure_closing_frontier_count(admissions.clone()) == 0) -} - -pub fn namespace_reference_derived_closure_acceptance_admissions( -) -> Rc>> { - Rc::new(vec![ - Rc::new( - ReferenceDerivedClosureAdmission::ReferenceDerivedClosureUnavailable { - capability: ReferenceDerivedClosureCapability::SameFileEarlierNeighbourVisible, - trigger: ReferenceDerivedClosureTrigger::P2aStructuralCandidateProducer7515, - }, - ), - Rc::new( - ReferenceDerivedClosureAdmission::ReferenceDerivedClosureUnavailable { - capability: ReferenceDerivedClosureCapability::SiblingDecisionBranchExcluded, - trigger: ReferenceDerivedClosureTrigger::P2aStructuralCandidateProducer7515, - }, - ), - Rc::new( - ReferenceDerivedClosureAdmission::ReferenceDerivedClosureUnavailable { - capability: ReferenceDerivedClosureCapability::LaterDeclarationExcluded, - trigger: ReferenceDerivedClosureTrigger::P2aStructuralCandidateProducer7515, - }, - ), - Rc::new( - ReferenceDerivedClosureAdmission::ReferenceDerivedClosureUnavailable { - capability: - ReferenceDerivedClosureCapability::DistinctSameSpelledDeclarationsPreserved, - trigger: ReferenceDerivedClosureTrigger::P2aStructuralCandidateProducer7515, - }, - ), - Rc::new( - ReferenceDerivedClosureAdmission::ReferenceDerivedClosureUnavailable { - capability: ReferenceDerivedClosureCapability::RepeatedMentionsCollapseDependency, - trigger: ReferenceDerivedClosureTrigger::P2aReferenceDependencyProjection7515, - }, - ), - Rc::new( - ReferenceDerivedClosureAdmission::ReferenceDerivedClosureUnavailable { - capability: ReferenceDerivedClosureCapability::UnrelatedLoadedFileExcluded, - trigger: ReferenceDerivedClosureTrigger::P2aPoolIndependentDependencyProjection7515, - }, - ), - ]) -} diff --git a/src/v1/stage0/src/lib.rs b/src/v1/stage0/src/lib.rs index 33afc0c252d..2a2e77e2f73 100644 --- a/src/v1/stage0/src/lib.rs +++ b/src/v1/stage0/src/lib.rs @@ -39,8 +39,6 @@ pub mod extdeps_uri; pub mod extdeps_uri_path; pub mod extdeps_version; pub mod extdeps_version_semver; -pub mod gunbc_namespace_reference_derived_closure_admission; -pub mod gunbc_namespace_reference_derived_closure_contract; pub mod gunbc_rust_decl_type_overlay; pub mod gunbc_stage0_crate_layout_generated; pub mod gunbc_stage0_crate_partition_generated; From 0479b060494179317075fe21b9dc029d87721a1e Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Thu, 20 Aug 2026 00:56:45 +0000 Subject: [PATCH 09/10] Declare the nine behavioral-receipt seed oracles in the seed crate: the shim drivers import them from v1_compiler --- dag/gunbc/bmc_netboot_serve.dag | 23 ++-------- .../self_host/stage0_crate_layout.dag | 42 +++++++++++++++---- 2 files changed, 37 insertions(+), 28 deletions(-) diff --git a/dag/gunbc/bmc_netboot_serve.dag b/dag/gunbc/bmc_netboot_serve.dag index 313d6aedfe8..3f494d2b767 100644 --- a/dag/gunbc/bmc_netboot_serve.dag +++ b/dag/gunbc/bmc_netboot_serve.dag @@ -18,10 +18,8 @@ import extdeps.exec.command { shell_command_render, scp_command, } -import extdeps.shell import extdeps.filesystem.filesystem_io { Filesystem } -import gunbc.shell_bash_runner { shell_exec_via_bash } -import gunbc.retained_shell_script { retained_runtime } +import gunbc.command_runner { run_shell_command } import std.process { ProcessExit, ExitSuccess, exit_failure } import std.resources { Network } import std.disposition { Disposition, Scaffold, RealizationDispatch } @@ -143,19 +141,12 @@ data bmc_netboot_provision_scaffold: Disposition = Scaffold { } } -data bmc_netboot_provision_dissolution_trigger: DissolutionCondition = unbound_dissolution(description: "🟡 dissolve-on: bmc_netboot_provision — the staging manifest (bmc_netboot_staging_manifest) IS the driver: provision folds its BmcStagedFile rows through bmc_netboot_stage_file (LocalArtifact scp / InlineText write+scp / FetchFromUri typed refusal), so the file list has one authority and the former hand-unrolled sequence is deleted. Remaining debt is the transport: shell.Exec.Run rendering of scp_command (extdeps.exec.command, the single ssh/scp posture authority — no forked argv) on the pre-runtime BMC bootstrap window. DISSOLVES WHEN host_effect_apply binds the manifest fold as a typed staging effect and dag/gunbc/bmc_netboot_serve.dag retires its shell/scp glue") +data bmc_netboot_provision_dissolution_trigger: DissolutionCondition = unbound_dissolution(description: "🟡 dissolve-on: bmc_netboot_provision — the staging manifest (bmc_netboot_staging_manifest) IS the driver: provision folds its BmcStagedFile rows through bmc_netboot_stage_file (LocalArtifact scp / InlineText write+scp / FetchFromUri typed refusal), so the file list has one authority and the former hand-unrolled sequence is deleted. bmc_netboot_run_bmc and bmc_netboot_put_path no longer hand-roll their own retained_runtime/shell.Exec.Run heredoc glue (that was two bridge sites duplicating one pattern, §2/§3); both now call gunbc.command_runner.run_shell_command, the single authority for rendering an ArgvCommand+CommandTransport over the heredoc bridge — command_runner already carries its own dissolution obligation (command_runner_dissolution_trigger) for that bridge, so this module inherits rather than duplicates it. Remaining debt is unchanged and lives one level down, in extdeps.exec.command.command_over_transport: SshExec composes ssh_exec_prefix ++ argv, appending argv members as a space-joined string with no escaping — RFC 4254 carries one command string, so this is fail-open for any argv member outside the portable alphabet; repairing it needs the nested shell-command target (CliSurface -> shell grammar -> RFC 4254 string), out of scope here. DISSOLVES WHEN host_effect_apply binds ArgvCommand execution (mkdir / scp / busybox-httpd-launch) as typed staging effects with a correct SSH command-string realization, and dag/gunbc/bmc_netboot_serve.dag retires command_runner.run_shell_command in favor of host_effect_apply") func bmc_netboot_run_bmc(plan: BmcNetbootServePlan, argv: List) -> ProcessExit uses net: Network { - let cmd = command_over_transport(command: ArgvCommand { argv: argv }, transport: bmc_transport(plan: plan)) - let run = shell.Exec.Run( - script: retained_runtime( - body: shell_exec_via_bash(body: shell_command_render(command: cmd)), - reason: "bmc-netboot pre-runtime bootstrap window: ssh/scp posture rendered through the heredoc transport" as NonEmptyStr, - ) - ) - if run.success { ExitSuccess } else { exit_failure(reason: concat("bmc-netboot: ", run.stderr)) } + run_shell_command(command: ArgvCommand { argv: argv }, transport: bmc_transport(plan: plan)) } fn bmc_staged_file_basename(remote_path: NonEmptyStr) -> String { @@ -171,13 +162,7 @@ func bmc_netboot_put_path(plan: BmcNetbootServePlan, local: NonEmptyStr, remote_ { let remote_target = join([bmc_ssh_target(plan: plan) as String, ":", remote_path as String], "") as NonEmptyStr let cmd = scp_command(local_path: local, remote_target: remote_target) - let run = shell.Exec.Run( - script: retained_runtime( - body: shell_exec_via_bash(body: shell_command_render(command: cmd)), - reason: "bmc-netboot pre-runtime bootstrap window: scp staging rendered through the heredoc transport" as NonEmptyStr, - ) - ) - if run.success { ExitSuccess } else { exit_failure(reason: concat("bmc-netboot: scp failed for ", remote_path as String)) } + run_shell_command(command: cmd, transport: LocalExec) } func bmc_netboot_stage_file(plan: BmcNetbootServePlan, file: BmcStagedFile) -> ProcessExit diff --git a/src/v2/compiler/self_host/stage0_crate_layout.dag b/src/v2/compiler/self_host/stage0_crate_layout.dag index e19c4f4ebd6..081b706bedf 100644 --- a/src/v2/compiler/self_host/stage0_crate_layout.dag +++ b/src/v2/compiler/self_host/stage0_crate_layout.dag @@ -31,6 +31,30 @@ type SeedRetainedSupportDirRegistration { basename: String } +// NINE ROWS FLIPPED TO `has_pub_mod: true` (2026-08-20), AND THIS CORRECTS A CLAIM THE ROW BELOW +// MAKES. `pre_existing_hand_retained_registration_backfill_note` states that the Gate-A oracles are +// "never part of the stage0 crate's own mod tree at all" because the CSSL harness compiles them +// standalone. The first half is what the harness does; the second half does not follow, and the +// drivers say so directly: every `dag/tools/self_host_*_shims/witness_main.rs` opens with +// `use v1_compiler::v2_compiler_X as seed;` -- the SEED crate, reached as an ordinary cargo +// dependency of the generated `v1_compiled` crate. Their roster rows in +// `tools.self_host_module_behavioral_transport_roster` carry `shim_lib_rel: ""` and +// `shim_writes: []`, so the harness writes nothing into the seed crate that could supply that path, +// and `tools.self_host_curated_seed_linked_harness` `cssl_closure_assembly_note` says plainly that +// "seed lib.rs pub mod presence is external-oracle only" -- present, and read, on the oracle side. +// +// A module the seed crate does not declare cannot be imported from it, so those drivers do not +// compile, so no behavioral receipt over these modules can be green OR red. That is the shape +// DESIGN section 5 names specification-without-execution, one layer below the harness that was +// believed to be the blocker: the machinery exists, and the seed side of the comparison has no +// path to link against. +// +// WHAT THIS DOES NOT CLAIM. Declaring the modules is necessary, not sufficient, and it is not a +// receipt: nothing here has executed a behavioral transport. It is also a TWO-GENERATION change -- +// the emitted lib.rs takes its pub-mod block from the committed +// `gunbc_stage0_crate_layout_generated.rs`, which is itself one of the files +// `--required-regen` reports as drifted -- so these declarations reach the built crate when the +// seed is regenerated, not when this row merges. data seed_retained_intrinsic_registrations: List = [ SeedRetainedIntrinsicRegistration { basename: "v1_interpreter", has_pub_mod: true, is_dir: false }, SeedRetainedIntrinsicRegistration { basename: "bounded_shell_host_drain", has_pub_mod: false, is_dir: false }, @@ -50,17 +74,17 @@ data seed_retained_intrinsic_registrations: List Date: Thu, 20 Aug 2026 01:04:55 +0000 Subject: [PATCH 10/10] Regenerate the crate-layout pub-mod projection for the nine declared seed oracles --- dag/gunbc/stage0_crate_layout_generated.dag | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dag/gunbc/stage0_crate_layout_generated.dag b/dag/gunbc/stage0_crate_layout_generated.dag index dd06b213cad..7b8a96104d6 100644 --- a/dag/gunbc/stage0_crate_layout_generated.dag +++ b/dag/gunbc/stage0_crate_layout_generated.dag @@ -4,7 +4,7 @@ import std.types { List, String } data stage0_crate_layout_generated_note: String = "Generated by gunbc stage0_crate_layout_emit — do not hand-edit. Authority: v2.compiler.self_host.stage0_crate_layout; regen via dag/tools/generated_artifact_gate.dag main_wet." -data generated_pub_mod_block: String = "\n#[macro_use]\npub mod v1_interpreter_dispatch_generated;\npub mod v1_interpreter;\npub mod cli_run;\npub mod codex_app_server_stdio_session;\npub mod coproduct_reflection;\npub mod data_initializer_identity;\npub mod resolved_graph_cache;\npub mod shared_typecheck_store;\npub mod recorded_fixture;\npub mod derived_realization_schedule;\npub mod v1_compiler_expected_red_roster_join;\npub mod memory_governor;\npub mod module_path_index;\npub mod usv_pilot_v2_std_algebra;\npub mod usv_pilot_v2_std_collection;\npub mod usv_pilot_v2_std_node;\npub mod v2_compiler_resolve;\npub mod v2_compiler_program_partition;\npub mod v2_compiler_tokenize;\npub mod v2_compiler_infer;" +data generated_pub_mod_block: String = "\n#[macro_use]\npub mod v1_interpreter_dispatch_generated;\npub mod v1_interpreter;\npub mod cli_run;\npub mod codex_app_server_stdio_session;\npub mod coproduct_reflection;\npub mod data_initializer_identity;\npub mod resolved_graph_cache;\npub mod shared_typecheck_store;\npub mod recorded_fixture;\npub mod derived_realization_schedule;\npub mod v1_compiler_expected_red_roster_join;\npub mod memory_governor;\npub mod module_path_index;\npub mod v2_compiler_body_producer;\npub mod v2_compiler_normalize;\npub mod v2_compiler_target_carriers;\npub mod v2_compiler_discovery_enumeration;\npub mod v2_compiler_parse_engine_hooks;\npub mod v2_compiler_use_site_verdict;\npub mod v2_compiler_compile;\npub mod v2_compiler_program_assembly;\npub mod v2_compiler_source_authority;\npub mod usv_pilot_v2_std_algebra;\npub mod usv_pilot_v2_std_collection;\npub mod usv_pilot_v2_std_node;\npub mod v2_compiler_resolve;\npub mod v2_compiler_program_partition;\npub mod v2_compiler_tokenize;\npub mod v2_compiler_infer;" data generated_pub_mod_basenames: List = [ "v1_interpreter", @@ -19,6 +19,15 @@ data generated_pub_mod_basenames: List = [ "v1_compiler_expected_red_roster_join", "memory_governor", "module_path_index", + "v2_compiler_body_producer", + "v2_compiler_normalize", + "v2_compiler_target_carriers", + "v2_compiler_discovery_enumeration", + "v2_compiler_parse_engine_hooks", + "v2_compiler_use_site_verdict", + "v2_compiler_compile", + "v2_compiler_program_assembly", + "v2_compiler_source_authority", "usv_pilot_v2_std_algebra", "usv_pilot_v2_std_collection", "usv_pilot_v2_std_node",