Skip to content

fix(code-fixer): content-addressed prepared image; no base pull when held - #809

Merged
blove merged 2 commits into
mainfrom
blove/code-fixer-blueprint-gaps
Sep 23, 2026
Merged

blove merged 2 commits into
mainfrom
blove/code-fixer-blueprint-gaps

Conversation

@blove

@blove blove commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes two gaps the 0.10.0 code-fixer requalification recorded
(docs/superpowers/runbooks/2026-09-22-code-fixer-0.10.0-qualification.md):

  1. Docker pull wedge. sandbox:prepare always ran docker pull node:24-slim, which hung 6 to 10 minutes on Docker Desktop's registry proxy. The Dockerfile now pins node:24-slim by digest (sha256:0e0ff40c…, the base used for the 0.10.0 qualification). Prepare pulls the base only when it is missing, builds with --pull=false, and reuses an existing prepared tag without building. Because the base is pinned by digest, reusing a local copy cannot silently change content. B4_CODE_FIXER_REBUILD=1 rebuilds an existing tag on request.
  2. Shared image tag. b4-code-fixer:fixture-v1 was fixed in source and shared by every install on a host, so re-preparing re-pointed it for other sessions. src/project/image.ts now derives b4-code-fixer:<32 hex> from the Dockerfile (which includes the base digest), .dockerignore, and the sample's package.json and lockfile. A unit test checks that the context allowlist admits exactly those hashed files and that changing any input changes the tag.

Consumers updated:

  • pnpm code-fixer:prepare now builds one image per historical sample through the example's own prepare script. It used to write a combined image under the example's tag.
  • The replay worker and evaluation cleanup read the tag of the installation they run in.
  • The Docker-gated managed-workspace tests in @b4run/sandbox and @b4run/cli find the prepared cli-flags image by the org.b4run.code-fixer.project label, or by B4_TEST_MANAGED_IMAGE.
  • There are no CI workflow edits: the sandbox-docker job already runs pnpm code-fixer:prepare before these lanes.

The blueprint is not changed here. A follow-up PR re-pins it to this PR's merge commit and requalifies it against published 0.11.0.

Test plan

Run locally on macOS with Docker Desktop 27.4.0 and Node 24.20.0:

  • pnpm --filter @b4-example/code-fixer-server sandbox:prepare: built b4-code-fixer:bf0155748a6fccb097d89a5deb4c75fd from the held base in about 2 s with no pull. A second run printed Reusing prepared image … (0.7 s).
  • pnpm code-fixer:prepare: cli-flags reused the same tag; nullable-inputs built b4-code-fixer:d6917b75…
  • Example test passed 27 tests; example test:sandbox passed 3 tests in 2 files
  • pnpm test:code-fixer passed 30 tests; pnpm test:code-fixer:sandbox passed 7 tests in 4 files
  • pnpm code-fixer:replay: both samples passed: true with all six criteria. Each receipt records its own image.
  • pnpm code-fixer:qualify: cli-flags and nullable-inputs qualified
  • pnpm code-fixer:consumer --packed: passed (install, lint, check, build, typecheck, test, test:sandbox, eval --record, built HTTP run with approval and exact export)
  • B4_TEST_DOCKER=1 @b4run/sandbox managed-workspace (26 tests) and @b4run/cli managed-workspace-process (1 test)
  • root pnpm lint, pnpm typecheck, node scripts/check-docs.mjs
  • Not observed: pulling the pinned base by digest when it is missing locally (the base was already held)

🤖 Generated with Claude Code

…, no pull when held

The prepared image tag `b4-code-fixer:fixture-v1` was fixed in source and shared
by every install on a host, so re-preparing one checkout re-pointed the image
other installs and sessions were running. `sandbox:prepare` also always ran
`docker pull node:24-slim`, which wedges on Docker Desktop's registry proxy.

- The Dockerfile pins `node:24-slim` by digest.
- `src/project/image.ts` derives the tag from the Dockerfile, `.dockerignore`
  and the sample's package.json and lockfile. `sandboxImage` is that tag.
- `sandbox:prepare` reuses an existing tag, pulls the base only when it is
  missing, builds with `--pull=false`, and labels the image with its project.
  `B4_CODE_FIXER_REBUILD=1` rebuilds an existing tag.
- `pnpm code-fixer:prepare` prepares one image per historical sample through
  the example's own script; the replay worker and cleanup read the tag of the
  installation they run in.
- The managed-workspace Docker tests in @b4run/sandbox and @b4run/cli find the
  prepared cli-flags image by label (or `B4_TEST_MANAGED_IMAGE`).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@blove
blove enabled auto-merge (squash) September 23, 2026 15:24
@vercel

vercel Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
b4-run Ready Ready Preview Sep 23, 2026 4:02pm UTC

Request Review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

…et stays exact

The homepage narrative mirrors src/project/workspace.ts and links lines 14-31 at a
pinned commit. Define the content-addressed tag in image.ts and re-export it on
the line the old constant used, so those lines are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@blove
blove merged commit 89b95af into main Sep 23, 2026
29 of 31 checks passed
@blove
blove deleted the blove/code-fixer-blueprint-gaps branch September 23, 2026 16:29
blove added a commit that referenced this pull request Sep 23, 2026
…814)

Requalified against published 0.11.0: an archive install and the guide followed
literally with [email protected] both passed check, build, typecheck, 27 unit
tests, 3 Docker acceptance tests, and the built-server smoke. At the source
commit the repository suite also passed test:code-fixer, the sandbox lane, both
historical replays, qualify, and consumer --packed.

- Source commit 89b95af (PR #809 merge on main): content-addressed prepared
  image tag and a digest-pinned base that is not pulled when held.
- The 0.11.0 basic scaffold's demo route is src/app/hello/ (no (public)).
- The guide no longer names a fixed image tag and describes the reuse and
  pull-when-missing behaviour of sandbox:prepare.
- New runbook: 2026-09-23-code-fixer-0.11.0-qualification.md.

Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch was successfully deployed

1 active and 1 inactive deployments
vercel-preview — ea0c49b7 Deployed Sep 23, 2026 by blove via vercel-native #2285
Preview — ea0c49b7 Deployed Sep 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant