salvage 2026-11-06: uncommitted work from scratch/darkwing-scratch/r186/wt (disk cleanup #824)

This commit is contained in:
mos committed 2026-11-06 10:04:28 -06:00
1 parent 1d7fd75e23
commit 9f3bd59399
3 files changed
+44 -8

No files matched your search

+28 -2
View File
@@ -380,6 +380,7 @@ async function seed(e,{copy=B,pm=false,store='3g',pointer:how='adopt'}={}){
const rolledBack=(code,to=B)=>`stack-release: ${code}; rolled back to ${to}, which passed the gate\n`;
const planBackup=(e)=>`backup: the run backs up the stopped store to ${e.data}/backups/stack/<activation>/ before any migration`;
const planNoBackup='backup: none; the run rolls back before the backup';
const planTail=(e,to,pm=false)=>[`bus: scripts/bus-service.sh install --copy ${to} --copies ${COPIES}${pm?' --pm':''} --claude ${e.claude}`,`Console: scripts/webui-service.sh install --copy ${to} --copies ${COPIES} --port ${e.port} --business acme`,`CLI: scripts/stack-copy.sh wrapper ${to} --copies ${COPIES} --bin ${e.bin}`];
// --- The T table ---
@@ -643,9 +644,9 @@ test('T26 --plan lists the commits an activate adds, after the migration lines',
'migration: 3g to 3h, after a backup of the stopped store','migration steps: 3g to 3h',`needs: --migrate (${mig})`,'needs: Jason present for this run (decision 96 condition 2)'];
const adds=commitLines(`${B}..${C}`);
assert.equal(adds.length,2);assert.match(adds[0],/^ {2}[0-9a-f]{7,} row 904: C$/);assert.match(adds[1],/^ {2}[0-9a-f]{7,} row 903: C1$/);
for(const [flags,mig] of [[[],'not given; the run would roll back with migration-needs-flag'],[['--migrate'],'given']]){
for(const [flags,mig,backup] of [[[],'not given; the run would roll back with migration-needs-flag',planNoBackup],[['--migrate'],'given',planBackup(e)]]){
const r=await run(e,'activate',C,'acme','--plan',...flags);assert.equal(r.code,0,r.err);
assert.equal(r.out,[...head(mig),planBackup(e),'commits: the run adds 2 (newest first, at most 200):',...adds,...planTail(e,C),''].join('\n'));
assert.equal(r.out,[...head(mig),backup,'commits: the run adds 2 (newest first, at most 200):',...adds,...planTail(e,C),''].join('\n'));
}
const same=await run(e,'activate',C1,'acme','--plan');assert.equal(same.code,0,same.err);
assert.ok(same.out.includes(`target schema: 3g\nmigration: none; the store is at the target's version\n${planBackup(e)}\ncommits: the run adds 1 (newest first, at most 200):\n`),same.out);
@@ -1373,6 +1374,31 @@ test('T51 row 185 test 5: an activate with no store file takes no backup',async(
const l=logLines(e).at(-1);assert.deepEqual([l.result,l.backup],['ok',null]);
});
// Row 186 (#1684): the activate plan prints the backup line only when the run reaches backup_store.
// Each case plans, checks nothing was written, then runs and checks a backup exists exactly when the plan said so.
test('T52 row 186: the activate plan\'s backup line says what the run will do',async(t)=>{
const newer='migration: none possible; 3z is not in 3h\'s migration chain, so the run would roll back with store-newer';
const cases=[
['same schema','3g',C1,[],'migration: none; the store is at the target\'s version',true,0],
['same schema with --migrate','3g',C1,['--migrate'],'migration: none; the store is at the target\'s version',true,0],
['in chain with --migrate','3g',C,['--migrate'],'needs: --migrate (given)',true,0],
['in chain without --migrate','3g',C,[],'needs: --migrate (not given; the run would roll back with migration-needs-flag)',false,1],
['outside the chain','3z',C,[],newer,false,1],
['outside the chain with --migrate','3z',C,['--migrate'],newer,false,1],
];
for(const [name,store,to,flags,why,backup,code] of cases)await t.test(name,async(t)=>{
const e=await mk(t);await seed(e,{store});
const before=fp(e),data=tree(e.data),n=calls(e).length,logs=logLines(e).length;
const p=await run(e,'activate',to,'acme','--plan',...flags);assert.equal(p.code,0,p.err);assert.equal(p.err,'');
const out=p.out.split('\n');assert.ok(out.includes(why),p.out);
assert.deepEqual(out.filter((x)=>x.startsWith('backup')),[backup?planBackup(e):planNoBackup]);
assert.deepEqual(fp(e),before);assert.deepEqual(tree(e.data),data);assert.deepEqual(startsStops(e,n),[]);assert.equal(logLines(e).length,logs);
assert.ok(!existsSync(join(e.data,'backups')));
const r=await run(e,'activate',to,'acme',...flags,'--timeout','3');assert.equal(r.code,code,r.out+r.err);
assert.equal(existsSync(join(e.data,'backups','stack')),backup);assert.equal(logLines(e).at(-1).backup??null,backup?logLines(e).at(-1).activation:null);
});
});
// Row 178: proof metadata uses temp fixture files, never the installed slot.
async function seedProof(e) {
await seed(e);