test(release): preserve full-history diagnostics and recover the user-closed host baseline

This commit is contained in:
Agent Workbench Dev
2026-11-06 02:06:43 +08:00
parent d5de90930e
commit 3e8c2f99fe
7 changed files with 31 additions and 9 deletions
@@ -7,8 +7,8 @@ import { publicSnapshot, compareOriginalState, hash } from './retained-host-stat
import { inspectHostInstallation } from '../src/core/desktop/app-installation.mjs';
// Retained-state 1.25.4 to 1.25.5 local upgrade (model capacity, full history and cache evidence).
// One installer operation only; preserve every first failure and never restart
// the formal Provider or read keys.
// One installer operation only; preserve the live baseline Provider and never
// restart it or read keys. A prior user-closed host has a separate recovery receipt.
const attempt = process.argv[3] ?? 'formal', url = 'http://127.0.0.1:4318', mode = process.argv[2];
assert.match(attempt, /^formal(-attempt-[0-9]+)?$/);
const root = path.resolve('.qa/capacity-cache-1.25.5', attempt);
@@ -35,12 +35,12 @@ async function inspectorClosed() {
const startedAt = new Date().toISOString(); let result;
try {
await inspectorClosed(); const host = await api('/host/status'), dataRoot = host.identity.dataRoot;
assert.equal(host.identity.pid, 36552); assert.equal(host.activity.active, false);
assert.ok(Number.isSafeInteger(host.identity.pid) && host.identity.pid > 0); assert.equal(host.activity.active, false);
assert.equal(host.desktopWindows.count, 0);
const installRoot = path.dirname(path.dirname(host.identity.runtimeRoot));
assert.equal(path.basename(path.dirname(host.identity.runtimeRoot)), 'versions');
const current = await publicSnapshot(url, dataRoot);
assert.equal(current.pid, 36552); assert.equal(current.hasKey, true); assert.deepEqual(current.active, []);
assert.equal(current.pid, host.identity.pid); assert.deepEqual(current.active, []);
if (baseline) {
assert.equal(current.version, '1.25.4');
save('state-before.json', current); save('host-before.json', host); save('pointer-before.json', read(path.join(installRoot, 'current.json')));
@@ -49,6 +49,8 @@ try {
tables: Object.fromEntries(Object.entries(current.database.tables).map(([name, table]) => [name, table.count])) };
} else {
const before = read(path.join(root, 'state-before.json')); compareOriginalState(before, current);
assert.equal(host.identity.pid, before.pid);
assert.equal(host.identity.instanceId, read(path.join(root, 'host-before.json')).identity.instanceId);
const candidate = read('releases/latest.json');
assert.equal(candidate.documentation.sourceCommit, sourceCommit, 'Candidate must be built from the reviewed HEAD.');
assert.equal(read(path.join(candidate.portableRoot, 'MANIFEST.json')).version, '1.25.5');