test(release): pi-unpin S5 re-check round: gate-lane-image.test.mjs reads the expected tag from the copied lock instead of 0.85.1, so it follows the lock to a newer pi; pi-unpin-s5.test.mjs requires test-task.sh and test-auth.sh to stop when image-tag.mjs refuses; build.sh's header and docs/TOOLS.md say the tag comes from the lock, build.sh runs the fit step, and build.sh comes before test-task.sh since compose no longer builds a missing image (#1873, lane pi-unpin-s5)

This commit is contained in:
jason.woltje committed 2026-11-20 08:34:47 -06:00
1 parent 5210522e13
commit 9d02ab4a69
4 files changed
+12 -7

No files matched your search

+2 -2
View File
@@ -16,7 +16,7 @@ and changes nothing.
| Command | Purpose | Notes |
|---|---|---|
| `scripts/bootstrap.sh [--instance NAME]` | Create `~/.config/mosaic-dev/config.json` if absent; with `--instance NAME`, `~/.config/mosaic-NAME/config.json` and the claimed root `~/.mosaic-NAME` | Idempotent; existing config validated, never rewritten. See [Stack instances](#stack-instances---instance-name-row-190) |
| `scripts/build.sh` | Build the release image | Tag derived from `RELEASE` + pinned pi version |
| `scripts/build.sh` | Build the release image | Tag `mosaic-poc-agent:<pi>-r<RELEASE>`, pi being the version `package-lock.json` resolves (`scripts/image-tag.mjs`); runs the image fit step (`scripts/pi-fit-image.mjs`) first. compose runs never build or pull the image, so run this before anything that needs a new tag |
| `scripts/hello.sh` | One-shot startup request | Prints model response on stdout |
| `scripts/verify.sh` | Full gated test | Exit 0 only on exact `MOSAIC_HELLO_OK`; `EXPECTED_MARKER` overrides for negative drills |
@@ -65,8 +65,8 @@ addition to its full repository gate; it was not run by this source repair:
```bash
node --test --test-concurrency=1 packages/processing-control/tests/containers.test.mjs packages/processing-control/tests/coordinator.test.mjs packages/processing-control/tests/effects.test.mjs packages/processing-control/tests/mount.test.mjs packages/processing-control/tests/runtimes.test.mjs packages/processing-control/tests/state.test.mjs packages/processing-control/tests/stop-run.test.mjs packages/processing-control/tests/task.test.mjs
node --test scripts/test-darkwing-launch.mjs
scripts/test-task.sh
scripts/build.sh
scripts/test-task.sh
```
## Agent (interactive TUI)
+6 -3
View File
@@ -8,6 +8,9 @@ function fixtureBase(root){return /^FROM (\S+)$/m.exec(readFileSync(join(root,'C
// #1873 S5: prepareImage runs the image fit step before the build; these fixtures have no node_modules,
// so they pass a stand-in step that records that it ran.
const fitStandIn=calls=>checkout=>calls.push(['fit',checkout]);
// The tag the fixture's copied lock gives (RELEASE 0.0.1), read here from the lock, so these tests
// follow the lock when it resolves a newer pi.
const lockTagOf=root=>'mosaic-poc-agent:'+JSON.parse(readFileSync(join(root,'package-lock.json'),'utf8')).packages['node_modules/@earendil-works/pi-coding-agent'].version+'-r0.0.1';
const processingInputs=['packages/processing-control/src/state.mjs','packages/processing-control/src/entrypoint.mjs'];
function copyProcessingInputs(root){
mkdirSync(join(root,'packages/processing-control/src'),{recursive:true});
@@ -21,7 +24,7 @@ test('a changed COPY input or actual image ID refuses compatible image sharing',
copyProcessingInputs(root);
writeFileSync(join(root,'RELEASE'),'0.0.1\n');
for(const d of ['contracts','src','adapters']){mkdirSync(join(root,d));writeFileSync(join(root,d,'one'),'same');}
const digest=image.imageFingerprint(root),id='sha256:'+'a'.repeat(64);const receipt={inputDigest:digest,imageId:id,tag:'mosaic-poc-agent:0.85.1-r0.0.1',baseDigest:fixtureBase(root),platform:'linux/amd64'};
const digest=image.imageFingerprint(root),id='sha256:'+'a'.repeat(64);const receipt={inputDigest:digest,imageId:id,tag:lockTagOf(root),baseDigest:fixtureBase(root),platform:'linux/amd64'};
const inspect=()=>({Id:id,Os:'linux',Architecture:'amd64'});
assert.equal(image.verifyImage(receipt,root,inspect).imageId,id);
assert.throws(()=>image.verifyImage(receipt,root,()=>({...inspect(),Id:'sha256:'+'c'.repeat(64)})),/image ID/);
@@ -41,7 +44,7 @@ test('exclusive image preparation records actual image ID and build wall time an
writeFileSync(join(root,'RELEASE'),'0.0.1\n');for(const d of ['contracts','src','adapters'])mkdirSync(join(root,d));
const calls=[];const invoke=(args)=>{calls.push(args);if(args[0]==='build')return '';return JSON.stringify({Id:'sha256:'+'a'.repeat(64),Os:'linux',Architecture:'amd64'});};
assert.throws(()=>image.prepareImage(root,{grant:'',tempRoot:root},invoke),/grant/);
const result=image.prepareImage(root,{grant:'fixture',tempRoot:root},invoke,fitStandIn(calls));assert.equal(result.imageId,'sha256:'+'a'.repeat(64));assert.equal(result.builds,1);assert.ok(result.buildWallMs>=0);assert.ok(calls.some(x=>x.join(' ')==='build -f Containerfile -t mosaic-poc-agent:0.85.1-r0.0.1 .'),'a plain docker build of the Containerfile under the lock tag (compose.yaml has no build section)');
const result=image.prepareImage(root,{grant:'fixture',tempRoot:root},invoke,fitStandIn(calls));assert.equal(result.imageId,'sha256:'+'a'.repeat(64));assert.equal(result.builds,1);assert.ok(result.buildWallMs>=0);assert.ok(calls.some(x=>x.join(' ')==='build -f Containerfile -t '+lockTagOf(root)+' .'),'a plain docker build of the Containerfile under the lock tag (compose.yaml has no build section)');
const fitAt=calls.findIndex(x=>x[0]==='fit');assert.ok(fitAt>=0&&fitAt<calls.findIndex(x=>x[0]==='build'),'the image fit step runs, before the build');
});
test('cleanup refuses a foreign Docker label and removes only an exact owned project',()=>{
@@ -56,7 +59,7 @@ function imageFixture(t){
for(const f of ['Containerfile','package.json','package-lock.json'])cpSync(new URL('../../../'+f,import.meta.url),join(root,f));
copyProcessingInputs(root);
writeFileSync(join(root,'RELEASE'),'0.0.1\n');for(const d of ['contracts','src','adapters'])mkdirSync(join(root,d));
const receipt={inputDigest:image.imageFingerprint(root),imageId:'sha256:'+'a'.repeat(64),tag:'mosaic-poc-agent:0.85.1-r0.0.1',baseDigest:fixtureBase(root),platform:'linux/amd64'};
const receipt={inputDigest:image.imageFingerprint(root),imageId:'sha256:'+'a'.repeat(64),tag:lockTagOf(root),baseDigest:fixtureBase(root),platform:'linux/amd64'};
return {root,receipt};
}
test('missing receipt and missing image refuse without permitting a gate',t=>{
+2 -1
View File
@@ -141,7 +141,8 @@ test("pi-unpin S5: no script builds the image tag from package.json, and every i
const compose = read("compose.yaml");
assert.doesNotMatch(compose, /^\s*build:/m, "compose.yaml has no build section");
assert.match(compose, /^\s*pull_policy: never$/m);
for (const f of ["scripts/test-task.sh", "scripts/test-auth.sh"]) assert.match(read(f), /node scripts\/image-tag\.mjs/, `${f} takes the tag from scripts/image-tag.mjs`);
// The tag comes from scripts/image-tag.mjs, and a refusal stops the script instead of running on an empty tag.
for (const f of ["scripts/test-task.sh", "scripts/test-auth.sh"]) assert.match(read(f), /^\s*TAG="\$\(node scripts\/image-tag\.mjs\)" \|\| exit 1(\s|$)/m, `${f} takes the tag from scripts/image-tag.mjs and stops when it can't`);
assert.match(read("scripts/mosaic-task.mjs"), /MOSAIC_IMAGE_TAG = tag;/);
});
+2 -1
View File
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
# Build the mosaic-agent container image using Docker Compose.
# Build the mosaic-agent container image through build_image in common.sh: the image fit step,
# then the build. compose.yaml has no build section, so this is how the image gets built.
set -euo pipefail
cd "$(dirname "$0")/.."
# shellcheck source=common.sh