From cf3d3f7ecd98a5311f944227c7cbc3c9ef8105ae Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Tue, 19 May 2026 03:01:22 +0000 Subject: [PATCH 1/4] v4 T-11+T-16 Wave-0: 05_emit.dag interface-freeze + omni-demo design layer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Authors the bounded Wave-0 deliverable for T-11 (per-target emit Γ—5 Shape-A) and T-16 (full-stack omni-emission demo): the immutable emit/compile I/O contract, the no-templating / inverse-grammar-walk discipline, the gate #28 ONE-Node-tree + coordination omni contract, and worked Acceptance examples a Wave-3+ worker fills against. Scaffold-only by design (anti-conflation rule): no carrier minted, no real impl. Refine-to-real is the explicitly NAMED Wave-3 triggers (T-10 orchestrator real / T-4 Γ—5 grammar-data for T-11; T-11 real + T-4.5–4.8 for T-16). Acceptance design is refinement-free β€” no refinement keys / NonEmptyList until T-25-core, per Wave-0 discipline. No new files; closed-tree checksum unchanged. Practice-4 disposition 🟒 (no dissolution surface in the diff). Co-Authored-By: Claude Opus 4.7 (1M context) --- src/v4/compiler/05_emit.dag | 175 +++++++++++++++++++++++++++++++++++- 1 file changed, 171 insertions(+), 4 deletions(-) diff --git a/src/v4/compiler/05_emit.dag b/src/v4/compiler/05_emit.dag index 01fd8ebb253..4bb4c77e9be 100644 --- a/src/v4/compiler/05_emit.dag +++ b/src/v4/compiler/05_emit.dag @@ -1,9 +1,176 @@ // src/v4/compiler/05_emit.dag -// Scope: target-source projection from inferred tree and target spec. +// +// Scope: target-source projection from the inferred tree and a target +// model β€” the U1 Realize phase, the structural inverse of +// `ingest`. Per-target specialization (T-11) and the full-stack +// omni-emission demo contract (T-16) are owned here: emit is the +// single coercion=emission authority (STRUCTURE.md Β§"coercion = +// emission"). There is no parallel per-target emitter and no +// separate omni-projection mechanism. // Anchor: https://en.wikipedia.org/wiki/Code_generation_(compiler) -// Owns: none. -// Consumes: none. -// Status: scaffold for T-10. +// +// ── WAVE-0 SCOPE (interface-freeze + witness/Acceptance design layer) ── +// +// This is the bounded Wave-0 deliverable for T-11 + T-16: the +// immutable I/O contract, the per-target / omni design contract, and +// the worked Acceptance examples a Wave-3+ worker must satisfy. It is +// NOT the implementation. Per the anti-conflation rule (codex BLOCKING +// `a67577c3`): Wave-0 β‰  dependency-satisfied implementation. No carrier +// is minted here; the real per-target grammar-data fold and the omni +// projection are the NAMED Wave-3 triggers below, not this PR. +// +// NAMED REFINE TRIGGERS (explicit β€” refine-to-real is Wave-3+, NOT here): +// β€’ T-11 real fill β€” TRIGGER: T-10 orchestrator real (`emit ∘ core ∘ +// ingest` over a real `InferredTree`) + T-4 Γ—5 Shape-A language +// models grammar-as-data landed. Wave-4 IMPL per TASKS.md T-11. +// β€’ T-16 real fill β€” TRIGGER: T-11 real + T-4.5–T-4.8 (coordination / +// react / formats) landed. Wave-5 IMPL per TASKS.md T-16. +// +// WITNESSES OFF REFINEMENT (Wave-0 discipline, operator-pinned): the +// Acceptance design below does NOT use refinement keys or +// `NonEmptyList`. Those are deferred to `std/collection.dag` Wave-A2 / +// T-25-core (a refined `List where non_empty`, never a per-file +// mint β€” 5-language precedent, operator-flagged). Any Acceptance shape +// that would need a non-empty/refined carrier is held until T-25-core +// lands OR is named as an explicit Wave-3 trigger above. Do NOT mint a +// local refinement to make a witness expressible β€” STOP and escalate. +// +// ── NO-TEMPLATING CONSTRAINT (operator 2026-05-17, binding) ── +// +// emit goes THROUGH the grounded target model's grammar-as-data, run +// in the inverse direction β€” NEVER a string template or print routine. +// The declarative bidirectional grammar relation (concrete-syntax ⟷ +// `Node`) is authored once (T-4 / T-7) and consumed in BOTH directions: +// forward = parse (T-7), inverse = emit. A string-templated emit path +// is the emit-side D2 hollow alias β€” an artifact the compiler cannot +// ground and coercion-check. The per-target "translation tables" of +// T-11 ARE this grammar-as-data, NOT fill-in-the-holes templates. STOP +// if any emission step cannot be expressed as the inverse grammar walk. +// +// ── T-11: PER-TARGET SPECIALIZATION (Γ—5 Shape-A) ── +// +// The five Shape-A targets β€” rust / python / go / cpp / typescript β€” +// match T-4's language set and the execution-graph critical path; T-16 +// depends on the full set. Per-target behavior is the inverse walk of +// each target's own grammar-as-data model (`extdeps/languages/`), +// never an `if target == X` special-case in emit. Per STRUCTURE.md: +// "every emitter special case is evidence of an ungrounded concept +// upstream" β€” a special-case in this file is a STOP signal pointing at +// a missing fact in `04_infer.dag` (owns) or the target's language +// model, not a local branch to add here. +// +// Target-specific optimization (or its principled absence) is a +// cost-lens-derived realization decision (U1/U2 cost spine, per-target +// from `extdeps/languages/`), taken at this emit boundary β€” it is +// read, never a heuristic guess. Same `InferredTree` β†’ five +// cost-derived realizations; the model never changes, only the +// per-target realize step does (mirrors lens/parallelism.dag example C). +// +// ── T-16: FULL-STACK OMNI-EMISSION DEMO CONTRACT ── +// +// ONE `.dag` program β†’ a multi-language, multi-endpoint application. +// The structural guarantee is gate #28 `omni_layers_share_one_node_ +// tree`: all projected artifacts share ONE `Node` tree β€” coherence is +// STRUCTURAL, not test-checked. The N-target projection set (gate #28 +// is layer-count-agnostic; canvas Q4 EXTEND, NOT a parallel gate β€” +// INVARIANTS P1): +// β€’ Rust backend β€” Shape-A (existing language model) +// β€’ C++ backend (variant) β€” Shape-A +// β€’ TypeScript + React UI β€” Shape-A (canvas Q2-a: a React component +// IS TS source at emit time; Q5-a: +// `Component` is `Behavior::Bind`, no new +// substrate kind) +// β€’ OpenAPI wire contract β€” Shape-B (`extdeps/formats/openapi.dag`) +// β€’ SQL DDL persistence β€” Shape-B (canvas #4 fork (a): emitted +// THROUGH `extdeps/formats/sql.dag`, a +// grounded ISO-SQL format model, so the +// schema is coercion-checked β€” never a +// string DDL printout, ruled out as the +// emit-side templating smell) +// β€’ Markdown docs β€” Shape-B +// +// Endpoint partitioning (which program fragment runs where) is +// expressed via `extdeps/coordination.dag`'s `Endpoint` / +// `DeploymentUnit`; the cross-endpoint wire contract derives from the +// shared domain types (one `Node` tree β‡’ Rust and TypeScript carry the +// SAME domain types by construction). Cross-target consistency is +// therefore structural here and L5-tested downstream, not re-asserted +// by a parallel mechanism in this file. +// +// ── WORKED ACCEPTANCE (design contract β€” Wave-3+ worker fills to satisfy; +// refinement-free per the Wave-0 discipline above) ── +// +// A. Inverse-grammar emit (T-11, golden). A typed `InferredTree` node +// for a record + a target language model β†’ that target's concrete +// syntax, produced by the INVERSE walk of the target's grammar-as- +// data. Round-trips: `parse(emit(n, t)) == n` for every Shape-A `t` +// (the bidirectional relation authored once, consumed both ways). +// +// B. Fail-closed on un-emittable (T-11, Diagnostic path). A node whose +// concept has no grounded production in target `t`'s grammar model +// β†’ a precise `Diagnostic` (which concept, which target, which +// missing production) β€” NEVER a fabricated or templated string. +// The architecture refusing to lie is the demonstrable result. +// +// C. Same tree, five realizations (T-11). One `InferredTree` β†’ +// rust/python/go/cpp/typescript artifacts, each the inverse walk of +// its own grammar model; differences are cost-realize-derived and +// inspectable per target, never an emit special-case. +// +// D. ONE Node tree, N projections (T-16, gate #28). One omni `.dag` +// program β†’ {Rust, TS+React, OpenAPI, SQL DDL, Markdown}, all read +// off the SAME `Node` tree. The Rust and TS domain types are +// structurally the same node β€” wire-contract derivation needs no +// separate declaration; divergence is impossible by construction, +// not caught by a test. +// +// E. Endpoint partition coherence (T-16). A `DeploymentUnit` over two +// `Endpoint`s (backend Rust + frontend TS/React) β†’ each fragment +// emits for its endpoint's language; the `WireContract` between +// them is the shared-type projection, fail-closed if the two +// endpoints' views of a domain type diverge (they cannot, given +// gate #28 β€” this Acceptance proves the impossibility is structural). +// +// I/O β€” Owns (immutable contract; grounded in merged `00_compile.dag` / +// `05_emit.dag` `Owns`, NOT a TASKS invention β€” keep `Result<…, +// Diagnostic>` here; do NOT standardize to `Outcome<…>` without +// changing `00_compile.dag` in the same commit train): +// +// - emit: (InferredTree, TargetModel) -> Result +// the emit boundary / U1 Realize phase; structural inverse of +// `ingest`; the single per-target (T-11) and omni (T-16) authority. +// - compile: (Source, TargetModel) -> Result +// the orchestrator, `emit ∘ core ∘ ingest` (T-10-owned composition; +// referenced here only for the literal `Owns` alignment). +// +// Consumes (closed; reference only β€” no new files, substrate extension = +// STOP signal): +// - std/node.dag β€” the universal `Node` IR (gate #28: ONE tree) +// - std/diagnostic.dag β€” `Result` / `Diagnostic` fail-closed branch +// - extdeps/languages/{rust,python,go,cpp,typescript}.dag +// β€” the Γ—5 Shape-A grammar-as-data models +// (inverse walk = emit; never a template) +// - extdeps/formats/{openapi,sql}.dag β€” T-16 Shape-B wire/persistence +// projections (coercion-checked, not printed) +// - extdeps/frameworks/react.dag β€” T-16 React-as-TS (canvas Q2-a) +// - extdeps/coordination.dag β€” T-16 endpoint partitioning +// (`Endpoint` / `DeploymentUnit` / +// `WireContract`) +// +// Dissolution disposition (Practice 4): 🟒 β€” no dissolution work. This +// PR authors the interface-freeze + Acceptance design layer ONLY; it +// mints NO carrier, no walker, no emit-template, no refinement. There +// is therefore no dissolution-class surface in the diff and no +// downstream dissolve named here. Carrier impl + witnesses are the +// NAMED Wave-3 triggers above (TASKS.md T-11 / T-16), not deferred +// prose. +// +// Status: scaffold β€” interface-freeze + Wave-0 design layer for T-11 +// (per-target Γ—5) and T-16 (omni demo); fill per TASKS.md T-11 / T-16 +// on the named refine triggers above. +// Brief: see BRIEF_TEMPLATE.md; this file's I/O contract is the immutable +// contract for the worker. Splitting this file requires explicit +// operator ratification (substrate extension = stop signal). module v4.compiler.emit From 7cb0b0f5ccfc59c96ea90915523f64ab8a1d1bf9 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Tue, 19 May 2026 03:02:44 +0000 Subject: [PATCH 2/4] 05_emit.dag: add substrate-spelling guardrail (Result is orchestrator Owns; diagnostic.dag carrier is Outcome until CP-1b/00_compile.dag train) Contract-honesty per neat-hawk-87 structural-diff verify: header no longer reads as if Result already lives in std/diagnostic.dag. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/v4/compiler/05_emit.dag | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/v4/compiler/05_emit.dag b/src/v4/compiler/05_emit.dag index 4bb4c77e9be..25c9e59e3ef 100644 --- a/src/v4/compiler/05_emit.dag +++ b/src/v4/compiler/05_emit.dag @@ -134,7 +134,17 @@ // I/O β€” Owns (immutable contract; grounded in merged `00_compile.dag` / // `05_emit.dag` `Owns`, NOT a TASKS invention β€” keep `Result<…, // Diagnostic>` here; do NOT standardize to `Outcome<…>` without -// changing `00_compile.dag` in the same commit train): +// changing `00_compile.dag` in the same commit train). +// +// SUBSTRATE-SPELLING GUARDRAIL (contract-honesty): `Result<…, +// Diagnostic>` here is the TASKS / orchestrator-`Owns` spelling. The +// landed fail-closed carrier in `std/diagnostic.dag` TODAY is +// `Outcome` (DECISIONS.md item I) β€” there is NO `Result` +// `.dag` type yet. A `Result` spelling enters substrate only when the +// CP-1b / `00_compile.dag` train (incl. the TargetSpec↔TargetModel +// freeze) explicitly lands it. Until that train merges, read the +// `Consumes` `std/diagnostic.dag` line as `Outcome`-backed; this +// header does NOT claim `Result` already lives in `diagnostic.dag`. // // - emit: (InferredTree, TargetModel) -> Result // the emit boundary / U1 Realize phase; structural inverse of @@ -146,7 +156,11 @@ // Consumes (closed; reference only β€” no new files, substrate extension = // STOP signal): // - std/node.dag β€” the universal `Node` IR (gate #28: ONE tree) -// - std/diagnostic.dag β€” `Result` / `Diagnostic` fail-closed branch +// - std/diagnostic.dag β€” fail-closed branch carrier (`Outcome` +// today; the `Result` spelling is the +// orchestrator `Owns` alignment pending the +// CP-1b / `00_compile.dag` train β€” see the +// substrate-spelling guardrail above) // - extdeps/languages/{rust,python,go,cpp,typescript}.dag // β€” the Γ—5 Shape-A grammar-as-data models // (inverse walk = emit; never a template) From 1bba4dd65274c10460474c59a0d0544feee2087e Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Tue, 19 May 2026 05:11:27 +0000 Subject: [PATCH 3/4] 05_emit.dag: collapse two temporal authorities on the Result contract (INVARIANTS P2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Operator BLOCKING inline (#3358:134): the I/O block claimed the Result contract is "grounded in merged 00_compile.dag/05_emit.dag Owns" while the guardrail said the 00_compile train is still pending β€” two temporal authorities. Also factually wrong at HEAD: both files are bare scaffolds (Owns: none.). Rewritten as ONE forward authority: Result is the pending CP-1b/00_compile-train target spelling; not yet in merged Owns; landed carrier is Outcome (DECISIONS I) until that train. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/v4/compiler/05_emit.dag | 38 +++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/v4/compiler/05_emit.dag b/src/v4/compiler/05_emit.dag index 25c9e59e3ef..4841343df58 100644 --- a/src/v4/compiler/05_emit.dag +++ b/src/v4/compiler/05_emit.dag @@ -131,20 +131,22 @@ // endpoints' views of a domain type diverge (they cannot, given // gate #28 β€” this Acceptance proves the impossibility is structural). // -// I/O β€” Owns (immutable contract; grounded in merged `00_compile.dag` / -// `05_emit.dag` `Owns`, NOT a TASKS invention β€” keep `Result<…, -// Diagnostic>` here; do NOT standardize to `Outcome<…>` without -// changing `00_compile.dag` in the same commit train). -// -// SUBSTRATE-SPELLING GUARDRAIL (contract-honesty): `Result<…, -// Diagnostic>` here is the TASKS / orchestrator-`Owns` spelling. The -// landed fail-closed carrier in `std/diagnostic.dag` TODAY is -// `Outcome` (DECISIONS.md item I) β€” there is NO `Result` -// `.dag` type yet. A `Result` spelling enters substrate only when the -// CP-1b / `00_compile.dag` train (incl. the TargetSpec↔TargetModel -// freeze) explicitly lands it. Until that train merges, read the -// `Consumes` `std/diagnostic.dag` line as `Outcome`-backed; this -// header does NOT claim `Result` already lives in `diagnostic.dag`. +// I/O β€” Owns (immutable contract; SINGLE temporal authority β€” the +// pending CP-1b / `00_compile.dag` train, not "already merged Owns"): +// +// `Result<…, Diagnostic>` below is the TASKS / orchestrator-target +// spelling that `00_compile.dag` / `05_emit.dag` `Owns` will carry +// once the CP-1b / `00_compile.dag` train (incl. the +// TargetSpec↔TargetModel freeze) freezes it. It is NOT yet grounded +// in merged `Owns`: at HEAD both files are bare scaffolds (`Owns: +// none.`), and the landed fail-closed carrier in `std/diagnostic.dag` +// is `Outcome` (DECISIONS.md item I) β€” there is no `Result` +// `.dag` type today. One authority, one tense: this header states the +// forward contract the train will land; it does NOT claim `Result` +// already lives in merged `Owns` or in `diagnostic.dag`. Do NOT +// standardize the spelling to `Outcome<…>` independently β€” the +// spelling is settled with `00_compile.dag` in that same train, not +// here. // // - emit: (InferredTree, TargetModel) -> Result // the emit boundary / U1 Realize phase; structural inverse of @@ -157,10 +159,10 @@ // STOP signal): // - std/node.dag β€” the universal `Node` IR (gate #28: ONE tree) // - std/diagnostic.dag β€” fail-closed branch carrier (`Outcome` -// today; the `Result` spelling is the -// orchestrator `Owns` alignment pending the -// CP-1b / `00_compile.dag` train β€” see the -// substrate-spelling guardrail above) +// today, DECISIONS.md item I; the `Result` +// spelling is the pending-train forward +// contract β€” see the single-temporal- +// authority note in the I/O block above) // - extdeps/languages/{rust,python,go,cpp,typescript}.dag // β€” the Γ—5 Shape-A grammar-as-data models // (inverse walk = emit; never a template) From 837ada5267aec19c80c607a5361fce5a8e22ddac Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Tue, 19 May 2026 05:12:38 +0000 Subject: [PATCH 4/4] =?UTF-8?q?05=5Femit.dag:=20unfreeze=20sql.dag=20?= =?UTF-8?q?=E2=80=94=20not=20on=20main,=20move=20to=20named=20pending=20de?= =?UTF-8?q?pendency=20(INVARIANTS=20P2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Operator BLOCKING inline (#3358:167): closed Consumes named extdeps/formats/sql.dag but no blob on origin/main β€” froze a dependency outside the closed tree. Split: openapi.dag (present) stays a Consumes edge; sql.dag moved to an explicit "named pending dependency, NOT a frozen closed-tree edge" β€” scheduled as the T-4.6 formats-bundle extension (canvas #4 fork (a)), binds when it lands (T-16 trigger already gates on T-4.6). T-16 SQL-DDL narrative reworded to match. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/v4/compiler/05_emit.dag | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/v4/compiler/05_emit.dag b/src/v4/compiler/05_emit.dag index 4841343df58..894eced73cd 100644 --- a/src/v4/compiler/05_emit.dag +++ b/src/v4/compiler/05_emit.dag @@ -82,11 +82,15 @@ // substrate kind) // β€’ OpenAPI wire contract β€” Shape-B (`extdeps/formats/openapi.dag`) // β€’ SQL DDL persistence β€” Shape-B (canvas #4 fork (a): emitted -// THROUGH `extdeps/formats/sql.dag`, a -// grounded ISO-SQL format model, so the -// schema is coercion-checked β€” never a -// string DDL printout, ruled out as the -// emit-side templating smell) +// THROUGH a grounded ISO-SQL format +// model so the schema is coercion- +// checked β€” never a string DDL printout. +// That model is `extdeps/formats/ +// sql.dag`, a NOT-YET-LANDED T-4.6 +// formats-bundle extension; this layer +// does NOT freeze a Consumes edge to it +// β€” see the named pending dependency +// below) // β€’ Markdown docs β€” Shape-B // // Endpoint partitioning (which program fragment runs where) is @@ -166,8 +170,18 @@ // - extdeps/languages/{rust,python,go,cpp,typescript}.dag // β€” the Γ—5 Shape-A grammar-as-data models // (inverse walk = emit; never a template) -// - extdeps/formats/{openapi,sql}.dag β€” T-16 Shape-B wire/persistence -// projections (coercion-checked, not printed) +// - extdeps/formats/openapi.dag β€” T-16 Shape-B wire-contract +// projection (coercion-checked, not printed) +// +// Named pending dependency (NOT a frozen closed-tree Consumes edge β€” +// the file is not on `main`; INVARIANTS P2): +// - extdeps/formats/sql.dag β€” T-16 Shape-B SQL-DDL persistence +// projection. NOT-YET-LANDED: scheduled as +// the T-4.6 formats-bundle 7th-file +// extension (canvas #4 fork (a)). The T-16 +// real-fill trigger above already gates on +// T-4.6; the SQL projection binds when +// `sql.dag` lands, not before. // - extdeps/frameworks/react.dag β€” T-16 React-as-TS (canvas Q2-a) // - extdeps/coordination.dag β€” T-16 endpoint partitioning // (`Endpoint` / `DeploymentUnit` /