Repository navigation
Conversation
briansrls
marked this pull request as ready for review
May 19, 2026 22:07
…71-v2.5-bootstrap
briansrls
commented
May 20, 2026
briansrls
left a comment
Contributor
Author
There was a problem hiding this comment.
Review metadata
- Provider / model:
codex/unknown - Commit:
d257235b· Trigger:schedule - Thinking:
48s wall
✅ The provided diff contains no changed files, so there are no PR-introduced concerns to flag.
Contributor
Author
|
Closing per operator wrap-up directive 2026-05-20. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
v2.5 fork bootstrap mechanism — design
Author: sunny-otter-371 (Tier 4, orthogonal to substrate + stage workers)
Brief: sunny-wolf-435 msg_b8c4e8d2, operator-direct 2026-05-19
Scope: investigation + design; no implementation in this PR
Sibling-analysis input: PR #3407 (
/tmp/v2_stage0_independence_analysis.md)TL;DR
.dag → .rsengine in the repo today; v2.5 starts as a generated crate produced by running v2-compiler againstsrc/v2.5/. No prior v2.5 binary needed.src/v2.5/holds the new tree's.dagfiles;src/v2.5/stage0/is a workspace-member crate whosesrc/*.rsfiles are all committed regen output (carrying theGenerated by …header). TheCargo.tomland a smallmain.rsare the only hand-maintained files in the seed.scripts/regenerate-stage25.sh(model after the working pre-retirementregenerate-stage0.sh) plus a thin Cargo binregen_stage25in a newtools/regen_stage25/workspace member. Either invocation does the same thing; supporting both lets local dev pick the shorter form and CI invoke whichever is more reliable.scripts/regenerate-stage25.sh --verifyinvoked directly as a CI step (orcargo run -p regen_stage25 -- --verify). Exit code is the gate. No libtest filter, no--exact, no cross-tree subprocess dependency. This avoids both of the failure modes documented in PR v2 stage0 independence — investigation (analysis-only, no implementation) #3407 (the vacuous--exactfilter and the missingemit_method_template_projectionv3 bin).stage0/Cargo.toml,stage0/src/main.rs); everything else generated. Tighter than v2's current 4-file hand-maintained surface and matches the operator's "no edits to stage0" framing..rsmakes fresh checkouts buildable offline without first building v2-compiler — not because of effort. The architectural property is real; offline-buildability is not a downscope.1. Constraints inherited from PR #3407
The v2.5 mechanism must not re-inherit any of these:
scripts/regenerate-stage0.shandscripts/check-stage0-freshness.shexit 1 with "retired — v2 stage0 tree no longer exists" messages left over fromT-V2-Retirement.BOOTSTRAP.mdcontinues to document them. v2.5 ships a script that actually works, and the doc never gets out of sync with reality (single producer; the script's--verifyis the source of truth).bootstrap_fixed_point -- --ignored --exactinvocation matches zero tests (test path isbootstrap::bootstrap_fixed_point;--exactrequires the full path). v2.5 invokes the regen check directly, not through a libtest filter.bootstrap.rsshells out tocargo run -p v3-compiler --bin emit_method_template_projection; that bin no longer exists. v2.5's regen depends only oncargo run -p v2-compiler --release(which is in repo and works).src/v2.x/boundaries, no v3 or v4 dependencies.2. Where v2.5 lives and what's hand-vs-generated
2.1 Tree layout (proposed)
2.2 Hand-maintained surface — exhaustive list
The fork starts with 4 hand-maintained files:
src/v2.5/stage0/Cargo.toml— workspace-member manifest, dependencies (stacker,clap,lazy_static,serde,serde_json; mirror v2's stage0 manifest).src/v2.5/stage0/src/main.rs— CLI shim (parse args, delegate to the generatedlib.rs::cli_run). v2's stage0 emits its ownmain.rsfrom.dag; v2.5 can do the same, in which case this file disappears and the count drops to 3.tools/regen_stage25/Cargo.toml+tools/regen_stage25/src/main.rs— the regen driver. ~100 lines hand-Rust total. This is in scope per the brief ("a small experimental implementation … if it's small enough") but is design-only here pending operator approval.scripts/regenerate-stage25.sh— shell convenience wrapper.Compare to v2 today: v2's
src/v2/stage0/src/has 4 hand-maintained Rust files (v2_interpreter.rs,cli_run.rs,rest_transport_facts.rs, plusCargo.toml). v2.5 starts at the same or better count, with the explicit intent of driving these to zero as v2.5's substrate matures (e.g., whencli_runis itself emitted from.dag).2.3 Cargo workspace integration
Workspace
Cargo.tomlgains two new members:Both are workspace members, frozen-buildable per the existing convention (only built/tested when their input subgraph is affected; gated in
.github/workflows/ci.ymllike v2 + v3 are today).3. The regen mechanism
3.1 What it does
This is literally what
regenerate-stage0.shdid before retirement, retargeted at the new tree.3.2 Shell-script form (recommended primary)
scripts/regenerate-stage25.sh:cargo build -p v2-compiler --release(release profile is required for the perf budget v2's compile pipeline already exercises).target/release/v2-compiler compile --source-root src/v2.5 --source-root dsl --output-dir /tmp/v2.5-regen-<pid>.cargo fmt --all --manifest-path /tmp/v2.5-regen-<pid>/Cargo.toml.cp -r /tmp/v2.5-regen-<pid>/src/*.rs src/v2.5/stage0/src/(excluding hand-maintained file list).--verify:diff -r --exclude=… /tmp/v2.5-regen-<pid>/src/ src/v2.5/stage0/src/and exit$?./tmp/v2.5-regen-<pid>/.3.3 Cargo-bin form (mirrors v3)
tools/regen_stage25/src/main.rsdoes the same thing in Rust, calling out tocargo/v2-compilerviastd::process::Command. Roughly the v3regen_bootstrap.rsshape — argparse for--verify, run, compare/copy, exit.The Cargo-bin form has two advantages worth carrying:
cargo run -p regen_stage25 -- --verifyis symmetric withcargo run -p v3-compiler --bin regen_bootstrap -- --verify. Developers and CI scripts that already know v3's pattern transfer over.The shell script's advantage is review-cost: ~60 lines of obvious shell vs ~150 lines of Rust. Both can coexist — the script calls into the bin, or vice versa, or they're independent.
3.4 REGEN_OUTPUTS registry (mirrors v3)
The list of "which
.rsfiles undersrc/v2.5/stage0/src/are regen-owned vs hand-maintained" lives in one place. Two reasonable hosts:tools/regen_stage25/src/main.rsas aconst(mirrors v3'sREGEN_OUTPUTSinbuild.rs:657). Single producer; the regen step and the--verifydiff enumerate from this constant.src/v2.5/stage0/build.rs(if v2.5's stage0 needs a build.rs anyway for anything else; unlikely at the seed stage).The first is simpler. Recommend
tools/regen_stage25/src/main.rs::REGEN_OUTPUTSas the canonical list.3.5 What
--verifyactually checksExit 0 if and only if:
cargo build -p v2-compiler --releasesucceeds.v2-compiler compile --source-root src/v2.5 --source-root dslsucceeds (zero hard diagnostics)..rsfiles (filenames + contents, post-rustfmt) under the temp output dir is byte-identical tosrc/v2.5/stage0/src/<same names>(excluding the hand-maintained file list registered in §3.4).Anything else is a verify failure with a diff in stderr.
This is the v2.5 analog of v3's
regen_bootstrap --verify(src/v3/compiler/src/bin/regen_bootstrap.rs:84-93).4. CI integration
4.1 What we add
A new job in
.github/workflows/ci.yml, gated by the v2.5 affected-set:Key properties:
--exact bootstrap_fixed_pointdefect.src/v3/for a missing bin.src/v2.5/**(or related deps) change.regen-verifyfailure =.dagsource and committed.rsdisagree (worker forgot to regen, or v2-compiler emitter changed)stage0 buildfailure = generated code doesn't compile (emitter bug)4.2 What we do NOT add
bootstrap_fixed_pointtest. v2.5's regen-verify IS the fixed-point check at the byte level; libtest is not in this picture.4.3 First-time-bootstrap freshness
There is no chicken-egg. v2.5 starts with
src/v2.5/std/files written by Tier 0/1 workers; the first regen run producessrc/v2.5/stage0/src/*.rsfrom those.dagfiles; that's the first commit that has both halves. Verify-mode CI passes from that commit forward.If a worker lands a
.dagchange without running regen: CI fails on regen-verify, worker re-runs regen locally, force-pushes, CI passes. Conventional Cargo-style workflow.5. Candidate alternatives considered
(E)
build.rs-generated stage0 — no committed.rssrc/v2.5/stage0/build.rsruns v2-compiler at everycargo build, writes toOUT_DIR,lib.rsisinclude!-stitched.Pros: zero committed
.rs; no PR diff overhead; no "did the worker regen?" failure mode (the build always regens).Cons:
cargo build -p v2-5-compilertriggers a full v2-compiler self-compile (~30-150s wall-clock per the v2 perf ratchet). Local dev feedback is painful unless aggressive caching is set up..rs, you need v2-compiler built first, which requires its committed.rs(or the network for binary fetch).cargo build --workspaceruns build.rs scripts in dependency order, but v2.5's build.rs depends on the v2-compiler binary, not the v2-compiler library; the dependency is intercrate-tool, not crate-source. Wiring is fragile.Verdict: Architecturally interesting but operationally costly. Reject for v2.5's launch shape; revisit when v2.5 self-hosts.
(F) v2.5 bootstraps from v3-compiler instead of v2-compiler
v3-compiler exists and parses
.dag. Could be the regen host.Cons:
Cargo.toml:12-13("frozen pending v4 program"). Tying v2.5's bootstrap to a frozen compiler is unwise.substrate.dagreflection), not arbitrary.dag → .rs— would require teaching v3 to emit v2.5's target shape, which is a non-trivial v3 change inside a frozen tree.ci.yml:248-252); v2.5 should be a similar v2-parseable subset by construction.Verdict: Reject. v2-compiler is the right host.
(G) Vendored / fetched binary seed
Tag a v2-compiler binary, vendor it in repo or fetch from artifact storage; regen uses the vendored binary, not a fresh
cargo build.Cons:
.dag/.rschanges. Either auto-update (extra mechanism) or stale-gate failures.Verdict: Reject.
cargo build -p v2-compiler --releaseis already fast on CI (cached perci.yml:182-184) and is the simpler dependency.6. Preconditions / verifications
Items that need checking before implementation lands. None are blockers in this PR (design-only) but are required before the regen bin merges.
.dag, runtarget/release/v2-compiler compile --source-root src/v2.5 --source-root dsl --output-dir /tmp/probeand confirm zero hard diagnostics. Owner: sunny-otter-371 at regen-bin implementation time, or vivid-lynx-807 as part of the substrate PR.src/v2.5/stage0+tools/regen_stage25should be a workspace-edit only; no impact onsrc/v2/orsrc/v3/. Verify by runningcargo metadataandcargo build --workspacepost-add. Low risk.v2-5-compiler(orv25-compiler; Rust crate names disallow.),regen_stage25. Confirm no collision with existing crates. Direct grep of workspaceCargo.tomlconfirms safe.src/v2.5/. Theaffectedjob inci.yml:41-49computes which trees are touched. A new tree means a new output key (v2_5) + a new detection rule. Mechanical addition.src/v2.5/stage0/src/main.rsis hand-maintained vs generated. v2 emits itsmain.rsfrom.dag; v2.5 can follow suit by ensuring thecompile.dagstage (keen-ibex-355) emits amainfunction. If that lands, the hand-maintained surface drops to 3 files. Question for substrate workers.stage0/Cargo.toml. Mirrors v2's tiny manifest; nothing novel. Sample text in §7.7. Concrete artifacts (proposed text)
7.1
src/v2.5/stage0/Cargo.toml(hand-maintained, ~15 lines)7.2
tools/regen_stage25/Cargo.toml(hand-maintained)7.3
tools/regen_stage25/src/main.rs(hand-maintained, ~120 lines)Shape:
--verifyflag (exit 2 on unknown args; mirrors v3 regen_bootstrap).cargo build -p v2-compiler --release.target/release/v2-compiler compile --source-root src/v2.5 --source-root dsl --output-dir /tmp/v2.5-regen-<pid>.cargo fmt --all --manifest-path /tmp/v2.5-regen-<pid>/Cargo.toml.<tmp>/src/, build set of (relative-path, content) tuples; excludeREGEN_OUTPUTScomplement (the hand-maintained file list).src/v2.5/stage0/src/<relative-path>.--verifymode: load committed file; if content differs, print diff hint + path + exit 1.7.4
scripts/regenerate-stage25.sh(hand-maintained, ~60 lines)Thin wrapper around
cargo run -p regen_stage25 -- "$@". Or independent shell implementation if no Cargo-bin form lands. Either works.7.5 CI step (ci.yml)
8. Open questions for the operator
src/v2.5/per the brief, but the brief also flags "operator may rename tosrc/v2-next/." Crate name follows (v2-5-compilervsv2-next-compiler). Pick one before implementation.tools/regen_stage25/(separate crate) vssrc/v2.5/stage0/src/bin/regen.rs(inside the v2.5 crate, hand-maintained). The former is cleaner (v2.5 crate stays 100% generated except for the manifest); the latter is fewer files. Default: tools/.main.rsis generated. Ifcompile.dagemits amainfunction in v2.5 (as v2 does), the hand-maintained file count drops from 4 to 3. Wait for compile.dag worker.v2_5is the natural shape but underscores in YAML/JSON keys vary. Confirm with the ci.yml convention.9. Honesty bar / what I did not verify
cargo build -p v2-compiler --releasein this session (investigation-only mandate)..dag— none exist yet.cargo metadatato confirm workspace-add wouldn't disturb cycle detection. Low risk per the existingsrc/v2/stage0+src/v3/compilerprecedent, but unverified.bootstrap.rs:704as the reference value. Actual times will vary.regen_bootstrap.rsshape facts (lines, structure) are from a Read in this session ofsrc/v3/compiler/src/bin/regen_bootstrap.rs+src/v3/compiler/Cargo.toml+src/v3/compiler/build.rs:640-715.10. Cross-stage interface notes
You depend on me (sunny-otter-371) for nothing on the critical path. The regen mechanism doesn't gate any other worker's design — they write
.dag, I (or whoever implements this) regen.I depend on you for:
src/v2.5/std/layout (does the regen need to know about a special directory structure, or is it just "all.dagundersrc/v2.5"?). My current design assumes the latter; if there's a directory split I should know about, escalate.compile.dagemitsmain.rs(impacts hand-maintained file count)..dagfiles are the regen input. Once they land, regen-verify can be exercised end-to-end.Per the brief: cross-stage discussion goes through PM (sunny-wolf-435), not directly worker-to-worker.
11. Status
Design complete; implementation deferred pending operator review + Tier 0/1 substrate. Recommended path: D (commit
.rs+ Cargo-bin + script regen with--verify). Effort cost is not the bottleneck per the "infinite labour" reframe; D is architecturally the right launch shape because of the offline-buildability property, not because it's small.