diff --git a/dag/gunbc/stage0_crate_layout_generated.dag b/dag/gunbc/stage0_crate_layout_generated.dag index 2e5f8c9bd10..e58740cfeb7 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 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", @@ -26,7 +26,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 +56,10 @@ data generated_stage0_filenames: List = [ "v2_compiler_discovery_enumeration.rs", "v2_compiler_parse_engine_hooks.rs", "v2_compiler_use_site_verdict.rs", + "bootstrap_stage0_crate_layout_generated.rs", + "cssl_seed_linked_closure_assembly.rs", + "required_regen_host.rs", + "compiler_tests.rs", "usv_pilot_v2_std_algebra.rs", "usv_pilot_v2_std_collection.rs", "usv_pilot_v2_std_node.rs", @@ -60,7 +67,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/gunbc/stage0_emit_plan_generated.dag b/dag/gunbc/stage0_emit_plan_generated.dag index f829fd9128c..240015d660b 100644 --- a/dag/gunbc/stage0_emit_plan_generated.dag +++ b/dag/gunbc/stage0_emit_plan_generated.dag @@ -4,8 +4,9 @@ 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." +data stage0_emit_plan_generated_orphan_correction_note: String = "This file's claimed generating authority, gunbc.stage0_emit_plan, was deleted by #8406 (the regen root cut) — no module by that name remains in the corpus, and neither generated_artifact.dag's registry nor generated_artifact_emit.dag's dispatch names this path, so main_wet has no live rule that regenerates this file; it is orphaned data from a deleted fold, not a currently-produced artifact. One row was hand-corrected rather than left standing: compiler_tests.rs was removed from generated_stage0_files/generated_stage0_paths. It is hand-authored Rust test code with no corresponding .dag source module (v1.compiler.compiler_tests does not exist — see stage0_crate_layout.dag's compiler_tests_seed_retained_note) and structurally cannot be freshly emitted, so its presence here falsely modeled it as a planned regen target and collided with its correct SeedRetainedIntrinsicRegistration, breaking derived_generated_hand_disjoint_holds. Restoring this file's real generating authority (or replacing it per the file's own dissolve-on trigger) is out of scope of this correction." + data generated_stage0_files: List = [ - "compiler_tests.rs", "extdeps_cargo.rs", "extdeps_cargo_version.rs", "extdeps_container_oci_digest.rs", @@ -137,7 +138,6 @@ data generated_stage0_files: List = [ ] data generated_stage0_paths: List = [ - "src/v1/stage0/src/compiler_tests.rs", "src/v1/stage0/src/extdeps_cargo.rs", "src/v1/stage0/src/extdeps_cargo_version.rs", "src/v1/stage0/src/extdeps_container_oci_digest.rs", 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/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..bd016215d5e 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,11 @@ 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] +test fn scaffold_generated_artifact_layout_overlap_repo_paths_is_exactly_the_two_dual_pipeline_artifacts() -> 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..b2c44251fb6 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,10 @@ pub const HAND_MAINTAINED_STAGE0_FILES: &[&str] = &[ "v2_compiler_discovery_enumeration.rs", "v2_compiler_parse_engine_hooks.rs", "v2_compiler_use_site_verdict.rs", + "bootstrap_stage0_crate_layout_generated.rs", + "cssl_seed_linked_closure_assembly.rs", + "required_regen_host.rs", + "compiler_tests.rs", "usv_pilot_v2_std_algebra.rs", "usv_pilot_v2_std_collection.rs", "usv_pilot_v2_std_node.rs", @@ -33,7 +37,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] 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/gunbc_stage0_crate_layout_generated.rs b/src/v1/stage0/src/gunbc_stage0_crate_layout_generated.rs index d9a4269ed77..7301db388a6 100644 --- a/src/v1/stage0/src/gunbc_stage0_crate_layout_generated.rs +++ b/src/v1/stage0/src/gunbc_stage0_crate_layout_generated.rs @@ -21,7 +21,7 @@ pub fn stage0_crate_layout_generated_note() -> String { pub fn generated_pub_mod_block() -> String { thread_local! { static CACHED: 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;".to_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;\npub mod v2_compiler_compile;\npub mod v2_compiler_program_assembly;\npub mod v2_compiler_source_authority;".to_string() }; } CACHED.with(|c: &String| c.clone()) @@ -30,7 +30,7 @@ pub fn generated_pub_mod_block() -> String { pub fn generated_pub_mod_basenames() -> Rc> { thread_local! { static CACHED: Rc> = { - Rc::new(vec!["v1_interpreter".to_string(), "cli_run".to_string(), "codex_app_server_stdio_session".to_string(), "coproduct_reflection".to_string(), "data_initializer_identity".to_string(), "resolved_graph_cache".to_string(), "shared_typecheck_store".to_string(), "recorded_fixture".to_string(), "derived_realization_schedule".to_string(), "expected_red_roster_join".to_string(), "memory_governor".to_string(), "module_path_index".to_string(), "usv_pilot_v2_std_algebra".to_string(), "usv_pilot_v2_std_collection".to_string(), "usv_pilot_v2_std_node".to_string(), "v2_compiler_resolve".to_string(), "v2_compiler_program_partition".to_string(), "v2_compiler_tokenize".to_string(), "v2_compiler_infer".to_string(), "v1_interpreter_dispatch_generated".to_string()]) + Rc::new(vec!["v1_interpreter".to_string(), "cli_run".to_string(), "codex_app_server_stdio_session".to_string(), "coproduct_reflection".to_string(), "data_initializer_identity".to_string(), "resolved_graph_cache".to_string(), "shared_typecheck_store".to_string(), "recorded_fixture".to_string(), "derived_realization_schedule".to_string(), "expected_red_roster_join".to_string(), "memory_governor".to_string(), "module_path_index".to_string(), "usv_pilot_v2_std_algebra".to_string(), "usv_pilot_v2_std_collection".to_string(), "usv_pilot_v2_std_node".to_string(), "v2_compiler_resolve".to_string(), "v2_compiler_program_partition".to_string(), "v2_compiler_tokenize".to_string(), "v2_compiler_infer".to_string(), "v1_interpreter_dispatch_generated".to_string(), "v2_compiler_compile".to_string(), "v2_compiler_program_assembly".to_string(), "v2_compiler_source_authority".to_string()]) }; } CACHED.with(|c: &Rc>| c.clone()) @@ -39,7 +39,7 @@ pub fn generated_pub_mod_basenames() -> Rc> { pub fn generated_stage0_filenames() -> Rc> { thread_local! { static CACHED: Rc> = { - Rc::new(vec!["v1_interpreter.rs".to_string(), "bounded_shell_host_drain.rs".to_string(), "cli_run.rs".to_string(), "codex_app_server_stdio_session.rs".to_string(), "coproduct_reflection.rs".to_string(), "data_initializer_identity.rs".to_string(), "resolved_graph_cache.rs".to_string(), "shared_typecheck_store.rs".to_string(), "recorded_fixture.rs".to_string(), "main.rs".to_string(), "phase_profile.rs".to_string(), "pre_push.rs".to_string(), "census_exclude_derive.rs".to_string(), "derived_realization_schedule.rs".to_string(), "expected_red_roster_join.rs".to_string(), "memory_governor.rs".to_string(), "std_lens_verdict.rs".to_string(), "v2_compiler_body_producer.rs".to_string(), "v2_compiler_normalize.rs".to_string(), "v2_compiler_target_carriers.rs".to_string(), "v2_compiler_discovery_enumeration.rs".to_string(), "v2_compiler_parse_engine_hooks.rs".to_string(), "v2_compiler_use_site_verdict.rs".to_string(), "usv_pilot_v2_std_algebra.rs".to_string(), "usv_pilot_v2_std_collection.rs".to_string(), "usv_pilot_v2_std_node.rs".to_string(), "v2_compiler_resolve.rs".to_string(), "v2_compiler_program_partition.rs".to_string(), "v2_compiler_tokenize.rs".to_string(), "v2_compiler_infer.rs".to_string(), "v1_interpreter_dispatch_generated.rs".to_string()]) + Rc::new(vec!["v1_interpreter.rs".to_string(), "bounded_shell_host_drain.rs".to_string(), "cli_run.rs".to_string(), "codex_app_server_stdio_session.rs".to_string(), "coproduct_reflection.rs".to_string(), "data_initializer_identity.rs".to_string(), "resolved_graph_cache.rs".to_string(), "shared_typecheck_store.rs".to_string(), "recorded_fixture.rs".to_string(), "main.rs".to_string(), "phase_profile.rs".to_string(), "pre_push.rs".to_string(), "census_exclude_derive.rs".to_string(), "derived_realization_schedule.rs".to_string(), "expected_red_roster_join.rs".to_string(), "memory_governor.rs".to_string(), "std_lens_verdict.rs".to_string(), "v2_compiler_body_producer.rs".to_string(), "v2_compiler_normalize.rs".to_string(), "v2_compiler_target_carriers.rs".to_string(), "v2_compiler_discovery_enumeration.rs".to_string(), "v2_compiler_parse_engine_hooks.rs".to_string(), "v2_compiler_use_site_verdict.rs".to_string(), "bootstrap_stage0_crate_layout_generated.rs".to_string(), "cssl_seed_linked_closure_assembly.rs".to_string(), "required_regen_host.rs".to_string(), "compiler_tests.rs".to_string(), "usv_pilot_v2_std_algebra.rs".to_string(), "usv_pilot_v2_std_collection.rs".to_string(), "usv_pilot_v2_std_node.rs".to_string(), "v2_compiler_resolve.rs".to_string(), "v2_compiler_program_partition.rs".to_string(), "v2_compiler_tokenize.rs".to_string(), "v2_compiler_infer.rs".to_string(), "v1_interpreter_dispatch_generated.rs".to_string(), "v2_compiler_compile.rs".to_string(), "v2_compiler_program_assembly.rs".to_string(), "v2_compiler_source_authority.rs".to_string()]) }; } CACHED.with(|c: &Rc>| c.clone()) diff --git a/src/v1/stage0/src/lib.rs b/src/v1/stage0/src/lib.rs index 33afc0c252d..22bf47e8c6e 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; @@ -160,9 +158,12 @@ pub mod usv_pilot_v2_std_algebra; pub mod usv_pilot_v2_std_collection; pub mod usv_pilot_v2_std_node; pub mod v1_interpreter; +pub mod v2_compiler_compile; pub mod v2_compiler_infer; +pub mod v2_compiler_program_assembly; pub mod v2_compiler_program_partition; pub mod v2_compiler_resolve; +pub mod v2_compiler_source_authority; pub mod v2_compiler_tokenize; pub struct NonEmptyVec(Vec); diff --git a/src/v1/stage0/src/required_regen_host.rs b/src/v1/stage0/src/required_regen_host.rs index 8eb8c176c7d..fb661dc205a 100644 --- a/src/v1/stage0/src/required_regen_host.rs +++ b/src/v1/stage0/src/required_regen_host.rs @@ -203,9 +203,21 @@ fn compile_stage0(workspace: &Path) -> Result, String> { if let Some(message) = stage0_self_compile_refusal_message(result.clone()) { return Err(message); } + // Normalize to a flat basename at insert time: emit paths are heterogeneous + // (some "src/foo.rs", some bare "Cargo.toml"), and every downstream consumer + // in this module (committed_generated_basenames, write_emitted_tree, + // verify_candidate_tree) already keys on flat basenames under stage0/src with + // no subdirectories. One normalized key-space here is the single authority; + // a prefix-then-fallback lookup at every call site is the same fact checked + // N times instead of established once. let mut out = HashMap::new(); for file in result.files.iter() { - out.insert(file.path.clone(), file.content.clone()); + let basename = Path::new(&file.path) + .file_name() + .and_then(|n| n.to_str()) + .unwrap_or(file.path.as_str()) + .to_string(); + out.insert(basename, file.content.clone()); } Ok(out) } @@ -214,14 +226,7 @@ fn generated_basenames_from_emit(emitted: &HashMap) -> Vec = BTreeSet::new(); for path in emitted.keys() { if path.ends_with(".rs") && !is_hand_maintained_path(path) { - // Basename, not the emit key: `committed_generated_basenames` keys on - // `file_name()`, and emit keys carry a `src/` prefix. Comparing the two - // key spaces made every file mismatch in both directions. - let basename = Path::new(path) - .file_name() - .and_then(|n| n.to_str()) - .unwrap_or(path); - names.insert(basename.to_string()); + names.insert(path.clone()); } } names.into_iter().collect() @@ -384,9 +389,7 @@ fn verify_hand_maintained( ) -> Result { 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 candidate = emitted.get(*file_name); let Some(candidate) = candidate else { continue; }; @@ -414,13 +417,20 @@ fn write_emitted_tree(dest_src: &Path, emitted: &HashMap) -> Res } fs::create_dir_all(dest_src).map_err(|e| format!("create {}: {e}", dest_src.display()))?; for (path, content) in emitted { + // compile_stage0 normalizes every key to a flat basename at insert time, + // so `path` here is already the basename — no join-time extraction needed. let out_path = dest_src.join(path); 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)?; - fs::write(&out_path, normalized) - .map_err(|e| format!("write {}: {e}", out_path.display()))?; + if path.ends_with(".rs") { + let normalized = normalize_generated_source(content)?; + fs::write(&out_path, normalized) + .map_err(|e| format!("write {}: {e}", out_path.display()))?; + } else { + fs::write(&out_path, content) + .map_err(|e| format!("write {}: {e}", out_path.display()))?; + } } Ok(()) } @@ -517,8 +527,27 @@ fn tree_digest_from_map( Ok(digest_label(payload.as_bytes())) } +/// rustfmt is not guaranteed idempotent on a single pass for every input: some +/// borderline formatting decisions only reach their stable shape on a second +/// pass. Comparing a once-formatted candidate against a committed file that +/// rustfmt itself would reformat further is false drift, not a real content +/// difference — so normalize to rustfmt's own fixed point (bounded, and +/// refused rather than silently accepted if rustfmt never converges) instead +/// of trusting a single pass. (Ported from gunbc#8488, which found this +/// independently while fixing the same file.) fn normalize_generated_source(content: &str) -> Result { - normalize_generated_source_attempt(content) + const MAX_PASSES: usize = 8; + let mut current = normalize_generated_source_attempt(content)?; + for _ in 1..MAX_PASSES { + let next = normalize_generated_source_attempt(¤t)?; + if next == current { + return Ok(current); + } + current = next; + } + Err(format!( + "rustfmt did not reach a fixed point within {MAX_PASSES} passes" + )) } fn normalize_generated_source_attempt(content: &str) -> Result { @@ -551,6 +580,7 @@ fn normalize_generated_source_attempt(content: &str) -> Result { } fn normalize_with_workdir(content: &str, work_dir: &Path, label: &str) -> Result { + fs::create_dir_all(work_dir).map_err(|e| format!("create {}: {e}", work_dir.display()))?; let path = work_dir.join(format!("{label}.rs")); fs::write(&path, content).map_err(|e| format!("write {}: {e}", path.display()))?; let output = Command::new("rustfmt") diff --git a/src/v1/stage0/src/std_measure.rs b/src/v1/stage0/src/std_measure.rs index e9da013627b..dd10c3eadc0 100644 --- a/src/v1/stage0/src/std_measure.rs +++ b/src/v1/stage0/src/std_measure.rs @@ -82,6 +82,7 @@ pub enum Scale { One, Sixty, RackUnitHeight, + SquareFootArea, ArcsecondAngle, DegreeAngle, TurnAngle, @@ -111,6 +112,7 @@ pub fn scale_exponent(s: Scale) -> Option { Scale::TurnAngle => None, Scale::Sixty => None, Scale::RackUnitHeight => None, + Scale::SquareFootArea => None, Scale::Kilo => Some(3), Scale::Mega => Some(6), Scale::Giga => Some(9), @@ -155,6 +157,7 @@ pub fn time_scale_factor_seconds(s: Scale) -> Option { Scale::TurnAngle => None, Scale::Sixty => Some(seconds_per_minute()), Scale::RackUnitHeight => None, + Scale::SquareFootArea => None, Scale::Atto => None, Scale::Femto => None, Scale::Pico => None, @@ -192,6 +195,7 @@ pub fn memory_scale_factor_bytes(s: Scale) -> Option { Scale::TurnAngle => None, Scale::Sixty => None, Scale::RackUnitHeight => None, + Scale::SquareFootArea => None, Scale::Kilo => None, Scale::Mega => None, Scale::Giga => None, @@ -284,6 +288,19 @@ pub type Mebibyte = Rc>; pub type Gibibyte = Rc>; +pub type Gigabyte = Rc>; + +pub fn gigabyte(count: Nat) -> Gigabyte { + Rc::new(Measure { + count: count.clone(), + _phantom: std::marker::PhantomData, + }) +} + +pub fn gigabyte_count(g: Gigabyte) -> Nat { + measure_count(g.clone()) +} + pub fn mebibyte(count: Nat) -> Mebibyte { Rc::new(Measure { count: count.clone(), @@ -318,6 +335,8 @@ pub fn bits_per_byte() -> Nat { pub type Hertz = Rc>; +pub type MegatransfersPerSecond = Rc>; + pub type HardwareThreadCount = Rc>; pub type CharacterCount = Rc>; @@ -348,6 +367,8 @@ pub type CubicMillimeter = Rc>; pub type SquareMeter = Rc>; +pub type SquareFoot = Rc>; + pub type CubicMeter = Rc>; pub type Arcsecond = Rc>; @@ -721,6 +742,16 @@ pub type MoneyPerMonth = Rc>; pub type MoneyOnce = Rc>; +#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] +pub struct PerKilowattHour(pub std::marker::PhantomData<()>); + +#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] +pub struct PerSquareFootYear(pub std::marker::PhantomData<()>); + +pub type MoneyPerKilowattHour = Rc>; + +pub type MoneyPerSquareFootYear = Rc>; + pub fn money_rate_carrier_representation_note() -> String { thread_local! { static CACHED: String = { @@ -750,6 +781,14 @@ pub fn money_once_micros(q: MoneyOnce) -> Nat { money_rate_micros(q.clone()) } +pub fn money_per_kilowatt_hour_micros(q: MoneyPerKilowattHour) -> Nat { + money_rate_micros(q.clone()) +} + +pub fn money_per_sqft_year_micros(q: MoneyPerSquareFootYear) -> Nat { + money_rate_micros(q.clone()) +} + pub fn per_hour_equivalent_from_per_minute(q: MoneyPerMinute) -> MoneyPerHour { Rc::new(MoneyRate { amount: money_amount_micro((money_per_minute_micros(q.clone()) * minutes_per_hour())), @@ -812,6 +851,17 @@ pub fn bit_width_count(b: BitWidth) -> Nat { measure_count(b.clone()) } +pub fn square_foot(count: Nat) -> SquareFoot { + Rc::new(Measure { + count: count.clone(), + _phantom: std::marker::PhantomData, + }) +} + +pub fn square_foot_count(a: SquareFoot) -> Nat { + measure_count(a.clone()) +} + pub fn hertz(count: Nat) -> Hertz { Rc::new(Measure { count: count.clone(), @@ -819,6 +869,17 @@ pub fn hertz(count: Nat) -> Hertz { }) } +pub fn megatransfers_per_second(count: Nat) -> MegatransfersPerSecond { + Rc::new(Measure { + count: count.clone(), + _phantom: std::marker::PhantomData, + }) +} + +pub fn megatransfers_per_second_count(r: MegatransfersPerSecond) -> Nat { + measure_count(r.clone()) +} + pub fn hertz_count(h: Hertz) -> Nat { measure_count(h.clone()) } @@ -1409,6 +1470,8 @@ pub struct Sixty; #[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] pub struct RackUnitHeight; #[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] +pub struct SquareFootArea; +#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] pub struct ArcsecondAngle; #[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] pub struct DegreeAngle; diff --git a/src/v1/stage0/src/std_pareto.rs b/src/v1/stage0/src/std_pareto.rs index a78e5fd22c2..d09c684bc18 100644 --- a/src/v1/stage0/src/std_pareto.rs +++ b/src/v1/stage0/src/std_pareto.rs @@ -4,9 +4,14 @@ use self::AxisComparison::*; use self::AxisGoal::*; use self::DominanceVerdict::*; +use self::PairStanding::*; +use self::ParetoStanding::*; +use self::ReadingLookup::*; pub use crate::std_algebra::Ordering; use crate::std_algebra::Ordering::*; -pub use crate::std_types::List; +pub use crate::std_decl_ref::DeclarationRef; +pub use crate::std_decl_ref::{declaration_ref_display_key, declaration_ref_eq}; +pub use crate::std_types::{List, NonEmptyStr}; use crate::v1_rt; use crate::v1_rt::{VecCompat, VecJoin}; use crate::NonEmptyBTreeSet; @@ -171,6 +176,506 @@ pub fn on_pareto_front(verdicts: Rc>) -> bool { !any_dominates(verdicts.clone()) } +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct SelectionAxis { + pub identity: Rc, + pub goal: AxisGoal, +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct AxisReading { + pub axis: Rc, + pub value_micro: i64, +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ParetoEntry { + pub identity: Rc, + pub display_label: NonEmptyStr, + pub readings: Rc>>, + pub missing_inputs: Rc>, +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct Domination { + pub candidate: Rc, + pub winning_axes: Rc>>, +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(tag = "_variant")] +pub enum ParetoStanding { + ProvisionallyNonDominated { sensitivities: Rc> }, + DominatedBy { dominators: Rc>> }, + IncomparablePendingEvidence { missing: NonEmptyStr }, + SelectionRefused { cause: NonEmptyStr }, +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(tag = "_variant")] +pub enum ReadingLookup { + ReadingFound { value_micro: i64 }, + ReadingAbsent { absent_axis: Rc }, + ReadingDuplicated { duplicated_axis: Rc }, +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(tag = "_variant")] +pub enum PairStanding { + PairDominates { + winning_axes: Rc>>, + }, + PairNoDominance, + PairRefused { + cause: NonEmptyStr, + }, +} + +pub fn reading_matches(e: Rc, wanted: Rc) -> i64 { + e.readings + .clone() + .iter() + .cloned() + .fold(0, |acc: i64, r: Rc| { + if declaration_ref_eq(r.axis.clone(), wanted.clone()) { + (acc.clone() + 1) + } else { + acc.clone() + } + }) +} + +pub fn reading_for(e: Rc, wanted: Rc) -> Rc { + { + let matches = reading_matches(e.clone(), wanted.clone()); + if (matches.clone() > 1) { + Rc::new(ReadingLookup::ReadingDuplicated { + duplicated_axis: wanted.clone(), + }) + } else { + e.readings.clone().iter().cloned().fold( + Rc::new(ReadingLookup::ReadingAbsent { + absent_axis: wanted.clone(), + }), + |acc: Rc, r: Rc| match (*acc.clone()).clone() { + ReadingLookup::ReadingFound { + value_micro: value_micro, + .. + } => acc.clone(), + ReadingLookup::ReadingDuplicated { + duplicated_axis: duplicated_axis, + .. + } => acc.clone(), + ReadingLookup::ReadingAbsent { + absent_axis: absent_axis, + .. + } => { + if declaration_ref_eq(r.axis.clone(), absent_axis.clone()) { + Rc::new(ReadingLookup::ReadingFound { + value_micro: r.value_micro.clone(), + }) + } else { + acc.clone() + } + } + }, + ) + } + } +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct PairAccum { + pub refusal_causes: Rc>, + pub a_worse_somewhere: bool, + pub winning_axes: Rc>>, +} + +pub fn no_names() -> Rc> { + thread_local! { + static CACHED: Rc> = { + serde_json::from_value(serde_json::json!([])) + .expect("valid data definition") + }; + } + CACHED.with(|c: &Rc>| c.clone()) +} + +pub fn no_axis_ids() -> Rc>> { + thread_local! { + static CACHED: Rc>> = { + serde_json::from_value(serde_json::json!([])) + .expect("valid data definition") + }; + } + CACHED.with(|c: &Rc>>| c.clone()) +} + +pub fn no_dominators() -> Rc>> { + thread_local! { + static CACHED: Rc>> = { + serde_json::from_value(serde_json::json!([])) + .expect("valid data definition") + }; + } + CACHED.with(|c: &Rc>>| c.clone()) +} + +pub fn one_name(name: String) -> Rc> { + Rc::new(vec![name.clone()]) +} + +pub fn one_axis_id(id: Rc) -> Rc>> { + Rc::new(vec![id.clone()]) +} + +pub fn accum_refusal(acc: Rc, axis: Rc, defect: String) -> Rc { + Rc::new(PairAccum { + refusal_causes: v1_rt::concat( + acc.refusal_causes.clone(), + one_name( + Rc::new(vec![ + "axis ".to_string(), + declaration_ref_display_key(axis.identity.clone()), + " ".to_string(), + defect.clone(), + ]) + .join(&"".to_string()), + ), + ), + a_worse_somewhere: acc.a_worse_somewhere.clone(), + winning_axes: acc.winning_axes.clone(), + }) +} + +pub fn accum_both_read( + acc: Rc, + axis: Rc, + a_value: i64, + b_value: i64, +) -> Rc { + match axis_comparison_int(axis.goal.clone(), a_value.clone(), b_value.clone()) { + AxisComparison::Better => Rc::new(PairAccum { + refusal_causes: acc.refusal_causes.clone(), + a_worse_somewhere: acc.a_worse_somewhere.clone(), + winning_axes: v1_rt::concat( + acc.winning_axes.clone(), + one_axis_id(axis.identity.clone()), + ), + }), + AxisComparison::Worse => Rc::new(PairAccum { + refusal_causes: acc.refusal_causes.clone(), + a_worse_somewhere: true, + winning_axes: acc.winning_axes.clone(), + }), + AxisComparison::Same => acc.clone(), + } +} + +pub fn accum_with_a( + acc: Rc, + axis: Rc, + a_value: i64, + b_read: Rc, +) -> Rc { + match (*b_read.clone()).clone() { + ReadingLookup::ReadingAbsent { + absent_axis: absent_axis, + .. + } => accum_refusal( + acc.clone(), + axis.clone(), + "has no reading on one side".to_string(), + ), + ReadingLookup::ReadingDuplicated { + duplicated_axis: duplicated_axis, + .. + } => accum_refusal( + acc.clone(), + axis.clone(), + "has duplicate readings on one side".to_string(), + ), + ReadingLookup::ReadingFound { + value_micro: value_micro, + .. + } => accum_both_read( + acc.clone(), + axis.clone(), + a_value.clone(), + value_micro.clone(), + ), + } +} + +pub fn axis_pair_step( + acc: Rc, + axis: Rc, + a: Rc, + b: Rc, +) -> Rc { + { + let a_read = reading_for(a.clone(), axis.identity.clone()); + match (*a_read.clone()).clone() { + ReadingLookup::ReadingAbsent { + absent_axis: absent_axis, + .. + } => accum_refusal( + acc.clone(), + axis.clone(), + "has no reading on one side".to_string(), + ), + ReadingLookup::ReadingDuplicated { + duplicated_axis: duplicated_axis, + .. + } => accum_refusal( + acc.clone(), + axis.clone(), + "has duplicate readings on one side".to_string(), + ), + ReadingLookup::ReadingFound { + value_micro: value_micro, + .. + } => accum_with_a( + acc.clone(), + axis.clone(), + value_micro.clone(), + reading_for(b.clone(), axis.identity.clone()), + ), + } + } +} + +pub fn pair_from_accum(folded: Rc) -> Rc { + if ((folded.refusal_causes.clone().len() as i64) > 0) { + Rc::new(PairStanding::PairRefused { + cause: folded.refusal_causes.clone().join(&" ; ".to_string()), + }) + } else { + if folded.a_worse_somewhere.clone() { + Rc::new(PairStanding::PairNoDominance) + } else { + if ((folded.winning_axes.clone().len() as i64) > 0) { + Rc::new(PairStanding::PairDominates { + winning_axes: folded.winning_axes.clone(), + }) + } else { + Rc::new(PairStanding::PairNoDominance) + } + } + } +} + +pub fn compare_pair( + a: Rc, + b: Rc, + axes: Rc>>, +) -> Rc { + pair_from_accum(axes.clone().iter().cloned().fold( + Rc::new(PairAccum { + refusal_causes: no_names(), + a_worse_somewhere: false, + winning_axes: no_axis_ids(), + }), + |acc: Rc, axis: Rc| { + axis_pair_step(acc, axis.clone(), a.clone(), b.clone()) + }, + )) +} + +pub fn pair_dominates( + a: Rc, + b: Rc, + axes: Rc>>, +) -> bool { + match (*compare_pair(a.clone(), b.clone(), axes.clone())).clone() { + PairStanding::PairDominates { + winning_axes: winning_axes, + .. + } => true, + PairStanding::PairNoDominance => false, + PairStanding::PairRefused { cause: cause, .. } => false, + } +} + +pub fn count_axis_identity(axes: Rc>>, id: Rc) -> i64 { + axes.clone() + .iter() + .cloned() + .fold(0, |acc: i64, ax: Rc| { + if declaration_ref_eq(ax.identity.clone(), id.clone()) { + (acc.clone() + 1) + } else { + acc.clone() + } + }) +} + +pub fn axes_have_duplicate_identity(axes: Rc>>) -> bool { + axes.clone() + .iter() + .cloned() + .fold(false, |acc: bool, ax: Rc| { + (acc || (count_axis_identity(axes.clone(), ax.identity.clone()) > 1)) + }) +} + +pub fn count_entry_identity(field: Rc>>, id: Rc) -> i64 { + field + .clone() + .iter() + .cloned() + .fold(0, |acc: i64, e: Rc| { + if declaration_ref_eq(e.identity.clone(), id.clone()) { + (acc.clone() + 1) + } else { + acc.clone() + } + }) +} + +pub fn field_has_duplicate_identity(field: Rc>>) -> bool { + field + .clone() + .iter() + .cloned() + .fold(false, |acc: bool, e: Rc| { + (acc || (count_entry_identity(field.clone(), e.identity.clone()) > 1)) + }) +} + +pub fn challenger_applies(subject: Rc, other: Rc) -> bool { + (!declaration_ref_eq(other.identity.clone(), subject.identity.clone()) + && ((other.missing_inputs.clone().len() as i64) == 0)) +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct FieldAccum { + pub refusal_causes: Rc>, + pub dominators: Rc>>, +} + +pub fn one_domination(d: Rc) -> Rc>> { + Rc::new(vec![d.clone()]) +} + +pub fn field_step( + subject: Rc, + other: Rc, + axes: Rc>>, + acc: Rc, +) -> Rc { + if challenger_applies(subject.clone(), other.clone()) { + match (*compare_pair(other.clone(), subject.clone(), axes.clone())).clone() { + PairStanding::PairDominates { winning_axes: winning_axes, .. } => Rc::new(FieldAccum { + refusal_causes: acc.refusal_causes.clone(), + dominators: v1_rt::concat(acc.dominators.clone(), one_domination(Rc::new(Domination { + candidate: other.identity.clone(), + winning_axes: winning_axes.clone(), +}))), +}), + PairStanding::PairNoDominance => acc.clone(), + PairStanding::PairRefused { cause: cause, .. } => Rc::new(FieldAccum { + refusal_causes: v1_rt::concat(acc.refusal_causes.clone(), one_name(Rc::new(vec!["comparison against ".to_string(), declaration_ref_display_key(other.identity.clone()), " refused - ".to_string(), cause.clone(), " - a field entry lacking a funded-axis reading while declaring complete inputs is a projector contradiction, and no standing in its field is computable until it is fixed".to_string()]).join(&"".to_string()))), + dominators: acc.dominators.clone(), +}), +} + } else { + acc.clone() + } +} + +pub fn standing_from_accum( + folded: Rc, + sensitivities: Rc>, +) -> Rc { + if ((folded.refusal_causes.clone().len() as i64) > 0) { + Rc::new(ParetoStanding::IncomparablePendingEvidence { + missing: folded.refusal_causes.clone().join(&" ; ".to_string()), + }) + } else { + if ((folded.dominators.clone().len() as i64) > 0) { + Rc::new(ParetoStanding::DominatedBy { + dominators: folded.dominators.clone(), + }) + } else { + Rc::new(ParetoStanding::ProvisionallyNonDominated { + sensitivities: sensitivities.clone(), + }) + } + } +} + +pub fn entry_standing( + subject: Rc, + field: Rc>>, + axes: Rc>>, + sensitivities: Rc>, +) -> Rc { + if axes_have_duplicate_identity(axes.clone()) { + Rc::new(ParetoStanding::SelectionRefused { + cause: "two selection axes share one identity - a duplicate axis would resolve first-one-wins, so the selection refuses".to_string(), +}) + } else { + if field_has_duplicate_identity(field.clone()) { + Rc::new(ParetoStanding::SelectionRefused { + cause: "two field entries share one candidate identity - a duplicate would be skipped as self-comparison, so the selection refuses".to_string(), +}) + } else { + if ((subject.missing_inputs.clone().len() as i64) > 0) { + Rc::new(ParetoStanding::IncomparablePendingEvidence { + missing: subject.missing_inputs.clone().join(&" ; ".to_string()), + }) + } else { + standing_from_accum( + field.clone().iter().cloned().fold( + Rc::new(FieldAccum { + refusal_causes: no_names(), + dominators: no_dominators(), + }), + |acc: Rc, other: Rc| { + field_step(subject.clone(), other.clone(), axes.clone(), acc) + }, + ), + sensitivities.clone(), + ) + } + } + } +} + +pub fn dominator_names(dominators: Rc>>) -> Rc> { + dominators.clone().iter().cloned().fold( + no_names(), + |acc: Rc>, d: Rc| { + v1_rt::concat( + acc, + one_name(declaration_ref_display_key(d.candidate.clone())), + ) + }, + ) +} + +pub fn pareto_label(s: Rc) -> String { + match (*s.clone()).clone() { + ParetoStanding::ProvisionallyNonDominated { + sensitivities: sensitivities, + .. + } => "on the frontier".to_string(), + ParetoStanding::DominatedBy { + dominators: dominators, + .. + } => Rc::new(vec![ + "dominated by ".to_string(), + dominator_names(dominators.clone()).join(&", ".to_string()), + ]) + .join(&"".to_string()), + ParetoStanding::IncomparablePendingEvidence { + missing: missing, .. + } => "not computable".to_string(), + ParetoStanding::SelectionRefused { cause: cause, .. } => "selection refused".to_string(), + } +} + #[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] pub struct Dominates; #[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] diff --git a/src/v1/stage0/src/std_witness_admission.rs b/src/v1/stage0/src/std_witness_admission.rs index 2cf75f3771f..2f2a90b626d 100644 --- a/src/v1/stage0/src/std_witness_admission.rs +++ b/src/v1/stage0/src/std_witness_admission.rs @@ -20,7 +20,7 @@ use std::rc::Rc; pub fn witness_admission_authority_note() -> String { thread_local! { static CACHED: String = { - "Phase 0(b) admission invariant (docs/plans/module-identity-storage-binding-design.md): every enrolled witness row names an executing consumer — discovery rows run per selection; SelfEmitted receipts run on the falsifier wet cadence; known-red quarantined rows run on a probe cadence expecting red (greening is a counted un-quarantine event); operator-ruled OFFLINE rows carry an explicit local-recipe consumer. Enrolled-with-zero-consumers is a typed refusal, never silent. The prior dissolve-on FIRED 2026-07-22: witness exclusion rows now carry derived consumer classification on this module's WitnessConsumerCadence authority (gunbc.ci_layer_roots.witness_exclusion_frontier; group-of-units ruling, gunbc.roster_registry). Homed in dag/std (std.witness_admission) so dag-tree consumers resolve it in dag-only closures — the authority moved here from src/v2/std 2026-07-23 when gunbc.ci_layer_roots became a consumer. This module remains the cadence vocabulary authority; dissolves into the enforcement-intent registry when that thread lands.".to_string() + "Phase 0(b) admission invariant (docs/plans/module-identity-storage-binding-design.md): every enrolled witness row names an executing consumer — discovery rows run per selection; SelfEmitted receipts run on the falsifier wet cadence; known-red quarantined rows run on a probe cadence expecting red (greening is a counted un-quarantine event); operator-ruled OFFLINE rows carry an explicit local-recipe consumer. Enrolled-with-zero-consumers is a typed refusal, never silent. The prior dissolve-on FIRED 2026-07-22: witness exclusion rows now carry derived consumer classification on this module's WitnessConsumerCadence authority (gunbc.ci_layer_roots.witness_exclusion_frontier; group-of-units ruling, gunbc.roster_registry). Homed in dag/std (std.witness_admission) so dag-tree consumers resolve it in dag-only closures — the authority moved here from src/v2/std 2026-07-23 when gunbc.ci_layer_roots became a consumer. This module remains the cadence vocabulary authority; dissolves into the enforcement-intent registry when that thread lands.\n\nLIVE-EXECUTION CAVEAT (2026-08-19, dashboard node adhoc-1eb1a9f9-ad9; operator ruling relayed by royal-hawk-392, revised same day to withdraw an earlier restore-the-executor instruction): the sentence above describes what each cadence arm MEANS, not that a scheduler for it is currently running. falsifier.yml, the workflow that scheduled FalsifierSelfHostWet / FalsifierRehomedBinWet / FalsifierSubstrateLongLane / BinWitnessWet / QuarantineProbeExpectRed, was deleted at 611fd02770 (2026-08-15, #8283) — FLOOR-Y's deliberate cut, which reserved re-adding a scheduled executor for a separate future operator agreement rather than restoring or improvising one here. Cadence membership (WitnessConsumerCadence) is a classification of WHICH policy claims a row and stays correct; it is not proof anything executes that row — v2.workflow.witness_admission witness_execution_standing_for_row answers coverage only through DeclaredCadenceUnrealized | WitnessHasExecutingConsumer, gated on a closed per-cadence predicate naming which of the nine cadences presently have a live scheduled route (today: DiscoverySelection, OfflineLocalRecipe, FixtureExplicitRoster only), never on enum membership alone and never on a registry carrier — no WitnessCadenceRealization mechanism exists or is planned by this change. This is a RETROSPECTIVE declaration, not a new drop: the five falsifier-family cadences above lost their executing consumer at 611fd02770/#8283, and every row classified into one of them has read as covered ever since despite executing nowhere. DeclaredCadenceUnrealized types that gap rather than closing it; restoring a scheduled route for any of these cadences is a separate, later operator decision, not implied by this note.".to_string() }; } CACHED.with(|c: &String| c.clone()) @@ -146,6 +146,29 @@ pub fn witness_consumer_cadence_eq(a: WitnessConsumerCadence, b: WitnessConsumer } } +pub fn witness_cadence_has_scheduled_route_note() -> String { + thread_local! { + static CACHED: String = { + "THE CLOSED PER-CADENCE REALIZATION GATE (added 2026-08-19, dashboard node adhoc-1eb1a9f9-ad9). Cadence membership answers WHICH POLICY a row belongs to; this answers whether that policy currently has anything executing it. It is an exhaustive match over the nine WitnessConsumerCadence arms, not a registry carrier — no WitnessCadenceRealization mechanism exists, per the operator's explicit reversal of an earlier instruction to build one. Today exactly three arms have a live scheduled route: DiscoverySelection (per-PR discovery), OfflineLocalRecipe (an explicit local-recipe consumer is, by definition, the executing consumer), and FixtureExplicitRoster (an explicit admission row IS the enrollment). The five falsifier-family arms — FalsifierSelfHostWet, FalsifierRehomedBinWet, FalsifierSubstrateLongLane, BinWitnessWet, QuarantineProbeExpectRed — return false: falsifier.yml, the workflow that scheduled all five, was deleted at 611fd02770 (2026-08-15, #8283), and no replacement executor exists. NoConsumer also returns false and is unreachable at the one call site that consults this gate, since that site only reaches it after NoConsumer has already been dispatched separately. Restoring a scheduled route for any of the five is a separate, later, explicitly-agreed operator decision — this gate is the mechanical fact of today's state, not a policy choice made here.".to_string() + }; + } + CACHED.with(|c: &String| c.clone()) +} + +pub fn witness_cadence_has_scheduled_route(cadence: WitnessConsumerCadence) -> bool { + match cadence.clone() { + WitnessConsumerCadence::DiscoverySelection => true, + WitnessConsumerCadence::FalsifierSelfHostWet => false, + WitnessConsumerCadence::FalsifierRehomedBinWet => false, + WitnessConsumerCadence::FalsifierSubstrateLongLane => false, + WitnessConsumerCadence::BinWitnessWet => false, + WitnessConsumerCadence::QuarantineProbeExpectRed => false, + WitnessConsumerCadence::OfflineLocalRecipe => true, + WitnessConsumerCadence::FixtureExplicitRoster => true, + WitnessConsumerCadence::NoConsumer => false, + } +} + pub fn witness_consumer_cadence_content_hash_structural( cadence: WitnessConsumerCadence, ) -> Rc { @@ -264,7 +287,7 @@ impl WitnessExpectedVerdict { pub fn witness_execution_standing_axis_note() -> String { thread_local! { static CACHED: String = { - "TWO INDEPENDENT AXES, because ALLOWED TO REMAIN and HAS AN EXECUTING CONSUMER are different facts and one success arm cannot carry both (operator ruling on gunbc#7804, 2026-08-04). The first shape of the freeze wall returned WitnessAdmissionHolds — the same arm an executing consumer returns — for a frozen legacy row, and then reported the live gate green as evidence that every current row is admitted. But a frozen row has NO executing consumer; that is the entire content of its debt. Freezing establishes that the unexecuted hole existed at the cut and cannot grow. It does not establish coverage, and returning the success arm made the same fact answer differently depending on which door it entered: exact function-grain admission correctly REFUSES OfflineLocalRecipe because a local recipe is not an executing cadence, while path policy was returning success for exactly that.\n\nAXIS ONE — WitnessExecutionStanding, what actually runs this witness. WitnessHasExecutingConsumer is the only arm that means covered, and it carries WHICH cadence so the claim is checkable rather than a bare yes. LegacyFrozenPathDeferral means the identity is in the frozen baseline: tolerated by the migration ratchet, NOT covered, and anything downstream asking whether the behavior is covered must receive no from this arm. UnclassifiedPathDeferral is a row a broad OfflineLocalRecipe path policy claims but the freeze does not — the forward hole, refused. UnexecutedDeferredWitness is a row nothing claims at all; its remedy is to name a cadence or delete the witness, and it is nearly empty while the path-policy class is in the hundreds, which is why one arm would have hidden the larger population behind the rarer one.\n\nAXIS TWO — FrozenBaselineStanding, whether the migration ratchet still holds, a property of the ROSTER rather than of any row. Allowed and Shrank both permit the tolerated arm; Grew and Stale refuse regardless of any individual row, because a baseline that grew is the escape hatch reopening and a baseline naming a departed witness is an exemption the next witness to take that name inherits.\n\nTHE GATES DERIVE, and they are deliberately different: the coverage question admits ONLY WitnessHasExecutingConsumer, so seven hundred dark witnesses never read as covered; the floor gate additionally tolerates LegacyFrozenPathDeferral while axis two holds, so the tree stays green under the ratchet without anything claiming those rows execute.".to_string() + "TWO INDEPENDENT AXES, because ALLOWED TO REMAIN and HAS AN EXECUTING CONSUMER are different facts and one success arm cannot carry both (operator ruling on gunbc#7804, 2026-08-04). The first shape of the freeze wall returned WitnessAdmissionHolds — the same arm an executing consumer returns — for a frozen legacy row, and then reported the live gate green as evidence that every current row is admitted. But a frozen row has NO executing consumer; that is the entire content of its debt. Freezing establishes that the unexecuted hole existed at the cut and cannot grow. It does not establish coverage, and returning the success arm made the same fact answer differently depending on which door it entered: exact function-grain admission correctly REFUSES OfflineLocalRecipe because a local recipe is not an executing cadence, while path policy was returning success for exactly that.\n\nAXIS ONE — WitnessExecutionStanding, what actually runs this witness. WitnessHasExecutingConsumer is the only arm that means covered, and it carries WHICH cadence so the claim is checkable rather than a bare yes. LegacyFrozenPathDeferral means the identity is in the frozen baseline: tolerated by the migration ratchet, NOT covered, and anything downstream asking whether the behavior is covered must receive no from this arm. UnclassifiedPathDeferral is a row a broad OfflineLocalRecipe path policy claims but the freeze does not — the forward hole, refused. UnexecutedDeferredWitness is a row nothing claims at all; its remedy is to name a cadence or delete the witness, and it is nearly empty while the path-policy class is in the hundreds, which is why one arm would have hidden the larger population behind the rarer one.\n\nAXIS TWO — FrozenBaselineStanding, whether the migration ratchet still holds, a property of the ROSTER rather than of any row. Allowed and Shrank both permit the tolerated arm; Grew and Stale refuse regardless of any individual row, because a baseline that grew is the escape hatch reopening and a baseline naming a departed witness is an exemption the next witness to take that name inherits.\n\nTHE GATES DERIVE, and they are deliberately different: the coverage question admits ONLY WitnessHasExecutingConsumer, so seven hundred dark witnesses never read as covered; the floor gate additionally tolerates LegacyFrozenPathDeferral while axis two holds, so the tree stays green under the ratchet without anything claiming those rows execute.\n\nAXIS ONE, FIFTH ARM (added 2026-08-19, dashboard node adhoc-1eb1a9f9-ad9): DeclaredCadenceUnrealized is distinct from every other refusing arm because it is not a path-policy classification at all — it is an explicit or legacy roster row whose cadence names a real policy (FalsifierSelfHostWet, FalsifierRehomedBinWet, FalsifierSubstrateLongLane, BinWitnessWet, QuarantineProbeExpectRed today) that currently has no scheduled executing route, since falsifier.yml was deleted at 611fd02770 (#8283). It differs from UnexecutedDeferredWitness (nothing claims the row) and from LegacyFrozenPathDeferral (a path-policy tolerance, not a named cadence): here a cadence claims the row and would cover it once realized, but does not today. Like every refusing arm it reads false from both witness_has_executing_consumer and witness_floor_admission_holds — a declared-but-unrealized cadence is not floor-tolerated debt, it is an uncovered gap that happens to already have a name.".to_string() }; } CACHED.with(|c: &String| c.clone()) @@ -273,10 +296,26 @@ pub fn witness_execution_standing_axis_note() -> String { #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[serde(tag = "_variant")] pub enum WitnessExecutionStanding { - WitnessHasExecutingConsumer { cadence: WitnessConsumerCadence }, - LegacyFrozenPathDeferral { entry: String, function: String }, - UnclassifiedPathDeferral { entry: String, function: String }, - UnexecutedDeferredWitness { entry: String, function: String }, + WitnessHasExecutingConsumer { + cadence: WitnessConsumerCadence, + }, + LegacyFrozenPathDeferral { + entry: String, + function: String, + }, + UnclassifiedPathDeferral { + entry: String, + function: String, + }, + UnexecutedDeferredWitness { + entry: String, + function: String, + }, + DeclaredCadenceUnrealized { + cadence: WitnessConsumerCadence, + entry: String, + function: String, + }, } #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] diff --git a/src/v1/stage0/src/v1_compiler_infer.rs b/src/v1/stage0/src/v1_compiler_infer.rs index b51fcb2eaa9..df05667bb76 100644 --- a/src/v1/stage0/src/v1_compiler_infer.rs +++ b/src/v1/stage0/src/v1_compiler_infer.rs @@ -147,6 +147,7 @@ pub use crate::v1_compiler_infer_types::{ pub use crate::v1_compiler_resolve::{ModuleGraph, ResolvedImport, ResolvedModule}; use crate::v1_rt; use crate::v1_rt::{VecCompat, VecJoin}; +pub use crate::v1_std_core::expr_is_any_literal; use crate::v1_std_core::CallSemantics::{ FunctionValueCallSemantics, LookupCallSemantics, PlainCallSemantics, }; @@ -2350,14 +2351,20 @@ pub fn where_refinement_diags_for_predicate( } } }, - None => Rc::new(vec![where_refinement_unenforced_error( - pname.clone(), - formal.clone(), - "non-literal value at refined position".to_string(), - span.clone(), - module_name.clone(), - source_indices.clone(), - )]), + None => { + if expr_is_any_literal(value_expr.clone()) { + refinement_refusal + } else { + Rc::new(vec![where_refinement_unenforced_error( + pname.clone(), + formal.clone(), + "non-literal value at refined position".to_string(), + span.clone(), + module_name.clone(), + source_indices.clone(), + )]) + } + } } } else { if where_refinement_is_string_literal_predicate(pname.clone()) { @@ -2381,14 +2388,20 @@ pub fn where_refinement_diags_for_predicate( )]), } } - None => Rc::new(vec![where_refinement_unenforced_error( - pname.clone(), - formal.clone(), - "non-literal value at refined position".to_string(), - span.clone(), - module_name.clone(), - source_indices.clone(), - )]), + None => { + if expr_is_any_literal(value_expr.clone()) { + refinement_refusal + } else { + Rc::new(vec![where_refinement_unenforced_error( + pname.clone(), + formal.clone(), + "non-literal value at refined position".to_string(), + span.clone(), + module_name.clone(), + source_indices.clone(), + )]) + } + } } } else { if where_refinement_is_deferred_predicate(pname.clone()) { @@ -2557,17 +2570,7 @@ pub fn kernel_value_declared_type_mismatch( false } else { { - let formal_base = if (((formal.connective.clone() == Connective::Conj) - && (formal.type_annotation.clone() != None)) - && ((formal.children.clone().len() as i64) == 1)) - { - match formal.children.clone().first().cloned() { - Some(refinement_base) => refinement_base.clone(), - None => formal.clone(), - } - } else { - formal.clone() - }; + let formal_base = peel_where_refinement_base(formal.clone(), type_env.clone()); let actual_name = authored_name_at(source_indices.clone(), actual.clone()); if ((is_kernel_type(actual_name.clone()) == false) || (actual_name.clone() == "Unit".to_string())) @@ -2804,12 +2807,30 @@ pub fn structured_application_site_type_mismatch( ) -> bool { match (*actual_expr.expr_data.clone()).clone() { ExprData::ExprRecordLit { parent_enum: _, .. } => { - let source_indices = scope.type_env.clone().source_indices.clone(); - let formal_peeled = peel_nominal_alias_identity( + structured_application_site_type_mismatch_with_peeled( formal.clone(), - scope.type_env.clone(), - scope.module_name.clone(), - ); + peel_nominal_alias_identity( + formal.clone(), + scope.type_env.clone(), + scope.module_name.clone(), + ), + actual_expr.clone(), + scope.clone(), + ) + } + _ => false, + } +} + +pub fn structured_application_site_type_mismatch_with_peeled( + formal: Rc, + formal_peeled: Rc, + actual_expr: Rc, + scope: Rc, +) -> bool { + match (*actual_expr.expr_data.clone()).clone() { + ExprData::ExprRecordLit { parent_enum: _, .. } => { + let source_indices = scope.type_env.clone().source_indices.clone(); if type_node_is_callable(formal_peeled.clone()) { false } else { @@ -3090,8 +3111,9 @@ pub fn direct_call_structured_application_mismatch_diags( match app.matched_arg.clone() { Some(ta) => { let actual_expr = arg_value(ta.clone()); - if (structured_application_site_type_mismatch( + if (structured_application_site_type_mismatch_with_peeled( formal_subst.clone(), + formal.clone(), actual_expr.clone(), scope.clone(), ) diff --git a/src/v1/stage0/src/v1_std_core.rs b/src/v1/stage0/src/v1_std_core.rs index b7f5d9a2bab..4bda4277af6 100644 --- a/src/v1/stage0/src/v1_std_core.rs +++ b/src/v1/stage0/src/v1_std_core.rs @@ -2593,6 +2593,32 @@ pub fn expr_literal_string_optional(expr: Rc) -> Option { } } +pub fn expr_is_any_literal(mut expr: Rc) -> bool { + loop { + match (*expr.expr_data.clone()).clone() { + ExprData::ExprLiteral { value: lit, .. } => match (*lit.clone()).clone() { + LiteralValue::LitNull => { + break false; + } + _ => { + break true; + } + }, + ExprData::ExprUnaryOp { + op: UnaryOpKind::Neg, + .. + } => { + let __tco_0 = unaryop_operand(expr); + expr = __tco_0; + continue; + } + _ => { + break false; + } + } + } +} + pub fn record_lit_expr_optional(expr: Rc) -> Option> { match (*expr.expr_data.clone()).clone() { ExprData::ExprRecordLit { parent_enum: _, .. } => Some(expr.clone()), diff --git a/src/v2/compiler/self_host/stage0_crate_layout.dag b/src/v2/compiler/self_host/stage0_crate_layout.dag index 323df39686e..33254668745 100644 --- a/src/v2/compiler/self_host/stage0_crate_layout.dag +++ b/src/v2/compiler/self_host/stage0_crate_layout.dag @@ -55,11 +55,26 @@ data seed_retained_intrinsic_registrations: List = [ SeedRetainedSupportDirRegistration { basename: "cli_run" } ] @@ -76,6 +91,8 @@ data seed_retained_scaffold_registrations: List List { if row.has_pub_mod { [row.basename]