Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions dsl/gunbc/ci_layer_roots.dag
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// gunbc/ci_layer_roots.dag — single authority for CI witness layer roots (§3).
//
// Intentionally v2-import-free so dsl-only `gunbc compile` and transport scripts
// can read roots without pulling the ci_workflow projection graph.

module gunbc.ci_layer_roots

// Single authority for CI witness layer roots (replaces triple-fork in ci.yml / transport scripts).
data witness_layer_roots: List<String> = ["src/v2", "dsl"]

// Satisfies claim_batch --roster-from-discovery scan-dir gate (test-fn discovery needs no unified_claim resolve).
data witness_discovery_scan_dirs: List<String> = ["dsl/test/claim"]

fn witness_layer_source_flags(roots: List<String>) -> String {
fold(roots, init: "", f: (acc, r) => concat(acc, concat(" --source-root ", r)))
}

fn witness_layer_scan_flags() -> String {
fold(witness_discovery_scan_dirs, init: "", f: (acc, d) => concat(acc, concat(" --scan-dir ", d)))
}
72 changes: 23 additions & 49 deletions dsl/gunbc/ci_spec.dag
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
// gunbc/ci_spec.dag — CI intent as data (witness roots, gates, diff policy).
// gunbc/ci_spec.dag — CI intent as data (gates, diff policy, transport scripts).

module gunbc.ci_spec

type WitnessRoot {
root: String
scan_subtrees: List<String>
}

type WitnessEntry {
entry: String
function: String
import gunbc.ci_layer_roots {
witness_layer_roots,
witness_layer_source_flags
}

type Gate
Expand All @@ -29,42 +24,25 @@ type DiffPolicy {
}

type CiSpec {
witness_roots: List<WitnessRoot>
witness_entries: List<WitnessEntry>
gates: List<Gate>
diff_policy: DiffPolicy
notice_title: String
}

// 🟡 SCAFFOLD — feature:gate-coproduct-inhabitant-bridge — bind gunbc#4872 —
// dissolve-on-arrival: generic Symbol→inhabitant replaces exhaustive match roster;
// roster completeness is witness-checked in src/v2/test/claim/ci_spec_witness_test.dag.
data gunbc_ci_gates: List<Gate> = [
RustMonolithGate,
EmitHostGate,
LayeringImportsGate,
DslCompileCleanGate,
CiYamlGate,
SourceRootIngestGate
]

data gunbc_ci_spec: CiSpec = {
witness_roots: [
{ root: "src/v2", scan_subtrees: [] },
{ root: "dsl", scan_subtrees: [] }
],
witness_entries: [
{ entry: "dsl/test/claim/rust_stage0_gates_witness.dag", function: "rust_stage0_gates_witnesses" },
{ entry: "dsl/test/claim/emit_host_gate_witness.dag", function: "emit_host_gate_witnesses" },
{ entry: "src/v2/test/claim/layering_imports/coverage_domain_equivalence.dag", function: "coverage_domain_equivalence_argument_holds" },
{ entry: "dsl/test/claim/filesystem_entry_kind_witness.dag", function: "filesystem_entry_kind_witnesses" },
{ entry: "dsl/test/claim/power_watt_witness.dag", function: "power_watt_witnesses" },
{ entry: "dsl/test/claim/cargo_target_path_witness.dag", function: "cargo_target_path_witnesses" },
{ entry: "dsl/test/claim/dsl_compile_clean_witness.dag", function: "dsl_compile_clean_witnesses" },
{ entry: "dsl/test/claim/ci_spec_witness.dag", function: "ci_spec_witnesses" },
{ entry: "src/v2/test/claim/ci_floor_plan_witness.dag", function: "ci_floor_plan_witnesses" },
{ entry: "dsl/test/claim/ci_yaml_serializer_witness.dag", function: "ci_yaml_serializer_keystone_holds" },
{ entry: "dsl/test/claim/pareto_dominance_witness.dag", function: "pareto_dominance_holds" },
{ entry: "dsl/test/claim/hardware_selection_witness.dag", function: "hardware_selection_holds" },
{ entry: "dsl/test/claim/realization_witness.dag", function: "realization_witnesses" },
{ entry: "dsl/test/claim/realization_schedule_witness.dag", function: "realization_schedule_witnesses" }
],
gates: [
RustMonolithGate,
EmitHostGate,
LayeringImportsGate,
DslCompileCleanGate,
CiYamlGate,
SourceRootIngestGate
],
gates: gunbc_ci_gates,
diff_policy: {
base: "origin/main",
head: "HEAD",
Expand Down Expand Up @@ -164,23 +142,19 @@ fn git_fetch_script(policy: DiffPolicy) -> String {
)
}

fn witness_root_source_flag(wr: WitnessRoot) -> String {
concat(" --source-root ", wr.root)
}

// `claim_executor` takes ONLY `--source-root` (to resolve the plan) — it has no
// `--scan-dir` flag and hard-errors on any unknown argument. Scan dirs are carried
// SOLELY by the plan (`ci_floor_plan.corpus_scan_dirs` → `RunnableDiscoveryBatch.
// SOLELY by the plan (`ci_floor_plan` discovery batch `scan_dirs` from
// `gunbc.ci_layer_roots.witness_discovery_scan_dirs` → `RunnableDiscoveryBatch.
// scan_dirs`), the single authority for that derivation (DESIGN §3); emitting them
// on the argv too would be a redundant, fail-closed mis-wire (DESIGN §5).
fn witness_roots_source_flags(roots: List<WitnessRoot>) -> String {
fold(roots, init: "", f: (acc, wr) => concat(acc, witness_root_source_flag(wr: wr)))
}
//
// Layer roots: `gunbc.ci_layer_roots.witness_layer_roots` (§3 single authority).

// The dependency-ordered scheduler plan (the single floor topology, DESIGN §3) and
// the host entry the executor evaluates. The scheduler — NOT a flat claim_batch +
// gates pair — is the default CI runtime: both the discovery corpus and the gates
// are scheduler plan nodes (`dsl/gunbc/ci_floor_plan.dag`), run dependency-ordered
// are scheduler plan nodes (`src/v2/workflow/ci_floor_plan.dag`), run dependency-ordered
// and parallel-where-independent, fail-closed (DESIGN §4/§5).
data floor_plan_entry: String = "src/v2/workflow/ci_floor_plan.dag"
data floor_plan_function: String = "gunbc_ci_floor_batches"
Expand All @@ -189,7 +163,7 @@ fn scheduler_invoke(spec: CiSpec) -> String {
concat(
concat(
concat(
concat(concat(claim_executor_bin_shell(), witness_roots_source_flags(roots: spec.witness_roots)), concat(" --plan-entry ", floor_plan_entry)),
concat(concat(claim_executor_bin_shell(), witness_layer_source_flags(roots: witness_layer_roots)), concat(" --plan-entry ", floor_plan_entry)),
concat(" --plan-function ", floor_plan_function)
),
concat(concat(" --notice-title \"", spec.notice_title), "\"")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fn edition_tokens_render() -> Bool {
&& rust_edition_str(edition: default_rust_edition) == "2021"
}

fn cargo_target_path_witnesses() -> Bool {
test fn cargo_target_path_witnesses() -> Bool {
lib_lands_on_src_lib()
&& package_bin_collapses_to_main()
&& other_bin_lands_under_src_bin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ fn witness_sccache_wired_when_fleet_daemon_up() -> Bool {
!string_contains(s: yaml, pattern: "SCCACHE_DIR=$RUNNER_TEMP/sccache")
}

// Full-file drift gate (`ci_yml_drifted` == byte-identical to `expected_ci_yml()`); these
// pin distinctive `gunbc_ci_workflow_run` projections in the committed step body.
fn witness_gunbc_ci_step_projects_run_script_markers() -> Bool {
let yaml = expected_ci_yml()
let script = gunbc_ci_workflow_run(spec: gunbc_ci_spec)
Expand All @@ -179,7 +177,7 @@ fn witness_gunbc_ci_step_projects_run_script_markers() -> Bool {
string_contains(s: script, pattern: "env -u RUSTC_WRAPPER")
}

fn ci_yaml_serializer_keystone_holds() -> Bool {
test fn ci_yaml_serializer_keystone_holds() -> Bool {
witness_fetch_depth_is_int_not_string() &&
witness_rustflags_empty_string_quoted() &&
witness_steps_sequence_elements_are_yaml_values() &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ fn witness_perturb_optional_skew_goes_red() -> Bool {
run_perturb_optional_skew_red_receipt()
}

fn dsl_compile_clean_witnesses() -> Bool {
test fn dsl_compile_clean_witnesses() -> Bool {
witness_clean_tree_compile_holds() && witness_perturb_optional_skew_goes_red()
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn w_ts_byte_count_is_four() -> Bool {
}

// Conjunction keystone — CI runs with --claim-run (false → exit 1).
fn emit_host_gate_witnesses() -> Bool {
test fn emit_host_gate_witnesses() -> Bool {
w_rust_fixture_nonempty() &&
w_python_fixture_nonempty() &&
w_go_fixture_nonempty() &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn w_ntfs_normal_is_regular() -> Bool {
}

// Conjunction keystone — CI runs with --claim-run (false → exit 1).
fn filesystem_entry_kind_witnesses() -> Bool {
test fn filesystem_entry_kind_witnesses() -> Bool {
w_posix_socket_is_other() &&
w_posix_regular_is_regular() &&
w_posix_symlink_is_symlink() &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ fn derived_ratios_are_computed() -> Bool {
&& bandwidth_per_watt(a: cfg_a_axes) > bandwidth_per_watt(a: cfg_b_axes)
}

fn hardware_selection_holds() -> Bool {
test fn hardware_selection_holds() -> Bool {
downclock_is_rank_dependent()
&& psu_sizing_is_computed()
&& rank_tradeoff_is_incomparable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fn undominated_candidate_stays_on_front() -> Bool {
on_pareto_front(verdicts: pool) && !any_dominates(verdicts: pool)
}

fn pareto_dominance_holds() -> Bool {
test fn pareto_dominance_holds() -> Bool {
dominates_when_better_on_all_axes()
&& dominated_is_the_mirror()
&& equivalent_when_identical()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn watt_roundtrips() -> Bool {
watt_count(w: watt(count: 183)) == 183
}

fn power_watt_witnesses() -> Bool {
test fn power_watt_witnesses() -> Bool {
watt_roundtrips()
&& empty_budget_is_zero_watts()
&& total_power_is_computed_sum()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ fn witness_schedule_lens_red_when_corpus_runs_first_on_synthetic() -> Bool {
}
}

fn realization_schedule_witnesses() -> Bool {
test fn realization_schedule_witnesses() -> Bool {
witness_schedule_lens_green_on_synthetic_plan()
&& witness_schedule_lens_red_when_corpus_runs_first_on_synthetic()
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn witness_upsert_different_keys_independent() -> Bool {
) == Independent
}

fn realization_witnesses() -> Bool {
test fn realization_witnesses() -> Bool {
witness_unknown_independence_never_reorders()
&& witness_read_read_independent()
&& witness_create_unknown_not_independent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ fn w_git_fail_fires() -> Bool {
should_run_gates(paths: [], git_success: false) == true
}

// Conjunction keystone — the single fn the CI corpus runs (--claim-run; false → exit 1).
fn rust_stage0_gates_witnesses() -> Bool {
// Conjunction keystone — the single test fn the CI corpus runs (--claim-run; false → exit 1).
test fn rust_stage0_gates_witnesses() -> Bool {
w_rs_selects() &&
w_cargo_toml_selects() &&
w_toolchain_selects() &&
Expand Down
35 changes: 15 additions & 20 deletions dsl/tools/floor_effect_gate_witness.dag
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,40 @@
// CI gates, so the dependency-ordered scheduler (claim_executor) can run each gate
// as a plan node (`RunnableSingleClaim` is nullary — one `(entry, function)`).
//
// REUSE, not re-coin (DESIGN §2/§3): each adapter pins one closed `Gate` variant and
// calls that gate's composed CI entry (`run_*_ci_gate`). Do NOT import
// `tools.ci_gates` here — its composed `main`/`run_ci_gates` fold loops under the
// v1 interpreter (#5138); production CI runs one gate per witness adapter.
// REUSE, not re-coin (DESIGN §2/§3): the Gate→effect mapping stays the single
// authority `tools.ci_gates.run_spec_gate` (itself driven by `gunbc_ci_spec.gates`).
// Each adapter just pins one closed `Gate` variant and maps its ProcessExit to the
// Bool the scheduler's per-node verdict needs. These are `func` (effectful) — the
// host runs them in Wet mode so the transports fire.

module tools.floor_effect_gate_witness

import std.process { ProcessExit, ExitSuccess }
import tools.rust_gates_ci { run_rust_monolith_gate }
import tools.emit_host_gate { run_emit_host_ci_gate }
import tools.layering_imports_gate { run_layering_imports_ci_gate }
import tools.dsl_compile_clean_gate { run_dsl_compile_clean_gate }
import tools.ci_yaml_gate { run_ci_yaml_gate }
import tools.source_root_ingest_gate { run_source_root_ingest_ci_gate }

fn exit_ok(e: ProcessExit) -> Bool {
match e { ExitSuccess => true _ => false }
import gunbc.ci_spec {
RustMonolithGate, EmitHostGate, LayeringImportsGate, DslCompileCleanGate, CiYamlGate,
SourceRootIngestGate
}
import tools.ci_gates { exit_ok, run_spec_gate }

func rust_monolith_gate_passes() -> Bool {
exit_ok(e: run_rust_monolith_gate())
exit_ok(e: run_spec_gate(g: RustMonolithGate))
}

func emit_host_gate_passes() -> Bool {
exit_ok(e: run_emit_host_ci_gate())
exit_ok(e: run_spec_gate(g: EmitHostGate))
}

func layering_imports_gate_passes() -> Bool {
exit_ok(e: run_layering_imports_ci_gate())
exit_ok(e: run_spec_gate(g: LayeringImportsGate))
}

func dsl_compile_clean_gate_passes() -> Bool {
exit_ok(e: run_dsl_compile_clean_gate())
exit_ok(e: run_spec_gate(g: DslCompileCleanGate))
}

func ci_yaml_gate_passes() -> Bool {
exit_ok(e: run_ci_yaml_gate())
exit_ok(e: run_spec_gate(g: CiYamlGate))
}

func source_root_ingest_gate_passes() -> Bool {
exit_ok(e: run_source_root_ingest_ci_gate())
exit_ok(e: run_spec_gate(g: SourceRootIngestGate))
}
Loading