feat(self-bootstrap): wire rt to bake its own consumer-ready artifacts using internal/bake.Baker — closes dogfood meta-loop (rt-baked-by-rt) #547

Closed
opened 2026-07-26 14:51:00 +02:00 by bosun · 2 comments
Owner

Wire rt to bake its own consumer-ready artifacts using internal/bake.Baker (from #546). Closes the self-bootstrap / dogfood meta-loop: rt IS the release-toolkit and rt bakes rt.

Motivation

Phase 5 self-bootstrap gate per ADR-0009 §3.3 phase 5. Sibling to #546 bake impl. This tracker wires the Baker implementation into rt itself — rt uses Baker to produce its own reusable-workflow artifacts + manifest state that consumers pin.

Scope

  • Wire Baker into cmd/rt subcommand(s) that produce baked artifacts (likely rt bake or invoked from rt release / rt prep)
  • Ensure rt itself uses baked artifacts when it releases itself (dogfood: rt-baked-by-rt is what ships to consumers on release cuts)
  • Substrate verification: rt build → rt bake → rt release cycle produces byte-identical output when re-run (byte-exactness property extends from Baker impl into the meta-loop)
  • Verify consumer pinning story: consumers pinning to the baked artifact hash get immutable pinning (per #336 v1.1.0 direction — this tracker lands the substrate; the extended pinning to executed scripts is post-v1.0.0)

AC

  • rt invokes internal/bake.Baker for its own reusable-workflow + related artifacts — verified in PR#549 7b3eda5 via internal/selfboot.CommitBake (pure Bake + commit-tree -p HEAD). AC1 satisfied via internal-pkg (F3 endorsement — no C5 CLI expansion per F1). Binary-facing rt invocation lands in Phase-6 #508 per ratified scope
  • Self-bootstrap cycle demonstrated — verified via TestRoundTrip_ThreeActorBootstrap (the milestone #77 GATE): 3-actor round-trip (cut-prep bake / post-cut main reset / re-pin) tree-SHA equality + round-trip identity over the 5 REAL toolkit reusables. Genuine dogfood — vs production build_bake.sh oracle
  • Byte-exactness verified end-to-end — TestRoundTrip_ThreeActorBootstrap round-trip identity proven both sides; Surveyor 4587 verified in forgejo-ci-go:latest CI image with distinct parent-invariant mutation
  • Unit tests + equivalence-harness cases green — verified in PR#549 gate run (2 commits: 879de5d Baker clean-staged precondition enforce with dirty-wc test asserting ErrBakeFailed + Surveyor mutation proving removal-reds-both-dirty-wc-tests; 7b3eda5 caller-seam with round-trip gate)
  • go vet ./... + golangci-lint run clean — verified: gate own instrument (golangci-lint) fired 0 issues; full gate green local + CI-image
  • Depends on: #546 (Baker impl), #541 (forgejo Client for release-publication side), #542 (manifest for pinned-state), #505 (interfaces)
  • Gates: Phase 5 close (#544 v2/next → main merge fires when self-bootstrap gate satisfied per operator-ratified timing 2026-07-26)
  • Downstream: Phase 6 orchestrators (#508) use baked artifacts as canonical release inputs
  • Cross-phase: extends to consumer-pinning-to-executed-scripts per #336 (post-v1.0.0, v1.1.0 target — separate)
  • Refs ADR-0009 §3.3 phase 5 row, §7 ("What Framework B unlocks" — self-bootstrap is a Framework-B unlock)

Anchor

Filed 2026-07-26 by Bosun on operator continuation direction for Phase 5 dispatch.

Wire `rt` to bake its own consumer-ready artifacts using `internal/bake.Baker` (from [[#546]]). Closes the self-bootstrap / dogfood meta-loop: rt IS the release-toolkit and rt bakes rt. ## Motivation Phase 5 self-bootstrap gate per ADR-0009 §3.3 phase 5. Sibling to [[#546 bake impl]]. This tracker wires the Baker implementation into rt itself — rt uses Baker to produce its own reusable-workflow artifacts + manifest state that consumers pin. ## Scope - Wire Baker into `cmd/rt` subcommand(s) that produce baked artifacts (likely `rt bake` or invoked from `rt release` / `rt prep`) - Ensure rt itself uses baked artifacts when it releases itself (dogfood: rt-baked-by-rt is what ships to consumers on release cuts) - Substrate verification: rt build → rt bake → rt release cycle produces byte-identical output when re-run (byte-exactness property extends from Baker impl into the meta-loop) - Verify consumer pinning story: consumers pinning to the baked artifact hash get immutable pinning (per #336 v1.1.0 direction — this tracker lands the substrate; the extended pinning to executed scripts is post-v1.0.0) ## AC - [x] `rt` invokes `internal/bake.Baker` for its own reusable-workflow + related artifacts — verified in PR#549 7b3eda5 via internal/selfboot.CommitBake (pure Bake + commit-tree -p HEAD). AC1 satisfied via internal-pkg (F3 endorsement — no C5 CLI expansion per F1). Binary-facing `rt` invocation lands in Phase-6 #508 per ratified scope - [x] Self-bootstrap cycle demonstrated — verified via TestRoundTrip_ThreeActorBootstrap (the milestone #77 GATE): 3-actor round-trip (cut-prep bake / post-cut main reset / re-pin) tree-SHA equality + round-trip identity over the 5 REAL toolkit reusables. Genuine dogfood — vs production build_bake.sh oracle - [x] Byte-exactness verified end-to-end — TestRoundTrip_ThreeActorBootstrap round-trip identity proven both sides; Surveyor 4587 verified in forgejo-ci-go:latest CI image with distinct parent-invariant mutation - [x] Unit tests + equivalence-harness cases green — verified in PR#549 gate run (2 commits: 879de5d Baker clean-staged precondition enforce with dirty-wc test asserting ErrBakeFailed + Surveyor mutation proving removal-reds-both-dirty-wc-tests; 7b3eda5 caller-seam with round-trip gate) - [x] `go vet ./...` + `golangci-lint run` clean — verified: gate own instrument (golangci-lint) fired 0 issues; full gate green local + CI-image ## Related - Depends on: [[#546]] (Baker impl), #541 (forgejo Client for release-publication side), #542 (manifest for pinned-state), #505 (interfaces) - Gates: Phase 5 close (#544 v2/next → main merge fires when self-bootstrap gate satisfied per operator-ratified timing 2026-07-26) - Downstream: Phase 6 orchestrators (#508) use baked artifacts as canonical release inputs - Cross-phase: extends to consumer-pinning-to-executed-scripts per #336 (post-v1.0.0, v1.1.0 target — separate) - Refs ADR-0009 §3.3 phase 5 row, §7 ("What Framework B unlocks" — self-bootstrap is a Framework-B unlock) ## Anchor Filed 2026-07-26 by Bosun on operator continuation direction for Phase 5 dispatch.
Owner

Carry-forward from #546 / PR#548 review (Surveyor 4585, non-blocking should-consider): land a Baker-side clean-staged precondition check as the first commit of #547, before the caller-seam wiring.

The hazard (Surveyor reproduced it): internal/bake.Baker.Bake sources the marked files from the working copy (os.ReadFile, design-call 4) but the bash oracle create_detached_bake_commit sources from HEAD. Under the documented clean-staged precondition (working copy == HEAD) these coincide, but the precondition is disclosed-yet-unenforced: dirtying a canonical reusable in the working copy (uncommitted, marker intact) makes Bake return a different tree with no error (clean cfad477… vs dirty c139b8a…), silently breaking repin == cutprep == Go (design-call 2). Not red today because the shipped equivalence harness is clean-staged; latent for any #547 caller.

Fix (Surveyor option A — the scope-correct §5 precondition-check-inside-method the milestone #77 names): in Bake, for each canonical file being baked, assert working-copy bytes == HEAD bytes; on mismatch fail loud with the existing ErrBakeFailed ("working tree not clean-staged at base"). Add a dirty-wc test (dirty canonical file → ErrBakeFailed) and mutation-verify that removing the check reds it. Design-call 2 preserved (the check only fail-louds a dirty wc; clean-staged fixtures unaffected).

The self-bootstrap caller must additionally stage RepoDir at the intended base and say so at the seam. Refs #546.

**Carry-forward from #546 / PR#548 review (Surveyor 4585, non-blocking should-consider):** land a Baker-side clean-staged precondition check as the **first commit of #547**, before the caller-seam wiring. **The hazard** (Surveyor reproduced it): `internal/bake.Baker.Bake` sources the marked files from the *working copy* (`os.ReadFile`, design-call 4) but the bash oracle `create_detached_bake_commit` sources from *HEAD*. Under the documented clean-staged precondition (working copy == HEAD) these coincide, but the precondition is **disclosed-yet-unenforced**: dirtying a canonical reusable in the working copy (uncommitted, marker intact) makes `Bake` return a *different* tree with **no error** (clean `cfad477…` vs dirty `c139b8a…`), silently breaking `repin == cutprep == Go` (design-call 2). Not red today because the shipped equivalence harness is clean-staged; latent for any #547 caller. **Fix (Surveyor option A — the scope-correct §5 precondition-check-inside-method the milestone #77 names):** in `Bake`, for each canonical file being baked, assert working-copy bytes == HEAD bytes; on mismatch fail loud with the existing `ErrBakeFailed` ("working tree not clean-staged at base"). Add a dirty-wc test (dirty canonical file → `ErrBakeFailed`) and mutation-verify that removing the check reds it. Design-call 2 preserved (the check only fail-louds a dirty wc; clean-staged fixtures unaffected). The self-bootstrap caller must additionally stage `RepoDir` at the intended base and say so at the seam. Refs #546.
bosun closed this issue 2026-07-26 20:59:22 +02:00
Author
Owner

Closed by hand — PR#549 merged as 7b3eda50e7627ce6ca515d10fa7b2c3bf8d03ece on v2/next (fast-forward). All 5 ACs ticked with substrate anchors above.

Substrate landed:

  • First commit 879de5d — Baker clean-staged precondition enforced (Surveyor Option A from #548 review 4585). git diff --quiet HEAD -- f per baked canonical file → ErrBakeFailed. §5 precondition-check-inside-method per milestone #77 naming.
  • Second commit 7b3eda5internal/selfboot.CommitBake = pure bake.Baker tree + git commit-tree tree -p HEAD. Caller-seam wiring composing Baker with commit-wrap per design-call-1 endorsed scope line (#546→#547).
  • TestRoundTrip_ThreeActorBootstrap = milestone #77 GATE: 3-actor round-trip (cut-prep bake / post-cut main reset / re-pin) tree-SHA equality + round-trip identity vs production build_bake.sh over 5 REAL toolkit reusables. Genuine dogfood.
  • Mutation-verified ×2 byte-exact-reverted.

All 3 forks landed as ratified (Bosun 27f8):

  1. F1 no-C5 CLI expansioninternal/selfboot internal-package only. No new rt subcommand. Frozen C5 contract preserved (Surveyor-approved 4543).
  2. F2 build commit-wrap NOW — CommitBake composes Baker + git commit-tree tree -p base. Consistent with #546 design-call-1 scope line.
  3. F3 internal-package (internal/selfboot) — Phase-6 #508 rt release/prep is the natural binary-facing consumer. Baker interface stays frozen/pure-tree-only.

Scope-holds disclosed as Phase-6 concerns (per Surveyor 4587 forward-notes to #508):

  • Arbitrary-base-without-checkout (create_detached_bake_commit BASE arg) — Phase-6 orchestrator concern
  • CommitBake ambient-identity — the #546 auto-detect-email trap RELOCATED to production path; Phase-6 automation calling CommitBake must guarantee configured committer

Cross-references:

  • Depends on: #546 (Baker impl), #505 (interfaces), #503 (harness), #504 (contracts)
  • Fulfills: milestone #77 GATE per its description ("round-trip the full three-actor bootstrap")
  • Downstream: #508 Phase-6 orchestrators consume internal/selfboot.CommitBake at binary-facing surface
  • Cross-phase: #544 v2/next → main merge fires next per operator-ratified Phase-5-close timing (2026-07-26); Bosun awaits explicit operator go-ahead for the substrate-critical merge action
  • Refs ADR-0009 §3.3 phase 5 row, §7 (self-bootstrap Framework-B unlock)

Phase 5 SUBSTRATE COMPLETE: #546 bake + #547 self-bootstrap both landed. Milestone #77 NOT YET CLOSED#544 (v2/next → main merge coordination) remains open + fires as the next operator-ratified action.

**Closed by hand** — PR#549 merged as `7b3eda50e7627ce6ca515d10fa7b2c3bf8d03ece` on v2/next (fast-forward). All 5 ACs ticked with substrate anchors above. **Substrate landed**: - **First commit 879de5d** — Baker clean-staged precondition enforced (Surveyor Option A from #548 review 4585). `git diff --quiet HEAD -- f` per baked canonical file → ErrBakeFailed. §5 precondition-check-inside-method per milestone #77 naming. - **Second commit 7b3eda5** — `internal/selfboot.CommitBake` = pure `bake.Baker` tree + `git commit-tree tree -p HEAD`. Caller-seam wiring composing Baker with commit-wrap per design-call-1 endorsed scope line (#546→#547). - **TestRoundTrip_ThreeActorBootstrap** = milestone #77 GATE: 3-actor round-trip (cut-prep bake / post-cut main reset / re-pin) tree-SHA equality + round-trip identity vs production build_bake.sh over 5 REAL toolkit reusables. Genuine dogfood. - Mutation-verified ×2 byte-exact-reverted. **All 3 forks landed as ratified** (Bosun 27f8): 1. **F1 no-C5 CLI expansion** — `internal/selfboot` internal-package only. No new `rt` subcommand. Frozen C5 contract preserved (Surveyor-approved 4543). 2. **F2 build commit-wrap NOW** — CommitBake composes Baker + `git commit-tree tree -p base`. Consistent with #546 design-call-1 scope line. 3. **F3 internal-package (`internal/selfboot`)** — Phase-6 #508 rt release/prep is the natural binary-facing consumer. Baker interface stays frozen/pure-tree-only. **Scope-holds disclosed as Phase-6 concerns** (per Surveyor 4587 forward-notes to #508): - Arbitrary-base-without-checkout (create_detached_bake_commit BASE arg) — Phase-6 orchestrator concern - CommitBake ambient-identity — the #546 auto-detect-email trap RELOCATED to production path; Phase-6 automation calling CommitBake must guarantee configured committer **Cross-references**: - Depends on: #546 (Baker impl), #505 (interfaces), #503 (harness), #504 (contracts) - Fulfills: milestone #77 GATE per its description ("round-trip the full three-actor bootstrap") - Downstream: #508 Phase-6 orchestrators consume `internal/selfboot.CommitBake` at binary-facing surface - Cross-phase: **#544 v2/next → main merge fires next** per operator-ratified Phase-5-close timing (2026-07-26); Bosun awaits explicit operator go-ahead for the substrate-critical merge action - Refs ADR-0009 §3.3 phase 5 row, §7 (self-bootstrap Framework-B unlock) **Phase 5 SUBSTRATE COMPLETE**: #546 bake + #547 self-bootstrap both landed. **Milestone #77 NOT YET CLOSED** — #544 (v2/next → main merge coordination) remains open + fires as the next operator-ratified action.
Sign in to join this conversation.
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
frankenbit/release-toolkit#547
No description provided.