diff --git a/dag/gunbc/ci_layer_roots.dag b/dag/gunbc/ci_layer_roots.dag index 95a7982032f..31ac5a0ad01 100644 --- a/dag/gunbc/ci_layer_roots.dag +++ b/dag/gunbc/ci_layer_roots.dag @@ -40,6 +40,7 @@ data witness_exclusion_substrings: List = [ "self_host_discovery_enumeration_behavioral_witness_test.dag", "self_host_target_carriers_behavioral_witness_test.dag", "self_host_body_producer_behavioral_witness_test.dag", + "self_host_03_resolve_behavioral_witness_test.dag", "dag_collect_fingerprint_witness_test.dag", "dag_compile_clean_perturb_receipts_test.dag", "test/claim/diagnostics_test.dag", diff --git a/dag/gunbc/stage0_crate_layout_generated.dag b/dag/gunbc/stage0_crate_layout_generated.dag index 5a89aad2f0a..f52f339bdc7 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.frontier; regen via dag/tools/generated_artifact_gate.dag main_wet." -data generated_pub_mod_block: String = "\npub mod v1_interpreter;\npub mod cli_run;\npub mod coproduct_reflection;\npub mod resolved_graph_cache;\npub mod shared_typecheck_store;\npub mod recorded_fixture;\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_body_producer;\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;" +data generated_pub_mod_block: String = "\npub mod v1_interpreter;\npub mod cli_run;\npub mod coproduct_reflection;\npub mod resolved_graph_cache;\npub mod shared_typecheck_store;\npub mod recorded_fixture;\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_body_producer;\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;" data generated_pub_mod_basenames: List = [ "v1_interpreter", @@ -18,6 +18,7 @@ data generated_pub_mod_basenames: List = [ "usv_pilot_v2_std_algebra", "usv_pilot_v2_std_collection", "usv_pilot_v2_std_node", + "v2_compiler_resolve", "v2_compiler_body_producer", "v2_compiler_target_carriers", "v2_compiler_discovery_enumeration", @@ -40,6 +41,7 @@ data generated_stage0_filenames: List = [ "usv_pilot_v2_std_algebra.rs", "usv_pilot_v2_std_collection.rs", "usv_pilot_v2_std_node.rs", + "v2_compiler_resolve.rs", "v2_compiler_body_producer.rs", "v2_compiler_target_carriers.rs", "v2_compiler_discovery_enumeration.rs", diff --git a/dag/test/claim/self_host_03_resolve_behavioral_witness_test.dag b/dag/test/claim/self_host_03_resolve_behavioral_witness_test.dag new file mode 100644 index 00000000000..681377d153e --- /dev/null +++ b/dag/test/claim/self_host_03_resolve_behavioral_witness_test.dag @@ -0,0 +1,9 @@ +module test.claim.self_host_03_resolve_behavioral_witness + +import tools.self_host_03_resolve_behavioral_transport { sr_behavioral_receipt_holds } + +data self_host_03_resolve_behavioral_witness_doc: String = "Wet self-host behavioral receipt probe for Wave 2 parallel flip (03_resolve): compares gunbc-emitted vs seed arrow_domain_param_scoping_note (03_resolve.dag module authority constant); --inject-fault perturbs emitted comparison (not driver flag). Full resolve-tree walk deferred until emit surface greens (#6775). Live host effects — enroll when frontier flips SelfEmitted with binding." + +test fn self_host_03_resolve_behavioral_receipt_holds() -> Bool { + sr_behavioral_receipt_holds() +} diff --git a/dag/tools/self_host_03_resolve_behavioral_transport.dag b/dag/tools/self_host_03_resolve_behavioral_transport.dag new file mode 100644 index 00000000000..9e2da0209ba --- /dev/null +++ b/dag/tools/self_host_03_resolve_behavioral_transport.dag @@ -0,0 +1,29 @@ +module tools.self_host_03_resolve_behavioral_transport + +import tools.self_host_curated_seed_linked_harness { cssl_seed_linked_behavioral_receipt } +import v2.std.collection { List } +import std.logic { Bool } + +data sr_doc: String = "Wave 2 parallel flip (03_resolve self-emit): curated seed-linked behavioral receipt via tools.self_host_curated_seed_linked_harness. Emit ONLY v2.compiler.resolve via gunbc compile --entry; runtime gunbc closure (empty shim_lib + shim_writes) — no committed frozen dep snapshots. Seed oracle: v1_compiler::v2_compiler_resolve in src/v1/stage0 (exported module-authority constants from 03_resolve.dag). Witness compares emitted vs seed on arrow_domain_param_scoping_note with inject-fault perturbing emitted side (parse_engine_hooks pattern). Full resolve-tree behavioral oracle deferred until post-#6775 Rc/Optional emit surface greens. Frontier NOT flipped until rustc-green receipt." + +data sr_emit_surface_note: String = "emit-surface rustc refusal probe (03_resolve entry): gunbc compile --entry is clean (0 diagnostics); cargo is the honest gate. Runtime emit supplies dep closure." + +data sr_source_rel: String = "src/v2/compiler/03_resolve.dag" + +data sr_shim_driver_rel: String = "dag/tools/self_host_03_resolve_shims/witness_main.rs" + +data sr_scaffold_dissolution_trigger: String = "dissolve-on: dag/tools/self_host_03_resolve_shims/witness_main.rs + sr harness transport. DISSOLVES WHEN modeled self-host behavioral-equivalence harness emits comparison driver + manifest." + +data sr_receipt_pass_marker: String = "SELF_HOST_03_RESOLVE_BEHAVIORAL_RECEIPT: PASS" + +fn sr_behavioral_receipt_holds() -> Bool { + cssl_seed_linked_behavioral_receipt( + source_rel: sr_source_rel, + shim_lib_rel: "", + shim_writes: [], + driver_rel: sr_shim_driver_rel, + pass_marker: sr_receipt_pass_marker, + claim_entry_rel: "", + claim_function: "" + ) +} diff --git a/dag/tools/self_host_03_resolve_shims/witness_main.rs b/dag/tools/self_host_03_resolve_shims/witness_main.rs new file mode 100644 index 00000000000..2c5b86d0432 --- /dev/null +++ b/dag/tools/self_host_03_resolve_shims/witness_main.rs @@ -0,0 +1,32 @@ +use v1_compiled::v2_compiler_resolve as emitted; +use v1_compiler::v2_compiler_resolve as seed; + +fn sym_eq(a: &str, b: &str) -> bool { + a == b +} + +fn main() { + let inject_fault = std::env::args().any(|a| a == "--inject-fault"); + let cases: [(&str, String, String); 1] = [( + "arrow_domain_param_scoping_note", + emitted::arrow_domain_param_scoping_note(), + seed::arrow_domain_param_scoping_note(), + )]; + let mut all_pass = true; + for (i, (label, e, s)) in cases.iter().enumerate() { + let e_cmp = if inject_fault && i == 0 { + "INJECTED_FAULT".to_string() + } else { + e.clone() + }; + let ok = sym_eq(&e_cmp, s); + println!("{label} emitted_len={} seed_len={} eq={ok}", e_cmp.len()); + all_pass &= ok; + } + if all_pass { + println!("SELF_HOST_03_RESOLVE_BEHAVIORAL_RECEIPT: PASS"); + std::process::exit(0); + } + println!("SELF_HOST_03_RESOLVE_BEHAVIORAL_RECEIPT: FAIL"); + std::process::exit(1); +} 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 4e56c36153d..70e33d1e4cc 100644 --- a/src/v1/stage0/src/bootstrap_stage0_crate_layout_generated.rs +++ b/src/v1/stage0/src/bootstrap_stage0_crate_layout_generated.rs @@ -17,6 +17,7 @@ pub const HAND_MAINTAINED_STAGE0_FILES: &[&str] = &[ "usv_pilot_v2_std_algebra.rs", "usv_pilot_v2_std_collection.rs", "usv_pilot_v2_std_node.rs", + "v2_compiler_resolve.rs", "v2_compiler_body_producer.rs", "v2_compiler_target_carriers.rs", "v2_compiler_discovery_enumeration.rs", 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 8ee54e39597..e41fe8bd388 100644 --- a/src/v1/stage0/src/gunbc_stage0_crate_layout_generated.rs +++ b/src/v1/stage0/src/gunbc_stage0_crate_layout_generated.rs @@ -23,7 +23,7 @@ pub fn stage0_crate_layout_generated_note() -> String { pub fn generated_pub_mod_block() -> String { thread_local! { static CACHED: String = { - "\npub mod v1_interpreter;\npub mod cli_run;\npub mod coproduct_reflection;\npub mod resolved_graph_cache;\npub mod shared_typecheck_store;\npub mod recorded_fixture;\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_body_producer;\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;".to_string() + "\npub mod v1_interpreter;\npub mod cli_run;\npub mod coproduct_reflection;\npub mod resolved_graph_cache;\npub mod shared_typecheck_store;\npub mod recorded_fixture;\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_body_producer;\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;".to_string() }; } CACHED.with(|c: &String| c.clone()) @@ -32,7 +32,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(), "coproduct_reflection".to_string(), "resolved_graph_cache".to_string(), "shared_typecheck_store".to_string(), "recorded_fixture".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_body_producer".to_string(), "v2_compiler_target_carriers".to_string(), "v2_compiler_discovery_enumeration".to_string(), "v2_compiler_parse_engine_hooks".to_string(), "v2_compiler_use_site_verdict".to_string()]) + Rc::new(vec!["v1_interpreter".to_string(), "cli_run".to_string(), "coproduct_reflection".to_string(), "resolved_graph_cache".to_string(), "shared_typecheck_store".to_string(), "recorded_fixture".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_body_producer".to_string(), "v2_compiler_target_carriers".to_string(), "v2_compiler_discovery_enumeration".to_string(), "v2_compiler_parse_engine_hooks".to_string(), "v2_compiler_use_site_verdict".to_string()]) }; } CACHED.with(|c: &Rc>| c.clone()) @@ -41,7 +41,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(), "cli_run.rs".to_string(), "coproduct_reflection.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(), "memory_governor.rs".to_string(), "std_lens_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_body_producer.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()]) + Rc::new(vec!["v1_interpreter.rs".to_string(), "cli_run.rs".to_string(), "coproduct_reflection.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(), "memory_governor.rs".to_string(), "std_lens_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_body_producer.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()]) }; } CACHED.with(|c: &Rc>| c.clone()) diff --git a/src/v1/stage0/src/lib.rs b/src/v1/stage0/src/lib.rs index 9b97f61ec62..1e85e06352f 100644 --- a/src/v1/stage0/src/lib.rs +++ b/src/v1/stage0/src/lib.rs @@ -120,6 +120,7 @@ pub mod v1_test_non_ascii_perf_fixture; pub mod v2_compiler_body_producer; pub mod v2_compiler_discovery_enumeration; pub mod v2_compiler_parse_engine_hooks; +pub mod v2_compiler_resolve; pub mod v2_compiler_target_carriers; pub mod v2_compiler_use_site_verdict; pub mod wt_a; diff --git a/src/v1/stage0/src/v2_compiler_resolve.rs b/src/v1/stage0/src/v2_compiler_resolve.rs new file mode 100644 index 00000000000..a526c953cdd --- /dev/null +++ b/src/v1/stage0/src/v2_compiler_resolve.rs @@ -0,0 +1,9 @@ +// Seed realization for v2.compiler.resolve (Wave 2 parallel flip). +// Hand-retained Rust oracle — independent of the self-emitted artifact under test. +// Dissolve-on: self-emit cutover retires this module when v2.compiler.resolve +// is emitted-only and the behavioral harness is modeled (sr_scaffold_dissolution_trigger). + +/// Mirrors `data arrow_domain_param_scoping_note` in src/v2/compiler/03_resolve.dag. +pub fn arrow_domain_param_scoping_note() -> String { + "Wave 1 Gate 1 A1: param scoping is add_arrow_domain_named_params over lowered Arrow domain Named edges (general-body-producer-design Stage A). dag_fn_decl_param_binding_atoms and scope_with_fn_decl_params dissolved. fn_decl ident now routes through StampLexeme and SymbolIndex fill carries module_qn.fn.param (parity proven by execution); domain construction remains interim param-list-walk (body_lower_domain_from_param_list) until domain is built from SymbolIndex lookup rather than walked from the param list.".to_string() +} diff --git a/src/v2/compiler/self_host/frontier.dag b/src/v2/compiler/self_host/frontier.dag index ce14d162830..74870d31be8 100644 --- a/src/v2/compiler/self_host/frontier.dag +++ b/src/v2/compiler/self_host/frontier.dag @@ -910,7 +910,8 @@ data seed_retained_intrinsic_registrations: List = [ SeedRetainedScaffoldRegistration { basename: "usv_pilot_v2_std_algebra" }, SeedRetainedScaffoldRegistration { basename: "usv_pilot_v2_std_collection" }, - SeedRetainedScaffoldRegistration { basename: "usv_pilot_v2_std_node" } + SeedRetainedScaffoldRegistration { basename: "usv_pilot_v2_std_node" }, + SeedRetainedScaffoldRegistration { basename: "v2_compiler_resolve" } ] fn intrinsic_pub_mod_basename_from_row(row: SeedRetainedIntrinsicRegistration) -> List {