Repository navigation
Wave 2 §11.7.5: Class-A temporary shell exception table (bootstrap/M1) — first executable slice #4284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wave 2 §11.7.5: Class-A temporary shell exception table (bootstrap/M1) — first executable slice #4284
Changes from 7 commits
6c7e6f9
91d6910
32750d2
7334b51
a369d67
85efa0d
a217da1
b95e23d
9cafbeb
0f26e16
55d269e
b0cdb45
0322519
62e1b13
6259d49
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1120,6 +1120,172 @@ fn v4_workflow_ci_bootstrap_gate_skip_policy_is_modeled() { | |
| ); | ||
| } | ||
|
|
||
| /// Wave 2 — §11.7.5 temporary shell exception table (first executable slice). Authority: #4137 | ||
| /// §11.7.5. Models the Class-A shell-owned floor steps allowed to stay REQUIRED pending their | ||
| /// `CiUpsertStep` runtime-authority migration (bootstrap viability + M1 rust emit), and the | ||
| /// no-new-shell ratchet (§11.7.1 #5): every REQUIRED ci-floor shell invocation in ci.yml must | ||
| /// carry a row here. Dissolve-on: ci.yml emits these steps FROM their `CiUpsertStep` (T-24), | ||
| /// at which point the rows delete and this slice retires. | ||
| /// | ||
| /// **P5 receipt (T-PB-B same-path SG-0 expansion):** this is a +0-new-path addition to the | ||
| /// existing `v4_workflow_ci_runner_dag_smoke_test` harness (already carried by one SG-0 | ||
| /// hand-authored-test census entry), NOT a new hand-Rust test path/authority surface — same | ||
| /// posture as the T-38/T-38B expansions documented in this file's header. Explicit P5 deferral: | ||
| /// ROADMAP.md § "Nine lanes" row **T-PB-B** / `pb_rust_tests_outside_residual_zero`. Dissolution: | ||
| /// generated `.dag` `TestClaim` execution covers the §11.7.5 shell-exception table + no-new-shell | ||
| /// ratchet (and A15 Shape-B emitted `ci.yml`), retiring this hand-Rust parse/string harness. | ||
| /// | ||
| /// **Required-CI wiring:** the `v4_workflow_ci_wave1_` name prefix places this under the required | ||
| /// `ci_floor` "M1 v4 workflow CI model/YAML binding smoke" step's `::v4_workflow_ci_wave1_` filter | ||
| /// (`.github/workflows/ci.yml`), so the no-new-shell ratchet — §11.7.1 item #5, a safety-floor | ||
| /// gate — is enforced on every PR, not just locally. The §11.7.5 table it asserts is Wave 2 work, | ||
| /// but the ratchet it enforces is Wave 1 floor, which is why it joins the `wave1_` floor-binding group. | ||
| #[test] | ||
| fn v4_workflow_ci_wave1_class_a_shell_exception_table_first_slice() { | ||
| let module = parse_module(CI_DAG, CI_DAG_PATH); | ||
|
|
||
| // Type substrate: the exception-row record + the §11.7.1 safety-floor enum it cites. | ||
| assert!( | ||
| module.items.iter().any(|item| matches!( | ||
| item, | ||
| SurfaceItem::TypeRecord { name, .. } if name == "CiShellExceptionRow" | ||
| )), | ||
| "{CI_DAG_PATH}: §11.7.5 must model CiShellExceptionRow" | ||
| ); | ||
| assert!( | ||
| module.items.iter().any(|item| matches!( | ||
| item, | ||
| SurfaceItem::TypeSum { name, .. } if name == "CiSafetyFloorItem" | ||
| )), | ||
| "{CI_DAG_PATH}: §11.7.5 must model the §11.7.1 safety-floor item enum" | ||
| ); | ||
|
|
||
| // Isolate the table body so per-row assertions can't accidentally match elsewhere. | ||
| let table = CI_DAG | ||
| .split("data ci_class_a_shell_exceptions:") | ||
| .nth(1) | ||
| .unwrap_or_else(|| panic!("{CI_DAG_PATH}: missing data ci_class_a_shell_exceptions")) | ||
| .split("\n]") | ||
| .next() | ||
| .expect("ci_class_a_shell_exceptions table must terminate with `]`"); | ||
|
|
||
| // Exactly the two Class-A shell-owned floor steps carry an exception: bootstrap + M1. | ||
| assert_eq!( | ||
| table.matches("CiShellExceptionRow {").count(), | ||
| 2, | ||
| "{CI_DAG_PATH}: §11.7.5 carries exactly two Class-A shell exceptions (bootstrap + M1)" | ||
| ); | ||
| for needle in [ | ||
| "job: v2_bootstrap_smoke_execution", | ||
| ".github/ci-floor/v4-bootstrap-viability.sh", | ||
| "protects_floor: BootstrapMinimalViability", | ||
| "job: m1_rust_emit_probe_execution", | ||
| ".github/ci-floor/v4-m1-rust-emit-probe.sh", | ||
| "protects_floor: OneRustEmitProbe", | ||
| ] { | ||
| assert!( | ||
| table.contains(needle), | ||
| "{CI_DAG_PATH}: shell exception table must carry `{needle}`" | ||
| ); | ||
| } | ||
|
|
||
| // P2 single-authority: `replacement_upsert` binds the canonical `CiUpsertStepSymbol` data | ||
| // declared elsewhere in this module — NOT a parallel `Symbol` alias that could drift or name | ||
| // a non-existent upsert. Assert both the table reference and the authority declaration exist. | ||
| for upsert in [ | ||
| "ci_upsert_v2_bootstrap_smoke_execution", | ||
| "ci_upsert_m1_rust_emit_probe_execution", | ||
| ] { | ||
| assert!( | ||
| table.contains(&format!("replacement_upsert: {upsert}")), | ||
| "{CI_DAG_PATH}: shell exception must point `replacement_upsert` at the canonical \ | ||
| upsert authority `{upsert}` (P2 single-authority — no parallel `_step` Symbol alias)" | ||
| ); | ||
| assert!( | ||
| CI_DAG.contains(&format!("data {upsert}: CiUpsertStepSymbol")), | ||
| "{CI_DAG_PATH}: `replacement_upsert` authority `{upsert}` must be a declared \ | ||
| `CiUpsertStepSymbol` (proves the named upsert exists)" | ||
| ); | ||
| } | ||
|
|
||
| // §11.7.5 cond 4 — every row names a structural dissolution path (no calendar/owner carrier). | ||
| assert_eq!( | ||
| table | ||
| .matches("dissolution_target: ModelMissingSubstrate") | ||
| .count(), | ||
| 2, | ||
| "{CI_DAG_PATH}: each shell exception must name a structural dissolution_target" | ||
| ); | ||
|
|
||
| // §11.7.5 cond 1 — each row's shell_owner is a live REQUIRED ci.yml floor invocation | ||
| // (no phantom exception for a script that does not actually run on PRs). | ||
| for script in [ | ||
| ".github/ci-floor/v4-bootstrap-viability.sh", | ||
| ".github/ci-floor/v4-m1-rust-emit-probe.sh", | ||
| ] { | ||
| assert!( | ||
| CI_YML.contains(&format!("bash {script}")), | ||
| "{CI_YML_PATH}: shell exception owner `{script}` must be a live floor invocation" | ||
| ); | ||
| } | ||
|
|
||
| // no-new-shell ratchet (§11.7.1 #5) — bidirectional bijection between the REQUIRED | ||
| // `.github/ci-floor/*.sh` invocations in ci.yml and the table's rows. | ||
| // | ||
| // Scan EVERY line (not just lines beginning `run: bash …`) so a block-scalar `run: |` body | ||
| // such as ` bash .github/ci-floor/foo.sh` cannot evade the gate by its YAML spelling. | ||
| let mut ci_floor_scripts: Vec<String> = Vec::new(); | ||
| for line in CI_YML.lines() { | ||
| if !line.contains("bash ") { | ||
| continue; | ||
| } | ||
| if let Some(idx) = line.find(".github/ci-floor/") { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Invariant violation: BLOCKING: The new ratchet only scans .github/ci-floor/, but the live required floor shell invocations are still .github/workflows/ci.yml:155 and .github/workflows/ci.yml:162 scripts/ paths, so the executable receipt is not faithful or fail-closed. |
||
| let leaf: String = line[idx..] | ||
| .chars() | ||
| .take_while(|c| !c.is_whitespace()) | ||
| .collect(); | ||
| if leaf.ends_with(".sh") { | ||
| ci_floor_scripts.push(leaf); | ||
| } | ||
| } | ||
| } | ||
| ci_floor_scripts.sort(); | ||
| ci_floor_scripts.dedup(); | ||
| assert!( | ||
| !ci_floor_scripts.is_empty(), | ||
| "{CI_YML_PATH}: expected at least one required ci-floor shell invocation to ratchet" | ||
| ); | ||
|
|
||
| // Forward — every required ci-floor shell must have an exception row (fail CLOSED on a new | ||
| // unlisted required shell). | ||
| for script in &ci_floor_scripts { | ||
| assert!( | ||
| table.contains(script.as_str()), | ||
| "{CI_YML_PATH}: required ci-floor shell `{script}` has no §11.7.5 \ | ||
| exception row (no-new-shell ratchet — add a CiShellExceptionRow or model it)" | ||
| ); | ||
| } | ||
| // Bijection — distinct required scripts must equal the row count, so a NEW ci-floor shell (or | ||
| // a duplicate/extra row) breaks the 1:1 correspondence and fails the gate rather than passing | ||
| // open on mere string containment. | ||
| assert_eq!( | ||
| ci_floor_scripts.len(), | ||
| table.matches("CiShellExceptionRow {").count(), | ||
| "{CI_DAG_PATH}: §11.7.5 table must be 1:1 with the required ci-floor invocations \ | ||
| in {CI_YML_PATH} (count {} scripts vs rows) — a new required shell or an extra/stale \ | ||
| row breaks the no-new-shell bijection", | ||
| ci_floor_scripts.len() | ||
| ); | ||
|
|
||
| // RESIDUAL (tracked, openai-pro #4284): this gate keys on the script PATH, not the modeled | ||
| // `(job, step)` `CiStepId`, because ci.yml's step→`CiStepId` mapping is not yet available in a | ||
| // string-checkable form here. A *second* required step reusing an already-listed ci-floor | ||
| // script would not yet be distinguished by its own `step_id`. Dissolves on the same trigger as | ||
| // this harness's overall retirement: the generated `.dag` CI step model lets the ratchet | ||
| // compare live `(job, step, script)` against `step_id + shell_owner` directly. Until then the | ||
| // bijection above (path-keyed, block-form-safe, count-exact) is the enforced contract. | ||
| } | ||
|
|
||
| #[test] | ||
| fn v4_workflow_affected_set_ci_runner_claim_dag_tokenizes_and_parses() { | ||
| let _module = parse_module(CLAIM_DAG, CLAIM_PATH); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -366,6 +366,77 @@ data ci_always_run_carveouts: List<CiCarveout> = [ | |
| } | ||
| ] | ||
|
|
||
| // ── Wave 2 — §11.7.5 temporary shell exception table (Class A safety floor) ────────────────── | ||
| // Authority: #4137 §11.7.5 "The temporary CI cut rule (codified)". A shell-owned check may remain | ||
| // REQUIRED on every PR only if it (1) protects a named §11.7.1 safety-floor item, (2) has no | ||
| // runtime-authoritative `CiUpsertStep` replacement yet, (3) is listed in THIS table, (4) names a | ||
| // structural dissolution path. Conditions (2)+(3) are definitional: a row exists here iff the step | ||
| // is still shell-owned and not yet emitted FROM its `CiUpsertStep` as ci.yml runtime authority. | ||
| // This is the first executable slice of Wave 2 (shell→`CiUpsertStep` migration, §11.7.7 lane 6): | ||
| // it models the exception registry the no-new-shell ratchet (§11.7.1 #5) consumes. INTENDED | ||
| // contract: the set of REQUIRED shell-owned ci-floor steps equals these rows' `step_id`s. | ||
| // ENFORCED today (`v4_workflow_ci_wave1_class_a_shell_exception_table_first_slice`): a path-keyed | ||
| // bijection between the required `.github/ci-floor/*.sh` invocations in ci.yml and these rows | ||
| // (block-form-safe, count-exact) — a new unlisted required shell fails CLOSED. RESIDUAL (tracked, | ||
| // openai-pro #4284): the gate keys on script path, not the modeled `(job, step)` `CiStepId`, since | ||
| // ci.yml's step→`CiStepId` mapping is not yet string-checkable; a *second* step reusing a listed | ||
| // script is not yet distinguished by `step_id`. Dissolves when the generated `.dag` CI step model | ||
| // lets the ratchet compare live `(job, step, script)` against `step_id + shell_owner` directly. | ||
This comment was marked as resolved.
Sorry, something went wrong. |
||
| // Reuses `CiStepId` + `DissolutionTarget` (no parallel exception genus); sibling to | ||
| // `ci_always_run_carveouts` (run-policy carveout) — distinct concept (shell retirement vs | ||
| // always-run), shared leaf substrate. | ||
|
|
||
| // 🟡 coproduct dissolution — feature:wave2-class-a-shell-exception-table — bind #4137 §11.7.1 — dissolve-on-arrival: this closed enumeration mirrors the §11.7.1 bare-minimum floor; it is DELETED when the dynamic affected-set + testgen safety net (§11.7.7 end state) replaces the static floor list and `protects_floor` no longer needs a fixed-arm carrier; forbidden: an open `Symbol`/`String` floor key, or an arm with no §11.7.1 row. | ||
| type CiSafetyFloorItem | ||
This comment was marked as resolved.
Sorry, something went wrong. |
||
| = FmtCheck | ||
| | BootstrapMinimalViability | ||
| | OneRustEmitProbe | ||
| | CiDagStructuralReceipt | ||
| | NoNewShellRatchet | ||
|
|
||
| // 🟡 coproduct dissolution — feature:wave2-class-a-shell-exception-table — bind #4137 §11.7.5 — dissolve-on-arrival: a row is DELETED when ci.yml emits its `step_id` FROM `replacement_upsert` as runtime authority (T-24), not when the shadow `CiUpsertStep` row merely exists; forbidden: a row without a named `dissolution_target`, or a Class-B/C/D (non-floor) step carried as a shell exception. | ||
| type CiShellExceptionRow { | ||
| step_id: CiStepId | ||
| // Repo-relative path of the `.github/ci-floor/*.sh` script owning this Class-A floor step. | ||
| // Canonical `RepoPath` carrier (v4.lens.edit_locus) — NOT a parallel path-as-String authority. | ||
| shell_owner: RepoPath | ||
| protects_floor: CiSafetyFloorItem | ||
| // The existing shadow `CiUpsertStep` AUTHORITY that retires this row once it becomes ci.yml | ||
| // runtime authority. Binds to the canonical `CiUpsertStepSymbol` data (single-authority, P2) — | ||
| // NOT a parallel `Symbol` alias that could drift or name a non-existent upsert. | ||
| replacement_upsert: CiUpsertStepSymbol | ||
| dissolution_target: DissolutionTarget | ||
| } | ||
|
|
||
| // Dissolution `what` atoms — the runtime-authority emission substrate whose arrival deletes the | ||
| // row (does NOT yet exist; standard `ModelMissingSubstrate` naming, like `ci_gate_run_policy_*`). | ||
| data ci_bootstrap_step_emitted_from_upsert_runtime_authority: Symbol = ci_bootstrap_step_emitted_from_upsert_runtime_authority | ||
| data ci_m1_rust_emit_step_emitted_from_upsert_runtime_authority: Symbol = ci_m1_rust_emit_step_emitted_from_upsert_runtime_authority | ||
|
|
||
| data ci_class_a_shell_exceptions: List<CiShellExceptionRow> = [ | ||
| CiShellExceptionRow { | ||
| step_id: JobStep { job: v2_bootstrap_smoke_execution, step: v2_bootstrap_smoke_execution }, | ||
| shell_owner: ".github/ci-floor/v4-bootstrap-viability.sh", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BLOCKING: The shell_owner rows model |
||
| protects_floor: BootstrapMinimalViability, | ||
| replacement_upsert: ci_upsert_v2_bootstrap_smoke_execution, | ||
| dissolution_target: ModelMissingSubstrate { | ||
| what: ci_bootstrap_step_emitted_from_upsert_runtime_authority | ||
| } | ||
| }, | ||
| CiShellExceptionRow { | ||
| step_id: JobStep { | ||
| job: m1_rust_emit_probe_execution, | ||
| step: m1_rust_emit_probe_execution | ||
| }, | ||
| shell_owner: ".github/ci-floor/v4-m1-rust-emit-probe.sh", | ||
| protects_floor: OneRustEmitProbe, | ||
| replacement_upsert: ci_upsert_m1_rust_emit_probe_execution, | ||
| dissolution_target: ModelMissingSubstrate { | ||
| what: ci_m1_rust_emit_step_emitted_from_upsert_runtime_authority | ||
| } | ||
| } | ||
| ] | ||
|
|
||
| // Wave 3 §11.7.4 — extend existing receipt (arbiter §8 2026-06-01); no parallel shadow receipt type. | ||
| // 🟡 coproduct dissolution — feature:wave3-shadow-selection-receipt — bind Wave 4 active-skip — dissolve-on-arrival: `CiActiveFloorSkipEvidence` is populated from cached TestClaimRun verdict partition; forbidden: bare `Active` tag without skip evidence (illegal floor-skip state). | ||
| type CiActiveFloorSkipEvidence { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BLOCKING: The new src/v3 hand-Rust test expansion cites ROADMAP.md § "Nine lanes" row T-PB-B /
pb_rust_tests_outside_residual_zero, but ROADMAP.md has no such row, so the P5 receipt is not checkable.