diff --git a/docs/briefs/r3-t-wad-full-r3-cidag-scaffold-worker.md b/docs/briefs/r3-t-wad-full-r3-cidag-scaffold-worker.md new file mode 100644 index 00000000000..17281161d54 --- /dev/null +++ b/docs/briefs/r3-t-wad-full-r3-cidag-scaffold-worker.md @@ -0,0 +1,202 @@ +# Worker brief — T-WAD FULL R3 ci_emission.dag substrate scaffold + +**Authority**: PM scoping doc `docs/r3-t-workflow-as-data-full-r3-close-scope.md` §6 WI-2; operator FULL elevation 2026-05-12; Director ratification msg_5cbdad24 + (c-refined) ratification msg_237bde05 / msg_f9fd669e 2026-05-12. +**Parent**: T-Workflow-As-Data lane (Substrate Mgr warm-wolf-698 lane-absorbed Slices 4-5/8 per Director); this WI lands the projection-function substrate that enables Slice 4 emitter implementation. +**Closure predicate**: `dsl/gunbc/ci_emission.dag` declares `WorkflowRuntime` open enum + Practice 4 coproduct-dissolution receipt (per acceptance gate 3) + `project_github_actions: (CIWorkflowDag, WorkflowRuntime) -> Workflow` projection function signature with TODO-marked total-handling skeleton. The `gunbc_ci_yml_workflow` pinned-projection data binding is **DEFERRED to Slice 4** per §3 + acceptance gate 5 (P2 single-authority lockdown — the binding requires a canonical `CIWorkflowDag` instance which Slice 4 authors alongside the binding; WI-2 landing the binding now would force placeholder-or-conversion authority creation per briansrls BLOCKING c#3224878308 fix in commit `f830b988f`). Downstream Slice 4 YamlStatic emitter consumes the projection and authors the pinned binding; downstream Slice 8 dissolves hand-authority over `.github/workflows/ci.yml` (per `ci_yml_hand_authority_dissolved` gate — see scope doc §1). + +## Substrate-shape ratification anchor + +The (c-refined) shape was ratified by Director at msg_237bde05 + msg_f9fd669e and self-corrected to via PR #2749 §7 (warm-wolf-698). The earlier (a) shape (`WorkflowRuntime?` field on `dsl/extdeps/github/actions.dag::Workflow`) was RETRACTED at Director msg_b4151f45 + codex BLOCKING #9970 on PR #2749 for INVARIANTS P1 violation (CI logic placed on platform carrier). + +**The ratified shape**: `WorkflowRuntime` is a parameter to a projection function in `dsl/gunbc/`, NOT a field on any carrier. The function's invocation pin produces the `Workflow` value the emitter consumes. + +## Output + +**Create NEW file `dsl/gunbc/ci_emission.dag`** declaring: + +1. **`WorkflowRuntime` open enum** (sum-type with named arms; OPEN per design): + + ``` + WorkflowRuntime = YamlStatic + | BinaryShim + | ... // open enum — additional targets land when real consumers exist + ``` + + Each arm is a tag indicating the emission strategy. **Initial set: 2 arms** (`YamlStatic`, `BinaryShim`) — both have concrete consumer-paired slices (Slice 4 / Slice 5). **`PythonShim` AND `InlineGunbc` are DESIGN-ONLY** held out of the initial enum until real runtime consumers exist. Per INVARIANTS P5 / Pure Bootstrap discipline + sibling WI-1 brief framing (PythonShim "Future; sketch only" — no concrete Slice consumer in scope) + PR #2746 §5.4 (InlineGunbc) + openai-pro BLOCKING on PR #2744 (2026-05-12 ~07:55Z) for InlineGunbc + briansrls BLOCKING on PR #2744 (2026-05-12T10:46:59Z) for PythonShim asymmetry: NO enum variant or emitter arm lands without a concrete consumer-paired slice. Open-enum discipline: the projection function must total-handle the declared arms; unknown arms compile-fail (per fail-closed discipline `feedback_fail_closed_discipline`); future arms (`PythonShim`, `InlineGunbc`, and any others) land via separate substrate-prereq PRs paired with their consumers. + +2. **`project_github_actions` projection function declaration**: + + ``` + project_github_actions: (CIWorkflowDag, WorkflowRuntime) -> Workflow + ``` + + - Input domain: `(ci_workflow_dag: CIWorkflowDag, target: WorkflowRuntime)` + - Output codomain: `Workflow` (the `dsl/extdeps/github/actions.dag::Workflow` platform carrier) + - **This WI lands the DECLARATION + signature**, not the per-arm implementation. Per-arm bodies (YamlStatic projection, BinaryShim projection, etc.) are Slice 4+ work owned by Substrate Mgr. + - Leave function body as `// TODO Slice 4-5: per-arm projection implementations` with structural total-handling skeleton (match on `target` arms; each arm body marked TODO). + +3. **`gunbc_ci_yml_workflow` pinned-projection data binding** — **DEFERRED TO SLICE 4** (P2 single-authority lockdown): + + The binding will eventually take this form: + + ``` + gunbc_ci_yml_workflow: Workflow = project_github_actions(, YamlStatic) + ``` + + But WI-2 does **NOT** land this binding. Rationale (per briansrls BLOCKING on PR #2744 2026-05-12T08:30:15Z c#3224878308): the binding requires a concrete `CIWorkflowDag` *instance* whose authority is locked to a canonical source. No such canonical instance exists in main today — `CIWorkflowDag` was introduced as a carrier (type) by PR #2736 (neat-badger-30), but the first canonical *value* (the CI-workflow-as-data corresponding to current `.github/workflows/ci.yml`) lands as part of **Slice 4** (YamlStatic projection-arm implementation, Substrate Mgr warm-wolf-698 lane). If WI-2 landed the binding now, the worker would have to either (a) invent a placeholder `CIWorkflowDag` value inline in `ci_emission.dag` (creating a parallel authority alongside the eventual Slice 4 canonical instance — P2 violation), or (b) build a `CIWorkflowDag` value from `CIPipeline` via inline conversion (reopens Path (a) authority despite the explicit Path (b) rejection below — P2 violation), or (c) leave the binding as a non-compiling forward-reference. + + **WI-2 scope therefore lands only items 1 (`WorkflowRuntime` enum) + 2 (function signature)**. The pinned-projection binding is a Slice 4 deliverable, not a WI-2 deliverable. Slice 4 authors the canonical `CIWorkflowDag` instance and the pinned-projection binding together, sourcing the binding's `ci_workflow_dag` argument from that canonical instance (single authority, P2-clean). + + Forward reference for Slice 4 (informational, not WI-2 work): the pinned binding will be the canonical YAML-emission point Slice 4's YamlStatic emitter walks to produce `.github/workflows/ci.yml`-equivalent output (per scope-doc §3 Slice 4). + +## CIWorkflowDag dependency sequencing — Path (b) REQUIRED (Substrate Mgr clarification 2026-05-12 msg_27d99080) + +**The projection function takes a `CIWorkflowDag` input.** Substrate Mgr (warm-wolf-698) clarified at msg_27d99080 that Path (a) is INSUFFICIENT: + +**Path (a) — reuse existing `dsl/gunbc/ci.dag::CIPipeline`** — REJECTED. `CIPipeline { name, gates: List }` is a FLAT gates list without edge/dependency structure. `project_github_actions` consumes gate-DEPENDENCY (which gates depend on which); flat `List` cannot serve as the projection input. Path (a) is INSUFFICIENT for the projection's input requirements. + +**Path (b) — use `CIWorkflowDag` carrier from PR #2736 (neat-badger-30)** — REQUIRED. `CIWorkflowDag { name, nodes: List, edges: List }` is the load-bearing semantic carrier carrying gate-dependency structure. This is **ALREADY canvas-tier ratified** (PR #2749 §1 option (a) discussion + §2.4 / §7.4 tables explicitly position CIWorkflowDag as the gate-dependency authority on which (c-refined) composes) AND Director-ratified (msg_4f7f536d). PR #2736 is the carrier-introduction PR; canvas + Director ratification covers Path (b) — **no additional Mgr ratification needed for the CIWorkflowDag choice itself**. + +**Disposition**: Proceed Path (b) directly. Use `CIWorkflowDag` from PR #2736 as the projection function's input domain. + +**Sequencing implication** (per Substrate Mgr msg_27d99080): +- WI-2 implementation **depends on PR #2736 merge** OR references the in-flight `CIWorkflowDag` type +- If PR #2736 is still HOLD-merging when cool-carp-720 opens WI-2: either (1) WI-2 holds until PR #2736 merges, OR (2) WI-2's PR rebases on PR #2736's branch (`session/neat-badger-30`) +- PR #2736 mergeable=CLEAN with all CI checks SUCCESS as of 2026-05-12 (no structural blocker; awaiting review tally) + +**STOP-and-route discipline** (revised): +- The CIWorkflowDag CARRIER CHOICE is canvas+Director-ratified — no STOP needed for this dimension. +- STOP still applies for OTHER substrate-shape questions (e.g., `WorkflowRuntime` open-enum vocabulary support, function-as-projection declaration vocabulary support) — see STOP / PING criteria below. +- PING-on-PR-open ratification covers shape (signature, derived-binding form, module placement), NOT the CIWorkflowDag choice in isolation. + +## Scope boundaries (DO / DON'T) + +**DO**: +- Create NEW file `dsl/gunbc/ci_emission.dag` (the projection-substrate file). +- Declare `WorkflowRuntime` open enum with **2** named arms (`YamlStatic`, `BinaryShim`) + open marker. **`PythonShim` AND `InlineGunbc` are DESIGN-ONLY** — do NOT add either as enum arm (PythonShim per briansrls BLOCKING on PR #2744 2026-05-12T10:46:59Z; InlineGunbc per WI-1 brief §scope + PR #2746 §5.4 + openai-pro BLOCKING on PR #2744). Both land via separate substrate-prereq PRs paired with their concrete runtime consumers. +- Declare `project_github_actions` function signature with TODO-marked total-handling skeleton. +- Author Practice 4 coproduct-dissolution receipt for `WorkflowRuntime` (🟡 YELLOW classification + named dissolution trigger + coordinate-dissolution sketch per WI-1 brief discipline; see acceptance gate 3). +- Reference existing `Workflow` carrier from `dsl/extdeps/github/actions.dag` as the codomain type. +- Reference `CIWorkflowDag` carrier from PR #2736 as the input domain type (canvas + Director-ratified per msg_4f7f536d). +- Sequence WI-2 PR after PR #2736 merge OR rebase WI-2's branch on PR #2736's `session/neat-badger-30` if PR #2736 is still HOLD-merging. + +**DON'T**: +- Do NOT add fields to `dsl/extdeps/github/actions.dag` carriers (Workflow/Job/Step) — this is the INVARIANTS P1 violation the (c-refined) shape resolves. +- Do NOT extend `dsl/gunbc/ci.dag` with new substrate types — extension belongs to Mgr canvas tier. +- Do NOT use `CIPipeline` from `dsl/gunbc/ci.dag` as the projection input — it is flat without edge structure and INSUFFICIENT for `project_github_actions` (per Substrate Mgr clarification msg_27d99080). +- Do NOT implement per-arm projection bodies — those are Slice 4-5 work owned by Substrate Mgr after canvas ratification. +- Do NOT modify `.github/workflows/ci.yml` — Slice 8 dissolves hand-authority; this WI only lands the projection substrate. +- Do NOT introduce ALTERNATE carriers for the projection input — `CIWorkflowDag` from PR #2736 is the ratified authority. +- Do NOT land the `gunbc_ci_yml_workflow` pinned-projection data binding in this PR — DEFERRED to Slice 4 per §3 + acceptance gate 5 (P2 single-authority lockdown; the binding requires a canonical `CIWorkflowDag` instance, which Slice 4 authors alongside the binding). +- Do NOT author a placeholder `CIWorkflowDag` instance to satisfy the binding shape — that creates parallel authority alongside Slice 4's canonical instance (P2 violation per briansrls BLOCKING c#3224878308). +- Do NOT land the `WorkflowRuntime` enum WITHOUT its Practice 4 receipt — receipt is a co-equal substrate authoring artifact, not optional documentation (per briansrls BLOCKING c#3224878313). + +## Acceptance gates + +1. New file `dsl/gunbc/ci_emission.dag` exists with valid `.dag` syntax per existing v3 parser. +2. `WorkflowRuntime` open enum declared with **2** named arms (`YamlStatic`, `BinaryShim`) + open-enum marker. **NEITHER `PythonShim` NOR `InlineGunbc` arms** — both DESIGN-ONLY future targets (PythonShim per briansrls BLOCKING on PR #2744 2026-05-12T10:46:59Z; InlineGunbc per PR #2746 §5.4); each lands via separate substrate-prereq PR paired with its concrete runtime consumer per INVARIANTS P5. +3. **Practice 4 coproduct-dissolution receipt for `WorkflowRuntime`** (consistent with WI-1 brief discipline; per `feedback_coproduct_dissolution` + `modeling-discipline.md` Practice 4; addresses briansrls BLOCKING c#3224878313 on PR #2744 2026-05-12T08:30:15Z): + - Receipt classification: **🟡 YELLOW scaffold** (flat enum with named coordinates noted: `Static` artifact branch has NO runner; `Shim` artifact branch parameterized by runner-kind — per WI-1 canvas §3 illegal-states-unrepresentable factoring; coordinates are NOT independent dimensions) + - Named dissolution trigger: first additional shim runtime (e.g., `EmittedPython` joining `CompiledBinary` under `Shim`) OR first need to share runner metadata across shim targets + - Coordinate-dissolution sketch (in-doc, not code): the eventual factoring is **sum-of-tagged-coordinates** per WI-1 canvas §3 (PR #2746 merged 08:29:09Z) — i.e. `Static(EmissionArtifactShape) | Shim { runner: ShimRunnerKind }`, NOT a Cartesian product `EmissionArtifactShape × ShimRunnerKind` (the product admits impossible states like `(StaticYaml, CompiledBinary)` — there is no runner on a Static artifact; per INVARIANTS P2 illegal-states-unrepresentable discipline; addresses briansrls BLOCKING on PR #2744 2026-05-12T10:46:59Z at line 101). Declare the receipt as a `.dag` comment block at the `WorkflowRuntime` declaration site OR as a `modeling-discipline.md`-style receipt header in `ci_emission.dag` preamble. WI-2 worker MUST NOT land the enum without the receipt — receipt is part of substrate authoring discipline, not optional documentation. +4. `project_github_actions: (CIWorkflowDag, WorkflowRuntime) -> Workflow` function signature declared with structural total-handling skeleton (match on `target`; each arm body TODO-marked). +5. **NO pinned-projection data binding** (`gunbc_ci_yml_workflow`) in WI-2's PR — DEFERRED to Slice 4 per §3 above (P2 single-authority lockdown; canonical `CIWorkflowDag` instance lands with Slice 4, binding lands with the canonical instance). +6. NO modifications to `dsl/extdeps/github/actions.dag` (INVARIANTS P1). +7. NO new fields on existing `dsl/gunbc/ci.dag` carriers (`CIGate` / `CIPipeline` / `GateSource`). +8. NO new substrate types introduced without Mgr ratification (per `feedback_substrate_shape_belongs_in_mgr_canvas`). +9. `cargo test --workspace` green (no breakage of existing tests including `t_ci_workflow_as_data_demo`). +10. `cargo clippy --all-targets -- -D warnings` clean. +11. `cargo fmt --all --check` clean. + +## STOP / PING criteria + +- **STOP** if `WorkflowRuntime` open-enum declaration requires substrate-shape features not yet supported by current v3 surface (e.g., open-enum vocabulary missing) — surface to Substrate Mgr. +- **STOP** if `project_github_actions` function signature requires substrate features not yet supported (e.g., function-as-projection declaration vocabulary missing) — surface to Substrate Mgr; canvas-tier decision. +- **STOP** if PR #2736 (CIWorkflowDag introduction) is BLOCKED on something WI-2 implementation reveals (e.g., shape mismatch with what `project_github_actions` actually needs) — surface to Substrate Mgr; CIWorkflowDag carrier shape ratified-but-revisable. +- **PING** PM (deep-wolf-155) on PR-open for review-routing. +- **PING** Substrate Mgr (warm-wolf-698) on PR-open for Mgr-tier ratification of overall shape (signature, derived-binding form, module placement; NOT CIWorkflowDag carrier choice — that's pre-ratified). +- **COORDINATE** with sibling still-heron-763 (WI-1 emitter-dispatch canvas at PR #2746) — the canvas declares emitter-dispatch architecture this WI's projection function plugs into. PR #2749 (warm-wolf-698's adjacent substrate-shape comparison canvas) §7 is the (c-refined) ratification anchor; if either canvas re-ratifies the shape, this WI must follow. +- **COORDINATE** with neat-badger-30 (PR #2736 CIWorkflowDag introduction) if shape questions arise about the input carrier itself. + +## Reference materials + +- `docs/r3-t-workflow-as-data-full-r3-close-scope.md` — PM FULL scope (this brief's parent); §1 gate `project_github_actions_landed` is the closure-gate for this WI. +- `docs/briefs/r3-t-wad-full-r3-emitter-dispatch-canvas-worker.md` — sibling WI-1 brief (declares the (c-refined) substrate shape this WI implements). +- PR #2746 (still-heron-763 WI-1 emitter-dispatch canvas, `docs/design-ci-workflow-emitter-dispatch.md`) — the primary WI-1 canvas; declares emitter-dispatch architecture this WI's projection function plugs into. +- PR #2749 (warm-wolf-698 substrate-shape comparison canvas, `session/warm-wolf-698-substrate-shape-canvas`) §7 — (c-refined) shape self-correction; THIS WI implements that shape. PR #2749 §1 + §2.4 + §7.4 — canvas-tier ratification of `CIWorkflowDag` as the gate-dependency authority on which (c-refined) composes. +- PR #2736 (neat-badger-30) — `CIWorkflowDag` carrier introduction; MERGEABLE with all checks SUCCESS as of 2026-05-12; awaiting review tally; this WI consumes `CIWorkflowDag` as the projection input domain. +- Director ratification msg_4f7f536d — covers Path (b) (CIWorkflowDag-as-input) per Substrate Mgr clarification msg_27d99080. +- `dsl/extdeps/github/actions.dag:1-12` — platform-carrier scope header ("platform constraints, not CI logic (that lives in gunbc/ci.dag)"); the discriminator that grounds the (c-refined) shape. +- `dsl/extdeps/github/actions.dag:21` — `Workflow` carrier (codomain type for `project_github_actions`). +- `dsl/gunbc/ci.dag::CIPipeline` — existing gate-centric CI substrate; INSUFFICIENT as projection input (flat without edge structure) per Substrate Mgr msg_27d99080. Do NOT use as `project_github_actions` input. +- `feedback_audit_extdeps_header_for_logic_vs_platform_discriminator.md` — the discipline that catches (a)-shape mis-placements at canvas-authoring time. + +## Sequencing + +- **Depends on PR #2736 merge** (CIWorkflowDag carrier introduction by neat-badger-30) — currently MERGEABLE, awaiting review tally. WI-2 implementation either holds for PR #2736 merge OR rebases on `session/neat-badger-30` branch. +- `dsl/extdeps/github/actions.dag::Workflow` already present — no upstream dependency for codomain type. +- Slice 1 substrate LANDED (PR #2160) — `WorkflowSecret` + `CronSchedule` available; consumed downstream by Slice 4 emitter, not this WI. +- Slice 3 demo LANDED (PR #2371) — `t_ci_workflow_as_data_demo.dag` exists; this WI extends scope from demo-of-evaluation into projection-substrate-declaration. +- This WI lands the projection-function substrate; Slice 4 implements per-arm bodies; Slice 8 dissolves hand-authority over `.github/workflows/ci.yml` (per renamed gate `ci_yml_hand_authority_dissolved` — see scope doc §1 fix 2026-05-12). + +## Propagated substrate-fidelity concerns (Slice 4-5 — Substrate Mgr canvas) + +These concerns are NOT acceptance gates for THIS WI (declaration-only scope). They are propagated to Slice 4-5 canvas as MUST-address-before-per-arm-body-PRs. + +Authority: briansrls BLOCKING inline reviews on PR #2744 (2026-05-12T06:58:55Z) + codex BLOCKING scheduled review on cc82ec4c (2026-05-12T~07:14Z) flagged the audit as incomplete and requested "key-by-key inventory and STOP/reroute missing carriers before WI-2." This section provides the exhaustive top-level inventory. + +### Exhaustive top-level inventory (current ci.yml → actions.dag carriers) + +Verified 2026-05-12 against `.github/workflows/ci.yml` HEAD + `dsl/extdeps/github/actions.dag` HEAD: + +| ci.yml field | actions.dag carrier | Status | +|---|---|---| +| `name: ci` | `Workflow.name: String` | ✓ covered | +| `on.push.branches: [main]` | `Push { branches: List, paths: List }` | ⚠ `Push.paths` REQUIRED in carrier; ci.yml omits — needs Optional | +| `on.pull_request.branches: [main]` | `PullRequest { branches, types }` | ✓ covered | +| `on.pull_request.types: [opened, synchronize, reopened, ready_for_review]` | `PullRequestActivity = Opened \| Synchronize \| Reopened \| Closed` | ⚠ **MISSING `ReadyForReview` arm** | +| `permissions.contents: read` | `WorkflowPermissions.contents: PermissionLevel` | ✓ covered | +| `permissions.pull-requests: read` | `WorkflowPermissions.pull_requests: PermissionLevel` | ✓ covered | +| (ci.yml omits `permissions.issues`) | `WorkflowPermissions.issues: PermissionLevel` REQUIRED | ⚠ field required; ci.yml omits — needs Optional OR `PermUnset` arm | +| (ci.yml omits `permissions.actions`) | `WorkflowPermissions.actions: PermissionLevel` REQUIRED | ⚠ same as issues | +| `concurrency.group: ` | NO `Workflow.concurrency` field — only `Job.concurrency: ConcurrencySpec?` | ⚠ **MISSING `Workflow.concurrency`** | +| `concurrency.cancel-in-progress: true` | `ConcurrencySpec.cancel_in_progress: Bool` | (depends on adding `Workflow.concurrency`) | +| `env.CARGO_TERM_COLOR: always` | `Workflow.env: Map` | ✓ covered | +| `env.RUSTFLAGS: -D warnings` | `Workflow.env: Map` | ✓ covered | + +### Per-job inventory (representative — `fmt` job from ci.yml) + +| ci.yml field | actions.dag carrier | Status | +|---|---|---| +| `if: github.event.pull_request.draft != true` | `Job.if_condition: String?` (opaque expression string) | ✓ covered | +| `runs-on: ${{ vars.CI_RUNNER \|\| 'ubuntu-latest' }}` | `Job.runner: RunnerSpec = HostedRunner { RunnerLabel } \| SelfHosted { labels }` | ⚠ **EXPRESSION-SYNTAX GAP** — `RunnerLabel` is enum literal only; cannot represent GH Actions expression `${{ vars.X \|\| 'fallback' }}` | +| `timeout-minutes: 5` | `Job.timeout_minutes: Int?` | ✓ covered | +| `steps: [...]` | `Job.steps: List` | covered (per-step shape ratified) | + +### Per-step inventory (representative — `actions/checkout@v4` step from ci.yml) + +| ci.yml field | actions.dag carrier | Status | +|---|---|---| +| `name: Checkout` | `UsesStep.name: String?` | ✓ covered | +| `uses: actions/checkout@v4` | `UsesStep.uses: ActionRef { owner, repo, ref }` | ✓ covered | +| `with: ` | `UsesStep.with: Map` | ✓ covered | + +### 5 substantive carrier gaps requiring Slice 4 substrate-prereq PRs (cited in propagated concerns below) + +1. **`Workflow.concurrency` absence**: ci.yml uses top-level `concurrency:`; `dsl/extdeps/github/actions.dag::Workflow` does NOT model `concurrency` (only `Job.concurrency` exists). P1/P2 fidelity requires extension (`Workflow.concurrency: ConcurrencySpec?`). +2. **`PullRequestActivity.ReadyForReview` arm absence**: ci.yml uses `types: [..., ready_for_review]`; carrier only has `Opened | Synchronize | Reopened | Closed`. Audit + extend. +3. **`Push.paths` required-but-omitted**: carrier requires both `branches` and `paths`; ci.yml only declares `branches`. Make `paths` optional with default empty list OR document the existing-default semantic. +4. **`WorkflowPermissions.issues/.actions` required-but-omitted**: carrier requires all 4 permission fields; ci.yml only declares `contents` + `pull-requests`. Either (a) make fields Optional, OR (b) introduce `PermUnset` arm to represent "no permission scope set" structurally. +5. **`RunnerSpec` expression-syntax modeling**: ci.yml uses `runs-on: ${{ vars.CI_RUNNER || 'ubuntu-latest' }}` — a GH Actions expression with fallback. Current `RunnerLabel` is enum literal only; cannot represent expression sites. Decide: (a) generalize `RunnerSpec` to allow opaque expression strings (parallel to `if_condition: String?`), (b) introduce expression-AST carrier covering all expression sites (`concurrency.group`, `if_condition`, `with` values, `env` values, `runner`), or (c) declare expression-string opaque for runner only as minimal-surface fix. Choice IS substrate-shape — Mgr canvas-tier decision. + +### Carry-forward authoring concerns (Slice 4 acceptance discipline) + +6. **Trigger fidelity — NO fabrication**: current ci.yml declares only `push` and `pull_request` triggers — NOT `schedule`. Slice 4 YamlStatic emitter MUST emit faithfully (push + PR only); `Schedule` trigger arm exists in the carrier but is NOT instantiated for current ci.yml. **No fabrication of triggers absent from source.** +7. **Step body + action input completeness as MUST (not SHOULD / NICE-TO-HAVE)**: Slice 4 ci.yml-equivalent regeneration requires executable step bodies (`RunStep.run`, `RunStep.shell`, `RunStep.env`) and complete action references (`UsesStep.uses: ActionRef`, `UsesStep.with: Map`) as MUST acceptance. P1 modeling faithfulness fails if these are partial. +8. **Exhaustive inventory must extend per-job and per-step coverage**: this brief covers top-level + ONE representative job (`fmt`) + ONE representative step. Slice 4 canvas MUST inventory EVERY job (`fmt`, `ci`, `changes`, `v3`, `self_host_ratchet`, etc.) and EVERY step within each. STOP/reroute discipline applies per-job-per-step. + +These concerns will be encoded into the Slice 4 brief as MUST-address acceptance gates when Substrate Mgr (warm-wolf-698) authors post-canvas-merge. + +--- + +— Authored by deep-wolf-155 (PM) 2026-05-12 per operator FULL elevation directive + Director ratification msg_5cbdad24 + (c-refined) ratification msg_237bde05 / msg_f9fd669e; revised after codex BLOCKING #9970 on PR #2749 (INVARIANTS P1: WorkflowRuntime belongs in gunbc-substrate projection function, not as field on actions.dag::Workflow). diff --git a/docs/briefs/r3-t-wad-full-r3-emitter-dispatch-canvas-worker.md b/docs/briefs/r3-t-wad-full-r3-emitter-dispatch-canvas-worker.md new file mode 100644 index 00000000000..19c7ab5b00d --- /dev/null +++ b/docs/briefs/r3-t-wad-full-r3-emitter-dispatch-canvas-worker.md @@ -0,0 +1,88 @@ +# Worker brief — T-WAD FULL R3 emitter-dispatch architecture canvas + +**Authority**: PM scoping doc `docs/r3-t-workflow-as-data-full-r3-close-scope.md` §6 WI-1; operator FULL elevation 2026-05-12; Director ratification msg_5cbdad24 + (c-refined) substrate-shape ratification msg_237bde05 + msg_f9fd669e + msg_2a68a4b5 2026-05-12. +**Parent**: T-Workflow-As-Data lane (Substrate Mgr warm-wolf-698); this design canvas; final Mgr-tier ratification routes through warm-wolf-698, with Director co-sign at #828 if cross-tier confirmation needed. +**Closure predicate**: design canvas authored at `docs/design-ci-workflow-emitter-dispatch.md` + Mgr-ratified per-target emission semantics; downstream Slice 4-5 emitter implementation work consumes this canvas. + +## Substrate-shape ratification anchor + +**The (c-refined) substrate-shape is LOCKED** (post-2026-05-12 cascade): + +- `WorkflowRuntime` is an invocation-time parameter to `project_github_actions: (CIWorkflowDag, WorkflowRuntime) -> Workflow`, **NOT a field on any carrier**. +- `WorkflowRuntime` lives in gunbc namespace (`dsl/gunbc/ci_emission.dag` — NEW file landed by WI-2). +- `dsl/extdeps/github/actions.dag::Workflow` stays platform-faithful and UNMODIFIED. +- The earlier option (a) "field on Workflow" was **RETRACTED** at Director msg_b4151f45 + codex BLOCKING #9970 on PR #2749 (INVARIANTS P1 violation — CI logic on platform carrier). +- Option (b) "field on CIPipeline" was **SUPERSEDED** — `CIPipeline { name, gates: List }` is flat without edge structure; cannot serve as projection input per warm-wolf-698 msg_27d99080. Replaced by `CIWorkflowDag` (PR #2736) as input domain. +- Option (c) "wrapper node" was **SUPERSEDED** by (c-refined) projection function — parameter-as-data preserves single-substrate-fact + cost-of-change ≤ 1. + +**This brief does NOT reopen the placement question**. The canvas evaluates per-target emission semantics on top of the ratified substrate-shape, not the substrate-shape itself. + +## Output + +`docs/design-ci-workflow-emitter-dispatch.md` — new design canvas matching the shape of `docs/design-affected-set-lens.md` (single-authority, locked-design). Canvas should consume the ratified (c-refined) shape as given, not re-derive it. + +## Scope + +Design the emitter-dispatch architecture for T-Workflow-As-Data FULL R3-close on top of the locked (c-refined) substrate: + +1. **Per-target emission semantics** (the substantive canvas surface): + - **YamlStatic** (Slice 4 deliverable): body of `project_github_actions(ci_workflow_dag, YamlStatic)` walks `CIWorkflowDag` (PR #2736) and emits a `Workflow` value whose deterministic YAML encoding is **semantically equivalent** to current `.github/workflows/ci.yml` (same triggers / jobs / steps / runners / conditions / permissions / matrix as consumed by GitHub Actions); one-time migration rewrites committed file to canonical encoding (non-semantic facts — comments, whitespace, key ordering — discarded per P1: `Workflow` is single authority for CI semantics; load-bearing comments must migrate into substrate as modeled facts, not into parallel byte-authority); regression-guard gate compares on-disk artifact byte-wise to fresh projection output (internal byte-identity: projection-output ↔ committed-artifact, NOT external: substrate ↔ legacy hand-authored content); regenerated on workflow edit; consumer is GH Actions runner directly. + - **BinaryShim** (Slice 5): body of `project_github_actions(ci_workflow_dag, BinaryShim)` emits a Workflow value pointing to a compiled binary (Rust target) entry-point + thin shim YAML (≤10 lines invoking binary); binary reads diff at PR-time, computes affected-set, dispatches matrix dynamically. Slice 7 affected-set integration consumes. + - **PythonShim** (DESIGN-ONLY per briansrls BLOCKING on PR #2744 2026-05-12T10:46:59Z; held out of initial enum until real consumer exists): same shim model, Python runtime substrate (Python target emit pattern reused); sketch only — NO enum variant or emitter arm lands until a real runtime consumer exists (symmetric treatment with InlineGunbc per INVARIANTS P5 / Pure Bootstrap). + - **InlineGunbc** (DESIGN-ONLY per codex BLOCKING #9970 + PR #2746 §5.4; held out of initial enum until real consumer exists): gunbc-as-runtime-orchestrator longer-term option; sketch only — NO enum variant or emitter arm lands until a real runtime consumer exists. + +2. **Emitter dispatch composition** — how per-arm projection bodies compose with existing `05_emit_rust.dag` / `_python.dag` / `_go.dag` consolidation thesis (per memory `project_eliminate_emit_lang_files.md`); how the projection function's pinned invocation (`gunbc_ci_yml_workflow: Workflow = project_github_actions(ci_workflow_dag, YamlStatic)`) flows into the existing emission pipeline. + +3. **Affected-set integration shape** — how `BinaryShim` arm consumes `affected_set(Dag_before, Dag_after)` from `docs/design-affected-set-lens.md`; what the runtime decision surface looks like (matrix-spec emission, job-skip emission, etc.); cross-tier coordination with Slice 7 owner (Verification Mgr clever-tern-670). + +4. **Equivalence claim** — what does "same `CIWorkflowDag` emits semantically equivalent output across workflow runtimes" mean precisely; test claim shape for `workflow_runtime_open_enum_landed` + `project_github_actions_landed` gates (per scope doc §1). + +5. **GH Actions expression-substrate consumption** — per Director ratification of PR #2751 (warm-wolf-698 expression-substrate canvas): canvas should reference the ratified `Expression = OpaqueString(String)` 🟡 YELLOW shape + 5-site uniform migration (RunnerSpec / Job.if_condition / ConcurrencySpec.group / Step.with[k] / Step.env[k]); YamlStatic emission = "emit Expression::OpaqueString variant verbatim to YAML"; BinaryShim/PythonShim = "evaluate Expression at runtime" (opaque-passthrough until dissolution fires). + +6. **Carrier reuse audit** — confirm existing `dsl/extdeps/github/actions.dag` carriers (concrete `Workflow` `:21` / `Job` `:110` / `Step` `:147`) + ratified Expression carrier (PR #2751) are sufficient for YamlStatic emitter. **5 carrier gaps total** identified per WI-2 brief Propagated Substrate-Fidelity Concerns section + warm-wolf-698 inventory: **4 small extdeps-fidelity substrate-prereq PRs** (`Workflow.concurrency` / `PullRequestActivity.ReadyForReview` / `Push.paths` Optional / `WorkflowPermissions.*` Optional) PLUS **1 substrate-shape canvas + Expression carrier** for `RunnerSpec` expression-syntax (PR #2751 canvas RATIFIED at msg_168005e1; Expression carrier introduction is a separate substrate-prereq PR authored by warm-wolf-698 post-#2751-merge). The 5th gap is canvas-tier, not Slice-4-extdeps-fidelity. + +## Reference materials + +- `docs/r3-t-workflow-as-data-full-r3-close-scope.md` — PM FULL scope (this brief's parent); §2 has the LOCKED (c-refined) substrate-shape statement +- `docs/briefs/r3-t-wad-full-r3-cidag-scaffold-worker.md` — sibling WI-2 brief (declares projection-function substrate in NEW file `dsl/gunbc/ci_emission.dag` — NOT extension of `dsl/gunbc/ci.dag`); this canvas plugs into the projection-function-shape that WI-2 lands +- `docs/design-affected-set-lens.md` — affected-set lens substrate (Slice 7 consumer) +- `docs/design-emission-model.md` — existing emission architecture (the model this canvas extends) +- `docs/design-clean-emission-contract.md` — emission contract authority +- PR #2749 §7 (warm-wolf-698 substrate-shape comparison canvas) — (c-refined) ratification anchor +- PR #2736 (neat-badger-30) — `CIWorkflowDag` carrier introduction; projection input domain +- PR #2751 (warm-wolf-698 GH Actions expression substrate canvas) — `Expression` 🟡 YELLOW substrate; Director-ratified per msg_168005e1 +- `dsl/extdeps/github/actions.dag` — **canonical platform carriers**: concrete `Workflow` (`:21`), `Job` (`:110`), `Step` (`:147`), `WorkflowSecret` (`:102`) +- `dsl/gunbc/ci.dag` — **existing gate-centric CI substrate** (PR #2371); canvas does NOT extend this file (per (c-refined) shape); WI-2 lands the projection-function substrate in NEW file `dsl/gunbc/ci_emission.dag` +- memory: `project_eliminate_emit_lang_files.md` — omni-emission consolidation thesis + +## Acceptance gates + +1. Canvas authored at `docs/design-ci-workflow-emitter-dispatch.md` per scope §1-6 above +2. Each per-target emitter arm in the initial enum (`YamlStatic`, `BinaryShim`) has explicit emission semantics + acceptance contract +3. `PythonShim` AND `InlineGunbc` documented as DESIGN-ONLY future targets with explicit "no enum variant / emitter arm lands until real runtime consumer exists" exclusion rule (symmetric treatment per INVARIANTS P5) +4. Substrate-shape placement is NOT re-evaluated — (c-refined) shape is consumed as given; canvas explicitly cites PR #2749 §7 as placement authority +5. Cross-references to `design-affected-set-lens.md` §5 (CI integration sketch) explicit — canvas resolves the "CI integration deferred" placeholder +6. Cross-references to PR #2751 (Expression substrate) for expression-site emission contracts +7. No parallel-representation debt: canvas does NOT extend `dsl/gunbc/ci.dag` or modify `dsl/extdeps/github/actions.dag` substrate-shape outside the (c-refined)-ratified surface +8. Cargo / clippy / fmt clean (no code changes expected; doc-only PR) + +## STOP / PING criteria + +- **STOP** if canvas reveals the (c-refined) shape doesn't actually compose with the existing emission pipeline — surface to warm-wolf-698 + Director for shape re-evaluation (would constitute substrate-shape re-ratification request) +- **STOP** if per-target emission body shape requires substantive new substrate carriers beyond the 5 already-tracked gaps (4 small substrate-prereq PRs + 1 Expression carrier via PR #2751 canvas) — surface to Substrate Mgr warm-wolf-698 +- **STOP** if the emitter-dispatch shape conflicts with `project_eliminate_emit_lang_files.md` consolidation thesis — surface; this canvas should EXTEND that thesis, not contradict +- **STOP** if affected-set integration shape requires substantive negotiation with Verification Mgr clever-tern-670 — surface for cross-tier ratification (Slice 7 owner) +- **PING** PM (deep-wolf-155) on PR-open for review-routing +- **PING** Substrate Mgr (warm-wolf-698) on PR-open for Mgr-tier ratification routing (lane owner) +- **PING** Verification Mgr (clever-tern-670) on PR-open if BinaryShim affected-set-integration shape is non-trivial +- **COORDINATE** with sibling WI-2 worker cool-carp-720 — WI-2 lands the projection-function-substrate this canvas plugs into + +## Sequencing + +- Canvas authoring is dispatch-ready NOW (Slice 1 substrate LANDED via PR #2160; (c-refined) shape ratified at PR #2749; Expression substrate ratified at PR #2751 — all upstream) +- Canvas merge is the gate to dispatch Slice 4 (YamlStatic emitter implementation) + Slice 5 (BinaryShim emitter implementation) per-arm-body briefs +- Canvas should reference but NOT depend on Slice 2 (timing carriers) — emitter dispatch is orthogonal to timing instrumentation + +--- + +— Authored by deep-wolf-155 (PM) 2026-05-12 per operator FULL elevation directive + Director ratification msg_5cbdad24; revised 2026-05-12 per codex BLOCKING on PR #2744 (2026-05-12T07:49:06Z) — substrate-shape questions LOCKED to (c-refined) per ratification cascade; no longer "OPEN QUESTION"; WI-2 lands NEW file `dsl/gunbc/ci_emission.dag` not extension of `dsl/gunbc/ci.dag`. diff --git a/docs/r3-t-workflow-as-data-full-r3-close-scope.md b/docs/r3-t-workflow-as-data-full-r3-close-scope.md new file mode 100644 index 00000000000..f26d445b0fc --- /dev/null +++ b/docs/r3-t-workflow-as-data-full-r3-close-scope.md @@ -0,0 +1,244 @@ +# T-Workflow-As-Data — FULL R3-close scope (operator elevation 2026-05-12) + +**Author**: deep-wolf-155 (PM) +**Authority**: operator directive 2026-05-12 (Brian; transcript-cited at gunbc#846 / Director inbox routing) — elevate T-CI-Workflow-As-Data to FULL R3-close criterion (not just demonstration). Operator design ratification: workflow runtime is **modeled data** (open enum, invocation-time projection parameter), not a hard-coded emitter choice. **Substrate-shape RATIFIED (c-refined)** per PR #2749 §7 + Director msg_237bde05 / msg_f9fd669e / msg_2a68a4b5: `WorkflowRuntime` is an invocation-time parameter to `project_github_actions: (CIWorkflowDag, WorkflowRuntime) -> Workflow`, NOT a field on any carrier. See §2 for full (a)/(b)/(c) RETRACTED/SUPERSEDED treatment. +**Routing**: Director (zesty-bear-812) **RATIFIED** scope + framing at msg_5cbdad24 2026-05-12 ~06:35Z. Substrate Mgr (warm-wolf-698) lane-absorbs Slices 4-5/8; Verification Mgr (clever-tern-670) absorbs Slice 7 (affected-set integration); Debt-Paydown Mgr (zesty-boar-261) absorbs Slice 6 sub-component (slow-test-exemptions dissolution). +**Parent program**: T-Workflow-As-Data lane in `docs/r3-program-plan.md` §4.4 + §1.8 gates 53-58 + 63. +**Status**: **RATIFIED 2026-05-12** (Director). PR #2744 + downstream Mgr-tier briefs/canvases proceeding. + +--- + +## §0. What changes vs existing T-WAD plan + +**Existing scope** (per `r3-program-plan.md` §1.8 gate #56): `ci_workflow_modeled_as_dag` = "at least one workflow as `.dag` data executes through evaluator." Slice 3 demonstration; consumes Slices 1+2 substrate. **Slice 1 LANDED via PR #2160 + #2169** (`WorkflowSecret` + `CronSchedule` carriers — Slice 1 worker brief naming `CronExpression` was superseded by the landed `CronSchedule` model at `dsl/extdeps/cron_schedule_model.dag`; use `CronSchedule` as the grounded name). **Slice 3 demo LANDED via PR #2371** (`t_ci_workflow_as_data_demo.dag` + integration tests). + +**FULL R3-close scope** (operator-ratified 2026-05-12; Director-ratified gate-additive framing msg_5cbdad24): +1. **ALL** CI workflow authored as `.dag` (not just one demo workflow) — `.github/workflows/ci.yml` content sourced from gunbc-substrate via projection function `project_github_actions(ci_workflow_dag, target) → Workflow`; WI-2 lands the projection-substrate (new file `dsl/gunbc/ci_emission.dag`); Slice 4-5 implements per-arm projection bodies that walk `CIWorkflowDag` (PR #2736) + emit the chosen target. +2. **Hand-authored `ci.yml` AUTHORITY DISSOLVED** — `.github/workflows/ci.yml` content authored by gunbc emission (not hand-edited); file present as full-emit artifact (YamlStatic) OR thin-shim entry-point (BinaryShim); regression-guard test prevents hand-authored re-introduction. **Per briansrls BLOCKING #PR2744 2026-05-12 + openai-pro REQUEST_CHANGES on PR #2744 2026-05-12T10:51:06Z**: NOT file deletion — P5 / Pure Bootstrap dissolves AUTHORITY, not file presence; both initial-enum WorkflowRuntime arms (YamlStatic + BinaryShim) REQUIRE the artifact for GH Actions trigger discovery. The "absent" option is structurally impossible for the initial enum (only conceivable for future DESIGN-ONLY runtimes like InlineGunbc that don't target GH Actions; such runtimes land via separate substrate-prereq PR and would extend this gate description at that time). +3. **WorkflowRuntime toggle** — same `CIWorkflowDag` (PR #2736 carrier) projects through `project_github_actions(ci_workflow_dag, target)` to multiple target shapes (initial enum: `YamlStatic | BinaryShim | ...`; `PythonShim` AND `InlineGunbc` are DESIGN-ONLY future targets per INVARIANTS P5 — held out of initial enum until real consumers exist; PythonShim per briansrls BLOCKING 2026-05-12T10:46:59Z, InlineGunbc per PR #2746 §5.4); `WorkflowRuntime` is invocation-time projection parameter (modeled data), NOT carrier-time field. Substrate-shape LOCKED per (c-refined) ratification — see §2 for full treatment. +4. **Affected-set integration** — Layer 2 path-regex bridge (PR #2718/#2721/#2727) dissolved; CI selection consumes affected-set lens output (PR #2713 ✓ merged) +5. **Cost dimension on test nodes** — `slow-test-exemptions.txt` dissolved; slow-test ratchet derives from Cost dimension structurally + +## §1. §1.8 gate additions — RATIFIED 2026-05-12 (gate-additive; revised post-(c-refined) ratification) + +**Authority**: Director ratification (zesty-bear-812): +- Initial gate-additive framing + 4 NEW gates: msg_5cbdad24 2026-05-12 ~06:35Z +- Revised gate set per (c-refined) canvas ratification + clarification: msg_4f7f536d + msg_f9fd669e 2026-05-12 ~07:00Z (6 NEW gates with substrate-shape vs state-check family splits per kernel-modeling discipline) + +**Framing**: GATE-ADDITIVE (NOT scope-expand #56). Reasoning: #56 was authored as demonstration-class (one workflow proves feasibility); scope-expanding to "ALL workflow" would invalidate demonstration semantics + force a post-hoc reclassification of #56's status meaning. Cleaner: #56 stays as demonstration anchor (promotable to PASSING when first .dag workflow lands — likely closing soon given PR #2371 landed the demo); add 6 NEW gates for full-R3 closure surface. + +**Citation chain**: operator directive aligns with prior #846 c#4412330468 ("0 hand-Rust including tests AND stage0; bootstrap is data + self-generated") — `.github/workflows/ci.yml` is structurally identical to hand-Rust under that framing. Dissolution is load-bearing for R3 close. + +**Substrate-shape ratified** (per PR #2749 (c-refined)): `WorkflowRuntime` sum-type lives in gunbc namespace; `project_github_actions: (CIWorkflowDag, WorkflowRuntime) → Workflow` lives in gunbc; extdeps.github.actions.Workflow unmodified. Emission choice is invocation-time data (projection parameter), NOT carrier-time data. See PR #2749 for the comparison canvas authority. + +**Type-name rename `EmissionTarget` → `WorkflowRuntime`** (2026-05-12 per warm-wolf-698 PR #2749 commit `575eb7e36` addressing operator BLOCKING at PR #2749 :666 / :672): the original `EmissionTarget` name collided with the canonical Shape-A carrier `type EmissionTarget { language: LanguageSpec, rendering: RenderingSpec? }` declared at `src/v3/SELF_HOSTING.md:609`. Per INVARIANTS P2 (single-authority for type names across gunbc surface), the rename is structurally required; Director ratification msg_4f7f536d at sum-type-name level is superseded by post-ratification name-collision discovery per `feedback_pre_compaction_framings_self_supersede`. All OTHER ratified elements stand: initial-enum variant names (`YamlStatic | BinaryShim`; `PythonShim` is a reserved DESIGN-ONLY future name not in initial enum per INVARIANTS P5 — see §1 gate `workflow_runtime_open_enum_landed`), 22-site migration scope (per PR #2751 §5.5 expansion), 🟡 YELLOW Practice 4 receipt, projection function signature shape, gunbc-namespace placement, named dissolution trigger. Cascade renames coordinated across PR #2746 merged content (follow-on PR), PR #2745 WI-2 implementation (cool-carp-720 surfaced), and PR #2750 ledger sync (gate-ID rename `emission_target_open_enum_landed` → `workflow_runtime_open_enum_landed`). + +| Gate ID | Predicate-family | Lane | Pass condition | +|---|---|---|---| +| **#56** (unchanged) | demonstration | T-WAD | At least one workflow as `.dag` data executes through evaluator (existing scope — promotable when PR #2371 demo + integration is gate-PASSING) | +| **NEW: `ci_yml_hand_authority_dissolved`** | state-check | T-WAD | `.github/workflows/ci.yml` is no longer hand-authored CI logic — file is either (a) committed-emission-artifact byte-identical to `project_github_actions(ci_workflow_dag, target)` output with regression-guard test (YamlStatic), or (b) thin-shim entry-point invoking the emitted binary (BinaryShim); in NO case is it hand-edited CI logic AND in NO case is the artifact absent (both initial-enum WorkflowRuntime arms require `.github/workflows/ci.yml` for GH Actions trigger discovery). Regression guard test prevents hand-authored re-introduction. **Per briansrls BLOCKING #PR2744 inline review 2026-05-12T06:58:55Z + openai-pro REQUEST_CHANGES on PR #2744 2026-05-12T10:51:06Z**: deleting hand-maintenance ≠ deleting executable artifact; P5 / Pure Bootstrap dissolves AUTHORITY, not file presence; "absent" pass condition is structurally impossible for initial enum (only conceivable for future DESIGN-ONLY runtimes that don't target GH Actions, e.g., InlineGunbc — would extend this gate at land-time via substrate-prereq PR). | +| **NEW: `workflow_runtime_open_enum_landed`** | substrate-shape | T-WAD | `WorkflowRuntime` sum-type with **2 initial arms** (`YamlStatic \| BinaryShim \| ...`) declared in gunbc namespace as open enum; `PythonShim` AND `InlineGunbc` are DESIGN-ONLY per INVARIANTS P5 (PythonShim per briansrls BLOCKING 2026-05-12T10:46:59Z; InlineGunbc per PR #2746 §5.4) — both land via separate substrate-prereq PRs paired with their runtime consumers | +| **NEW: `project_github_actions_landed`** | substrate-shape | T-WAD | `project_github_actions: (CIWorkflowDag, WorkflowRuntime) → Workflow` projection function declared in gunbc namespace; consumes `extdeps.github.actions.Workflow` as output type; per (c-refined) substrate-shape per PR #2749 §7 | +| **NEW: `test_cost_dimension_landed`** | substrate-shape | T-WAD + Debt-Paydown | `Cost` dimension declared on test nodes (substrate-shape only — splits from state-check sibling below) | +| **NEW: `slow_test_exemptions_dissolved`** | state-check | T-WAD + Debt-Paydown | `scripts/slow-test-exemptions.txt` deleted; slow-test ratchet derives from `Cost` dimension structurally (state-check sibling of `test_cost_dimension_landed` per kernel-modeling discipline split) | +| **NEW: `ci_uses_affected_set_selection`** | state-check | T-WAD + T-Verification | `BinaryShim` emitter consumes affected-set lens output from PR #2713; Layer 2 path-regex `if:` gates removed from any remaining workflow files (cross-tier co-owned with clever-tern-670 Slice 7 work) | + +## §2. Architectural shape (operator-ratified 2026-05-12; (c-refined) substrate-shape LOCKED 2026-05-12 per PR #2749 §7) + +**`WorkflowRuntime` as modeled data** (open enum, same shape as `Dimension`): + +```dag +type WorkflowRuntime = YamlStatic | BinaryShim | ... +// PythonShim DESIGN-ONLY per briansrls BLOCKING 2026-05-12T10:46:59Z — NOT in initial enum; lands when Python runtime consumer exists +// InlineGunbc DESIGN-ONLY per PR #2746 §5.4 — NOT in initial enum; lands when gunbc-runtime consumer exists +``` + +**Substrate-shape RATIFIED** (per PR #2749 §7 + Director msg_237bde05 + msg_f9fd669e — (c-refined) shape; was option (c) wrapper, refined to projection-function): + +**`WorkflowRuntime` is an invocation-time parameter to the projection function in gunbc-substrate**, NOT a field on any carrier: + +```dag +// In dsl/gunbc/ci_emission.dag (NEW file, WI-2 lands the signature): +project_github_actions: (CIWorkflowDag, WorkflowRuntime) -> Workflow + +// Invocation pin DEFERRED to Slice 4 (canonical CIWorkflowDag instance lands with Slice 4; +// WI-2 landing the binding now would force placeholder-or-conversion authority creation — +// P2 single-authority lockdown per WI-2 brief §3 + acceptance gate 5): +// +// gunbc_ci_yml_workflow: Workflow = project_github_actions(, YamlStatic) +// +// Slice 4 authors the canonical CIWorkflowDag instance AND this pinned binding together. +``` + +- **Input domain**: `CIWorkflowDag` (PR #2736 carrier; gate-dependency-bearing semantic source — flat `CIPipeline` is INSUFFICIENT per warm-wolf-698 msg_27d99080) +- **Output codomain**: `extdeps.github.actions.Workflow` (platform-faithful; UNMODIFIED — INVARIANTS P1) +- **Emission choice**: invocation-time argument (`target: WorkflowRuntime`); per-arm projection bodies are Slice 4-5 implementation + +**Prior framings — RETRACTED / DISSOLVED**: + +- **(a) Field on `Workflow` (extdeps platform carrier)** — RETRACTED 2026-05-12 at Director msg_b4151f45 + codex BLOCKING #9970 on PR #2749. INVARIANTS P1 violation: workflow_runtime IS CI logic, not platform fact; cannot land on `dsl/extdeps/github/actions.dag` per its scope header ("platform constraints — not CI logic"). +- **(b) Field on `CIPipeline`** — superseded; `CIPipeline { name, gates: List }` is flat without edge structure; cannot serve as projection input per warm-wolf-698 msg_27d99080. Replaced by `CIWorkflowDag` (PR #2736) input domain. +- **(c) Wrapper node** `WorkflowEmission { workflow, target }` — superseded by (c-refined) projection function. Wrapper introduces an extra carrier; projection function is the cleaner shape (parameter-as-data preserves single-substrate-fact + cost-of-change ≤ 1). + +**Carrier hierarchy** (per `dsl/extdeps/github/actions.dag` authority — UNMODIFIED): + +``` +Workflow { // :21 — CONCRETE type, codomain for project_github_actions + on: List // :23 + jobs: List // :24 + env, permissions, ... +} + +Job { // :110 + steps: List // :114 + needs: List // :115 + runner, strategy, ... +} + +Step = RunStep | UsesStep // :147 — sum type +``` + +**Emitter dispatch** (parallel to `05_emit_*.dag` consolidation thesis per `project_eliminate_emit_lang_files.md`): + +- Slice 4-5 emitter consumes the **pinned-projection invocation** `gunbc_ci_yml_workflow = project_github_actions(ci_workflow_dag, YamlStatic)` (or other `target` for BinaryShim / PythonShim / etc.) +- Per-arm projection bodies (Slice 4 = YamlStatic, Slice 5 = BinaryShim) walk `CIWorkflowDag` + emit the chosen target. **`PythonShim` AND `InlineGunbc` are DESIGN-ONLY** (not in initial enum) — PythonShim per briansrls BLOCKING 2026-05-12T10:46:59Z, InlineGunbc per PR #2746 §5.4; each lands via separate substrate-prereq PR paired with its concrete runtime consumer per INVARIANTS P5 +- Same `ci_workflow_dag` value across all targets at workflow level; the emission STRATEGY is invocation-time +- A/B comparison is apples-to-apples (call `project_github_actions(ci_workflow_dag, BinaryShim)` vs `project_github_actions(ci_workflow_dag, YamlStatic)`) + +**Why BinaryShim is the affected-set unlock**: Static YAML can't naturally express "compute affected-set at PR time, dispatch matrix dynamically." BinaryShim makes runtime decisions structural — binary reads git diff, computes `affected_set = ⋃ over dim of reachable(Δ, dim)`, dispatches matrix accordingly. + +**Expression-substrate question — RATIFIED at canvas-tier (NOT blocking this scope)**: GH Actions expression syntax modeling (`runs-on: ${{ vars.CI_RUNNER || 'ubuntu-latest' }}` etc.) is a Slice 4-5 substrate-shape question handled at warm-wolf-698 canvas authority (PR #2751 — Expression 🟡 YELLOW + single OpaqueString variant + three-condition dissolution trigger + 5-site uniform migration; **Director-ratified at msg_168005e1 2026-05-12**). Expression carrier introduction is a separate substrate-prereq PR authored by warm-wolf-698 post-#2751-merge (distinct from the 4 small extdeps-fidelity substrate-prereq PRs covering concurrency / ready_for_review / Push.paths / WorkflowPermissions). NOT a §1 gate. + +## §3. Slice expansion + +Existing T-WAD slices (state at 2026-05-12): + +- **Slice 1**: substrate carriers (`WorkflowSecret { name: SecretName, scope: SecretScope }` + `CronSchedule`) — **LANDED via PR #2160 / #2169** (refined cron model). Brief at `docs/briefs/r3-substrate-t-workflow-as-data-slice-1-worker.md`. +- **Slice 2**: timing carriers (`TimingMeasurement` + `TimingObservationSet` + `WorkflowObservationAnchor` + `TimingBudget`); gates #54 #55; gated on T-LBP COMPLETE +- **Slice 3**: demonstration (gate #56) — `t_ci_workflow_as_data_demo.dag` **LANDED via PR #2371** ("post-S4 carriers"); existing `dsl/gunbc/ci.dag` provides gate-centric CI intent. Gate #56 may already be eligible for PASSING promotion; separate state-check sweep. + +**New slices added by FULL elevation** (Director-ratified absorption to lanes): + +- **Slice 4**: YamlStatic projection-arm implementation — body of `project_github_actions(..., YamlStatic)` walks `CIWorkflowDag` and emits a `Workflow` value whose deterministic YAML encoding is **semantically equivalent** to current `.github/workflows/ci.yml` (same triggers, jobs, steps, runner specs, conditions, permissions, and matrix structure as consumed by GitHub Actions). One-time migration rewrites the committed file to the canonical emission output; non-semantic facts in pre-migration `ci.yml` (comments, blank-line whitespace, key ordering quirks) are discarded — they are not load-bearing CI logic per P1 (`Workflow` is the single authority for CI semantics). Any load-bearing comments in current `ci.yml` (workaround explanations, dissolution-trigger pointers) must migrate into substrate as modeled facts (e.g., structured `Notes` on the carrier OR inlined documentation in `dsl/gunbc/ci_emission.dag`) — they MUST NOT become parallel byte-authority alongside the semantic carrier. The regression-guard gate (per §1 row `ci_yml_hand_authority_dissolved` option (b)) compares the on-disk artifact byte-wise to **fresh projection output** (not to pre-migration `ci.yml`); the byte-identity is internal to the substrate (projection-output ↔ committed-artifact), not external (substrate-output ↔ legacy hand-authored content). Consumed by emission pipeline to produce the on-disk artifact → **Substrate Mgr (warm-wolf-698) lane**. Gated on WI-1 + WI-2 PR merges + PR #2736 (CIWorkflowDag) merge. NOTE: NOT an "WorkflowRuntime field landing" — per (c-refined) shape (§2), `WorkflowRuntime` is invocation-time projection parameter, not carrier-time data. +- **Slice 5**: BinaryShim emitter implementation → **Substrate Mgr (warm-wolf-698) lane**. Parallel to Slice 4; proves toggle. +- **Slice 6**: Cost dimension on test nodes + slow-test-exemptions.txt dissolution → **Debt-Paydown Mgr (zesty-boar-261) lane** (sub-component). Gated on Phase 3 Cluster M settling (test-as-data substrate stable). +- **Slice 7**: Affected-set integration via BinaryShim → **Verification Mgr (clever-tern-670) lane**. Gated on Slice 5 + PR #2713 (✓ merged). +- **Slice 8**: ci.yml hand-authority dissolution (hand-authored content replaced by emission artifact or thin-shim per chosen `WorkflowRuntime`) + workflow-runtime toggle finalized + `ci_yml_hand_authority_dissolved` gate PASSING → **Substrate Mgr (warm-wolf-698) lane**. Gated on Slices 4-7 + acceptance verification. **NOTE** (per briansrls BLOCKING #PR2744 2026-05-12 + openai-pro REQUEST_CHANGES on PR #2744 2026-05-12T10:51:06Z): NOT file-deletion — P5 / Pure Bootstrap dissolves AUTHORITY, not file presence. Both initial-enum WorkflowRuntime arms (YamlStatic + BinaryShim) require `.github/workflows/ci.yml` (full-emit or thin-shim) for GH Actions trigger discovery; "absent" is NOT a valid pass condition for the initial enum. + +## §4. Dependency graph + +``` +External prereqs: + - T-LBP COMPLETE → unblocks Slice 2 (timing carriers) + - Phase 3 Cluster M settling (#2715/#2716, calm-newt-602 + silent-swift-300) → unblocks Slice 6 + - PR #2713 (affected-set lens) ✓ MERGED + - PR #2160 + #2169 (Slice 1 substrate) ✓ MERGED + - PR #2371 (Slice 3 demo) ✓ MERGED + +Critical path (forward): + WI-1 canvas merge ───────┐ + ├─→ Slice 4 (YamlStatic projection-arm) ──┐ + WI-2 ci_emission.dag ────┤ │ + (proj-fn substrate) │ │ + │ │ + PR #2736 CIWorkflowDag ──┤ │ + ├─→ Slice 5 (BinaryShim projection-arm) ──┼─→ Slice 7 (affected-set integration) ──┐ + │ │ + Phase 3 Cluster M settles → Slice 6 (Cost dim) ─────────────────────────┤ + │ + ├─→ Slice 8 (ci.yml hand-authority dissolution) + │ + └─→ all 6 NEW §1.8 gates PASSING + +Parallelizable (started 2026-05-12 — dispatched under PM): + - WI-1 emitter-dispatch architecture canvas (worker still-heron-763) + - WI-2 new file dsl/gunbc/ci_emission.dag — declares WorkflowRuntime open enum + Practice 4 receipt + project_github_actions function signature (DECLARATION + signature only; gunbc_ci_yml_workflow pinned-projection DEFERRED to Slice 4 per P2 single-authority lockdown — worker cool-carp-720) +``` + +## §5. Realistic R3-close timing + +Assumes: +- T-LBP COMPLETE within 2-3 weeks → Slice 2 dispatches +- Phase 3 Cluster M settles within 2-4 weeks → Slice 6 unblocks +- WI-1 + WI-2 land within 1 week (drafts in flight) +- Slices 4-5 take 1-2 weeks each (emitter implementation) +- Slice 7 (affected-set integration) takes 1-2 weeks +- Slice 8 (ci.yml hand-authority dissolution + acceptance) takes 1 week + +**Estimated R3-close-with-FULL**: 6-10 weeks from 2026-05-12. Tight but achievable if external gates (T-LBP, Phase 3 Cluster M) resolve on schedule. + +## §6. Immediate parallel work (PM-direct work-items — DISPATCHED 2026-05-12) + +**WI-1**: T-WAD emitter-dispatch architecture canvas +- Output: `docs/design-ci-workflow-emitter-dispatch.md` (new) +- Worker: **still-heron-763** (PM auto-spawn 2026-05-12 ~06:30Z) +- Brief: `docs/briefs/r3-t-wad-full-r3-emitter-dispatch-canvas-worker.md` +- Independent of held substrate; Slice 1 LANDED + +**WI-2**: NEW file `dsl/gunbc/ci_emission.dag` — projection-function substrate scaffold (per (c-refined) shape) +- Output: NEW file `dsl/gunbc/ci_emission.dag` declaring `WorkflowRuntime` open enum + Practice 4 coproduct-dissolution receipt + `project_github_actions: (CIWorkflowDag, WorkflowRuntime) -> Workflow` function signature with TODO-marked total-handling skeleton. The `gunbc_ci_yml_workflow` pinned-projection data binding is **DEFERRED to Slice 4** (P2 single-authority lockdown — canonical `CIWorkflowDag` instance lands with Slice 4, binding lands with the canonical instance; WI-2 brief §3 + acceptance gate 5). +- Scope: DECLARATION + signature ONLY (per-arm projection bodies are Slice 4-5 owned by Substrate Mgr post-canvas-merge) +- Worker: **cool-carp-720** (PM auto-spawn 2026-05-12 ~06:30Z) +- Brief: `docs/briefs/r3-t-wad-full-r3-cidag-scaffold-worker.md` +- Dependency: PR #2736 (CIWorkflowDag carrier introduction); WI-2 sequences after PR #2736 merge OR rebases on `session/neat-badger-30` +- **Does NOT extend `dsl/gunbc/ci.dag`** — existing gate-centric CI substrate from PR #2371 stays untouched (per (c-refined) shape; INVARIANTS P1 boundary) +- **Does NOT modify `dsl/extdeps/github/actions.dag`** — platform carriers stay platform-faithful (per (c-refined) shape; INVARIANTS P1) + +Both workers briefed with brief-pointer messages 2026-05-12 ~06:30Z. Canvas + extension PRs expected within ~1 week. + +## §7. Routing — RATIFIED 2026-05-12 + +**Director (zesty-bear-812) ratified at msg_5cbdad24 2026-05-12 ~06:35Z**: + +1. ✅ **FULL R3-close scope ratified** — operator directive aligns with #846 c#4412330468 framing; no R4 carve +2. ✅ **Gate framing: GATE-ADDITIVE** (NOT scope-expand #56); 4 NEW gates per §1 (subsequently revised to 6 NEW per msg_f9fd669e + briansrls BLOCKING fix 2026-05-12 — see §1 current table) +3. ✅ **Owner-Mgr decision: LANE-ABSORB to Substrate Mgr (warm-wolf-698)** with explicit T-CI-WAD program-tag on work-items; no dedicated T-CI-WAD Mgr spawn (avoids standing-Mgr-bottleneck per `feedback_standing_managers_need_owned_deliverables`) +4. ✅ **Sequencing endorsed** (Slice 2 gated T-LBP; Slice 6 gated Phase 3 Cluster M; WI-1/WI-2 dispatched immediately) + +**Lane-absorption details** (Director-ratified): +- **Substrate Mgr (warm-wolf-698)**: absorbs Slices 4-5 (emitters) + Slice 8 (ci.yml hand-authority dissolution) into T-WAD lane with T-CI-WAD program-tag; consumes WI-1 canvas + WI-2 extension PR output +- **Verification Mgr (clever-tern-670)**: absorbs Slice 7 (affected-set integration in BinaryShim) — natural extension of PR #2713 ownership +- **Debt-Paydown Mgr (zesty-boar-261)**: absorbs Slice 6 sub-component (slow-test-exemptions.txt dissolution; Cost-dimension on tests integrates with Phase 3 Cluster M test-as-data substrate) + +PM-relay to warm-wolf-698 + Director co-sign at #828 if cross-tier confirmation needed. + +## §8. Cross-references + +- `docs/r3-program-plan.md` §1.4 (Class 4 closure) + §1.8 (gates 53-58, 63) + §4.4 (T-WAD lane) +- `docs/design-affected-set-lens.md` — affected-set lens substrate (PR #2713 ✓ merged); Slice 7 consumes +- `docs/briefs/r3-substrate-t-workflow-as-data-slice-1-worker.md` — Slice 1 substrate carrier brief (LANDED PR #2160) +- `dsl/extdeps/github/actions.dag` — canonical platform carriers (`Workflow:21` `Job:110` `Step:147` `WorkflowSecret:102`) +- `dsl/gunbc/ci.dag` — existing gate-centric CI intent declarations (PR #2371); WI-2 does NOT extend this file (per (c-refined) shape); CIPipeline is NOT used as projection input (flat without edge structure per warm-wolf-698 msg_27d99080) +- `dsl/gunbc/ci_emission.dag` — NEW file WI-2 creates (projection-function substrate; WorkflowRuntime enum + Practice 4 receipt + project_github_actions signature; `gunbc_ci_yml_workflow` pinned-projection DEFERRED to Slice 4 per P2 single-authority lockdown) +- PR #2736 (neat-badger-30) — `CIWorkflowDag` carrier introduction; WI-2 sources projection input from this +- `dsl/extdeps/cron_schedule_model.dag` — CronSchedule carrier (LANDED via PR #2169) +- `docs/ci-pipeline-optimization.md` — pre-v3 historical optimization (background context; not active program) +- `docs/briefs/r3-ci-layer-2-pm-prestaged-mgr-fill-template.md` — Layer 2 path-regex bridge (PR #2721 ✓ merged); dissolution target for Slice 7 +- `project_eliminate_emit_lang_files.md` (memory) — omni-emission consolidation thesis; inherited architecture for workflow-target dispatch +- `feedback_audit_adjacent_authority_first` (memory) — grep authority before authoring; rule of record for codex BLOCKING #9970 fix below + +## §9. Acceptance-aggregator pattern pilot — Director scaffold LANDED (PR #2748); pilot row REVISED 2026-05-12 + +Director scaffolded acceptance-aggregator pattern doc at `docs/design-section-1-8-acceptance-aggregator-pattern.md` (PR #2748). Pattern semantics: new §1.8 Family value 'acceptance-aggregator' + new 'depends_on:' column (comma-separated #-refs to constituent rows). Status derived as lattice-meet (DECLARED < CONSUMER_LANDED < PASSING) — machine-checkable; never hand-set. Aggregator rows are VIEWS over constituents; do NOT inflate 97→96 honest-close arithmetic. + +**T-CI-WAD pilot row** (Director-ratified at msg_4f7f536d + msg_f9fd669e 2026-05-12; depends_on revised 4→5→6 across Director iterations): + +| Proposed | Predicate-family | Lane | depends_on (lattice-meet status) | +|---|---|---|---| +| `t_ci_wad_acceptance` (or PM-named equivalent) | acceptance-aggregator | T-CI-WAD | **#56 + 6 NEW** (from §1): #56, `ci_yml_hand_authority_dissolved`, `workflow_runtime_open_enum_landed`, `project_github_actions_landed`, `test_cost_dimension_landed`, `slow_test_exemptions_dissolved`, `ci_uses_affected_set_selection` | + +**Status**: PARKED pending PR #2748 ratification (currently 1/2 approvals). When PR #2748 ratifies, this pilot row inserts into §1.8 ledger as the canonical T-CI-WAD aggregator. Sibling clusters (Cluster M / Cluster F / Cluster K / T-V2-Retirement) get the same template at low marginal cost. + +**Row is SHAPE-STABLE** post (c-refined) ratification: constituent gate-IDs finalized at Director msg_f9fd669e. depends_on revisions from #56+4→#56+5→#56+6 reflect canvas-driven gate-set refinement; aggregator semantics unchanged. + +**Lattice-meet status derivation**: +- All constituents DECLARED → aggregator DECLARED +- All constituents CONSUMER_LANDED → aggregator CONSUMER_LANDED +- All constituents PASSING → aggregator PASSING +- ANY mix → aggregator status = minimum of constituents (per lattice-meet rule) + +--- + +**End of scoping doc.** + +— Authored by deep-wolf-155 (PM) 2026-05-12. Director ratification absorbed msg_5cbdad24. codex BLOCKING #9970 (carrier hierarchy: Workflow > Job > Step) fixed 2026-05-12 — earlier draft incorrectly stated `Workflow` generic + flat job→Step mapping; corrected to concrete `Workflow` per `dsl/extdeps/github/actions.dag:21` authority + nested Job-with-Steps hierarchy.