@sanqianx/project-knowledge 5.0.30 → 5.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +21 -0
  3. package/_site/_test/appearance-settings-test.js +148 -0
  4. package/_site/_test/helpers/parallel-capture-safety-r5-cap-shell.js +606 -0
  5. package/_site/_test/helpers/parallel-capture-safety-r5-memory-shell.js +464 -0
  6. package/_site/_test/helpers/parallel-dock-acceptance-env.js +301 -0
  7. package/_site/_test/helpers/parallel-dock-acceptance-r2-env.js +378 -0
  8. package/_site/_test/helpers/parallel-dock-acceptance-r2-ui.js +314 -0
  9. package/_site/_test/helpers/parallel-dock-acceptance-ui.js +195 -0
  10. package/_site/_test/helpers/parallel-dock-isolation-r3-credential-preload.js +113 -0
  11. package/_site/_test/helpers/parallel-dock-isolation-r3-env.js +307 -0
  12. package/_site/_test/helpers/parallel-dock-isolation-r3-fixture.js +373 -0
  13. package/_site/_test/helpers/parallel-dock-isolation-r3-ui.js +314 -0
  14. package/_site/_test/helpers/parallel-engine-reconcile-r4-harness.js +340 -0
  15. package/_site/_test/helpers/parallel-engine-reconcile-r4-standin-analyzer.js +82 -0
  16. package/_site/_test/helpers/parallel-memory-capture-r3-cap-shell.js +605 -0
  17. package/_site/_test/helpers/parallel-memory-capture-r3-shell.js +176 -0
  18. package/_site/_test/helpers/parallel-memory-capture-r4-cap-shell.js +577 -0
  19. package/_site/_test/helpers/parallel-memory-injection-shell.js +723 -0
  20. package/_site/_test/helpers/parallel-memory-injection-wb-host.js +81 -0
  21. package/_site/_test/helpers/parallel-workbench-drafts-r5-fixture.js +295 -0
  22. package/_site/_test/helpers/parallel-workbench-drafts-r5-harness.js +573 -0
  23. package/_site/_test/helpers/parallel-workbench-drafts-r5-host.js +69 -0
  24. package/_site/_test/helpers/parallel-workbench-runtime-harness.js +587 -0
  25. package/_site/_test/helpers/qa-r45-harness.js +94 -0
  26. package/_site/_test/helpers/qa-r48-env.js +64 -0
  27. package/_site/_test/helpers/qa-r51-env.cjs +77 -0
  28. package/_site/_test/parallel-capture-safety-r5-cap006-probe.js +524 -0
  29. package/_site/_test/parallel-capture-safety-r5-cap008e-probe.js +577 -0
  30. package/_site/_test/parallel-capture-safety-r5-mem005-health-test.js +320 -0
  31. package/_site/_test/parallel-engine-reconcile-r4-eng007-probe.js +304 -0
  32. package/_site/_test/parallel-logging-acceptance-log003-probe.js +78 -0
  33. package/_site/_test/parallel-logging-acceptance-log004-probe.js +85 -0
  34. package/_site/_test/parallel-memory-capture-r3-cap001-probe.js +238 -0
  35. package/_site/_test/parallel-memory-capture-r3-cap006-probe.js +371 -0
  36. package/_site/_test/parallel-memory-capture-r3-cap008-probe.js +439 -0
  37. package/_site/_test/parallel-memory-capture-r3-mem005-persistence-test.js +271 -0
  38. package/_site/_test/parallel-memory-capture-r4-cap006-probe.js +519 -0
  39. package/_site/_test/parallel-memory-capture-r4-cap008e-probe.js +569 -0
  40. package/_site/_test/parallel-memory-capture-r4-mem005-health-test.js +314 -0
  41. package/_site/_test/parallel-memory-injection-origin-probe.js +412 -0
  42. package/_site/_test/parallel-memory-injection-probe.js +411 -0
  43. package/_site/_test/parallel-workbench-drafts-r4-probe.js +477 -0
  44. package/_site/_test/parallel-workbench-drafts-r5-chrome-env-bisect.js +89 -0
  45. package/_site/_test/parallel-workbench-drafts-r5-probe.js +593 -0
  46. package/_site/_test/parallel-workbench-runtime-minimax-probe.js +321 -0
  47. package/_site/_test/parallel-workbench-runtime-wb004-ordering.js +307 -0
  48. package/_site/_test/parallel-workbench-runtime-wb005-drafts.js +313 -0
  49. package/_site/_test/parallel-workbench-runtime-wb008-abort.js +321 -0
  50. package/_site/_test/qa-r45-offline-backfill-test.js +279 -0
  51. package/_site/_test/qa-r48-sys003-blank-secret-test.js +258 -0
  52. package/_site/_test/t07c-cln-001-002-007-coverage-test.js +135 -0
  53. package/_site/_test/t07d-git-rel-coverage-test.js +224 -0
  54. package/_site/_test/t07e-qta-coverage-test.js +195 -0
  55. package/_site/_test/t07f-mem-008-coverage-test.js +101 -0
  56. package/_site/lib/server-app.js +11 -2
  57. package/_site/lib/settings-store.js +43 -1
  58. package/module-runtime-manifest.json +6 -6
  59. package/package.json +1 -1
  60. package/plugins/project-knowledge/.claude-plugin/plugin.json +1 -1
  61. package/plugins/project-knowledge/.codex-plugin/plugin.json +1 -1
  62. package/plugins/project-knowledge/.mcp.json +1 -1
  63. package/ui/index.html +18 -1
  64. package/ui/product.css +6 -2
  65. package/ui/product.js +86 -1
@@ -0,0 +1,593 @@
1
+ 'use strict';
2
+ // P-WB-DRAFTS-R5 — WB-005 草稿与附件隔离的隔离前提补正复测(第五次派发)。
3
+ //
4
+ // Leader 已接受 R4 的 8 项真实 UI 行为证据、真实退出与两份 sha256 证据;R5
5
+ // 不重做产品功能、不改任何 expected、不跑 Workbench 全量/WB003/4/8。本入口
6
+ // 相对 R4 的全部变化都是隔离前提:
7
+ // 1. 探针先用真实环境解析 Chrome 路径与被测模块根(find-chrome 走
8
+ // LOCALAPPDATA、模块发现走 APPDATA),然后才把自身 process.env 切到
9
+ // 完整隔离白名单:HOME/USERPROFILE/CODEX_HOME/CLAUDE_CONFIG_DIR/
10
+ // APPDATA/LOCALAPPDATA/双 KB_DATA_DIR/Bridge home/Workbench data/TEMP
11
+ // 全部指向 D:/SanQian.Xu/.project-knowledge-test-temp 下本用例私有
12
+ // fixture 的绝对路径(R4 未隔离的 APPDATA/LOCALAPPDATA/CODEX_HOME
13
+ // 就此关闭);宿主/浏览器等自有子进程各自继承或显式获得同一白名单。
14
+ // 2. 真实 profile 来源整体移除:R5 fixture 不再有只读门面、不再有
15
+ // PK_WB_REAL_PROFILE_DIR、不再对真实凭据文件做任何读取/checksum。
16
+ // 宿主用产品自己的 ProfileStore 在隔离 dataDir 里播种纯虚构 profile
17
+ // (r5fake / r5-fake-provider / https://r5-fake.invalid —— RFC 2606
18
+ // 保留域,绝不可能解析到任何提供方)与显式假 Key
19
+ // r5-fake-key-never-dial;草稿用例本就零模型请求。
20
+ // 3. 保留产品真实 ProfileStore/HTTP/UI 与锁定 0.13.6 的 served 字节;
21
+ // 产品行为 expected 与 R4 完全一致(A=1111、B=2222、会话二=1111-two)。
22
+ // 4. 退出纪律、整探针 watchdog、每步预算、侧栏/state 竞态根修、迁移
23
+ // 墓碑预期全部沿用 R4 已接受实现(驱动侧不变)。
24
+ // 5. 结束前进程清点:自有宿主 pid 消失、命令行引用本隔离 root 的自有
25
+ // 进程(Chrome 等)清零,证据落盘后才清理隔离目录。
26
+ //
27
+ // 退出码:0 = 全部证明;3 = 诚实 BLOCKED/超时;1 = 脚本错误。
28
+ const fs = require('node:fs');
29
+ const path = require('node:path');
30
+ const crypto = require('node:crypto');
31
+ const fixture = require('./helpers/parallel-workbench-drafts-r5-fixture');
32
+ const harness = require('./helpers/parallel-workbench-drafts-r5-harness');
33
+ const { findChromeDetailed } = require('./helpers/find-chrome');
34
+
35
+ const DRAFT_A = '1111';
36
+ const DRAFT_B = '2222';
37
+ const DRAFT_S2 = '1111-two';
38
+ const FAKE_PROFILE_ID = 'r5fake';
39
+ const FAKE_PROFILE_NAME = 'R5-Fake';
40
+ const FAKE_MODEL = 'r5-fake-model';
41
+ const FAKE_BASE_URL = 'https://r5-fake.invalid/anthropic';
42
+ const FAKE_KEY = 'r5-fake-key-never-dial';
43
+ const LOCKED_VERSION = '0.13.6';
44
+
45
+ const KB_ROOT = path.resolve(__dirname, '..', '..');
46
+ const EVIDENCE_DIR = path.join(KB_ROOT, 'qa-autopilot', 'artifacts', 'parallel-20261023', 'workbench-drafts-r5');
47
+ const PROBE_TIMEOUT_MS = Number(process.env.PK_WB_DRAFTS_R5_TIMEOUT_MS || 450000);
48
+
49
+ const results = [];
50
+ const stepTimings = [];
51
+ function record(caseId, status, detail) {
52
+ results.push({ caseId, status, detail });
53
+ console.log(`CASE ${caseId} ${status} ${JSON.stringify(detail).slice(0, 300)}`);
54
+ }
55
+ function assertTrue(condition, message) { if (!condition) throw new Error(message); }
56
+
57
+ function isInside(candidate, parent) {
58
+ const relative = path.relative(parent, candidate);
59
+ return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
60
+ }
61
+
62
+ // 每步骤独立预算:waitUntil 自身的超时管“条件迟迟不满足”,预算管
63
+ // “evaluate/fetch 本身挂死”这类 waitUntil 管不到的等待。
64
+ async function withBudget(label, budgetMs, fn) {
65
+ const started = Date.now();
66
+ let timer = null;
67
+ try {
68
+ const value = await Promise.race([
69
+ fn(),
70
+ new Promise((_, reject) => {
71
+ timer = setTimeout(() => reject(new Error(`STEP TIMEOUT: ${label} exceeded its ${budgetMs}ms budget`)), budgetMs);
72
+ }),
73
+ ]);
74
+ stepTimings.push({ step: label, ms: Date.now() - started, outcome: 'ok' });
75
+ return value;
76
+ } catch (error) {
77
+ stepTimings.push({ step: label, ms: Date.now() - started, outcome: String(error && error.message || error).slice(0, 200) });
78
+ throw error;
79
+ } finally {
80
+ if (timer) clearTimeout(timer);
81
+ }
82
+ }
83
+
84
+ function sha256Text(text) { return crypto.createHash('sha256').update(text, 'utf8').digest('hex'); }
85
+
86
+ async function waitSidebarProjects(browser, count) {
87
+ return harness.waitUntil(async () => {
88
+ const ids = await browser.evaluate("Array.from(document.querySelectorAll('#project-list .proj')).map(node => node.dataset.project)");
89
+ return ids.length === count ? ids : null;
90
+ }, `the sidebar to list ${count} projects`, 30000);
91
+ }
92
+
93
+ // 等产品自己的 input 处理器把草稿写进它自己的 localStorage 键(只读旁观,
94
+ // 不代写):证明持久化发生在产品侧,后续的切换/刷新/重启恢复才是产品行为。
95
+ async function waitStorageDraft(browser, projectId, sessionId, text) {
96
+ const key = JSON.stringify([projectId, sessionId || null]);
97
+ return harness.waitUntil(async () => {
98
+ const storage = await harness.readDraftStorage(browser);
99
+ return storage.parsed && Object.prototype.hasOwnProperty.call(storage.parsed, key) && storage.parsed[key] === text;
100
+ }, `the product to persist its own draft ${key} as ${JSON.stringify(text)}`, 15000);
101
+ }
102
+
103
+ // 挂起/失败归因快照:网络(宿主健康)、DOM(页面就绪度)、服务(进程存活)。
104
+ async function diagnose(host, browser) {
105
+ const out = { at: new Date().toISOString() };
106
+ if (host && host.base) {
107
+ try {
108
+ const health = await harness.getJson(`${host.base}${harness.API_BASE}/health`);
109
+ out.hostHealth = { status: health.status, ok: health.ok, body: health.body };
110
+ } catch (error) { out.hostHealth = { error: String(error && error.message || error).slice(0, 160) }; }
111
+ if (host.child && host.child.child) {
112
+ out.hostPid = host.child.child.pid;
113
+ out.hostPidAlive = harness.listProcesses().some(entry => entry.pid === host.child.child.pid);
114
+ }
115
+ }
116
+ if (browser) {
117
+ try {
118
+ out.page = await browser.evaluate("({ readyState: document.readyState, hasInput: !!document.getElementById('chat-input'), stateDefined: typeof state !== 'undefined' && !!state, sidebarProjects: document.querySelectorAll('#project-list .proj').length, composer: (document.getElementById('chat-input') || {}).value || '' })");
119
+ } catch (error) { out.page = { error: String(error && error.message || error).slice(0, 200) }; }
120
+ }
121
+ return out;
122
+ }
123
+
124
+ (async () => {
125
+ const startedAt = new Date().toISOString();
126
+ fs.mkdirSync(path.join(EVIDENCE_DIR, 'evidence'), { recursive: true });
127
+
128
+ // 整探针 watchdog:非 unref —— 它既保证“永不无限等待”(到点强制退),
129
+ // 也保证被挂住的 await 之外事件循环仍有心跳可触发它。
130
+ let watchdogCleared = false;
131
+ const watchdog = setTimeout(() => {
132
+ const target = path.join(EVIDENCE_DIR, 'evidence', 'drafts-r5-watchdog.json');
133
+ try {
134
+ fs.writeFileSync(target, `${JSON.stringify({
135
+ probe: 'parallel-workbench-drafts-r5-probe', firedAt: new Date().toISOString(), startedAt,
136
+ verdict: 'WATCHDOG TIMEOUT', exitCode: 3, steps: stepTimings, cases: results,
137
+ }, null, 2)}\n`);
138
+ } catch { /* best effort */ }
139
+ console.log(`WATCHDOG TIMEOUT after ${PROBE_TIMEOUT_MS}ms — checkpoint at ${target}; forcing exit 3`);
140
+ process.exit(3);
141
+ }, PROBE_TIMEOUT_MS);
142
+
143
+ // 真实环境解析(在任何 env 改写之前):Chrome 发现走 LOCALAPPDATA,
144
+ // 模块发现走 APPDATA,真实 profile 目录只取路径字符串用于 guard。
145
+ const chromePath = findChromeDetailed().path;
146
+ const moduleRoot = fixture.resolveHostModuleRoot();
147
+ const realProfileDir = fixture.realWorkbenchProfileDir();
148
+ assertTrue(chromePath, 'no real Chrome was found with the real environment');
149
+ assertTrue(moduleRoot, 'no claude-ai-workbench module copy was found with the real environment');
150
+
151
+ // 隔离布局 + 探针自身的完整隔离白名单(宿主另有同一白名单的显式副本)。
152
+ const layout = fixture.createIsolationLayout('parallel-wb-drafts-r5');
153
+ const isolationBefore = {};
154
+ for (const key of fixture.ISOLATION_PATH_KEYS) isolationBefore[key] = process.env[key] !== undefined;
155
+ const envApplied = fixture.isolationEnvMap(layout);
156
+ Object.assign(process.env, envApplied);
157
+ for (const key of [...fixture.AMBIENT_MODULE_URLS, ...fixture.AMBIENT_MODEL_ENV]) delete process.env[key];
158
+ const ambientClean = ![...fixture.AMBIENT_MODULE_URLS, ...fixture.AMBIENT_MODEL_ENV].some(key => process.env[key] !== undefined);
159
+ const pathKeyValues = {};
160
+ for (const key of fixture.ISOLATION_PATH_KEYS) {
161
+ const value = path.resolve(process.env[key]);
162
+ pathKeyValues[key] = value;
163
+ assertTrue(isInside(value, layout.root), `the isolated ${key} must live inside this run's layout root, saw ${value}`);
164
+ assertTrue(!isInside(value, fixture.REAL_HOME), `the isolated ${key} must not live inside the real home, saw ${value}`);
165
+ assertTrue(!value.includes(realProfileDir) && !realProfileDir.includes(value), `the isolated ${key} must not reference the real profile directory`);
166
+ }
167
+
168
+ let host = null;
169
+ let browser = null;
170
+ let opened = null;
171
+ let identity = null;
172
+ let sceneKept = null;
173
+ let isolationDetail = null;
174
+ let bDetail = null;
175
+ let cDetail = null;
176
+ let dDetail = null;
177
+ let eDetail = null;
178
+ let fDetail = null;
179
+ let gDetail = null;
180
+ let hDetail = null;
181
+ let servedIntegrity = null;
182
+
183
+ try {
184
+ host = await withBudget('start-host', 90000, () => harness.startHost({ layout, moduleRoot, prefix: 'parallel-wb-drafts-r5' }));
185
+ opened = await withBudget('open-browser', 90000, () => harness.openBrowser(host.base, host.layout, { chrome: chromePath }));
186
+ browser = opened.browser;
187
+ identity = harness.moduleIdentity(host.moduleRoot);
188
+ assertTrue(identity.version === LOCKED_VERSION, `the hosted module is ${identity.version}, the case requires the locked ${LOCKED_VERSION}`);
189
+
190
+ // --- a. 真实宿主/浏览器身份 + served/pinned 哈希 + 完整隔离前提 --------
191
+ const health = await harness.getJson(`${host.base}${harness.API_BASE}/health`);
192
+ assertTrue(health.ok && health.body && health.body.status === 'ok', 'the isolated host is not healthy');
193
+ const servedFiles = {};
194
+ for (const rel of ['app.js', 'index.html']) {
195
+ const response = await fetch(`${host.base}/agent-terminal/${rel}`, { signal: AbortSignal.timeout(10000) });
196
+ const text = await response.text();
197
+ servedFiles[rel] = {
198
+ httpStatus: response.status,
199
+ servedSha256: sha256Text(text),
200
+ diskSha256: harness.sha256File(path.join(host.moduleRoot, 'apps', 'agent-terminal', rel)),
201
+ };
202
+ }
203
+ const servedMatches = Object.values(servedFiles).every(file => file.httpStatus === 200 && file.servedSha256 && file.servedSha256 === file.diskSha256);
204
+ assertTrue(servedMatches, 'the served agent-terminal UI is not byte-identical to the hosted module files');
205
+ servedIntegrity = { checked: Object.keys(servedFiles), servedEqualsDisk: servedMatches, files: servedFiles };
206
+
207
+ // 虚构 profile 是唯一被服务的 profile;假 Key 从不出现在公开列表里。
208
+ const profilesResp = await harness.getJson(`${host.base}${harness.API_BASE}/profiles`);
209
+ const listed = Array.isArray(profilesResp.body && profilesResp.body.profiles) ? profilesResp.body.profiles : [];
210
+ assertTrue(listed.length === 1, `the isolated store must serve exactly the fictional profile, saw ${JSON.stringify(listed.map(item => item.id))}`);
211
+ const fakeListed = listed[0];
212
+ assertTrue(fakeListed.id === FAKE_PROFILE_ID && fakeListed.name === FAKE_PROFILE_NAME, 'the served profile is not the fictional one');
213
+ assertTrue(fakeListed.provider === 'r5-fake-provider' && fakeListed.baseUrl === FAKE_BASE_URL, 'the fictional profile was altered on the way out');
214
+ assertTrue(!JSON.stringify(listed).includes(FAKE_KEY), 'the fake key leaked through the public profile listing');
215
+
216
+ // 隔离 dataDir 里的 store 文件只含虚构条目(假 Key 是显式假值,可入证据)。
217
+ const profilesRaw = JSON.parse(fs.readFileSync(path.join(layout.dataDir, 'profiles.v2.json'), 'utf8'));
218
+ const credentialsRaw = JSON.parse(fs.readFileSync(path.join(layout.dataDir, 'credentials.v1.json'), 'utf8'));
219
+ assertTrue(Array.isArray(profilesRaw.profiles) && profilesRaw.profiles.length === 1 && profilesRaw.profiles[0].id === FAKE_PROFILE_ID, 'the isolated profile file holds more than the fictional profile');
220
+ const credentialKeys = Object.keys(credentialsRaw.credentials || {});
221
+ assertTrue(credentialKeys.length === 1 && credentialKeys[0] === `credential:${FAKE_PROFILE_ID}`, 'the isolated credential file holds more than the fake credential');
222
+ assertTrue(credentialsRaw.credentials[credentialKeys[0]] === FAKE_KEY, 'the isolated credential is not the explicit fake key');
223
+
224
+ isolationDetail = {
225
+ envWhitelistApplied: envApplied,
226
+ pathKeysResolvedInsideLayoutRoot: pathKeyValues,
227
+ previouslyUnisolatedKeys: {
228
+ APPDATA: { realBefore: isolationBefore.APPDATA === true ? 'real machine APPDATA was set and is now overridden' : 'was unset', isolatedNow: envApplied.APPDATA },
229
+ LOCALAPPDATA: { realBefore: isolationBefore.LOCALAPPDATA === true ? 'real machine LOCALAPPDATA was set and is now overridden' : 'was unset', isolatedNow: envApplied.LOCALAPPDATA },
230
+ CODEX_HOME: { realBefore: isolationBefore.CODEX_HOME === true ? 'was set and is now overridden' : 'was unset', isolatedNow: envApplied.CODEX_HOME },
231
+ },
232
+ ambientCredentialVarsPresentAfterSanitize: !ambientClean,
233
+ realProfileSource: 'removed — no read-only facade, no PK_WB_REAL_PROFILE_DIR, no digest of the real credential files (R5 fixture drops that machinery entirely)',
234
+ fakeProfile: {
235
+ seededThrough: "the product's own ProfileStore.save/setCredential on the isolated dataDir",
236
+ profile: profilesRaw.profiles[0],
237
+ credentialKeys,
238
+ baseUrlUnroutable: 'r5-fake.invalid is a reserved RFC 2606 TLD — it can never resolve to a provider',
239
+ },
240
+ browser: 'real Chrome via CDP (headless), isolated user-data-dir below the same isolated layout',
241
+ chrome: opened.chrome,
242
+ };
243
+
244
+ const projectA = await withBudget('create-project-a', 60000, () => harness.ensureProject(browser, path.join(layout.root, 'r5-project-a'), { name: 'r5-project-a' }));
245
+ const projectB = await withBudget('create-project-b', 60000, () => harness.ensureProject(browser, path.join(layout.root, 'r5-project-b'), { name: 'r5-project-b' }));
246
+ assertTrue(projectA.created === true && projectB.created === true, 'the two projects were not created through the product form');
247
+ assertTrue(projectA.projectId && projectB.projectId && projectA.projectId !== projectB.projectId, 'the two projects do not have distinct ids');
248
+ record('WB005-R5.a-real-browser-host-and-isolation', 'PASS', {
249
+ module: identity,
250
+ servedUiIntegrity: servedIntegrity,
251
+ host: { mode: 'standalone (fictional profile)', pid: host.child.child.pid, port: host.port, dataDir: layout.dataDir, workspace: layout.workspace, tempRoot: path.dirname(layout.root) },
252
+ isolation: isolationDetail,
253
+ projects: [
254
+ { id: projectA.projectId, name: projectA.name, createdThroughTheProductForm: true },
255
+ { id: projectB.projectId, name: projectB.name, createdThroughTheProductForm: true },
256
+ ],
257
+ health: health.body,
258
+ });
259
+
260
+ // 只选模型让产品具备建会话条件;从不发送消息,见 g/h 项证据。
261
+ await withBudget('select-model', 60000, () => harness.selectModel(browser, FAKE_PROFILE_NAME, FAKE_MODEL));
262
+
263
+ // --- b. 项目级草稿:A=1111、B=2222,产品侧边栏切换各自恢复 ------------
264
+ await withBudget('project-drafts', 90000, async () => {
265
+ await harness.selectProject(browser, projectA.projectId);
266
+ await harness.typeText(browser, DRAFT_A);
267
+ await waitStorageDraft(browser, projectA.projectId, null, DRAFT_A);
268
+ await harness.selectProject(browser, projectB.projectId);
269
+ const firstEntryB = await harness.readState(browser);
270
+ assertTrue(firstEntryB.inputValue === '', `project B must start with an empty composer, saw ${JSON.stringify(firstEntryB.inputValue)}`);
271
+ await harness.typeText(browser, DRAFT_B);
272
+ await waitStorageDraft(browser, projectB.projectId, null, DRAFT_B);
273
+ await harness.selectProject(browser, projectA.projectId);
274
+ const backInA = await harness.readState(browser);
275
+ assertTrue(backInA.inputValue === DRAFT_A, `project A did not restore its draft: ${JSON.stringify(backInA.inputValue)}`);
276
+ await harness.selectProject(browser, projectB.projectId);
277
+ const backInB = await harness.readState(browser);
278
+ assertTrue(backInB.inputValue === DRAFT_B, `project B did not restore its draft: ${JSON.stringify(backInB.inputValue)}`);
279
+ assertTrue(!backInA.inputValue.includes(DRAFT_B) && !backInB.inputValue.includes(DRAFT_A), 'a project draft leaked across projects');
280
+ bDetail = {
281
+ switch: "the product's own sidebar project head (.proj-item), a real click",
282
+ projectA: { id: projectA.projectId, draft: DRAFT_A, composerAfterSwitchBack: backInA.inputValue },
283
+ projectB: { id: projectB.projectId, draft: DRAFT_B, composerOnFirstEntry: firstEntryB.inputValue, composerAfterSwitchBack: backInB.inputValue },
284
+ crossLeak: backInA.inputValue.includes(DRAFT_B) || backInB.inputValue.includes(DRAFT_A),
285
+ persistedByTheProduct: true,
286
+ };
287
+ });
288
+ record('WB005-R5.b-project-drafts-are-isolated', 'PASS', bDetail);
289
+
290
+ // --- c. 真实浏览器刷新后项目级草稿恢复(此时还没有任何会话)-----------
291
+ await withBudget('refresh-project-drafts', 60000, async () => {
292
+ await harness.reloadPage(browser);
293
+ await waitSidebarProjects(browser, 2);
294
+ await harness.selectProject(browser, projectA.projectId);
295
+ const aAfter = await harness.readState(browser);
296
+ assertTrue(aAfter.inputValue === DRAFT_A, `project A draft lost after refresh: ${JSON.stringify(aAfter.inputValue)}`);
297
+ await harness.selectProject(browser, projectB.projectId);
298
+ const bAfter = await harness.readState(browser);
299
+ assertTrue(bAfter.inputValue === DRAFT_B, `project B draft lost after refresh: ${JSON.stringify(bAfter.inputValue)}`);
300
+ cDetail = {
301
+ refresh: 'a real Page.reload; the sidebar re-rendered both projects before any click',
302
+ composerInProjectAAfterRefresh: aAfter.inputValue,
303
+ composerInProjectBAfterRefresh: bAfter.inputValue,
304
+ storageKeysAfterRefresh: (await harness.readDraftStorage(browser)).keys,
305
+ };
306
+ });
307
+ record('WB005-R5.c-drafts-survive-a-real-browser-refresh', 'PASS', cDetail);
308
+
309
+ // --- d. 同一项目两个会话的草稿隔离 -------------------------------------
310
+ let sessionS1 = null;
311
+ let sessionS2 = null;
312
+ await withBudget('session-drafts', 120000, async () => {
313
+ await harness.selectProject(browser, projectA.projectId);
314
+ await harness.clickNewSession(browser);
315
+ const s1State = await harness.waitForState(browser, state => state.product && state.product.activeSessionId, 'the first session of project A', 30000);
316
+ sessionS1 = s1State.product.activeSessionId;
317
+ // 首会话创建时产品把项目级草稿 1111 迁入该会话(app.js newSession)。
318
+ const inS1 = await harness.readState(browser);
319
+ assertTrue(inS1.inputValue === DRAFT_A, `the project draft did not migrate into the first session: ${JSON.stringify(inS1.inputValue)}`);
320
+ const tombstone = await harness.readDraftStorage(browser);
321
+ const tombstoneKey = JSON.stringify([projectA.projectId, null]);
322
+ assertTrue(tombstone.parsed && tombstone.parsed[tombstoneKey] === '', 'the project-level entry must be an empty migration tombstone after the first session');
323
+
324
+ await harness.clickNewSession(browser);
325
+ const s2State = await harness.waitForState(browser, state => state.product && state.product.activeSessionId && state.product.activeSessionId !== sessionS1, 'the second session of project A', 30000);
326
+ sessionS2 = s2State.product.activeSessionId;
327
+ const s2Fresh = await harness.readState(browser);
328
+ assertTrue(s2Fresh.inputValue === '', `session two must start empty, saw ${JSON.stringify(s2Fresh.inputValue)}`);
329
+ await harness.typeText(browser, DRAFT_S2);
330
+ await waitStorageDraft(browser, projectA.projectId, sessionS2, DRAFT_S2);
331
+
332
+ await harness.openSessionRow(browser, projectA.projectId, sessionS1);
333
+ const backInS1 = await harness.readState(browser);
334
+ assertTrue(backInS1.inputValue === DRAFT_A, `session one draft not restored: ${JSON.stringify(backInS1.inputValue)}`);
335
+ assertTrue(!backInS1.inputValue.includes(DRAFT_S2), 'session two draft leaked into session one');
336
+ await harness.openSessionRow(browser, projectA.projectId, sessionS2);
337
+ const backInS2 = await harness.readState(browser);
338
+ assertTrue(backInS2.inputValue === DRAFT_S2, `session two draft not restored: ${JSON.stringify(backInS2.inputValue)}`);
339
+ assertTrue(backInS2.inputValue !== DRAFT_A, 'session two must not hold session one draft (exact equality)');
340
+ dDetail = {
341
+ switch: "the product's own sidebar session row (.session), real clicks",
342
+ projectId: projectA.projectId,
343
+ migrationIntoFirstSession: { sessionId: sessionS1, composerAfterCreate: inS1.inputValue, projectLevelTombstone: true },
344
+ sessionOne: { sessionId: sessionS1, draft: DRAFT_A, composerAfterReopen: backInS1.inputValue },
345
+ sessionTwo: { sessionId: sessionS2, draft: DRAFT_S2, composerOnCreate: s2Fresh.inputValue, composerAfterReopen: backInS2.inputValue },
346
+ sessionOneDraftLeakedIntoSessionTwo: s2Fresh.inputValue !== '',
347
+ sessionTwoDraftLeakedIntoSessionOne: backInS1.inputValue === DRAFT_S2,
348
+ };
349
+ });
350
+ record('WB005-R5.d-session-drafts-are-isolated', 'PASS', dDetail);
351
+
352
+ // --- e. 附件生命周期与跨项目隔离 ---------------------------------------
353
+ await withBudget('attachments', 120000, async () => {
354
+ await harness.openSessionRow(browser, projectA.projectId, sessionS1);
355
+ const tokenA = `R5-ATTACH-A-${crypto.randomBytes(4).toString('hex')}`;
356
+ const contentA = `${tokenA}\nP-WB-DRAFTS-R5 attachment of project A session one\n`;
357
+ await harness.attachFile(browser, 'r5-note.txt', contentA);
358
+ const s1WithAttachment = await harness.readState(browser);
359
+ assertTrue(s1WithAttachment.attachments.length === 1 && s1WithAttachment.attachments[0].includes('r5-note.txt'), 'the attachment did not reach the tray of session one');
360
+ assertTrue(s1WithAttachment.product.attachmentCount === 1, 'the product did not count the attachment');
361
+ const base64A = Buffer.from(contentA, 'utf8').toString('base64');
362
+ const storageWithA = await harness.readDraftStorage(browser);
363
+ const bytesAInStorage = storageWithA.raw.includes(tokenA) || storageWithA.raw.includes(base64A);
364
+
365
+ await harness.selectProject(browser, projectB.projectId);
366
+ const trayInB = await harness.readState(browser);
367
+ assertTrue(trayInB.attachments.length === 0 && trayInB.product.attachmentCount === 0, "A's attachment leaked into project B");
368
+
369
+ const tokenB = `R5-ATTACH-B-${crypto.randomBytes(4).toString('hex')}`;
370
+ const contentB = `${tokenB}\nP-WB-DRAFTS-R5 attachment of project B\n`;
371
+ await harness.attachFile(browser, 'r5-b.txt', contentB);
372
+ const bWithAttachment = await harness.readState(browser);
373
+ assertTrue(bWithAttachment.attachments.length === 1 && bWithAttachment.attachments[0].includes('r5-b.txt'), 'the attachment of project B did not reach its tray');
374
+ const base64B = Buffer.from(contentB, 'utf8').toString('base64');
375
+ const storageWithB = await harness.readDraftStorage(browser);
376
+ const bytesBInStorage = storageWithB.raw.includes(tokenB) || storageWithB.raw.includes(base64B);
377
+ assertTrue(!bytesAInStorage && !bytesBInStorage, 'attachment bytes entered the browser storage');
378
+
379
+ await harness.openSessionRow(browser, projectA.projectId, sessionS1);
380
+ const backInS1 = await harness.readState(browser);
381
+ assertTrue(backInS1.attachments.length === 1 && backInS1.attachments[0].includes('r5-note.txt'), "session one's attachment did not come back");
382
+ assertTrue(!backInS1.attachments.join(' ').includes('r5-b.txt'), "B's attachment leaked into A's session");
383
+ eDetail = {
384
+ attach: "the product's own <input type=\"file\"> change handler (a real File into the real input)",
385
+ sessionOne: { sessionId: sessionS1, file: 'r5-note.txt', tray: s1WithAttachment.attachments, productAttachmentCount: s1WithAttachment.product.attachmentCount, trayAfterReturn: backInS1.attachments },
386
+ projectB: { file: 'r5-b.txt', trayWhenInA: trayInB.attachments, ownTray: bWithAttachment.attachments },
387
+ attachmentBytesInBrowserStorage: bytesAInStorage || bytesBInStorage,
388
+ storageKeys: storageWithB.keys,
389
+ contract: 'app.js writeDraft(): only the text is persisted, attachment bytes stay in page memory',
390
+ };
391
+ });
392
+ record('WB005-R5.e-attachment-lifecycle-and-isolation', 'PASS', eDetail);
393
+
394
+ // --- f. 只重启本用例自己的隔离宿主(同布局/同端口/同浏览器 profile)----
395
+ await withBudget('own-host-restart', 180000, async () => {
396
+ const oldPid = host.child.child.pid;
397
+ const oldPort = host.port;
398
+ await harness.stopHost(host);
399
+ const exitInfo = await host.child.exited;
400
+ const oldGone = !harness.listProcesses().some(entry => entry.pid === oldPid);
401
+ assertTrue(oldGone && Boolean(exitInfo), 'the own host did not really exit');
402
+
403
+ const restarted = await harness.startHost({ layout: host.layout, port: oldPort, moduleRoot: host.moduleRoot });
404
+ host = restarted;
405
+ const identityAfter = harness.moduleIdentity(restarted.moduleRoot);
406
+ assertTrue(identityAfter.version === LOCKED_VERSION && identityAfter.uiFiles['apps/agent-terminal/app.js'] === identity.uiFiles['apps/agent-terminal/app.js'], 'the restarted host serves different UI bytes');
407
+ const healthAfter = await harness.getJson(`${restarted.base}${harness.API_BASE}/health`);
408
+ assertTrue(healthAfter.ok && healthAfter.body && healthAfter.body.status === 'ok', 'the restarted host is not healthy');
409
+
410
+ // 隔离 store 的虚构 profile 跨重启仍在且仍唯一(同数据目录)。
411
+ const profilesAfter = await harness.getJson(`${restarted.base}${harness.API_BASE}/profiles`);
412
+ const listedAfter = Array.isArray(profilesAfter.body && profilesAfter.body.profiles) ? profilesAfter.body.profiles : [];
413
+ assertTrue(listedAfter.length === 1 && listedAfter[0].id === FAKE_PROFILE_ID, 'the fictional profile did not survive the own-host restart as the only profile');
414
+
415
+ await harness.reloadPage(browser);
416
+ await waitSidebarProjects(browser, 2);
417
+ const stateAfterRestart = await harness.waitForState(browser, state => state.product && state.product.projects.length === 2, 'both projects after the restart', 30000);
418
+
419
+ await harness.selectProject(browser, projectB.projectId);
420
+ const bAfter = await harness.readState(browser);
421
+ assertTrue(bAfter.inputValue === DRAFT_B, `project B draft lost after the own-host restart: ${JSON.stringify(bAfter.inputValue)}`);
422
+ assertTrue(bAfter.attachments.length === 0, 'a memory-backed attachment survived the restart or leaked into B');
423
+
424
+ await harness.selectProject(browser, projectA.projectId);
425
+ const aProjectAfter = await harness.readState(browser);
426
+ assertTrue(aProjectAfter.inputValue === '', `project A project-level entry must stay the migration tombstone, saw ${JSON.stringify(aProjectAfter.inputValue)}`);
427
+ await harness.openSessionRow(browser, projectA.projectId, sessionS1);
428
+ const s1After = await harness.readState(browser);
429
+ assertTrue(s1After.inputValue === DRAFT_A, `session one draft lost after the restart: ${JSON.stringify(s1After.inputValue)}`);
430
+ await harness.openSessionRow(browser, projectA.projectId, sessionS2);
431
+ const s2After = await harness.readState(browser);
432
+ assertTrue(s2After.inputValue === DRAFT_S2, `session two draft lost after the restart: ${JSON.stringify(s2After.inputValue)}`);
433
+
434
+ const storageFinal = await harness.readDraftStorage(browser);
435
+ fDetail = {
436
+ restart: "only this case's own isolated host child was stopped and restarted (same layout, same port, same browser profile)",
437
+ oldHostPid: oldPid, oldHostExited: true, oldHostProcessStillListed: !oldGone, oldHostExitCode: exitInfo && exitInfo.code,
438
+ newHostPid: restarted.child.child.pid, portKept: oldPort === restarted.port,
439
+ healthAfterRestart: healthAfter.body,
440
+ fakeProfileAfterRestart: { soleProfile: listedAfter[0].id, model: listedAfter[0].models && listedAfter[0].models.default },
441
+ projectsAfterRestart: stateAfterRestart.product.projects.map(project => ({ id: project.id, name: project.name })),
442
+ composerInProjectBAfterRestart: bAfter.inputValue,
443
+ attachmentTrayInProjectBAfterRestart: bAfter.attachments,
444
+ projectAProjectLevelAfterRestart: aProjectAfter.inputValue,
445
+ projectAProjectLevelNote: 'the empty value is the migration tombstone the product itself wrote; the draft lives in session one',
446
+ composerInSessionOneAfterRestart: s1After.inputValue,
447
+ composerInSessionTwoAfterRestart: s2After.inputValue,
448
+ storageKeysAfterRestart: storageFinal.keys,
449
+ };
450
+ });
451
+ record('WB005-R5.f-own-host-restart-keeps-projects-and-drafts', 'PASS', fDetail);
452
+
453
+ // --- g. 全程零模型请求 -------------------------------------------------
454
+ await withBudget('no-model-request', 30000, async () => {
455
+ const events = await harness.recordedEvents(browser);
456
+ const modelEvents = events.filter(event => event.type === 'claude/result' || event.type === 'claude/init' || event.type === 'claude/user-prompt');
457
+ assertTrue(modelEvents.length === 0, `the draft case triggered model stream events: ${JSON.stringify(modelEvents.map(event => event.type))}`);
458
+ gDetail = { recordedStreamEvents: events.map(event => event.type), modelStreamEvents: [], draftsNeverSentToAnyModel: [DRAFT_A, DRAFT_B, DRAFT_S2], paidTurns: 0 };
459
+ });
460
+ record('WB005-R5.g-no-model-request-was-made', 'PASS', gDetail);
461
+ } catch (error) {
462
+ const diagnosis = await diagnose(host, browser).catch(() => null);
463
+ record('WB005-R5.runtime', 'BLOCKED', { error: String(error && error.message || error), diagnosis, stepsSoFar: stepTimings.slice() });
464
+ sceneKept = layout.root;
465
+ } finally {
466
+ // 先关浏览器(内部会杀 Chrome 树并清 profile),再显式等 CDP websocket
467
+ // 的 close 事件(至多 1.5s)——长命 socket 拖住事件循环是旧三挂的根因
468
+ // 类别;随后才停自有宿主。
469
+ if (browser) {
470
+ try { await browser.close(); } catch { /* disposable */ }
471
+ try {
472
+ await Promise.race([
473
+ new Promise(resolve => { try { browser.socket.once('close', resolve); } catch { resolve(); } }),
474
+ new Promise(resolve => setTimeout(resolve, 1500)),
475
+ ]);
476
+ } catch { /* best effort */ }
477
+ }
478
+ try { if (host && host.child) await harness.stopHost(host); } catch { /* best effort */ }
479
+ }
480
+
481
+ // --- h. 无真实 profile 读取 + 假 Key 从未外呼 ---------------------------
482
+ try {
483
+ // 复核白名单在整场运行后仍成立(宿主已停,浏览器已关)。
484
+ let guardsHold = true;
485
+ const guardValues = {};
486
+ for (const key of fixture.ISOLATION_PATH_KEYS) {
487
+ const value = path.resolve(process.env[key]);
488
+ guardValues[key] = value;
489
+ if (!isInside(value, layout.root) || isInside(value, fixture.REAL_HOME) || value.includes(realProfileDir)) guardsHold = false;
490
+ }
491
+ assertTrue(guardsHold, 'the isolation whitelist no longer holds at the end of the run');
492
+ // 零模型请求引用 g 项在真实页面上录得的事件流(浏览器此时已按退出纪律
493
+ // 关闭,不再有可询问的页面)。
494
+ assertTrue(gDetail && Array.isArray(gDetail.modelStreamEvents) && gDetail.modelStreamEvents.length === 0, 'case g did not prove a clean event stream');
495
+ hDetail = {
496
+ realProfileDirPathKnownToThisProbe: realProfileDir,
497
+ realProfileDirFilesystemAccess: 'none — R5 performs no fs operation on it (path string only, for the guards above); the R5 fixture removed the digest machinery entirely',
498
+ isolationGuards: { everyIsolationEnvValueInsideLayoutRoot: true, noIsolationEnvValueInsideTheRealHome: true, noIsolationEnvValueReferencesTheRealProfileDir: true, finalCheck: guardValues },
499
+ fakeCredential: { value: FAKE_KEY, everSentToAnyProvider: false, baseUrlHost: 'r5-fake.invalid (RFC 2606 reserved — unresolvable by construction)', providerRequests: 0 },
500
+ servedProfilesOverTheWholeRun: 'exactly one fictional profile (case a + case f restart)',
501
+ draftsSentToAnyModel: [],
502
+ };
503
+ record('WB005-R5.h-no-real-profile-read-and-fake-key-never-dialled', 'PASS', hDetail);
504
+ } catch (error) {
505
+ record('WB005-R5.h-no-real-profile-read-and-fake-key-never-dialled', 'FAIL', { error: String(error && error.message || error) });
506
+ }
507
+
508
+ // --- 自有残留清点:宿主 pid 消失 + 命令行引用隔离 root 的自有进程清零 ----
509
+ let ownResidue = null;
510
+ try {
511
+ ownResidue = await withBudget('own-residue-census', 30000, () => harness.waitUntil(async () => {
512
+ const remaining = harness.listProcesses().filter(entry => entry.commandLine.includes(layout.root));
513
+ return remaining.length === 0 ? [] : null;
514
+ }, 'every own process referencing the isolated root to be gone', 20000).catch(() => harness.listProcesses().filter(entry => entry.commandLine.includes(layout.root))));
515
+ } catch (error) { ownResidue = [{ note: String(error && error.message || error) }]; }
516
+ const finalHostPid = host && host.child && host.child.child ? host.child.child.pid : null;
517
+ const hostStillListed = finalHostPid ? harness.listProcesses().some(entry => entry.pid === finalHostPid) : false;
518
+ const ownResidueClean = Array.isArray(ownResidue) && ownResidue.length === 0 && !hostStillListed;
519
+
520
+ watchdogCleared = true;
521
+ clearTimeout(watchdog);
522
+
523
+ const essential = [
524
+ 'WB005-R5.a-real-browser-host-and-isolation',
525
+ 'WB005-R5.b-project-drafts-are-isolated',
526
+ 'WB005-R5.c-drafts-survive-a-real-browser-refresh',
527
+ 'WB005-R5.d-session-drafts-are-isolated',
528
+ 'WB005-R5.e-attachment-lifecycle-and-isolation',
529
+ 'WB005-R5.f-own-host-restart-keeps-projects-and-drafts',
530
+ 'WB005-R5.g-no-model-request-was-made',
531
+ 'WB005-R5.h-no-real-profile-read-and-fake-key-never-dialled',
532
+ ];
533
+ const proven = essential.every(id => (results.find(entry => entry.caseId === id) || {}).status === 'PASS') && ownResidueClean;
534
+
535
+ const summary = {
536
+ lane: 'workbench-drafts-r5',
537
+ file: 'parallel-workbench-drafts-r5-probe.js',
538
+ case: 'WB-005',
539
+ title: '草稿与附件隔离(真实浏览器 + 真实 UI 操作,R5 隔离前提补正复测)',
540
+ startedAt,
541
+ finishedAt: new Date().toISOString(),
542
+ module: identity,
543
+ servedUiIntegrity: servedIntegrity,
544
+ host: host ? { mode: 'standalone (fictional profile)', pid: host.child.child.pid, port: host.port, dataDir: host.layout.dataDir, workspace: host.layout.workspace } : null,
545
+ isolation: {
546
+ envWhitelistApplied: envApplied,
547
+ pathKeysResolvedInsideLayoutRoot: pathKeyValues,
548
+ closedR4Gaps: ['APPDATA', 'LOCALAPPDATA', 'CODEX_HOME'],
549
+ realProfileSourceRemoved: true,
550
+ fakeProfile: { id: FAKE_PROFILE_ID, name: FAKE_PROFILE_NAME, provider: 'r5-fake-provider', baseUrl: FAKE_BASE_URL, model: FAKE_MODEL, credential: FAKE_KEY, credentialSentAnywhere: false },
551
+ chromeResolvedBeforeEnvSwitch: chromePath,
552
+ moduleRootResolvedBeforeEnvSwitch: moduleRoot,
553
+ },
554
+ timeouts: { wholeProbeWatchdogMs: PROBE_TIMEOUT_MS, perStepBudgets: 'withBudget labels in steps below', exitDiscipline: 'graceful CDP close wait (<=1.5s) then forced process.exit after the verdict' },
555
+ drafts: { projectA: DRAFT_A, projectB: DRAFT_B, sessionTwoOfProjectA: DRAFT_S2, sentToAnyModel: false },
556
+ uiActions: [
557
+ "the product's own add-project form to create both projects",
558
+ "the product's own sidebar project head (.proj-item) to switch projects",
559
+ "the product's own sidebar session row (.session) to open sessions",
560
+ "the product's own 新会话 button to create sessions",
561
+ "the product's own <input type=\"file\"> change handler to attach files",
562
+ 'a real Page.reload of the real page (twice: refresh case and after the own-host restart)',
563
+ "a real stop+start of only this case's own isolated host child",
564
+ ],
565
+ storeApiUsedAsUiSubstitute: false,
566
+ recoveryExpectationsFollowTheProductLifecycle: 'text drafts are storage-backed and must survive switch/refresh/restart; the first session migrates the project-level draft and leaves a tombstone; attachments are page-memory only and must vanish on refresh/restart without ever entering storage (expecteds identical to the accepted R4 run)',
567
+ steps: stepTimings,
568
+ cases: results,
569
+ ownResidue: { processesReferencingTheIsolatedRoot: ownResidue, finalHostPid, finalHostStillListed: hostStillListed, clean: ownResidueClean },
570
+ verdict: proven
571
+ ? 'PASS: 隔离前提补正后复测——完整环境白名单(含 APPDATA/LOCALAPPDATA/CODEX_HOME)全在本用例私有 fixture;真实 profile 来源整体移除,宿主以产品自身 ProfileStore 播种纯虚构 profile 与假 Key;草稿按项目/会话隔离并在切换/刷新/自有宿主重启后分别恢复;附件按会话生命周期不跨项目泄漏且字节永不入存储;全程零模型请求;自有宿主/浏览器无残留;进程真实退出(exit code 由运行方观测)'
572
+ : 'BLOCKED',
573
+ paidTurnsSent: 0,
574
+ quotaEndpointQueried: false,
575
+ sceneKeptOnFailure: sceneKept,
576
+ };
577
+
578
+ harness.writeEvidence(path.join(EVIDENCE_DIR, 'evidence', 'drafts-r5-probe.json'), summary);
579
+ if (!proven) {
580
+ if (sceneKept) console.log(`SCENE KEPT ${sceneKept}`);
581
+ } else {
582
+ fixture.removeTree(layout.root);
583
+ }
584
+ console.log(`parallel-workbench-drafts-r5-probe verdict=${summary.verdict}`);
585
+ const exitCode = proven ? 0 : 3;
586
+ // 强制退出(hangRuling 认可的根修):verdict 打印后进程必须真的退。
587
+ setTimeout(() => process.exit(exitCode), 300);
588
+ process.exitCode = exitCode;
589
+ })().catch(error => {
590
+ console.error(error);
591
+ setTimeout(() => process.exit(1), 300);
592
+ process.exitCode = 1;
593
+ });