@seanhogg/builderforce-memory 2026.10.52 → 2026.10.54

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 (44) hide show
  1. package/dist/knowledge/backfillNoExtract.d.ts +2 -2
  2. package/dist/knowledge/backfillNoExtract.d.ts.map +1 -1
  3. package/dist/knowledge/backfillNoExtract.js +10 -7
  4. package/dist/knowledge/backfillNoExtract.js.map +1 -1
  5. package/dist/knowledge/extractFile.d.ts.map +1 -1
  6. package/dist/knowledge/extractFile.js +11 -4
  7. package/dist/knowledge/extractFile.js.map +1 -1
  8. package/dist/knowledge/extractJob.d.ts +11 -0
  9. package/dist/knowledge/extractJob.d.ts.map +1 -1
  10. package/dist/knowledge/extractJob.js +10 -0
  11. package/dist/knowledge/extractJob.js.map +1 -1
  12. package/dist/knowledge/index.d.ts +1 -1
  13. package/dist/knowledge/index.d.ts.map +1 -1
  14. package/dist/knowledge/index.js +1 -1
  15. package/dist/knowledge/index.js.map +1 -1
  16. package/dist/knowledge/owedFiles.d.ts +10 -1
  17. package/dist/knowledge/owedFiles.d.ts.map +1 -1
  18. package/dist/knowledge/owedFiles.js +12 -3
  19. package/dist/knowledge/owedFiles.js.map +1 -1
  20. package/dist/knowledge/review.d.ts.map +1 -1
  21. package/dist/knowledge/review.js +16 -10
  22. package/dist/knowledge/review.js.map +1 -1
  23. package/dist/knowledge/reviewFailure.d.ts +37 -0
  24. package/dist/knowledge/reviewFailure.d.ts.map +1 -0
  25. package/dist/knowledge/reviewFailure.js +37 -0
  26. package/dist/knowledge/reviewFailure.js.map +1 -0
  27. package/dist/knowledge/reviewPrefetch.d.ts +3 -2
  28. package/dist/knowledge/reviewPrefetch.d.ts.map +1 -1
  29. package/dist/knowledge/reviewPrefetch.js +7 -6
  30. package/dist/knowledge/reviewPrefetch.js.map +1 -1
  31. package/package.json +3 -3
  32. package/src/contract/exports.snapshot.json +1 -0
  33. package/src/contract/regression.recheck.test.ts +228 -0
  34. package/src/contract/regression.review.test.ts +1 -93
  35. package/src/contract/regression.store.test.ts +13 -0
  36. package/src/contract/types.contract.test.ts +2 -1
  37. package/src/knowledge/backfillNoExtract.ts +6 -4
  38. package/src/knowledge/extractFile.ts +6 -4
  39. package/src/knowledge/extractJob.ts +11 -0
  40. package/src/knowledge/index.ts +1 -1
  41. package/src/knowledge/owedFiles.ts +15 -3
  42. package/src/knowledge/review.ts +20 -8
  43. package/src/knowledge/reviewFailure.ts +51 -0
  44. package/src/knowledge/reviewPrefetch.ts +8 -7
@@ -0,0 +1,37 @@
1
+ /**
2
+ * knowledge/reviewFailure.ts — what a review does with a file whose read or extraction failed (the ONE failure path).
3
+ *
4
+ * A failure is TRANSIENT unless proven final (see {@link ExtractFailed}): a read, a timeout, a crashed or disposed worker, a failing store, a stop.
5
+ * A replica that holds the file back and asks about it needs an answer, but only a final one may be terminal (`[]` = nothing extracted):
6
+ *
7
+ * - final: the manifest's bytes are gone (the hash moved), or the parser/extractor threw on them. `[]` is stored under the manifest's hash
8
+ * and the request is settled — unless an unchanged planned file still carries that hash (its content is readable: do not hide it);
9
+ * - transient at the manifest's own bytes: the request is kept and the path is made OWED, so the next normal review retries it;
10
+ * after {@link MAX_TRANSIENT_FAILURES} in a row at the same hash it is treated as final, so a file that never reads cannot hold a root forever;
11
+ * - never anything when the run was stopped.
12
+ */
13
+ import type { KnowledgeStore } from './model.js';
14
+ import type { PlanDetail } from './plan.js';
15
+ import type { Prefetch } from './reviewPrefetch.js';
16
+ /** Consecutive transient failures at one hash after which the failure is recorded as final. */
17
+ export declare const MAX_TRANSIENT_FAILURES = 3;
18
+ export interface FailureContext {
19
+ store: KnowledgeStore;
20
+ detail: PlanDetail;
21
+ stopped: () => boolean;
22
+ /** Paths to record as owed (a transient failure at the manifest's own bytes). */
23
+ unreadable: Set<string>;
24
+ /** Consecutive transient failures by path (persisted beside the owed entry). */
25
+ failures: Map<string, {
26
+ hash: string;
27
+ count: number;
28
+ }>;
29
+ settledRecheck: (hash: string) => Promise<void>;
30
+ }
31
+ export declare function recordFailure(ctx: FailureContext, f: {
32
+ path: string;
33
+ hash: string;
34
+ }, job: Extract<Prefetch, {
35
+ kind: 'read-error' | 'failed';
36
+ }>): Promise<void>;
37
+ //# sourceMappingURL=reviewFailure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reviewFailure.d.ts","sourceRoot":"","sources":["../../src/knowledge/reviewFailure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,+FAA+F;AAC/F,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE,cAAc,CAAC;IACtB,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,MAAM,OAAO,CAAC;IACvB,iFAAiF;IACjF,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACxB,gFAAgF;IAChF,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvD,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD;AAED,wBAAsB,aAAa,CAAC,GAAG,EAAE,cAAc,EAAE,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,EAAE;IAAE,IAAI,EAAE,YAAY,GAAG,QAAQ,CAAA;CAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBpK"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * knowledge/reviewFailure.ts — what a review does with a file whose read or extraction failed (the ONE failure path).
3
+ *
4
+ * A failure is TRANSIENT unless proven final (see {@link ExtractFailed}): a read, a timeout, a crashed or disposed worker, a failing store, a stop.
5
+ * A replica that holds the file back and asks about it needs an answer, but only a final one may be terminal (`[]` = nothing extracted):
6
+ *
7
+ * - final: the manifest's bytes are gone (the hash moved), or the parser/extractor threw on them. `[]` is stored under the manifest's hash
8
+ * and the request is settled — unless an unchanged planned file still carries that hash (its content is readable: do not hide it);
9
+ * - transient at the manifest's own bytes: the request is kept and the path is made OWED, so the next normal review retries it;
10
+ * after {@link MAX_TRANSIENT_FAILURES} in a row at the same hash it is treated as final, so a file that never reads cannot hold a root forever;
11
+ * - never anything when the run was stopped.
12
+ */
13
+ import { putNoExtract } from './extractFile.js';
14
+ /** Consecutive transient failures at one hash after which the failure is recorded as final. */
15
+ export const MAX_TRANSIENT_FAILURES = 3;
16
+ export async function recordFailure(ctx, f, job) {
17
+ const known = ctx.detail.prior.get(f.path);
18
+ if (!known || ctx.stopped())
19
+ return;
20
+ const transient = job.kind === 'read-error' || job.transient === true;
21
+ if (known === f.hash && transient) {
22
+ const prev = ctx.failures.get(f.path);
23
+ const count = (prev?.hash === known ? prev.count : 0) + 1;
24
+ if (count < MAX_TRANSIENT_FAILURES) {
25
+ ctx.failures.set(f.path, { hash: known, count });
26
+ ctx.unreadable.add(f.path);
27
+ return;
28
+ }
29
+ }
30
+ ctx.failures.delete(f.path);
31
+ // An unchanged planned file that still carries `known` is readable content: a terminal `[]` would hide it.
32
+ if (ctx.detail.files.some((g) => g.path !== f.path && !g.changed && g.hash === known))
33
+ return;
34
+ await putNoExtract(ctx.store, known);
35
+ await ctx.settledRecheck(known);
36
+ }
37
+ //# sourceMappingURL=reviewFailure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reviewFailure.js","sourceRoot":"","sources":["../../src/knowledge/reviewFailure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG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AAI,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO;IAC9F,MAAM,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACrC,MAAM,GAAG,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC"}
@@ -11,6 +11,7 @@
11
11
  import type { SourceDocument } from '../ingest/types.js';
12
12
  import type { KnowledgePack, KnowledgeStore, NodeRef, ReviewArgs } from './model.js';
13
13
  import { type FileExtraction } from './extractFile.js';
14
+ import { CHANGED_SINCE_PLAN } from './extractJob.js';
14
15
  import { type ReviewStep } from './reviewRunModel.js';
15
16
  import { type ComposedPacks } from './sources.js';
16
17
  /** What the prefetch stage learned about one file. `failed` and `read-error` carry why. */
@@ -28,6 +29,7 @@ export type Prefetch = ({
28
29
  } | {
29
30
  kind: 'failed';
30
31
  reason: string;
32
+ transient?: true;
31
33
  }) & {
32
34
  ms: number;
33
35
  lane: number;
@@ -49,8 +51,7 @@ export interface PrefetchContext {
49
51
  }
50
52
  /** The extract step event of a settled job. */
51
53
  export declare function extractStepOf(path: string, job: Prefetch): ReviewStep;
52
- /** The failure reason of a file whose bytes no longer match the planned hash. */
53
- export declare const CHANGED_SINCE_PLAN = "changed since plan";
54
+ export { CHANGED_SINCE_PLAN };
54
55
  /** Per-job ceilings of the extract path (PRD 41 A10 rule 2). */
55
56
  export declare const DEFAULT_READ_TIMEOUT_MS = 5000;
56
57
  export declare const DEFAULT_EXTRACT_TIMEOUT_MS = 10000;
@@ -1 +1 @@
1
- {"version":3,"file":"reviewPrefetch.d.ts","sourceRoot":"","sources":["../../src/knowledge/reviewPrefetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,OAA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AAE,IAAI,CAAA;CAAE,CACzD,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAA;CAAE,CAAC;AAE3E,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,kFAAkF;IAClF,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IAChC,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,aAAa,CAAC;IACxB,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,kFAAkF;IAClF,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAKD,+CAA+C;AAC/C,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,UAAU,CASrE;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,gEAAgE;AAChE,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAC7C,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAEjD,wBAAgB,cAAc,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,QAAQ,CAAC,CA2D3G"}
@@ -9,7 +9,7 @@
9
9
  * holds one lane (0..width-1) and emits its `extract` step the moment it settles.
10
10
  */
11
11
  import { extractFileDetailed } from './extractFile.js';
12
- import { BinaryContent } from './extractJob.js';
12
+ import { BinaryContent, CHANGED_SINCE_PLAN, ExtractFailed } from './extractJob.js';
13
13
  import { judgesPack } from './reviewJudge.js';
14
14
  import { createDeadlines } from './jobDeadline.js';
15
15
  import { createModelLimiter } from './modelLimiter.js';
@@ -26,8 +26,7 @@ export function extractStepOf(path, job) {
26
26
  case 'extracted': return { ...base, outcome: job.extraction.cached ? 'cached' : 'ok' };
27
27
  }
28
28
  }
29
- /** The failure reason of a file whose bytes no longer match the planned hash. */
30
- export const CHANGED_SINCE_PLAN = 'changed since plan';
29
+ export { CHANGED_SINCE_PLAN };
31
30
  /** Per-job ceilings of the extract path (PRD 41 A10 rule 2). */
32
31
  export const DEFAULT_READ_TIMEOUT_MS = 5_000;
33
32
  export const DEFAULT_EXTRACT_TIMEOUT_MS = 10_000;
@@ -45,7 +44,7 @@ export function createPrefetch(c) {
45
44
  const run = async (f, parts, held) => {
46
45
  // A stopped run starts nothing: a job that has not begun settles at once. Once the read has begun the job finishes (its slot wait below is signal-free for a file already read).
47
46
  if (c.signal.aborted)
48
- return { kind: 'failed', reason: reasonOf(c.signal.reason) };
47
+ return { kind: 'failed', reason: reasonOf(c.signal.reason), transient: true };
49
48
  let doc;
50
49
  const t0 = Date.now();
51
50
  if (!byPool) {
@@ -81,13 +80,15 @@ export function createPrefetch(c) {
81
80
  // extract cache only for an 'extracted' job, so nothing is stored under the stale hash.
82
81
  const hashOf = c.args.source.hashOf;
83
82
  if (hashOf && doc && doc.content.kind === 'text' && hashOf(doc.content.text) !== f.hash)
84
- return { kind: 'failed', reason: CHANGED_SINCE_PLAN };
83
+ return { kind: 'failed', reason: CHANGED_SINCE_PLAN, transient: true };
85
84
  return { kind: 'extracted', ...(doc ? { doc } : {}), extraction };
86
85
  }
87
86
  catch (error) {
88
87
  if (error instanceof BinaryContent)
89
88
  return { kind: 'binary' };
90
- return { kind: 'failed', reason: reasonOf(error) };
89
+ // Transient UNLESS proven final: only the parser or extractor throwing on these bytes (ExtractFailed) is. A read, a timeout, a crashed or
90
+ // disposed worker, a failing store, a stop: all say nothing final about the file.
91
+ return { kind: 'failed', reason: reasonOf(error), ...(error instanceof ExtractFailed && !c.signal.aborted ? {} : { transient: true }) };
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C;IAEF,OAAO,KAAK,EAAE,CAAC,EAAE,EAAE;QACf,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACtB,MAAM,KAAK,GAAqC,EAAE,CAAC;QACnD,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACtC,MAAM,GAAG,GAAG,EAAE,GAAG,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAc,CAAC;QAChF,uKAAuK;QACvK,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC;YAAE,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;QAC9F,OAAO,GAAG,CAAC;IACf,CAAC,CAAC;AACN,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seanhogg/builderforce-memory",
3
- "version": "2026.10.52",
3
+ "version": "2026.10.54",
4
4
  "description": "BuilderForce Agent Memory — runtime layer. SSM execution, Transformer orchestration, online distillation, enterprise RAG (ingestion pipelines, vector-store adapters, tenant/ACL-scoped hybrid retrieval), multi-agent graph orchestration, LLM telemetry and cost accounting, persistent agent memory, and token-saving agent-run memory (code maps, a prompt-cache-safe working memory, chunked transcript windowing) for BuilderForce.ai agents.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -117,7 +117,7 @@
117
117
  },
118
118
  "homepage": "https://github.com/SeanHogg/builderforce-memory/tree/main/packages/memory#readme",
119
119
  "peerDependencies": {
120
- "@seanhogg/builderforce-memory-engine": "^2026.10.52"
120
+ "@seanhogg/builderforce-memory-engine": "^2026.10.54"
121
121
  },
122
122
  "devDependencies": {
123
123
  "@jest/globals": "^29.7.0",
@@ -131,7 +131,7 @@
131
131
  "ts-jest": "^29.2.0",
132
132
  "typescript": "npm:@typescript/typescript6@^6.0.2",
133
133
  "typescript-7": "npm:typescript@^7.0.2",
134
- "@seanhogg/builderforce-memory-engine": "2026.10.52"
134
+ "@seanhogg/builderforce-memory-engine": "2026.10.54"
135
135
  },
136
136
  "jest": {
137
137
  "preset": "ts-jest/presets/default-esm",
@@ -281,6 +281,7 @@
281
281
  "EXPAND_HOP_DECAY",
282
282
  "EXTERNAL_SERVICE_IDS",
283
283
  "EXTRACTOR_VERSION",
284
+ "ExtractFailed",
284
285
  "GOD_MODULE_KIND",
285
286
  "GOD_MODULE_LIMITS",
286
287
  "LocalSnapshotStore",
@@ -0,0 +1,228 @@
1
+ /**
2
+ * src/contract/regression.recheck.test.ts — the re-check channel between a replica and the review, each bug pinned by one test named
3
+ * `regression: <what broke>`: a replica that holds a file back asks the next review about its hash; the review answers only when the work is done.
4
+ */
5
+
6
+ import { hashText } from '../ingest/hash.js';
7
+ import { InMemoryIngestManifest } from '../ingest/IngestionPipeline.js';
8
+ import { ExtractFailed, type ExtractPool } from '../knowledge/extractJob.js';
9
+ import { DOCS_PACK } from '../knowledge/packs/docs.js';
10
+ import type { KnowledgePack } from '../knowledge/model.js';
11
+ import { reviewDirectory } from '../knowledge/review.js';
12
+ import { filesManifestKey, saveManifestMap } from '../knowledge/sources.js';
13
+ import { args, memSource, memStore, ROOT, stateOf, type SpySource } from '../knowledge/testkit.test-util.js';
14
+
15
+ describe('regression: a root reviewed before binary files were recorded is settled by its next review, without reading a file', () => {
16
+ const text = '# A\nalpha\n';
17
+
18
+ it('regression: a binary-by-extension file the manifest names, with no stored body, gets a stored [] and no file is read', async () => {
19
+ const source = memSource({ 'a.md': text, 'img.png': 'x' });
20
+ const manifest = new InMemoryIngestManifest();
21
+ await saveManifestMap(manifest, filesManifestKey(ROOT), new Map([['img.png', 'imghash']]));
22
+ const store = memStore();
23
+ await reviewDirectory(args(source, store, manifest));
24
+ expect(await store.getExtracted('imghash')).toEqual([]);
25
+ expect(source.reads).not.toContain('img.png');
26
+ });
27
+
28
+ it('regression: the review reads ONLY the files a replica asked to re-check: a NUL-binary gets [], a text file is extracted, the set is cleared', async () => {
29
+ const binary = 'bin\u0000ary';
30
+ const files = { 'blob.txt': binary, 'a.md': text, 'b.md': '# B\nbeta\n' };
31
+ const manifest = new InMemoryIngestManifest();
32
+ await reviewDirectory(args(memSource(files), memStore(), manifest));
33
+ const legacy = memStore(); // a root reviewed before: the manifest names the files, this store holds no bodies
34
+ await legacy.markRecheck([hashText(binary), hashText(text)]);
35
+
36
+ const source = memSource(files);
37
+ await reviewDirectory(args(source, legacy, manifest));
38
+ expect(new Set(source.reads)).toEqual(new Set(['blob.txt', 'a.md'])); // b.md was never named
39
+ expect(await legacy.getExtracted(hashText(binary))).toEqual([]);
40
+ expect((await legacy.getExtracted(hashText(text)))!.length).toBeGreaterThan(0);
41
+ expect(await legacy.getExtracted(hashText(files['b.md']))).toBeUndefined();
42
+ expect(await legacy.recheckHashes()).toEqual([]);
43
+
44
+ source.reads.length = 0;
45
+ await reviewDirectory(args(source, legacy, manifest)); // the set is empty now: nothing is read
46
+ expect(source.reads).toEqual([]);
47
+ });
48
+
49
+ it('regression: a re-checked hash only a SKIPPED manifest entry carries (here: ignored) is settled with [] and cleared, never left to loop', async () => {
50
+ const manifest = new InMemoryIngestManifest();
51
+ await saveManifestMap(manifest, filesManifestKey(ROOT), new Map([['skip.md', 'skiphash']]));
52
+ const legacy = memStore();
53
+ await legacy.markRecheck(['skiphash', 'gonehash']);
54
+ await reviewDirectory(args(memSource({ '.gitignore': 'skip.md\n', 'skip.md': '# S\nskipped\n', 'a.md': text }), legacy, manifest));
55
+ expect(await legacy.getExtracted('skiphash')).toEqual([]); // no review will ever extract an ignored file
56
+ expect(await legacy.getExtracted('gonehash')).toBeUndefined(); // carried by nothing: nothing to store
57
+ expect(await legacy.recheckHashes()).toEqual([]);
58
+ });
59
+
60
+ it('regression: a file whose read fails gets a terminal [] under the hash the manifest holds, so it is never held back forever (and a later read replaces it)', async () => {
61
+ const manifest = new InMemoryIngestManifest();
62
+ await saveManifestMap(manifest, filesManifestKey(ROOT), new Map([['locked.md', 'oldhash']]));
63
+ const store = memStore();
64
+ const inner = memSource({ 'locked.md': '# L\nlocked\n' });
65
+ const locked = { ...inner, read: async () => { throw new Error('EBUSY'); } };
66
+ const report = await reviewDirectory(args(locked as never, store, manifest));
67
+ expect(report.readErrors).toBe(1);
68
+ expect(await store.getExtracted('oldhash')).toEqual([]);
69
+ // The file becomes readable at a new hash: the real body is stored under it, and the terminal answer for the old hash stays harmless.
70
+ await reviewDirectory(args(inner, store, manifest));
71
+ expect((await store.getExtracted(hashText('# L\nlocked\n')))!.length).toBeGreaterThan(0);
72
+ });
73
+
74
+
75
+ /** A source whose `a.md` read is observed: `onRead(n)` runs on its n-th read and may throw. */
76
+ const watched = (onRead: (n: number) => void): SpySource => {
77
+ const inner = memSource({ 'a.md': text });
78
+ let n = 0;
79
+ return { ...inner, read: async (p: string) => { if (p === 'a.md') onRead(++n); return inner.read(p); } } as SpySource;
80
+ };
81
+ const legacyStore = async (manifest: InMemoryIngestManifest) => {
82
+ await reviewDirectory(args(memSource({ 'a.md': text }), memStore(), manifest));
83
+ const legacy = memStore(); // the manifest names a.md; this store holds no body for it
84
+ await legacy.markRecheck([hashText(text)]);
85
+ return legacy;
86
+ };
87
+
88
+ it('regression: a review stopped mid-way (after the backfill queued the file) keeps the re-check request and records no terminal [], and a complete one clears it', async () => {
89
+ const manifest = new InMemoryIngestManifest();
90
+ const legacy = await legacyStore(manifest);
91
+ const stop = new AbortController();
92
+ // Read 1 is the backfill's, read 2 is the review's: the run is stopped there and the read rejects.
93
+ const source = watched((n) => { if (n === 2) { stop.abort(); throw new Error('aborted'); } });
94
+ await reviewDirectory(args(source, legacy, manifest, { signal: stop.signal })).catch(() => undefined);
95
+ expect(await legacy.recheckHashes()).toEqual([hashText(text)]);
96
+ expect(await legacy.getExtracted(hashText(text))).toBeUndefined();
97
+ await reviewDirectory(args(memSource({ 'a.md': text }), legacy, manifest));
98
+ expect(await legacy.recheckHashes()).toEqual([]);
99
+ expect((await legacy.getExtracted(hashText(text)))!.length).toBeGreaterThan(0);
100
+ });
101
+
102
+ it('regression: a read error at the manifest\'s own bytes keeps the request and makes the file owed; the next review stores the body', async () => {
103
+ const manifest = new InMemoryIngestManifest();
104
+ const legacy = await legacyStore(manifest);
105
+ const report = await reviewDirectory(args(watched(() => { throw new Error('EBUSY'); }), legacy, manifest));
106
+ expect(report.readErrors).toBe(1);
107
+ expect(await legacy.getExtracted(hashText(text))).toBeUndefined(); // not a terminal answer: the bytes may be readable next time
108
+ expect(await legacy.recheckHashes()).toEqual([hashText(text)]);
109
+ expect((await stateOf(manifest)).owed).toContain('a.md');
110
+ await reviewDirectory(args(memSource({ 'a.md': text }), legacy, manifest)); // a normal review: it is owed, so it is retried
111
+ expect((await legacy.getExtracted(hashText(text)))!.length).toBeGreaterThan(0);
112
+ expect(await legacy.recheckHashes()).toEqual([]);
113
+ expect((await stateOf(manifest)).owed).toEqual([]);
114
+ });
115
+
116
+ it('regression: a PROVEN-final extraction failure (the parser threw) at the same bytes gets a terminal [] and settles the request', async () => {
117
+ const manifest = new InMemoryIngestManifest();
118
+ const legacy = await legacyStore(manifest);
119
+ const exploding: ExtractPool = async () => { throw new ExtractFailed('parser exploded'); }; // proven final: the parser itself threw
120
+ const report = await reviewDirectory(args(memSource({ 'a.md': text }), legacy, manifest, { extractPool: exploding, deferRead: true }));
121
+ expect(report.extractErrors).toBe(1);
122
+ expect(await legacy.getExtracted(hashText(text))).toEqual([]);
123
+ expect(await legacy.recheckHashes()).toEqual([]);
124
+ });
125
+
126
+ it('regression: the body is stored BEFORE the request is cleared (a store that observes the put still sees the request)', async () => {
127
+ const manifest = new InMemoryIngestManifest();
128
+ const legacy = await legacyStore(manifest);
129
+ let sawRequest: boolean | undefined;
130
+ const put = legacy.putExtracted.bind(legacy);
131
+ legacy.putExtracted = async (h, e) => { sawRequest ??= await legacy.hasRecheck(h); await put(h, e); };
132
+ await reviewDirectory(args(memSource({ 'a.md': text }), legacy, manifest));
133
+ expect(sawRequest).toBe(true);
134
+ expect(await legacy.recheckHashes()).toEqual([]);
135
+ });
136
+
137
+
138
+ /** The request is kept, the file is owed, and nothing terminal is stored: the failure said nothing final about the file. */
139
+ const expectTransient = async (legacy: ReturnType<typeof memStore>, manifest: InMemoryIngestManifest): Promise<void> => {
140
+ expect(await legacy.getExtracted(hashText(text))).toBeUndefined();
141
+ expect(await legacy.recheckHashes()).toEqual([hashText(text)]);
142
+ expect((await stateOf(manifest)).owed).toContain('a.md');
143
+ };
144
+
145
+ it('regression: a deferRead pool whose read fails (EBUSY) at the manifest\'s bytes is transient, not a terminal []', async () => {
146
+ const manifest = new InMemoryIngestManifest();
147
+ const legacy = await legacyStore(manifest);
148
+ const busy: ExtractPool = async () => { throw new Error('EBUSY: resource busy or locked'); };
149
+ const report = await reviewDirectory(args(memSource({ 'a.md': text }), legacy, manifest, { extractPool: busy, deferRead: true }));
150
+ expect(report.extractErrors).toBe(1);
151
+ await expectTransient(legacy, manifest);
152
+ });
153
+
154
+ it('regression: a pool that times out (plain Error "timeout") is transient', async () => {
155
+ const manifest = new InMemoryIngestManifest();
156
+ const legacy = await legacyStore(manifest);
157
+ const stuck: ExtractPool = async () => { throw new Error('timeout'); };
158
+ await reviewDirectory(args(memSource({ 'a.md': text }), legacy, manifest, { extractPool: stuck, deferRead: true }));
159
+ await expectTransient(legacy, manifest);
160
+ });
161
+
162
+ it('regression: an in-thread read that does not match the planned hash (changed since plan) at the same hash is transient', async () => {
163
+ const manifest = new InMemoryIngestManifest();
164
+ const legacy = await legacyStore(manifest);
165
+ const drifting = { ...memSource({ 'a.md': text }), hashOf: () => 'some-other-hash' } as SpySource;
166
+ const report = await reviewDirectory(args(drifting, legacy, manifest));
167
+ expect(report.failures).toEqual([{ path: 'a.md', phase: 'extract', reason: 'changed since plan' }]);
168
+ await expectTransient(legacy, manifest);
169
+ });
170
+
171
+ it('regression: an extraction past its ceiling (a slow pool under a tiny extractMs) is transient', async () => {
172
+ const manifest = new InMemoryIngestManifest();
173
+ const legacy = await legacyStore(manifest);
174
+ const slow: ExtractPool = () => new Promise(() => undefined);
175
+ await reviewDirectory(args(memSource({ 'a.md': text }), legacy, manifest, { extractPool: slow, deferRead: true, timeouts: { extractMs: 5 } }));
176
+ await expectTransient(legacy, manifest);
177
+ });
178
+
179
+ it('regression: the third transient failure in a row at the same hash is recorded as final', async () => {
180
+ const manifest = new InMemoryIngestManifest();
181
+ const legacy = await legacyStore(manifest);
182
+ const busy: ExtractPool = async () => { throw new Error('EBUSY'); };
183
+ const run = () => reviewDirectory(args(memSource({ 'a.md': text }), legacy, manifest, { extractPool: busy, deferRead: true }));
184
+ await run();
185
+ await run();
186
+ await expectTransient(legacy, manifest); // two in a row: still asked for
187
+ await run();
188
+ expect(await legacy.getExtracted(hashText(text))).toEqual([]); // the third: final
189
+ expect(await legacy.recheckHashes()).toEqual([]);
190
+ });
191
+
192
+ it('regression: a forced review whose read fails keeps the request (the backfill does not clear a changed file\'s hash)', async () => {
193
+ const manifest = new InMemoryIngestManifest();
194
+ const legacy = await legacyStore(manifest);
195
+ const failing = { ...memSource({ 'a.md': text }), read: async () => { throw new Error('EBUSY'); } } as SpySource;
196
+ await reviewDirectory(args(failing, legacy, manifest, { force: true }));
197
+ expect(await legacy.recheckHashes()).toEqual([hashText(text)]);
198
+ });
199
+
200
+ it('regression: a file the packs accept at plan time but not once read (job "none") is recorded as nothing-to-extract and its request is answered', async () => {
201
+ const picky: KnowledgePack = { ...DOCS_PACK, parsers: [{ ...DOCS_PACK.parsers[0]!, accepts: (s) => s.content.kind === 'text' && s.content.text === '' }] };
202
+ const manifest = new InMemoryIngestManifest();
203
+ await reviewDirectory(args(memSource({ 'a.md': text }), memStore(), manifest, { packs: [picky] }));
204
+ const legacy = memStore();
205
+ await legacy.markRecheck([hashText(text)]);
206
+ await reviewDirectory(args(memSource({ 'a.md': text }), legacy, manifest, { packs: [picky], force: true }));
207
+ expect(await legacy.getExtracted(hashText(text))).toEqual([]);
208
+ expect(await legacy.recheckHashes()).toEqual([]);
209
+ });
210
+
211
+ it('regression: an unchanged text file with no stored body is NOT given [] (it is "not extracted yet")', async () => {
212
+ const manifest = new InMemoryIngestManifest();
213
+ await reviewDirectory(args(memSource({ 'a.md': text }), memStore(), manifest));
214
+ const legacy = memStore();
215
+ await reviewDirectory(args(memSource({ 'a.md': text }), legacy, manifest));
216
+ expect(await legacy.getExtracted(hashText(text))).toBeUndefined();
217
+ });
218
+
219
+ it('regression: a healthy root performs no extra reads on an incremental review', async () => {
220
+ const source = memSource({ 'a.md': text, 'blob.txt': 'bin\u0000ary' });
221
+ const manifest = new InMemoryIngestManifest();
222
+ const store = memStore();
223
+ await reviewDirectory(args(source, store, manifest));
224
+ source.reads.length = 0;
225
+ await reviewDirectory(args(source, store, manifest));
226
+ expect(source.reads).toEqual([]);
227
+ });
228
+ });
@@ -15,7 +15,7 @@ import { planReview } from '../knowledge/plan.js';
15
15
  import { srcRef } from '../knowledge/refs.js';
16
16
  import { reviewDirectory } from '../knowledge/review.js';
17
17
  import { applyRunEvent, failuresOf, failureTotal, REVIEW_RUN_FAILURE_CHUNK, startRun } from '../knowledge/reviewRun.js';
18
- import { extractorManifestKey, filesManifestKey, judgedManifestKey, manifestMap, saveManifestMap } from '../knowledge/sources.js';
18
+ import { extractorManifestKey, filesManifestKey, judgedManifestKey, manifestMap } from '../knowledge/sources.js';
19
19
  import {
20
20
  ALL, args, fakeJudge, FILES, memSource, memStore, quietPack, ROOT, stateOf, type SpySource,
21
21
  } from '../knowledge/testkit.test-util.js';
@@ -262,95 +262,3 @@ describe('regression: a file with nothing to extract is told apart from one not
262
262
  expect(await store.getExtracted(hashText(text))).toEqual(before);
263
263
  });
264
264
  });
265
-
266
- describe('regression: a root reviewed before binary files were recorded is settled by its next review, without reading a file', () => {
267
- const text = '# A\nalpha\n';
268
-
269
- it('regression: a binary-by-extension file the manifest names, with no stored body, gets a stored [] and no file is read', async () => {
270
- const source = memSource({ 'a.md': text, 'img.png': 'x' });
271
- const manifest = new InMemoryIngestManifest();
272
- await saveManifestMap(manifest, filesManifestKey(ROOT), new Map([['img.png', 'imghash']]));
273
- const store = memStore();
274
- await reviewDirectory(args(source, store, manifest));
275
- expect(await store.getExtracted('imghash')).toEqual([]);
276
- expect(source.reads).not.toContain('img.png');
277
- });
278
-
279
- it('regression: the review reads ONLY the files a replica asked to re-check: a NUL-binary gets [], a text file is extracted, the set is cleared', async () => {
280
- const binary = 'bin\u0000ary';
281
- const files = { 'blob.txt': binary, 'a.md': text, 'b.md': '# B\nbeta\n' };
282
- const manifest = new InMemoryIngestManifest();
283
- await reviewDirectory(args(memSource(files), memStore(), manifest));
284
- const legacy = memStore(); // a root reviewed before: the manifest names the files, this store holds no bodies
285
- await legacy.markRecheck([hashText(binary), hashText(text)]);
286
-
287
- const source = memSource(files);
288
- await reviewDirectory(args(source, legacy, manifest));
289
- expect(new Set(source.reads)).toEqual(new Set(['blob.txt', 'a.md'])); // b.md was never named
290
- expect(await legacy.getExtracted(hashText(binary))).toEqual([]);
291
- expect((await legacy.getExtracted(hashText(text)))!.length).toBeGreaterThan(0);
292
- expect(await legacy.getExtracted(hashText(files['b.md']))).toBeUndefined();
293
- expect(await legacy.recheckHashes()).toEqual([]);
294
-
295
- source.reads.length = 0;
296
- await reviewDirectory(args(source, legacy, manifest)); // the set is empty now: nothing is read
297
- expect(source.reads).toEqual([]);
298
- });
299
-
300
- it('regression: a re-checked hash only a SKIPPED manifest entry carries (here: ignored) is settled with [] and cleared, never left to loop', async () => {
301
- const manifest = new InMemoryIngestManifest();
302
- await saveManifestMap(manifest, filesManifestKey(ROOT), new Map([['skip.md', 'skiphash']]));
303
- const legacy = memStore();
304
- await legacy.markRecheck(['skiphash', 'gonehash']);
305
- await reviewDirectory(args(memSource({ '.gitignore': 'skip.md\n', 'skip.md': '# S\nskipped\n', 'a.md': text }), legacy, manifest));
306
- expect(await legacy.getExtracted('skiphash')).toEqual([]); // no review will ever extract an ignored file
307
- expect(await legacy.getExtracted('gonehash')).toBeUndefined(); // carried by nothing: nothing to store
308
- expect(await legacy.recheckHashes()).toEqual([]);
309
- });
310
-
311
- it('regression: a file whose read fails gets a terminal [] under the hash the manifest holds, so it is never held back forever (and a later read replaces it)', async () => {
312
- const manifest = new InMemoryIngestManifest();
313
- await saveManifestMap(manifest, filesManifestKey(ROOT), new Map([['locked.md', 'oldhash']]));
314
- const store = memStore();
315
- const inner = memSource({ 'locked.md': '# L\nlocked\n' });
316
- const locked = { ...inner, read: async () => { throw new Error('EBUSY'); } };
317
- const report = await reviewDirectory(args(locked as never, store, manifest));
318
- expect(report.readErrors).toBe(1);
319
- expect(await store.getExtracted('oldhash')).toEqual([]);
320
- // The file becomes readable at a new hash: the real body is stored under it, and the terminal answer for the old hash stays harmless.
321
- await reviewDirectory(args(inner, store, manifest));
322
- expect((await store.getExtracted(hashText('# L\nlocked\n')))!.length).toBeGreaterThan(0);
323
- });
324
-
325
- it('regression: a review that is aborted before it did the work keeps the re-check request, and one that completes it clears it', async () => {
326
- const manifest = new InMemoryIngestManifest();
327
- await reviewDirectory(args(memSource({ 'a.md': text }), memStore(), manifest));
328
- const legacy = memStore();
329
- await legacy.markRecheck([hashText(text)]);
330
- const stop = new AbortController();
331
- stop.abort();
332
- await reviewDirectory(args(memSource({ 'a.md': text }), legacy, manifest, { signal: stop.signal })).catch(() => undefined);
333
- expect(await legacy.recheckHashes()).toEqual([hashText(text)]);
334
- await reviewDirectory(args(memSource({ 'a.md': text }), legacy, manifest));
335
- expect(await legacy.recheckHashes()).toEqual([]);
336
- expect((await legacy.getExtracted(hashText(text)))!.length).toBeGreaterThan(0);
337
- });
338
-
339
- it('regression: an unchanged text file with no stored body is NOT given [] (it is "not extracted yet")', async () => {
340
- const manifest = new InMemoryIngestManifest();
341
- await reviewDirectory(args(memSource({ 'a.md': text }), memStore(), manifest));
342
- const legacy = memStore();
343
- await reviewDirectory(args(memSource({ 'a.md': text }), legacy, manifest));
344
- expect(await legacy.getExtracted(hashText(text))).toBeUndefined();
345
- });
346
-
347
- it('regression: a healthy root performs no extra reads on an incremental review', async () => {
348
- const source = memSource({ 'a.md': text, 'blob.txt': 'bin\u0000ary' });
349
- const manifest = new InMemoryIngestManifest();
350
- const store = memStore();
351
- await reviewDirectory(args(source, store, manifest));
352
- source.reads.length = 0;
353
- await reviewDirectory(args(source, store, manifest));
354
- expect(source.reads).toEqual([]);
355
- });
356
- });
@@ -94,4 +94,17 @@ describe('regression: re-check channel', () => {
94
94
  await again.clearRecheck(['b']);
95
95
  expect(JSON.parse(snap.value!).recheck).toBeUndefined();
96
96
  });
97
+
98
+ it('regression: hasRecheck answers membership, survives a reload, and is false after the hash is cleared', async () => {
99
+ const snap = memPersistence();
100
+ const store = new LocalSnapshotStore(snap);
101
+ expect(await store.hasRecheck('a')).toBe(false);
102
+ await store.markRecheck(['a']);
103
+ expect(await store.hasRecheck('a')).toBe(true);
104
+ expect(await store.hasRecheck('b')).toBe(false);
105
+ expect(await new LocalSnapshotStore(snap).hasRecheck('a')).toBe(true); // persisted
106
+ await store.clearRecheck(['a']);
107
+ expect(await store.hasRecheck('a')).toBe(false);
108
+ expect(await new LocalSnapshotStore(snap).hasRecheck('a')).toBe(false);
109
+ });
97
110
  });
@@ -17,7 +17,7 @@ import type {
17
17
  OutlineFile, ReviewFailure, ReviewFailureChunks, ReviewPhase, ReviewReport, ReviewRun, ReviewRunPhase, ReviewStep, ScopeRecord,
18
18
  StoredFact, StoredRelation, ExtractedLogPersistence, KnowledgeSnapshot, LocalSnapshotStoreOptions, SnapshotPersistence,
19
19
  } from '../knowledge/index.js';
20
- import { failuresOf, failureTotal, LocalSnapshotStore, localSnapshotStore } from '../knowledge/index.js';
20
+ import { ExtractFailed, failuresOf, failureTotal, LocalSnapshotStore, localSnapshotStore } from '../knowledge/index.js';
21
21
 
22
22
  type Equal<A, B> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? true : false;
23
23
  type Expect<T extends true> = T;
@@ -89,6 +89,7 @@ export const jobWithNeither: ExtractJob = { ...base };
89
89
  export type ExtractJob_readByPool_shape = Expect<Equal<NonNullable<Extract<ExtractJob, { readByPool: unknown }>['readByPool']>, { path: string; hash: string }>>;
90
90
  export const resultShape = { binary: true, extracted: [anExtract], sections: someSections } satisfies ExtractJobResult;
91
91
  export type ExtractJobResult_fields = Expect<Equal<ExtractJobResult, { binary?: true; extracted: Extracted[]; sections?: ParsedSection[] }>>;
92
+ // ExtractFailed: the marker of a PROVEN-final extraction failure (the parser or extractor threw); every other failure is transient.export type ExtractFailed_is_an_Error = Expect<Equal<InstanceType<typeof ExtractFailed> extends Error ? true : false, true>>;export type ExtractFailed_constructor = Expect<Equal<ConstructorParameters<typeof ExtractFailed>, [message: string, options?: { cause?: unknown }]>>;
92
93
 
93
94
  /* ── KnowledgeStore: the port hosts implement ──────────────────────────────────────────────────────────────── */
94
95
  export type KnowledgeStore_methods = Expect<Equal<