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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 33 additions & 20 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,30 +363,32 @@ M5: Meta-process modeling (bootstrap, CI, dev process)
old didn't), the debug is manual — no visibility into WHICH
stage diverged or WHY.

bootstrap.dag already models the building blocks (195 lines,
zero consumers): CompilerStage (8 stages), StageInput/Output,
TransformContract (preserved/recomputed fields per transform),
FieldPropagation (per-stage per-field), ChangeClassification,
BootstrapStrategy (SinglePass/TwoPhase/Additive).
**Authority note (2026-04-16):** `bootstrap.dag`'s stage
vocabulary is superseded by the pipeline composition
(`SELF_HOSTING.md` §2.1). The pipeline's typed function
signatures ARE the stage contracts. `bootstrap.dag`'s 195
lines of `CompilerStage`, `TransformContract`, etc. dissolve
into the pipeline declaration — they are not wired as a
separate authority. See Track 17b below for the updated plan.

Three levels, each building on the previous:

Level 1 — Per-stage structural diffs (Track 17b extension):
regen.dag runs old binary + new binary, compares output
at EACH stage boundary (not just the final pass). When
divergence occurs, the report says "Resolve stage output
differs" instead of "fixed-point failed." bootstrap.dag's
CompilerStage and ArtifactKind drive the comparison.
differs" instead of "fixed-point failed." The pipeline's
typed stage signatures drive the comparison.
Directly helps current dark-emu session.

Level 2 — Stage contracts verified during bootstrap:
Each stage declares a TransformContract: "Resolve takes
a ParseTree, produces a ModuleGraph. Preserved fields:
[ident, span]. Recomputed fields: [module_deps, exports]."
Each stage's function signature declares its input/output
types. A lens verifies each contract holds: "does infer
produce a Dag where all ports have Resolved state?"
The bootstrap loop checks: did the contract hold? If a
stage recomputes a field it claims to preserve, the check
fires at the stage boundary with a typed diff — not at the
end as a cryptic fixed-point failure.
stage's output fails its lens check, the error fires at
the stage boundary with a typed diff — not at the end as
a cryptic fixed-point failure.

Level 3 — Automatic strategy selection (M5 "done when"):
ChangeClassification (AddField with default → Additive,
Expand Down Expand Up @@ -1102,22 +1104,33 @@ before/after benefit):**
- **Size:** medium. Each REST op needs a one-line annotation;
the structural test is new infrastructure.

- **PR 17b: `gunbc/bootstrap.dag` → `gunbc/tools/regen.dag`**
- **PR 17b: pipeline composition → `gunbc/tools/regen.dag`**
- **Authority note (2026-04-16):** `bootstrap.dag`'s stage

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKING: This authority note says ChangeClassification and BootstrapStrategy dissolve into the pipeline, but src/v3/SELF_HOSTING.md §10 still makes those schema-migration types load-bearing, so the docs reintroduce a single-authority contradiction.

vocabulary (`CompilerStage`, `TransformContract`,
`ChangeClassification`, `BootstrapStrategy`) is **superseded**
by the pipeline composition declared in
`src/v3/SELF_HOSTING.md` §2.1. The pipeline's typed function
signatures ARE the stage contracts; `bootstrap.dag`'s parallel
vocabulary dissolves into the pipeline declaration. `regen.dag`
reads the pipeline's stage signatures, not a separate
`bootstrap.dag` type set. See `SELF_HOSTING.md` §2.1 for the
single-authority rationale.
- Currently `regen.dag` hardcodes the 5-step sequence in nested
matches (build → compile → copy → check → rebuild → recompile).
- Replace with `let stages: List<CompilerStage> = [...]` driven
from `bootstrap.dag`, folded over.
- Each step's input/output derives from `StageInput`/`StageOutput`,
not bare strings.
- Replace with stage iteration driven from the pipeline
composition's typed stage functions, folded over.
- Each step's input/output derives from the pipeline's function
signatures, not bare strings or a parallel `StageInput`/
`StageOutput` vocabulary.
- **Extension (M5 Phase 4 Level 1):** add per-stage structural
diffs to the bootstrap loop. When old and new binary diverge,
the report names the STAGE where divergence starts, not just
"fixed-point failed." Directly addresses the dark-emu-36-pr3
bootstrap regression (new binary detects a dependency cycle
the old binary didn't — the diff would localize to the Resolve
stage). See M5 Phase 4 for the 3-level plan.
- **Benefit:** adding a new compiler stage is one edit to
`bootstrap.dag`, not edits in regen/freshness/ci. Pipeline
- **Benefit:** adding a new compiler stage is one edit to the
pipeline composition, not edits in regen/freshness/ci. Pipeline
sequence becomes data. Bootstrap failures become diagnosable.
- **Size:** medium (was small — the per-stage diff adds scope,
but it's the most valuable part).
Expand Down
27 changes: 27 additions & 0 deletions src/v3/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,33 @@ multi-target emission, §8.11 ratchet) shifts shape:

## M3 — Self-hosting (deferred)

Full design: [`src/v3/SELF_HOSTING.md`](SELF_HOSTING.md). Key points:

- **The pipeline is a `.dag` composition** (§2.1). Stages are typed
functions with declared input/output types, composed as `let`
bindings with explicit dependencies. The compiler reads its own
pipeline structure the same way it reads any user program's
dependency graph. Stage contracts, per-stage fixed-point, and
self-analysis via lenses all fall out of this shape.
- **Dependency order:** L1 (reflection, prereqs shipping) → L2
(lens migrations) + L2.5 (per-stage domain modeling, parallel
with L2) → L3 (pipeline stages in `.dag`: emit → lower → infer
→ parse) → L4 (full self-hosting). L2.5 is the design work that
models each stage's inputs/outputs to spec BEFORE implementation.
L2.5 runs ahead of L3 by one stage — emit domain models while
lens migrations start, lower domain models while emit implements,
etc. See §2.2 for the principle and §2 for the full diagram.
- **Infer is the research gate.** Every other stage migration is
engineering with known patterns. Inference-as-data has no
production precedent. The I0-I8 experiment sequence
(`docs/inference-as-data-experiments.md`) is the empirical
gate. I0 passed (no decidability blocker); the write-surface
decision (§5 of SELF_HOSTING.md) is the next open question.
- **Schema migration as structural operation** (§10). Schema
changes become a typed pipeline: structural diff → patch
generation → bridge build → bridge compile → fixed-point
verification. Zero manual stage0 edits. Option C (native
`.dag` patch language) upfront.
- v3 compiles itself
- Bootstrap: v2 compiles v3 stage0, v3 compiles v3 → fixed point
- All v2 test programs compile under v3 with same output
Expand Down
Loading
Loading