Repository navigation
Conversation
briansrls
marked this pull request as ready for review
May 19, 2026 21:30
This was referenced May 19, 2026
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:
e54c12f7· Trigger:schedule - Thinking:
90s wall
✅ The provided PR diff is empty, so there are no changed file lines or PR-introduced invariant violations to block.
Contributor
Author
|
Closing per operator wrap-up directive 2026-05-20. |
briansrls
added a commit
that referenced
this pull request
May 21, 2026
… (sunny-otter-371/#3407 recommendation) (#3471) * WIP: Path-D v2-side regen_stage0 bin — mirror v3's regen_bootstrap pattern (s * WIP: Path-D v2-side regen_stage0 bin — mirror v3's regen_bootstrap pattern (s * WIP: Path-D v2-side regen_stage0 bin — mirror v3's regen_bootstrap pattern (s * WIP: Path-D v2-side regen_stage0 bin — mirror v3's regen_bootstrap pattern (s * WIP: Path-D v2-side regen_stage0 bin — mirror v3's regen_bootstrap pattern (s * WIP: Path-D v2-side regen_stage0 bin — mirror v3's regen_bootstrap pattern (s * WIP: Path-D v2-side regen_stage0 bin — mirror v3's regen_bootstrap pattern (s * WIP: Path-D v2-side regen_stage0 bin — mirror v3's regen_bootstrap pattern (s
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 stage0 independence — investigation
Author: sunny-otter-371 (worker)
Brief: operator-direct 2026-05-19 via sunny-wolf-435 — "how do we NOT edit stage0 anymore"
Scope: investigation only; PR body is the deliverable
TL;DR
scripts/regenerate-stage0.shandscripts/check-stage0-freshness.shboth exit 1 with a "retired" message (left over fromT-V2-Retirementdeletingsrc/v2/; v2 was restored in Restore src/v2 — comparison artifact + frozen-buildable #3148 but neither script was). The script-driven.dag → .rspropagation path thatBOOTSTRAP.mddocuments does not currently exist..github/workflows/ci.yml:189invokescargo test … bootstrap_fixed_point -- --ignored --exact. With--exact, libtest filters against full test paths; the test's path isbootstrap::bootstrap_fixed_point, which does not match the bare filter — so the v2 job runs zero tests and exits clean. Independently flagged by swift-swift-37; corroborated here by inspection.run_self_compilepaths insrc/v2/tests/src/bootstrap.rs:58-66shell out tocargo run -p v3-compiler --bin emit_method_template_projection. That bin does not exist insrc/v3/compiler/src/bin/(deleted in39ba75728; the v2 restore in Restore src/v2 — comparison artifact + frozen-buildable #3148 did not restore the bin). Affectsbootstrap_fixed_point,ci_fixed_point,ci_freshness,bootstrap_stage0_to_stage1,strict_compile_diagnostic_count, andperformance_ratchet.src/v2/stage0/src/v2_compiler_complexity.rsagainst the.dagchange because there was no automatic regen path. This is exactly the gap the operator's framing is asking us to close.src/v3/compiler/src/bin/regen_bootstrap.rsis the pattern (feature-gated regen bin, supports--verifyfor CI, writes snapshots on intentional regen). v2 needs the same shape, owned by v2 itself.Recommended path: (D) "Replicate v3's
regen_bootstrappattern inside v2." Restore the regen mechanism by building aregen_stage0v2-compiler bin (or thin wrapper) with--verify, wire CI to it, fix the gate filter, and unblock or stub theemit_method_template_projectiondependency. Keep stage0.rsfiles committed for fresh-checkout buildability. Rejects (A)/(B) binary-caching as inappropriate for this stage; (C) would regress.The operator owns the call; this is feed-not-rule.
1. Current state — concrete mechanism
1.1 What's in the repo
Cargo.toml:10listssrc/v2/stage0;src/v2/stage0/Cargo.tomlis a hand-maintained 14-line manifest. Building anything in the workspace triggers cargo to compile stage0 directly from the 65.rsfiles insrc/v2/stage0/src/(94,927 lines total)..rsfiles are committed. They all carry a// Generated by v2 compiler -- do not edit.header. Largest single file:v2_compiler_emit_rust.rs(16,015 lines).v2_compiler_complexity.rsis 9,545 lines.src/v2/stage0/src/are hand-maintained (excluded from regen diff bydiff_excluding_hand_maintainedinbootstrap.rs:174-200):v2_interpreter.rs,cli_run.rs,rest_transport_facts.rs, andCargo.toml. Everything else is supposed to be a regen artifact.1.2 What the build does
cargo build -p v2-compiler --releasereads only the committed.rsfiles. No regen happens automatically. This is the path CI takes; this is the path local devs take.target/release/v2-compiler compile --source-root src/v2 --source-root dsl --output-dir <out>reads.dag+ emits fresh.rs. But producing the binary in the first place requires the committed.rsfiles to be correct.1.3 What's supposed to keep
.dagand.rsin syncBOOTSTRAP.mddocuments./scripts/regenerate-stage0.shas the regen tool.scripts/regenerate-stage0.shreads (verbatim, from the file):docs/design-pure-bootstrap-zero.mdand v3 regen bins, but those are v3-specific.scripts/check-stage0-freshness.shis identically retired.BOOTSTRAP.mdis therefore documenting a mechanism that no longer works. The doc-to-reality gap was set when v2 was deleted (39ba75728, T-V2-Retirement) and never closed when v2 was restored (fdaedb127, Restore src/v2 — comparison artifact + frozen-buildable #3148, 2026-05-15).1.4 What CI actually runs for v2
.github/workflows/ci.yml:159-189defines thev2job, gated byneeds.affected.outputs.v2 == 'true'(skipped unlesssrc/v2/**is touched in the PR). When it runs, the only v2-specific check is:Two independent reasons this gate produces zero signal today:
--exactrequires the filter to equal the full test path. The test is defined atsrc/v2/tests/src/bootstrap.rs:569in modulebootstrap(file-as-module), so its full path isbootstrap::bootstrap_fixed_point. The filterbootstrap_fixed_pointdoes not match. libtest reports 0 filtered-in, exits 0, CI green.run_self_compile(bootstrap.rs:47-53) callswrite_method_template_projection_generated_root(bootstrap.rs:55-75), which shells out tocargo run -p v3-compiler --bin emit_method_template_projection. That bin does not exist (ls ofsrc/v3/compiler/src/bin/:gunbc_ci.rs,r1c_e_emit_gates.rs,regen_bootstrap.rs,regen_parse.rs,regen_parse_tables.rs,regen_tokenize.rs,regen_v3.rs,self_host_fixed_point.rs— noemit_method_template_projection). The deleted bin was a v3 artifact removed in T-V2-Retirement and never restored.The "right" CI tests (
ci_freshnessandci_fixed_point, definedbootstrap.rs:987-1014) are not invoked by ci.yml at all, and would hit the same missing-bin panic in theirLazyLockinitialization if they were.1.5 Observed consequence
src/v2/complexity.dag+250/-11,src/v2/stage0/src/v2_compiler_complexity.rs+277/-1. The worker had to hand-mirror the algorithmic change into the generated file because there is no automatic regen path. The hand-mirror is not verifiable against a fresh compile; it is a manually-asserted match.fdaedb127) there are zero regen commits tosrc/v2/stage0/src/*.rs. Either the.daghas not changed in ways that require regen (lucky), or changes have silently diverged from stage0.1.6 What v3 does (the existing reference)
v3 has the same conceptual problem (Rust seed compiling
.dagsource for the next pipeline) and has built the answer:src/v3/compiler/src/bin/regen_bootstrap.rs— bin that regeneratessrc/v3/compiler/src/bootstrap_*_generated.rssnapshots from.dagsource.Cargo.toml:14 bootstrap-regen-fresh = []; bin listsrequired-features = ["bootstrap-regen-fresh"](Cargo.toml:60). The fresh-parse subgraph is kept out of the default library build graph so the bootstrap chicken-egg stays one-way.--verify: CI runscargo run -p v3-compiler --features bootstrap-regen-fresh --bin regen_bootstrap -- --verify(ci.yml:139) which fails the build if committed snapshots disagree with a fresh compile. Local dev runs the same bin without--verifyto write updates.REGEN_OUTPUTSconst insrc/v3/compiler/build.rs:657, exposed at runtime asv3_compiler::generated_files::GENERATED_FILES, both the regen and the verify path enumerate from one source.This pattern is the obvious template for v2.
1.7 What v4 does
v4 has no Rust pipeline yet (per
src/v4/STRUCTURE.md+ brief context). v4's bootstrap chain currently uses v2's compiled binary as stage-minus-one (ci.yml:248-252runstarget/release/v2-compiler compile --source-root src/v4 --target dagas a bootstrap-viability gate). v4's eventual zero-floor design (docs/design-pure-bootstrap-zero.md) is data-driven all the way down, but is not yet operational. v4 is not a near-term answer for v2.2. Candidate paths
(A) Binary-cached bootstrap — vendor or remote-cache the v2-compiler binary; stop committing
.rsMechanism change. Drop
src/v2/stage0/src/*.rsfrom the repo. CI fetches a taggedv2-compilerbinary from artifact storage on every build; locally,cargo buildwould need a way to fetch + invoke the binary before its own build graph runs. Workspace membersrc/v2/stage0becomes either (a) a synthetic crate populated bybuild.rsfrom the fetched binary's output, or (b) deleted entirely with v2-compiler distributed solely as a prebuilt binary.What breaks.
cargo build -p v2-compilerworks offline; (A) doesn't.ci.yml:248-252) requires a real working v2-compiler binary — if v2's source ceases to be locally-buildable, the v4 gate has to fetch too..dagedit needs the binary updated before stage0 can rebuild; round-trip latency is higher than today's local-build.Rollback. Reverting requires recovering the deleted
.rsfiles (from git history of a prior commit) and re-adding them to source control. Tractable but disruptive.Effort tier. XL. Touches Cargo workspace shape, CI fetch infrastructure, fresh-checkout developer flow, and the v4 viability gate. Not the right move for "stage0 churn is annoying."
Verdict. Reject for v2 today. The problem is not stage0's existence in repo — it's that there's no working regen. Removing stage0 entirely solves the wrong problem and creates several new ones.
(B) Self-host via prior binary — CI fetches a tagged binary and regenerates locally per-build,
.rsstill in repoMechanism change. Same fetch mechanism as (A), but
.rsfiles stay committed; CI regenerates them every run and diffs against the committed copy as the freshness gate. Local dev can either fetch the binary (online) or build from committed.rs(offline, current behavior).What breaks.
.rsstill gets committed.Rollback. Drop the fetch step, restore the build-from-source path.
Effort tier. L. Less disruptive than (A) but with similar dependency-shape additions and no observable PR-UX improvement.
Verdict. Reject. Adds infrastructure without solving the documented operator complaint.
(C) Pure declaration mode —
.dagbecomes spec,.rsbecomes hand-maintainedMechanism change. Drop the self-host claim; the
.dagfiles insrc/v2/become documentation/spec, and the.rsfiles insrc/v2/stage0/src/become the real, hand-maintained compiler.Verdict. Strict regression from v2's documented "1-residual hand-Rust" achievement; contradicts THESIS.md and the no-Rust-hand-edits standing rule the parallel calibration workers are operating under. Listed only for completeness. Reject.
(D) Replicate v3's
regen_bootstrappattern inside v2 (RECOMMENDED)Mechanism change. Build a
regen_stage0bin owned byv2-compilerthat mirrors v3'sregen_bootstrap:src/v2/stage0/src/bin/regen_stage0.rs(or a sibling cratesrc/v2/regen/) that:cargo build -p v2-compiler --release).src/v2 + dslto a temp dir.src/v2/stage0/src/, runscargo fmt, exits 0.--verify: diffs the temp output againstsrc/v2/stage0/src/(excluding the four hand-maintained files), exits non-zero on drift with a unified diff in stderr..rsfiles undersrc/v2/stage0/src/are regen-owned vs hand-maintained. Single source of truth, consumed by both the regen step and the--verifydiff. Mirrors v3'sREGEN_OUTPUTSconst.ci.yml's v2 job: replacebootstrap_fixed_point -- --ignored --exactwithcargo run -p v2-compiler --bin regen_stage0 -- --verify. Failure means committed stage0 disagrees with what v2-compiler would produce from.dag.emit_method_template_projectiondependency. Either restore the v3 bin, stub it inside v2 so v2's tests don't reach into v3, or remove the dependency entirely (the harness shouldn't need a v3 bin to run a v2 self-compile). This is a separate piece of work but is a prerequisite for any test inbootstrap.rsthat callsrun_self_compileto even start.BOOTSTRAP.mdto reflect the actual mechanism (this PR or a follow-up)..rsfiles committed for fresh-checkout buildability — the regen mechanism is what guarantees they stay correct, not what replaces them.What breaks.
.dagchanges must runcargo run -p v2-compiler --bin regen_stage0before pushing. CI's--verifywill catch misses, so the consequence of forgetting is a CI failure, not silent drift.emit_method_template_projectionwork is a prerequisite blocker for any test that runs the harness end-to-end — but the regen bin itself does not need that harness; it can run an in-process or subprocess self-compile directly againstsrc/v2 + dsl, with the same source-root contract v2's maincompilesubcommand already uses.Rollback. Remove the regen bin + CI step + revert
BOOTSTRAP.md. Repository state is unchanged; only the workflow file and the new bin file would need to be reverted.Effort tier. M. New bin is ~50-150 lines (most logic already exists in
v2-compiler'scompilesubcommand andbootstrap.rs's diff helpers). Wiring CI is one-line. The prerequisiteemit_method_template_projectioncleanup is independently scoped (S/M depending on whether we delete the dependency or restore the bin). One-time stage0 regen commit is mechanical.Verdict. Matches the operator's framing. Closes the immediate "stage0 churn is manual" complaint (regen is automatic; the diff still exists but is mechanically produced and verifiable). Replaces a documented-but-broken mechanism with a documented-and-working one. Uses a pattern that already exists in v3.
(E) Generate-on-build via
build.rs(mentioned, not recommended)A more aggressive variant of (D): use
build.rsto run regen during everycargo build -p v2-compiler. Avoids committed stage0 drift entirely — but creates a circular dependency (the binary that regenerates the crate is the crate being built), forcing a multi-pass build with the same chicken-eggregen_bootstrap.rsis feature-gated to avoid. The complexity gain over (D)'s explicit invocation is not worth the build-graph cost.Verdict. Mention only. (D) is cleaner.
3. Preconditions to verify before committing to (D)
--exactfilter mismatch onbootstrap_fixed_pointis the actual cause of zero filtered-in tests — claim is from swift-swift-37 + this analysis's inspection; runningcargo test -p v2-compiler-tests --release bootstrap_fixed_point -- --ignored --exact 2>&1 | tailand observing "0 filtered out" would close it. Did not run here (test path isbootstrap::bootstrap_fixed_pointper the file's directory layout, but unverified by execution).emit_method_template_projectionv3 bin truly is unused outside the broken harness — verified by ls; needs grep acrosssrc/v3/to confirm no other consumer depends on it before deletion vs restoration is decided.compilesubcommand entry point can be invoked in-process by a sibling bin in the same crate —src/v2/stage0/src/main.rsusesclapand exits viastd::process::exit. A regen bin would either invoke v2 as a subprocess (simpler, no API risk) or call the library functions directly (v2_compiler::v2_compiler_compile::compile_sources). Subprocess invocation is the conservative starting point and matches howbootstrap.rsalready does it.v2_interpreter.rs,cli_run.rs,rest_transport_facts.rs,Cargo.toml) remain hand-maintained or get a dissolution plan. The brief is "stop editing stage0 anymore" — hand-maintained files are a remaining edit surface. Out of scope for this investigation; flag as follow-up..rsfiles have drifted from what.dagwould produce, landing (D) means a large initial diff. Operator may want that staged or scoped.4. Open questions for the operator
emit_method_template_projection. Is this v3 bin worth restoring, or should v2's test harness be cut free of it entirely? Restoring is mechanical (find the deleted file in git history, re-add); cutting v2 free is cleaner long-term but requires identifying what the bin produced and whether v2's tests still need it.--exactfilter + missing bin should be either fixed in a small standalone PR (fix the filter, fix or remove the v3 dependency) or explicitly marked as a known gap with a tracking work item.BOOTSTRAP.mdgo. It currently describes a mechanism that doesn't exist. Either it gets corrected as part of (D), or it gets retired with a pointer to whatever v3-style doc the operator wants v2 to share.5. Honesty bar / what I did not verify
cargo test -p v2-compiler-tests bootstrap_fixed_point -- --ignored --exactto empirically confirm the libtest filter behavior. The claim is structural and aligns with libtest documentation, but the live observation is from swift-swift-37, not from this session.cargo buildor self-compile during this investigation (workspace was clean; investigation-only mandate).src/v3/for consumers ofemit_method_template_projection— only confirmed the bin file's absence.wc -l,ls, and directReadof the cited files in this session.6. Sibling-worker findings folded in
From the brief:
.rsagainst a.dagchange; cited as the immediate field consequence (§1.5).--exactfilter mismatch + missing v3 bin; folded into §1.4.zip). Noted for completeness; does not directly affect the regen mechanism but is a related "v2's substrate is incomplete for the modeling discipline we want to apply" data point. Out of scope for stage0 independence.