@sanqianx/project-knowledge 5.0.29 → 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 +16 -16
  59. package/package.json +2 -2
  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,314 @@
1
+ 'use strict';
2
+ // _site/_test/parallel-memory-capture-r4-mem005-health-test.js
3
+ //
4
+ // MEM-005 R4 — the UI half that R3 never proved on a healthy page.
5
+ //
6
+ // The Leader review of the R3 run found the vacuous pass: the after-reload
7
+ // screenshot showed the memory view's offline fallback ("知识引擎暂时不可用。
8
+ // 未读取到的记忆不会显示为已确认。"), so "no candidate card / no candidate
9
+ // text" was trivially true on an unavailable page. R3's waits accepted any
10
+ // non-empty #memoryContent — including that banner — before the page's own
11
+ // boot snapshot had answered.
12
+ //
13
+ // This case keeps the accepted R3 layers (product API ignored, engine API
14
+ // ignored, engine state file ignored, frozen source byte-identical, never
15
+ // injected) and re-proves the UI half with three gates that cannot pass on an
16
+ // unhealthy or empty projection:
17
+ // * a CONTRAST memory B is produced through the same real pipeline and must
18
+ // stay visible in the candidate box — before the ignore, right after it,
19
+ // and again after a real page reload. A box that empties, errors or falls
20
+ // back offline can never satisfy "B visible".
21
+ // * the offline banner text must be absent from the memory view AND from the
22
+ // home view at every gate.
23
+ // * the page's own /api/engine/snapshot requests after the reload must have
24
+ // answered 200 (network capture of the real browser).
25
+ // Only then: the ignored A has no card, no text, no ignore button, is not
26
+ // counted by the candidate badge and is not presented as confirmed.
27
+ //
28
+ // HONEST SCOPE: the analysis step is the frozen P-MEMORY-01 stand-in analyzer
29
+ // (helpers/parallel-memory-analyzer.js); this case is evidence about the
30
+ // engine's admission, the ignore action, the persistence of that state, the
31
+ // frozen source and the real UI's healthy-page projection — never about the
32
+ // model's judgement. The health gates are read-only observations of the real
33
+ // page; the driver never sets any availability flag.
34
+
35
+ const fs = require('node:fs');
36
+ const path = require('node:path');
37
+ const assert = require('node:assert/strict');
38
+
39
+ const { startHarness, makeRepo } = require('./helpers/parallel-memory-shell');
40
+ const r3 = require('./helpers/parallel-memory-capture-r3-shell');
41
+
42
+ const EVIDENCE = process.env.PK_TEST_EVIDENCE_DIR ? path.resolve(process.env.PK_TEST_EVIDENCE_DIR) : null;
43
+ const BANNER = '知识引擎暂时不可用';
44
+ const TEXT_A = 'R4 健康页忽略持久性(忽略项):对外错误信息使用中文表述,并优先复用已有模块。';
45
+ const TEXT_B = 'R4 对照记忆(保持候选):发布前必须运行隔离回归,不允许跳过。';
46
+ const REPO_NAME = 'mem005r4-repo';
47
+
48
+ async function openMemoryView(harness) {
49
+ await harness.nativeClick('nav [data-view="memory"]');
50
+ await harness.waitFor(
51
+ () => harness.run("document.getElementById('view-memory').classList.contains('active')"),
52
+ 'the memory view is open',
53
+ 10000,
54
+ );
55
+ }
56
+
57
+ async function openCandidateBox(harness) {
58
+ await openMemoryView(harness);
59
+ await harness.nativeClick('[data-memory-tab="candidate"]');
60
+ }
61
+
62
+ /** A memory card's text is rendered by the real page (implies engine data). */
63
+ const cardTextVisible = (harness, text) => harness.run(
64
+ `document.getElementById('memoryContent').textContent.includes(${JSON.stringify(text)})`,
65
+ );
66
+
67
+ const bannerInMemoryView = harness => harness.run(
68
+ `document.getElementById('memoryContent').textContent.includes(${JSON.stringify(BANNER)})`,
69
+ );
70
+
71
+ const bannerInHome = harness => harness.run(
72
+ `document.getElementById('homeContent').textContent.includes(${JSON.stringify(BANNER)})`,
73
+ );
74
+
75
+ /**
76
+ * The healthy-page gate: the contrast candidate B must be visible AND the
77
+ * offline banner absent. Waiting for B's real text is the essential part —
78
+ * only a page that actually read engine data can render it.
79
+ */
80
+ async function waitHealthyCandidateBox(harness, label) {
81
+ const startedAt = Date.now();
82
+ await harness.waitFor(
83
+ () => cardTextVisible(harness, TEXT_B),
84
+ `${label}: the contrast candidate is visible in the candidate box (a page that fell back offline cannot render it)`,
85
+ 20000,
86
+ );
87
+ await harness.waitFor(
88
+ () => harness.run(`!document.getElementById('memoryContent').textContent.includes(${JSON.stringify(BANNER)})`),
89
+ `${label}: the offline banner is absent from the memory view`,
90
+ 10000,
91
+ );
92
+ return { waitedMs: Date.now() - startedAt };
93
+ }
94
+
95
+ async function main() {
96
+ const harness = await startHarness({ tag: 'mem005r4', evidenceDir: EVIDENCE || undefined });
97
+ const evidence = [];
98
+ try {
99
+ const repo = makeRepo(harness.fixture, REPO_NAME, { 'README.md': '# R4 健康页忽略持久性夹具\n' });
100
+ const { projectId, knowledgePath } = await harness.importProject(repo, 'R4健康页忽略持久性');
101
+ await harness.requestRegistryRefresh();
102
+ await harness.waitFor(
103
+ () => harness.run("document.getElementById('homeContent').textContent.includes('R4健康页忽略持久性')"),
104
+ 'the imported project is listed',
105
+ 20000,
106
+ );
107
+
108
+ // 1. Two real candidates through the real pipeline: A will be ignored,
109
+ // B stays candidate and is the healthy-page contrast.
110
+ const producedA = await harness.produceCandidate({ repo, projectId, text: TEXT_A, scopeType: 'global', file: 'src/r4-candidate-a.js' });
111
+ const producedB = await harness.produceCandidate({ repo, projectId, text: TEXT_B, scopeType: 'global', file: 'src/r4-candidate-b.js' });
112
+ assert.equal(producedA.capture.accepted, 1, `run A admitted one candidate: ${JSON.stringify(producedA.capture)}`);
113
+ assert.equal(producedB.capture.accepted, 1, `run B admitted one candidate: ${JSON.stringify(producedB.capture)}`);
114
+ const memories = await harness.productMemories();
115
+ const candidateA = memories.find(memory => memory.text === TEXT_A);
116
+ const candidateB = memories.find(memory => memory.text === TEXT_B);
117
+ assert.ok(candidateA, 'candidate A really exists in the engine');
118
+ assert.ok(candidateB, 'candidate B really exists in the engine');
119
+ assert.equal(candidateA.status, 'candidate', 'A starts as a candidate');
120
+ assert.equal(candidateB.status, 'candidate', 'B starts as a candidate');
121
+ assert.equal(candidateA.evidence.commitSha, producedA.commitSha, 'A\'s frozen source names its real commit');
122
+ assert.equal(candidateB.evidence.commitSha, producedB.commitSha, 'B\'s frozen source names its real commit');
123
+
124
+ // 2. The frozen sources, fingerprinted before anything is clicked.
125
+ const fingerprint = (candidate, produced) => {
126
+ const events = harness.engine.coordinator.conversations.readEvents(projectId);
127
+ return {
128
+ source: r3.sourceFingerprint({
129
+ knowledgePath,
130
+ entryId: candidate.evidence.entryId,
131
+ repoPath: repo.path,
132
+ commitSha: produced.commitSha,
133
+ eventId: candidate.sourceEventId,
134
+ events,
135
+ }),
136
+ memory: r3.memoryFrozenFields(candidate),
137
+ };
138
+ };
139
+ const beforeA = fingerprint(candidateA, producedA);
140
+ assert.equal(beforeA.source.git.commitExists, true, 'A\'s frozen commit really exists');
141
+ assert.ok(beforeA.source.event, 'A\'s frozen conversation event really exists');
142
+
143
+ // 3. Healthy candidate box BEFORE the ignore: both cards visible, no banner.
144
+ await harness.reload();
145
+ await openCandidateBox(harness);
146
+ const gateBefore = await waitHealthyCandidateBox(harness, 'before ignore');
147
+ assert.equal(await cardTextVisible(harness, TEXT_A), true, 'A is listed alongside B before the ignore');
148
+ const cardsBefore = await harness.run("document.querySelectorAll('#memoryContent [data-memory-card]').length");
149
+ assert.ok(Number(cardsBefore) >= 2, `the healthy candidate box really shows both cards: ${cardsBefore}`);
150
+ if (harness.evidence) await harness.browser.screenshot(path.join(harness.evidence, 'mem005-r4-healthy-before-ignore.png'));
151
+
152
+ // 4. Ignore A through the real UI. The strong half: A must leave while B
153
+ // STAYS — an emptied, errored or offline box can never pass this.
154
+ await harness.nativeClick(`[data-memory-action="ignore"][data-memory-id="${candidateA.id}"]`);
155
+ await harness.waitFor(
156
+ () => harness.run(`!document.getElementById('memoryContent').textContent.includes(${JSON.stringify(TEXT_A)})`),
157
+ 'the ignored candidate A leaves the candidate box',
158
+ 15000,
159
+ );
160
+ assert.equal(await cardTextVisible(harness, TEXT_B), true, 'the contrast candidate B is STILL visible right after the ignore (the box did not empty or fall back offline)');
161
+ const ignorePatch = harness.network.find(entry => entry.method === 'PATCH' && entry.url.includes(`/api/engine/memories/${candidateA.id}`)).pop();
162
+ assert.ok(ignorePatch, 'the shell really ignored A');
163
+ assert.equal(ignorePatch.status, 200, `the ignore answers 200: ${JSON.stringify(ignorePatch.body)}`);
164
+ assert.deepEqual(ignorePatch.body, { status: 'ignored' }, 'the ignore only changes the status');
165
+
166
+ // 5. RELOAD. Re-open the view the way a user does. First gate: the page
167
+ // must really have read engine data again — B visible, banner absent,
168
+ // and the page's own snapshot requests answered 200.
169
+ await harness.reload();
170
+ await harness.waitFor(() => harness.run("document.readyState === 'complete'"), 'the reloaded page is complete', 20000);
171
+ await harness.nativeClick('nav [data-view="home"]');
172
+ await harness.waitFor(
173
+ () => harness.run("document.getElementById('view-home').classList.contains('active')"),
174
+ 'the home view is open after the reload',
175
+ 10000,
176
+ );
177
+ await harness.waitFor(
178
+ () => harness.run(`document.getElementById('homeContent').textContent.includes(${JSON.stringify(TEXT_B)})`),
179
+ 'the home view\'s 待确认记忆 panel lists the contrast candidate B after the reload',
180
+ 20000,
181
+ );
182
+ assert.equal(await bannerInHome(harness), false, 'the home view shows real updates, not the engine-offline fallback, after the reload');
183
+
184
+ await openCandidateBox(harness);
185
+ const gateAfter = await waitHealthyCandidateBox(harness, 'after reload');
186
+ const afterReload = {
187
+ candidateACardPresent: await harness.run(`Boolean(document.querySelector('[data-memory-card=${JSON.stringify(candidateA.id)}]'))`),
188
+ textAInMemoryView: await cardTextVisible(harness, TEXT_A),
189
+ candidateCountBadge: await harness.run("document.getElementById('candidateCount').textContent"),
190
+ ignoreButtonPresent: await harness.run(`Boolean(document.querySelector('[data-memory-action="ignore"][data-memory-id=${JSON.stringify(candidateA.id)}]'))`),
191
+ confirmButtonPresent: await harness.run(`Boolean(document.querySelector('[data-memory-action="confirm"][data-memory-id=${JSON.stringify(candidateA.id)}]'))`),
192
+ contrastCardPresent: await harness.run(`Boolean(document.querySelector('[data-memory-card=${JSON.stringify(candidateB.id)}]'))`),
193
+ };
194
+ assert.equal(afterReload.candidateACardPresent, false, 'the ignored A has no card after the reload');
195
+ assert.equal(afterReload.textAInMemoryView, false, 'A\'s text is not in the memory view after the reload');
196
+ assert.equal(String(afterReload.candidateCountBadge).trim(), '1', `the candidate counter counts only the contrast candidate B after the reload: ${JSON.stringify(afterReload.candidateCountBadge)}`);
197
+ assert.equal(afterReload.ignoreButtonPresent, false, 'A offers no ignore button after the reload');
198
+ assert.equal(afterReload.confirmButtonPresent, false, 'A offers no confirm button after the reload');
199
+ assert.equal(afterReload.contrastCardPresent, true, 'B\'s card is right there — the absence of A is a real filtered-out record, not an offline fallback');
200
+ if (harness.evidence) await harness.browser.screenshot(path.join(harness.evidence, 'mem005-r4-after-reload-healthy-candidates.png'));
201
+
202
+ // 6. The confirmed tab: rendered from real data (B is not confirmed, so
203
+ // the real empty-state text shows), banner absent, A not confirmed.
204
+ await harness.nativeClick('[data-memory-tab="confirmed"]');
205
+ await harness.waitFor(
206
+ () => harness.run(`(!document.getElementById('memoryContent').textContent.includes(${JSON.stringify(BANNER)}) && (document.getElementById('memoryContent').textContent.includes('还没有已确认的长期记忆') || document.querySelectorAll('[data-memory-card]').length > 0))`),
207
+ 'the confirmed tab is rendered from real data (not the offline banner)',
208
+ 15000,
209
+ );
210
+ const confirmedTab = {
211
+ cardAPresent: await harness.run(`Boolean(document.querySelector('[data-memory-card=${JSON.stringify(candidateA.id)}]'))`),
212
+ textAPresent: await cardTextVisible(harness, TEXT_A),
213
+ bannerPresent: await bannerInMemoryView(harness),
214
+ };
215
+ assert.equal(confirmedTab.cardAPresent, false, 'A is not shown as a confirmed memory');
216
+ assert.equal(confirmedTab.textAPresent, false, 'A\'s text is not shown in the confirmed tab');
217
+ assert.equal(confirmedTab.bannerPresent, false, 'the confirmed tab is not the offline fallback');
218
+ if (harness.evidence) await harness.browser.screenshot(path.join(harness.evidence, 'mem005-r4-after-reload-confirmed.png'));
219
+
220
+ // 7. The page's own snapshot requests after the reload answered 200.
221
+ const pageSnapshotRequests = harness.network
222
+ .find(entry => entry.method === 'GET' && entry.url.includes('/api/engine/snapshot'))
223
+ .map(entry => ({ url: entry.url.replace(harness.base, ''), status: entry.status }));
224
+ assert.ok(
225
+ pageSnapshotRequests.some(entry => entry.status === 200),
226
+ `the real page loaded its engine snapshot successfully after the reload: ${JSON.stringify(pageSnapshotRequests.slice(-5))}`,
227
+ );
228
+
229
+ // 8. The engine state after the reload — kept from R3: through the
230
+ // product, through the engine itself and from the persisted file.
231
+ const productView = (await harness.productMemories()).find(memory => memory.id === candidateA.id);
232
+ assert.ok(productView, 'A is still served by the product after the reload');
233
+ assert.equal(productView.status, 'ignored', 'the product still reports A as ignored after the reload');
234
+ const productB = (await harness.productMemories()).find(memory => memory.id === candidateB.id);
235
+ assert.equal(productB.status, 'candidate', 'the contrast B is still a candidate after the reload');
236
+
237
+ const engineList = await harness.engineApi('GET', '/api/memories');
238
+ assert.equal(engineList.status, 200, `the engine memory list must be readable: ${JSON.stringify(engineList.body)}`);
239
+ const engineA = (engineList.body.memories || []).find(memory => memory.id === candidateA.id);
240
+ const engineB = (engineList.body.memories || []).find(memory => memory.id === candidateB.id);
241
+ assert.ok(engineA, 'the engine still knows A after the reload');
242
+ assert.equal(engineA.status, 'ignored', 'the engine still reports A as ignored after the reload');
243
+ assert.equal(engineB.status, 'candidate', 'the engine still reports B as a candidate after the reload');
244
+
245
+ const onDisk = r3.engineStateOnDisk(harness.engine);
246
+ assert.equal(onDisk.exists, true, 'the engine really persisted a state file');
247
+ const diskA = onDisk.memories.find(memory => memory.id === candidateA.id);
248
+ const diskB = onDisk.memories.find(memory => memory.id === candidateB.id);
249
+ assert.ok(diskA, 'A is really persisted in the engine state file');
250
+ assert.equal(diskA.status, 'ignored', 'the persisted record on disk carries A\'s ignored status');
251
+ assert.equal(diskB.status, 'candidate', 'the persisted record on disk keeps B a candidate');
252
+
253
+ // 9. A's frozen source is untouched by the ignore.
254
+ const afterA = fingerprint(productView, producedA);
255
+ const comparison = r3.compareFrozen(beforeA, afterA);
256
+ assert.equal(comparison.identical, true, `A's frozen source must not change: ${JSON.stringify(comparison.diffs)}`);
257
+ assert.equal(comparison.entrySha256Same, true, 'A\'s promoted entry file is byte-identical after the ignore');
258
+ assert.equal(comparison.gitTreeSame, true, 'A\'s frozen commit tree is unchanged after the ignore');
259
+ assert.equal(comparison.eventHashSame, true, 'A\'s frozen event hash is unchanged after the ignore');
260
+ assert.equal(comparison.memoryFrozenFieldsSame, true, 'A\'s frozen record fields are unchanged after the ignore');
261
+
262
+ // 10. Still not injected after the reload.
263
+ const injected = await harness.injectedMemories(projectId);
264
+ assert.ok(
265
+ !injected.some(entry => entry.memoryId === candidateA.id),
266
+ `an ignored memory is still never injected: ${JSON.stringify(injected)}`,
267
+ );
268
+
269
+ assert.equal(harness.browser.exceptions.length, 0, `no uncaught product JavaScript exceptions: ${JSON.stringify(harness.browser.exceptions)}`);
270
+
271
+ evidence.push({
272
+ case: 'MEM-005-persistence-healthy-page',
273
+ run: {
274
+ projectId,
275
+ commitA: producedA.commitSha,
276
+ commitB: producedB.commitSha,
277
+ knowledgePath,
278
+ },
279
+ candidates: {
280
+ ignored: { id: candidateA.id, text: TEXT_A, statusBefore: 'candidate', statusAfter: productView.status },
281
+ contrast: { id: candidateB.id, text: TEXT_B, statusBefore: 'candidate', statusAfter: productB.status },
282
+ },
283
+ healthyPageGates: {
284
+ banner: BANNER,
285
+ beforeIgnore: { ...gateBefore, bothCardsVisible: true },
286
+ afterIgnoreClick: { contrastStillVisible: true },
287
+ afterReload: { ...gateAfter, contrastVisible: true, homeListsContrast: true, bannerInMemoryView: false, bannerInHome: false },
288
+ pageSnapshotRequests: pageSnapshotRequests.slice(-6),
289
+ },
290
+ uiAfterReload: { ...afterReload, confirmedTab, pageReloaded: true, viewReopenedAfterReload: true },
291
+ ignoreRequest: { method: 'PATCH', url: ignorePatch.url.replace(harness.base, ''), status: ignorePatch.status, request: ignorePatch.body },
292
+ engineStateAfterReload: {
293
+ productEndpoint: { A: productView.status, B: productB.status },
294
+ engineEndpoint: { A: engineA.status, B: engineB.status },
295
+ engineStateFile: { file: onDisk.file, exists: onDisk.exists, sha256: onDisk.sha256, A: diskA.status, B: diskB.status },
296
+ },
297
+ frozenSourceIgnored: { before: beforeA.source, after: afterA.source, comparison },
298
+ injectedAfterReload: injected.map(entry => entry.memoryId),
299
+ provenance: r3.provenance(),
300
+ scopeLabel: 'honest: the analysis step is the frozen P-MEMORY-01 stand-in analyzer, not a model; health gates only read the real page (banner absence + contrast visibility + page snapshot 200s), the driver never sets an availability flag',
301
+ });
302
+
303
+ if (harness.evidence) {
304
+ fs.mkdirSync(harness.evidence, { recursive: true });
305
+ fs.writeFileSync(path.join(harness.evidence, 'mem005-r4-healthy-persistence.json'), `${JSON.stringify(evidence, null, 2)}\n`, 'utf8');
306
+ }
307
+
308
+ console.log('parallel-memory-capture-r4-mem005-health-test PASS (on a provably healthy page — contrast candidate visible, offline banner absent, page snapshot 200s — the ignored candidate stays ignored across a real reload and never returns as candidate or confirmed, while the engine, its persisted state and the frozen source are unchanged)');
309
+ } finally {
310
+ await harness.cleanup();
311
+ }
312
+ }
313
+
314
+ main().catch(error => { console.error(error.stack || error.message); process.exitCode = 1; });