Repository navigation
v4 T-11+T-16 Wave-0: 05_emit.dag interface-freeze + omni-demo design layer #3358
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
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cf3d3f7
v4 T-11+T-16 Wave-0: 05_emit.dag interface-freeze + omni-demo design …
briansrls 7cb0b0f
05_emit.dag: add substrate-spelling guardrail (Result is orchestrator…
briansrls 1bba4dd
05_emit.dag: collapse two temporal authorities on the Result contract…
briansrls 837ada5
05_emit.dag: unfreeze sql.dag — not on main, move to named pending de…
briansrls 1eac1dc
Merge remote-tracking branch 'origin/main' into session/proud-swift-532
briansrls be5b321
Merge remote-tracking branch 'origin/main' into session/proud-swift-532
briansrls ec7a9e2
Merge remote-tracking branch 'origin/main' into session/proud-swift-532
briansrls d4cf847
Merge remote-tracking branch 'origin/main' into session/proud-swift-532
briansrls File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,206 @@ | ||
| // 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<T> 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/<t>`), | ||
| // 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/<t>`), 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`) | ||
|
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: OpenAPI is still listed as an emit-owned projection rather than a Shape-B user-program output, so the text still conflicts with THESIS.md's load-bearing Shape A/Shape B split. |
||
| // • SQL DDL persistence — Shape-B (canvas #4 fork (a): emitted | ||
| // 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 | ||
| // 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; 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<T>` (DECISIONS.md item I) — there is no `Result<ok,err>` | ||
| // `.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<TargetSource, Diagnostic> | ||
| // 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<TargetSource, Diagnostic> | ||
| // 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 — fail-closed branch carrier (`Outcome<T>` | ||
| // 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) | ||
| // - 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` / | ||
| // `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 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: Framing T-16 omni-emission as owned by compiler emit blurs THESIS.md's load-bearing Shape A/Shape B split, where OpenAPI/SQL/Markdown are user-program outputs rather than compiler render targets.