Files
Agent-Workbench/docs/project-cache-f-release-evidence/0077-prepare-cache-seal.mjs
T
2026-11-01 09:31:00 +08:00

31 lines
3.9 KiB
JavaScript

import fs from 'node:fs';
import assert from 'node:assert/strict';
let code = fs.readFileSync('.qa/seal-vision-release.mjs', 'utf8');
code = code.replaceAll('vision-inputs', 'project-cache').replaceAll('vision-f-', 'cache-f-').replaceAll('vision-native-', 'cache-native-')
.replaceAll('./vision-f-state.mjs', './cache-f-state.mjs').replaceAll('1.18.0', '1.19.0');
function replace(old, next) { assert.ok(code.includes(old), old); code = code.replace(old, next); }
replace("'portable-vision', 'prepare-install'", "'portable-vision', 'portable-cache', 'prepare-install'");
replace("'formal-stage-reconcile-retry'", "'formal-stage'");
replace('source.tests.tests, 576', 'source.tests.tests, 590');
replace('source.tests.pass, 576', 'source.tests.pass, 590');
replace('ui.results.length, 26', 'ui.results.length, 27');
replace('ui.groups, 196', 'ui.groups, 203');
replace("assert.equal(source.actualVisionEngineering.cases.length, 7);", "assert.equal(source.actualProjectCache.success, true); assert.equal(source.actualProjectCache.passed.length, 7);\nassert.equal(source.actualCacheEngineering.success, true); assert.equal(source.actualCacheEngineering.cases.length, 9);\nassert.deepEqual(source.actualCacheEngineering.results.map(value => value.check.results[0].tests.passed), [8, 9, 10]);\nassert.equal(source.actualVisionEngineering.cases.length, 7);");
replace("assert.equal(read('.qa/cache-f-formal-stage-result.json').success,false);assert.equal(read(baselineLocation.staged).installerRerun,false);", "assert.equal(read('.qa/cache-f-formal-stage-result.json').success,true); assert.equal(baselineLocation.staged,'.qa/cache-f-formal-stage.json');");
replace('smoke.results.length, 20', 'smoke.results.length, 24');
replace('/^(?:vision-.*\\.(?:json|log|tap|mjs)|(?:prepare|freeze|package|run|shorten|deploy|verify|audit|seal|record|reconcile|finalize|write)-vision-.*\\.mjs)$/', '/^(?:(?:cache-f-|project-cache-).*\\.(?:json|log|tap|mjs)|(?:prepare|freeze|package|run|shorten|deploy|verify|audit|seal|record|finalize|write)-cache-.*\\.mjs)$/');
replace("copy('releases/latest.json');", "copy('.qa/cache-f-state.mjs'); copy('.qa/desktop-f-state.mjs'); copy('.qa/prepare-cache-seal.mjs');\ncopy('releases/latest.json');");
replace("'.qa/vision-all-ui-first-failure', ", '');
replace('/^(?:vision-ui-|vision-projects-)/', '/^(?:project-cache-ui-|project-cache-projects-)/');
replace("'responses-engineering', 'vision-engineering'", "'responses-engineering', 'vision-engineering', 'project-cache-engineering'");
replace('source.actualVision, smoke, native', 'source.actualVision, source.actualProjectCache, smoke, native');
replace("['portable-companion', 'portable-protocols', 'portable-vision']", "['portable-companion', 'portable-protocols', 'portable-vision', 'portable-cache']");
code = code.replaceAll('classes: 26, groups: 196', 'classes: 27, groups: 203').replaceAll('formalPanels: 20', 'formalPanels: 24');
replace('screenshotEngineering: 7, parentTests', 'screenshotEngineering: 7, cacheEngineering: 9, cacheUi: 7, parentTests');
replace("native, baselineReconciliation:{receipt:baselineLocation.staged,originalFailure:'.qa/cache-f-formal-stage.json',installerRerun:false,concurrentWorkbenchModelRequests:1}", "native, baseline: { before: baselineLocation.before, staged: baselineLocation.staged, freshCompleteSnapshot: true, installerRerun: false }");
replace('realModelRequests: 0, concurrentWorkbenchModelRequests:1', 'realModelRequests: 0');
replace("limitations: ['Real configured-model", "limitations: ['Cache has measured cross-instance AST benefit only; cold/warm/invalidation closure adds overhead, Python shows no stable improvement, no token savings inferred.', 'Real configured-model");
assert.doesNotMatch(code, /reconcile-vision|baselineReconciliation|concurrentWorkbenchModelRequests|vision-inputs|vision-f-/);
fs.writeFileSync('.qa/seal-cache-release.mjs', code, { flag: 'wx' });
console.log('Prepared 1.19 seal with fresh baseline and cache-specific independent acceptance.');