@seanhogg/builderforce-memory 2026.10.68 → 2026.10.70

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 (77) hide show
  1. package/dist/knowledge/build.d.ts.map +1 -1
  2. package/dist/knowledge/build.js +7 -2
  3. package/dist/knowledge/build.js.map +1 -1
  4. package/dist/knowledge/comparability.d.ts +3 -1
  5. package/dist/knowledge/comparability.d.ts.map +1 -1
  6. package/dist/knowledge/comparability.js +2 -1
  7. package/dist/knowledge/comparability.js.map +1 -1
  8. package/dist/knowledge/index.d.ts +3 -2
  9. package/dist/knowledge/index.d.ts.map +1 -1
  10. package/dist/knowledge/index.js +2 -1
  11. package/dist/knowledge/index.js.map +1 -1
  12. package/dist/knowledge/model.d.ts +17 -1
  13. package/dist/knowledge/model.d.ts.map +1 -1
  14. package/dist/knowledge/pack/encode.d.ts +2 -1
  15. package/dist/knowledge/pack/encode.d.ts.map +1 -1
  16. package/dist/knowledge/pack/encode.js +2 -1
  17. package/dist/knowledge/pack/encode.js.map +1 -1
  18. package/dist/knowledge/pack/extrDiff.d.ts.map +1 -1
  19. package/dist/knowledge/pack/extrDiff.js +4 -1
  20. package/dist/knowledge/pack/extrDiff.js.map +1 -1
  21. package/dist/knowledge/pack/sections/columns.d.ts +15 -2
  22. package/dist/knowledge/pack/sections/columns.d.ts.map +1 -1
  23. package/dist/knowledge/pack/sections/columns.js +16 -1
  24. package/dist/knowledge/pack/sections/columns.js.map +1 -1
  25. package/dist/knowledge/pack/sections/extrLists.js +2 -2
  26. package/dist/knowledge/pack/sections/extrLists.js.map +1 -1
  27. package/dist/knowledge/pack/sections/facts.d.ts.map +1 -1
  28. package/dist/knowledge/pack/sections/facts.js +2 -2
  29. package/dist/knowledge/pack/sections/facts.js.map +1 -1
  30. package/dist/knowledge/pack/sections/index.d.ts +1 -0
  31. package/dist/knowledge/pack/sections/index.d.ts.map +1 -1
  32. package/dist/knowledge/pack/sections/index.js +3 -1
  33. package/dist/knowledge/pack/sections/index.js.map +1 -1
  34. package/dist/knowledge/pack/sections/rows.d.ts +1 -0
  35. package/dist/knowledge/pack/sections/rows.d.ts.map +1 -1
  36. package/dist/knowledge/pack/sections/rows.js +1 -1
  37. package/dist/knowledge/pack/sections/rows.js.map +1 -1
  38. package/dist/knowledge/pack/sections/sites.d.ts +24 -0
  39. package/dist/knowledge/pack/sections/sites.d.ts.map +1 -0
  40. package/dist/knowledge/pack/sections/sites.js +96 -0
  41. package/dist/knowledge/pack/sections/sites.js.map +1 -0
  42. package/dist/knowledge/pack/types.d.ts +2 -2
  43. package/dist/knowledge/pack/types.d.ts.map +1 -1
  44. package/dist/knowledge/sources.d.ts +1 -1
  45. package/dist/knowledge/sources.d.ts.map +1 -1
  46. package/dist/knowledge/sources.js +2 -1
  47. package/dist/knowledge/sources.js.map +1 -1
  48. package/dist/knowledge/symbolEdges.d.ts +39 -0
  49. package/dist/knowledge/symbolEdges.d.ts.map +1 -0
  50. package/dist/knowledge/symbolEdges.js +71 -0
  51. package/dist/knowledge/symbolEdges.js.map +1 -0
  52. package/dist/knowledge/truncate.d.ts.map +1 -1
  53. package/dist/knowledge/truncate.js +4 -0
  54. package/dist/knowledge/truncate.js.map +1 -1
  55. package/package.json +1 -1
  56. package/src/contract/exports.snapshot.json +7 -0
  57. package/src/contract/regression.analysisTruncated.test.ts +32 -0
  58. package/src/contract/regression.symbolEdges.test.ts +323 -0
  59. package/src/contract/symbolEdges.golden.json +345 -0
  60. package/src/contract/types.contract.test.ts +15 -2
  61. package/src/knowledge/build.ts +7 -2
  62. package/src/knowledge/comparability.analysis.test.ts +16 -1
  63. package/src/knowledge/comparability.ts +4 -1
  64. package/src/knowledge/index.ts +6 -2
  65. package/src/knowledge/model.ts +18 -1
  66. package/src/knowledge/pack/encode.ts +2 -1
  67. package/src/knowledge/pack/extrDiff.ts +4 -1
  68. package/src/knowledge/pack/sections/columns.ts +16 -1
  69. package/src/knowledge/pack/sections/extrLists.ts +2 -2
  70. package/src/knowledge/pack/sections/facts.ts +2 -2
  71. package/src/knowledge/pack/sections/index.ts +3 -1
  72. package/src/knowledge/pack/sections/rows.ts +1 -1
  73. package/src/knowledge/pack/sections/sites.ts +87 -0
  74. package/src/knowledge/pack/types.ts +2 -2
  75. package/src/knowledge/sources.ts +2 -1
  76. package/src/knowledge/symbolEdges.ts +72 -0
  77. package/src/knowledge/truncate.ts +3 -1
@@ -0,0 +1,345 @@
1
+ {
2
+ "//": "Generated with @seanhogg/builderforce-memory@2026.10.68 (aliased memory-prev) by the P0b compat script; never edit by hand.",
3
+ "prevVersion": "2026.10.68",
4
+ "prevPackHex": "42464b50010001720300000000000000000000000000000000000000000000000000000000000000000145080004612e7473000563616c6c7301036f6465000c666163743a636c61696d3a3100087372632f612e74730404622e7473030c3a723a3a7372632f612e74730b04622e747302430200aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb030702040100017850042b0100000106000104010c01040281897a00800200030c0000070707010b0001040404000000000000010c0006070106030a0400007cdb87bb",
5
+ "prevPackDecodedByPrev": {
6
+ "rootId": "r",
7
+ "baseGeneration": 3,
8
+ "targetDigest": "0000000000000000000000000000000000000000000000000000000000000000",
9
+ "files": [
10
+ {
11
+ "path": "src/a.ts",
12
+ "hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
13
+ "bytes": 120
14
+ },
15
+ {
16
+ "path": "src/b.ts",
17
+ "hash": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
18
+ "bytes": 80
19
+ }
20
+ ],
21
+ "extracted": [
22
+ {
23
+ "kind": "full",
24
+ "hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
25
+ "entries": [
26
+ {
27
+ "sourceRef": "src:r::src/a.ts",
28
+ "sourceHash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
29
+ "extractorVersion": 4,
30
+ "nodes": [
31
+ {
32
+ "ref": "src:r::src/a.ts",
33
+ "kind": "file",
34
+ "label": "src/a.ts",
35
+ "pack": "code",
36
+ "importance": 0.5,
37
+ "origin": "extracted",
38
+ "sourceHash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
39
+ }
40
+ ],
41
+ "edges": [
42
+ {
43
+ "from": "src:r::src/a.ts",
44
+ "to": "src:r::src/b.ts",
45
+ "kind": "references",
46
+ "weight": 1,
47
+ "origin": "extracted"
48
+ },
49
+ {
50
+ "from": "src:r::src/a.ts",
51
+ "to": "src:r::src/b.ts",
52
+ "kind": "co-changed",
53
+ "weight": 1,
54
+ "origin": "extracted"
55
+ },
56
+ {
57
+ "from": "src:r::src/a.ts",
58
+ "to": "src:r::src/b.ts",
59
+ "kind": "calls",
60
+ "weight": 1,
61
+ "origin": "extracted"
62
+ }
63
+ ],
64
+ "keys": [
65
+ {
66
+ "ref": "src:r::src/a.ts",
67
+ "key": "a.ts"
68
+ }
69
+ ]
70
+ }
71
+ ]
72
+ }
73
+ ],
74
+ "relations": [
75
+ {
76
+ "from": "src:r::src/a.ts",
77
+ "to": "fact:claim:1",
78
+ "kind": "about",
79
+ "weight": 1,
80
+ "origin": "model"
81
+ }
82
+ ]
83
+ },
84
+ "newPack": {
85
+ "rootId": "r",
86
+ "baseGeneration": 4,
87
+ "targetDigest": "0000000000000000000000000000000000000000000000000000000000000000",
88
+ "extracted": [
89
+ {
90
+ "kind": "full",
91
+ "hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
92
+ "entries": [
93
+ {
94
+ "sourceRef": "src:r::src/a.ts",
95
+ "sourceHash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
96
+ "extractorVersion": 5,
97
+ "nodes": [
98
+ {
99
+ "ref": "src:r::src/a.ts",
100
+ "kind": "file",
101
+ "label": "src/a.ts",
102
+ "pack": "code",
103
+ "importance": 0.5,
104
+ "origin": "extracted",
105
+ "sourceHash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
106
+ }
107
+ ],
108
+ "edges": [
109
+ {
110
+ "from": "src:r::src/a.ts#A@1",
111
+ "to": "src:r::src/b.ts#B@1",
112
+ "kind": "extends",
113
+ "weight": 1,
114
+ "origin": "extracted"
115
+ },
116
+ {
117
+ "from": "src:r::src/a.ts#A@1",
118
+ "to": "src:r::src/b.ts#I@9",
119
+ "kind": "implements",
120
+ "weight": 1,
121
+ "origin": "extracted"
122
+ },
123
+ {
124
+ "from": "src:r::src/a.ts#A@1",
125
+ "to": "src:r::src/b.ts#B@1",
126
+ "kind": "composes",
127
+ "weight": 1,
128
+ "origin": "extracted"
129
+ },
130
+ {
131
+ "from": "src:r::src/a.ts#A.run@3",
132
+ "to": "src:r::src/b.ts#Row@20",
133
+ "kind": "uses",
134
+ "weight": 1,
135
+ "origin": "extracted"
136
+ },
137
+ {
138
+ "from": "src:r::src/a.ts#A.run@3",
139
+ "to": "src:r::src/b.ts#B.get@2",
140
+ "kind": "calls",
141
+ "weight": 1,
142
+ "origin": "extracted",
143
+ "sites": [
144
+ {
145
+ "path": "src/a.ts",
146
+ "line": 4,
147
+ "column": 5,
148
+ "order": 0
149
+ }
150
+ ]
151
+ }
152
+ ],
153
+ "keys": []
154
+ }
155
+ ]
156
+ },
157
+ {
158
+ "kind": "diff",
159
+ "hash": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
160
+ "prior": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
161
+ "entries": [
162
+ {
163
+ "sourceRef": "src:r::src/a.ts",
164
+ "sourceHash": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
165
+ "extractorVersion": 5,
166
+ "nodes": {
167
+ "remove": [
168
+ "src:r::src/a.ts"
169
+ ],
170
+ "add": [
171
+ {
172
+ "at": 0,
173
+ "item": {
174
+ "ref": "src:r::src/a.ts",
175
+ "kind": "file",
176
+ "label": "src/a.ts",
177
+ "pack": "code",
178
+ "importance": 0.5,
179
+ "origin": "extracted",
180
+ "sourceHash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
181
+ }
182
+ }
183
+ ]
184
+ },
185
+ "edges": {
186
+ "remove": [
187
+ "src:r::src/a.ts#A.run@3\u0000src:r::src/b.ts#B.get@2\u0000calls"
188
+ ],
189
+ "add": [
190
+ {
191
+ "at": 4,
192
+ "item": {
193
+ "from": "src:r::src/a.ts#A.run@3",
194
+ "to": "src:r::src/b.ts#B.get@2",
195
+ "kind": "calls",
196
+ "weight": 1,
197
+ "origin": "extracted",
198
+ "sites": [
199
+ {
200
+ "path": "src/a.ts",
201
+ "line": 4,
202
+ "column": 5,
203
+ "order": 0
204
+ },
205
+ {
206
+ "path": "src/a.ts",
207
+ "line": 6,
208
+ "column": 9,
209
+ "order": 2
210
+ }
211
+ ]
212
+ }
213
+ }
214
+ ]
215
+ },
216
+ "keys": {
217
+ "remove": [],
218
+ "add": []
219
+ }
220
+ }
221
+ ]
222
+ }
223
+ ]
224
+ },
225
+ "newPackHex": "42464b50010001720400000000000000000000000000000000000000000000000000000000000000000195010f000563616c6c7301036f646502066d706f7365730007657874656e6473000a696d706c656d656e747300087372632f612e7473030c3a723a3a7372632f612e74730f0823412e72756e4033171e007372633a723a3a7372632f622e747323422e67657440320063616c6c73110240310b0c622e747323422e67657440321102403110034940391006526f7740323000047573657302430200aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb04600200000106000105010c01050181897a008002000512000003000b0c0b0d0a000300040002000e000004040404040000000000000000000000010100010601010501060100010c01050181897a0080020001080104010e0a00000400000000000d150200000401050405000100000205040500050609025ab5ca20",
226
+ "newPackDecodedByPrev": {
227
+ "rootId": "r",
228
+ "baseGeneration": 4,
229
+ "targetDigest": "0000000000000000000000000000000000000000000000000000000000000000",
230
+ "extracted": [
231
+ {
232
+ "kind": "full",
233
+ "hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
234
+ "entries": [
235
+ {
236
+ "sourceRef": "src:r::src/a.ts",
237
+ "sourceHash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
238
+ "extractorVersion": 5,
239
+ "nodes": [
240
+ {
241
+ "ref": "src:r::src/a.ts",
242
+ "kind": "file",
243
+ "label": "src/a.ts",
244
+ "pack": "code",
245
+ "importance": 0.5,
246
+ "origin": "extracted",
247
+ "sourceHash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
248
+ }
249
+ ],
250
+ "edges": [
251
+ {
252
+ "from": "src:r::src/a.ts#A@1",
253
+ "to": "src:r::src/b.ts#B@1",
254
+ "kind": "extends",
255
+ "weight": 1,
256
+ "origin": "extracted"
257
+ },
258
+ {
259
+ "from": "src:r::src/a.ts#A@1",
260
+ "to": "src:r::src/b.ts#I@9",
261
+ "kind": "implements",
262
+ "weight": 1,
263
+ "origin": "extracted"
264
+ },
265
+ {
266
+ "from": "src:r::src/a.ts#A@1",
267
+ "to": "src:r::src/b.ts#B@1",
268
+ "kind": "composes",
269
+ "weight": 1,
270
+ "origin": "extracted"
271
+ },
272
+ {
273
+ "from": "src:r::src/a.ts#A.run@3",
274
+ "to": "src:r::src/b.ts#Row@20",
275
+ "kind": "uses",
276
+ "weight": 1,
277
+ "origin": "extracted"
278
+ },
279
+ {
280
+ "from": "src:r::src/a.ts#A.run@3",
281
+ "to": "src:r::src/b.ts#B.get@2",
282
+ "kind": "calls",
283
+ "weight": 1,
284
+ "origin": "extracted"
285
+ }
286
+ ],
287
+ "keys": []
288
+ }
289
+ ]
290
+ },
291
+ {
292
+ "kind": "diff",
293
+ "hash": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
294
+ "prior": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
295
+ "entries": [
296
+ {
297
+ "sourceRef": "src:r::src/a.ts",
298
+ "sourceHash": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
299
+ "extractorVersion": 5,
300
+ "nodes": {
301
+ "remove": [
302
+ "src:r::src/a.ts"
303
+ ],
304
+ "add": [
305
+ {
306
+ "at": 0,
307
+ "item": {
308
+ "ref": "src:r::src/a.ts",
309
+ "kind": "file",
310
+ "label": "src/a.ts",
311
+ "pack": "code",
312
+ "importance": 0.5,
313
+ "origin": "extracted",
314
+ "sourceHash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
315
+ }
316
+ }
317
+ ]
318
+ },
319
+ "edges": {
320
+ "remove": [
321
+ "src:r::src/a.ts#A.run@3\u0000src:r::src/b.ts#B.get@2\u0000calls"
322
+ ],
323
+ "add": [
324
+ {
325
+ "at": 4,
326
+ "item": {
327
+ "from": "src:r::src/a.ts#A.run@3",
328
+ "to": "src:r::src/b.ts#B.get@2",
329
+ "kind": "calls",
330
+ "weight": 1,
331
+ "origin": "extracted"
332
+ }
333
+ }
334
+ ]
335
+ },
336
+ "keys": {
337
+ "remove": [],
338
+ "add": []
339
+ }
340
+ }
341
+ ]
342
+ }
343
+ ]
344
+ }
345
+ }
@@ -18,12 +18,13 @@ import type {
18
18
  DirectorySource, Extracted, ExtractJob, ExtractJobResult, GraphApp, GraphOutline, GraphReadSkip, GraphSystem, KEdge, KNode, KnowledgeGraph, KnowledgeStore,
19
19
  OutlineFile, OutlineCommunity, NodePlacement, ReviewFailure, ReviewFailureChunks, ReviewPhase, ReviewReport, ReviewRun, ReviewRunPhase, ReviewStep, ScopeRecord,
20
20
  StoredFact, StoredRelation, ExtractedLogPersistence, KnowledgeSnapshot, LocalSnapshotStoreOptions, SnapshotPersistence,
21
- RowChange, RowPersistence,
21
+ RowChange, RowPersistence, CallSite, SymbolEdgeKind,
22
22
  } from '../knowledge/index.js';
23
+ import type { dedupeSymbolEdges } from '../knowledge/index.js';
23
24
  import type { PlannedFile } from '../knowledge/index.js';
24
25
  import type {
25
26
  AnalysisIssue, AnchorKind, CodeAnalysisSnapshot, ComparabilityMeta, Finding, FindingIdentity, LineageEntry,
26
- comparable, compareAnalysis, identityOf, matchLineage,
27
+ comparable, compareAnalysis, identityOf, matchLineage, isBinaryBytes,
27
28
  } from '../knowledge/index.js';
28
29
  import { placementOf } from '../knowledge/index.js';
29
30
  import { canonicalDump, ExtractFailed, failuresOf, failureTotal, LocalSnapshotStore, localSnapshotStore, type ExtractorState } from '../knowledge/index.js';
@@ -259,6 +260,15 @@ export type NodePlacement_shape = Expect<Equal<NodePlacement, { kind: 'partition
259
260
  export type placementOf_signature = Expect<Equal<ReturnType<typeof placementOf>, NodePlacement | undefined>>;
260
261
  export type KEdge_verdict = Expect<Equal<KEdge['verdict'], 'allowed' | 'same' | 'skips' | 'upward' | undefined>>;
261
262
 
263
+ /* ── Symbol-level edges (PRD 43 P0b): `calls` edges carry their call sites ─────────────────────────────────── */
264
+ export type KEdge_sites = Expect<Equal<KEdge['sites'], CallSite[] | undefined>>;
265
+ export type KEdge_sites_is_optional = Expect<Equal<IsOptional<KEdge, 'sites'>, true>>;
266
+ export type CallSite_shape = Expect<Equal<CallSite, { path: string; line: number; column: number; order: number }>>;
267
+ export type SymbolEdgeKind_values = Expect<Equal<SymbolEdgeKind, 'extends' | 'implements' | 'composes' | 'uses' | 'calls'>>;
268
+ export type dedupeSymbolEdges_signature = Expect<Equal<
269
+ typeof dedupeSymbolEdges, (edges: readonly KEdge[], opts?: { maxPerSymbol?: number; maxSites?: number }) => KEdge[]
270
+ >>;
271
+
262
272
  /* ── Finding identity v2, lineage, comparability (PRD 41 §C3/§C9) ─────────────────────────────────────────── */
263
273
  export type AnchorKind_values = Expect<Equal<AnchorKind, 'symbol' | 'route' | 'package' | 'file' | 'group'>>;
264
274
  export type Finding_anchor_is_optional = Expect<Equal<IsOptional<Finding, 'anchor'>, true>>;
@@ -284,6 +294,9 @@ export type compareAnalysis_result = Expect<Equal<
284
294
  { comparable: boolean; reasons: string[]; added: AnalysisIssue[]; unchanged: AnalysisIssue[]; resolved: AnalysisIssue[] }
285
295
  >>;
286
296
  export type CodeAnalysisSnapshot_version = Expect<Equal<CodeAnalysisSnapshot['version'], 1>>;
297
+ export type CodeAnalysisSnapshot_truncated = Expect<Equal<CodeAnalysisSnapshot['truncated'], true | undefined>>;
298
+ export type CodeAnalysisSnapshot_truncated_is_optional = Expect<Equal<IsOptional<CodeAnalysisSnapshot, 'truncated'>, true>>;
299
+ export type isBinaryBytes_signature = Expect<Equal<typeof isBinaryBytes, (bytes: Uint8Array) => boolean>>;
287
300
 
288
301
  describe('type contract', () => {
289
302
  it('is enforced by `npm run check:contract-types` (tsc over tsconfig.contract.json), not at run time', () => {
@@ -27,6 +27,7 @@ import { pageRank } from './importance.js';
27
27
  import { applyCommunities } from './communities.js';
28
28
  import { loadPartitions, partitionOf, verdictOf } from './partitions.js';
29
29
  import { entityName } from './resolve.js';
30
+ import { isSymbolEdgeKind } from './symbolEdges.js';
30
31
  import {
31
32
  basenameOf, canonicalJson, compareStr, factRef, FALLBACK_PACK_ID, fileRefOf, nameResolver, pathOfRef, round6, sortBy, srcRef,
32
33
  } from './refs.js';
@@ -199,7 +200,9 @@ export function buildGraph(input: BuildGraphInput, opts: BuildGraphOptions = {})
199
200
  const systems = [...(input.systems ?? [])].sort((a, b) => compareStr(a.path, b.path));
200
201
  placeNodes(rootId, g, registries, systems);
201
202
 
202
- const rank = pageRank([...g.nodes.keys()], [...g.edges.values()]);
203
+ // The symbol-level kinds restate a dependency the file's `references` already carry (the code pack's rollup):
204
+ // they draw the class/method bands and never re-weigh importance.
205
+ const rank = pageRank([...g.nodes.keys()], [...g.edges.values()].filter((e) => !isSymbolEdgeKind(e.kind)));
203
206
  for (const n of g.nodes.values()) n.importance = rank.get(n.ref) ?? 0;
204
207
  const { modularity, method: communityMethod } = applyCommunities(g.nodes.values(), g.edges.values());
205
208
 
@@ -300,7 +303,8 @@ function placeNodes(rootId: string, g: GraphBuilder, registries: Map<string, Par
300
303
  for (const e of g.edges.values()) {
301
304
  const from = g.nodes.get(e.from), to = g.nodes.get(e.to);
302
305
  const reg = from && registries.get(from.pack);
303
- if (!from || !to || !reg || from.pack !== to.pack) continue;
306
+ // A symbol-level edge restates its file's import: the layer verdict (and its finding) is the import's alone.
307
+ if (!from || !to || !reg || from.pack !== to.pack || isSymbolEdgeKind(e.kind)) continue;
304
308
  // Layers are a system's own: a reference into another system is neither upward nor skipping.
305
309
  if (crossesSystems(systemOfRef.get(from.ref) ?? from, systemOfRef.get(to.ref) ?? to)) continue;
306
310
  const verdict = verdictOf(from.partition, to.partition, reg);
@@ -333,5 +337,6 @@ export function finalEdge(e: KEdge): KEdge {
333
337
  ...(e.verdict ? { verdict: e.verdict } : {}),
334
338
  ...(e.cycle ? { cycle: true } : {}),
335
339
  ...(e.stale ? { stale: true } : {}),
340
+ ...(e.sites?.length ? { sites: e.sites } : {}),
336
341
  };
337
342
  }
@@ -5,7 +5,7 @@
5
5
  * names/versions are restated below; the analyzer-RUNNING cases stay in agent-tools.
6
6
  */
7
7
 
8
- import { compareAnalysis, identityOfIssue, normalizeAnalysis, type CodeAnalysisSnapshot } from './comparability.js';
8
+ import { analysisMeta, compareAnalysis, identityOfIssue, normalizeAnalysis, type CodeAnalysisSnapshot } from './comparability.js';
9
9
 
10
10
  const ANALYZERS = [{ name: 'dependency-cruiser', version: '16.10.4' }, { name: 'jscpd', version: '4.0.5' }, { name: 'knip', version: '5.62.0' }];
11
11
 
@@ -71,3 +71,18 @@ describe('compareAnalysis delegates to comparable()', () => {
71
71
  expect(compareAnalysis(scoped, snapshot()).reasons).toEqual(['scope-changed']);
72
72
  });
73
73
  });
74
+
75
+ describe('a truncated snapshot (PRD 41 B2, C9)', () => {
76
+ it('carries truncated into its meta only when set', () => {
77
+ expect(analysisMeta({ ...snapshot(), truncated: true })).toMatchObject({ truncated: true });
78
+ expect(analysisMeta(snapshot())).not.toHaveProperty('truncated');
79
+ });
80
+ it('is not comparable on either side, so it reports nothing added or resolved', () => {
81
+ const full = snapshot(); const cut = { ...snapshot(), truncated: true as const, issues: snapshot().issues.slice(1) };
82
+ for (const [current, baseline] of [[cut, full], [full, cut]] as const) {
83
+ const result = compareAnalysis(current, baseline);
84
+ expect(result).toMatchObject({ comparable: false, reasons: ['truncated'], added: [], resolved: [] });
85
+ }
86
+ expect(compareAnalysis(snapshot(), snapshot())).toMatchObject({ comparable: true, reasons: [] });
87
+ });
88
+ });
@@ -83,6 +83,8 @@ export interface CodeAnalysisSnapshot {
83
83
  nodes: string[];
84
84
  edges: Array<{ from: string; to: string; circular: boolean }>;
85
85
  issues: AnalysisIssue[];
86
+ /** Set when the analyzed scope was cut short (the host's file cap, or a listing that stopped early): the analysis is partial, so it is never comparable (reason `truncated`). */
87
+ truncated?: true;
86
88
  }
87
89
  export interface CodeAnalysisComparison { current: CodeAnalysisSnapshot; baseline?: CodeAnalysisSnapshot }
88
90
 
@@ -155,12 +157,13 @@ export function identityOfIssue(issue: AnalysisIssue): FindingIdentity {
155
157
  return { id: issue.id, anchor: issue.anchor ?? composeAnchor(issue.kind, ANALYSIS_ANCHOR_VERSION, anchorKind, anchorWithSnippet(primary, issue.snippet)), anchorKind, members };
156
158
  }
157
159
 
158
- /** A snapshot's comparability meta: source scope/repo/branch, tool versions, and every tool not `complete` as failed. */
160
+ /** A snapshot's comparability meta: source scope/repo/branch, tool versions, every tool not `complete` as failed, and `truncated` (only when set). */
159
161
  export function analysisMeta(snapshot: CodeAnalysisSnapshot): ComparabilityMeta {
160
162
  return {
161
163
  scope: snapshot.source.scope, repo: snapshot.source.repository, branch: snapshot.source.branch ?? undefined,
162
164
  tools: Object.fromEntries(snapshot.tools.map((t) => [t.name, t.version])),
163
165
  failed: snapshot.tools.filter((t) => t.status !== 'complete').map((t) => t.name),
166
+ ...(snapshot.truncated ? { truncated: true } : {}),
164
167
  };
165
168
  }
166
169
 
@@ -12,8 +12,12 @@ export type {
12
12
  JudgementPort, AnalyzerPort, AnalyzerProgress, KnowledgeParser, KnowledgePack, StoredFact, StoredRelation, Scope, ScopeRecord,
13
13
  KnowledgeStore, DirectorySource, LiveOverlay, KnowledgeGraph, ReviewPlan, ReviewProgress, ReviewReport,
14
14
  ReviewArgs, BuildGraphInput, BuildGraphOptions, TraceStep, Trace, GraphOutline, OutlineFile, OutlineCommunity,
15
- GraphSystem, GraphApp, GraphReadSkip,
15
+ GraphSystem, GraphApp, GraphReadSkip, CallSite,
16
16
  } from './model.js';
17
+ export {
18
+ SYMBOL_EDGE_KINDS, MAX_SYMBOL_EDGES_PER_SYMBOL, MAX_CALL_SITES_PER_EDGE, isSymbolEdgeKind, compareCallSites, dedupeSymbolEdges,
19
+ type SymbolEdgeKind,
20
+ } from './symbolEdges.js';
17
21
  export {
18
22
  buildOutline, outlineOf, outlineRef, OUTLINE_MAX_FILES, OUTLINE_MAX_LINKS, OUTLINE_BADGE_KEYS, OUTLINE_VERDICTS, OUTLINE_FLAG_CYCLE,
19
23
  } from './outline.js';
@@ -85,7 +89,7 @@ export {
85
89
  DEFAULT_REVIEW_MODEL_CALLS, DEFAULT_REVIEW_JUDGE_CONCURRENCY, REVIEW_FACT_SOURCE,
86
90
  } from './judge.js';
87
91
  export {
88
- composePacks, ignoreMatcher, ignoreSourcesOf, isAssetPath, isBinaryPath, isBinaryText, isDocumentPath, mediaTypeOfPath,
92
+ composePacks, ignoreMatcher, ignoreSourcesOf, isAssetPath, isBinaryBytes, isBinaryPath, isBinaryText, isDocumentPath, mediaTypeOfPath,
89
93
  resolveDocument, resolveRelativePath,
90
94
  DEFAULT_MAX_FILE_BYTES, EXTRACTOR_VERSION, filesManifestKey, extractorManifestKey, judgedManifestKey, compareManifestKey,
91
95
  } from './sources.js';
@@ -52,7 +52,8 @@ export interface KEdge {
52
52
  from: NodeRef;
53
53
  to: NodeRef;
54
54
  /** 'references' | 'links' | 'contains' | 'mentions' | 'duplicate' | 'near-duplicate'
55
- * | 'contradicts' | 'agrees' | 'supersedes' | 'about' | 'co-changed' — a new kind is a value. */
55
+ * | 'contradicts' | 'agrees' | 'supersedes' | 'about' | 'co-changed', and the symbol-level
56
+ * 'extends' | 'implements' | 'composes' | 'uses' | 'calls' (`SYMBOL_EDGE_KINDS`) — a new kind is a value. */
56
57
  kind: string;
57
58
  weight: number;
58
59
  origin: Origin;
@@ -67,6 +68,22 @@ export interface KEdge {
67
68
  * target) — so the cached extract never depends on which other files exist. Never emitted.
68
69
  */
69
70
  byName?: string;
71
+ /**
72
+ * `calls` edges: every call of `to` in the body of `from`, in source order (`order`). One deduped edge per
73
+ * (from, to, kind) — a repeated call is another site, never another edge. Absent elsewhere; never empty.
74
+ */
75
+ sites?: CallSite[];
76
+ }
77
+
78
+ /**
79
+ * Where a call is written: the root-relative `path`, 1-based `line` and `column`, and `order` — the call's position
80
+ * among ALL calls in the caller's body (0-based, source order), so a sequence shows the real call order.
81
+ */
82
+ export interface CallSite {
83
+ path: string;
84
+ line: number;
85
+ column: number;
86
+ order: number;
70
87
  }
71
88
 
72
89
  /** Output of a pack's deterministic extractor (or analyzer) for one source. Never stored. */
@@ -9,7 +9,8 @@
9
9
  * NORMALISATION (lossless for every value the model produces, documented where it is not): rows are sorted and
10
10
  * empty parts dropped; object keys of badges and of the analysis document are written in sorted order; a
11
11
  * negative zero is written as zero; a string holding a lone UTF-16 surrogate is written with U+FFFD in its place
12
- * (UTF-8 cannot carry it). Equal normalised input gives equal bytes.
12
+ * (UTF-8 cannot carry it); an edge's empty `sites` list is not written (the SITE section carries non-empty ones only).
13
+ * Equal normalised input gives equal bytes.
13
14
  */
14
15
 
15
16
  import { deflateRaw } from './deflate.js';
@@ -65,12 +65,15 @@ const nodeId = (n: KNode): string => n.ref;
65
65
  */
66
66
  const stamped = (n: KNode, entryHash: string): KNode => (n.sourceHash === entryHash ? { ...n, sourceHash: '\u0000entry' } : n);
67
67
  const edgeId = (e: KEdge): string => `${e.from}\u0000${e.to}\u0000${e.kind}`;
68
+ /** An edge with an empty `sites` list is the same edge as one without (the wire never carries an empty list). */
69
+ const withoutEmptySites = (e: KEdge): KEdge => (e.sites && e.sites.length === 0 ? (({ sites: _, ...rest }) => rest)(e) : e);
70
+ const sameEdge = (p: KEdge, n: KEdge): boolean => deepEqual(withoutEmptySites(p), withoutEmptySites(n));
68
71
  const keyId = (k: { ref: string; key: string }): string => `${k.ref}\u0000${k.key}`;
69
72
 
70
73
  export function diffEntry(prior: Extracted, next: Extracted): ExtrEntryDiff | undefined {
71
74
  if (prior.sourceRef !== next.sourceRef) return undefined;
72
75
  const nodes = diffList(prior.nodes, next.nodes, nodeId, (p, n) => deepEqual(stamped(p, prior.sourceHash), stamped(n, next.sourceHash)));
73
- const edges = diffList(prior.edges, next.edges, edgeId);
76
+ const edges = diffList(prior.edges, next.edges, edgeId, sameEdge);
74
77
  const keys = diffList(prior.keys, next.keys, keyId);
75
78
  if (!nodes || !edges || !keys) return undefined;
76
79
  return {
@@ -18,11 +18,26 @@ export interface SectionCodec {
18
18
  export const ORIGINS = ['extracted', 'model', 'human', 'agent'] as const;
19
19
  export const STORED_ORIGINS = ['model', 'human', 'agent'] as const;
20
20
  export const VERDICTS = ['allowed', 'same', 'skips', 'upward'] as const;
21
- /** The relation/edge kinds the model names; anything else is stored as 0 + a string. */
21
+ /**
22
+ * The relation/edge kinds a READER knows as one-byte codes; anything else is stored as 0 + a string. APPEND ONLY: a
23
+ * code is its index + 1, so an existing word never moves.
24
+ *
25
+ * Expand/contract across releases (frame.ts: "a new value in an existing closed vocabulary needs every reader
26
+ * upgraded first"): a reader before 2026-11-10 throws on a code past 11, so the symbol kinds (PRD 43 P0b) are KNOWN
27
+ * here but not yet WRITTEN as codes — see {@link WRITTEN_EDGE_KINDS}.
28
+ */
22
29
  export const EDGE_KINDS = [
23
30
  'references', 'links', 'contains', 'mentions', 'duplicate', 'near-duplicate', 'contradicts', 'agrees',
24
31
  'supersedes', 'about', 'co-changed',
32
+ // PRD 43 P0b (2026-11-10): the symbol-level kinds, in SYMBOL_EDGE_KINDS order.
33
+ 'extends', 'implements', 'composes', 'uses', 'calls',
25
34
  ] as const;
35
+ /**
36
+ * The prefix of {@link EDGE_KINDS} a WRITER codes: what every deployed reader decodes. A later kind is written as 0 + its
37
+ * string, which every reader (old or new) decodes to the same value. Grow it to the whole list once no reader older
38
+ * than this release remains (the contract step) — the bytes change, the decoded pack does not.
39
+ */
40
+ export const WRITTEN_EDGE_KINDS: readonly string[] = EDGE_KINDS.slice(0, 11);
26
41
  /** The node kinds the packs name. */
27
42
  export const NODE_KINDS = ['file', 'section', 'symbol', 'area', 'entity', 'claim', 'fact'] as const;
28
43
 
@@ -7,7 +7,7 @@
7
7
  import type { KEdge, KNode, NodeRef } from '../types.js';
8
8
  import type { ReadTables, Tables } from '../strings.js';
9
9
  import { assertFlagsKnown, boundedCount, ByteReader, ByteWriter, PackFormatError, type Budget } from '../varint.js';
10
- import { EDGE_KINDS, NODE_KINDS, ORIGINS, VERDICTS, readEnum, readWord, unzigzag, writeEnum, writeWord, zigzag } from './columns.js';
10
+ import { EDGE_KINDS, NODE_KINDS, ORIGINS, VERDICTS, WRITTEN_EDGE_KINDS, readEnum, readWord, unzigzag, writeEnum, writeWord, zigzag } from './columns.js';
11
11
 
12
12
  const N_PARTITION = 1, N_AREA = 2, N_STALE = 4, N_STALE_V = 8, N_BADGES = 16, N_SYSTEM = 32, N_APP = 64, N_COPY = 128, N_HASH = 256;
13
13
  const N_KNOWN = 0x1ff;
@@ -92,7 +92,7 @@ export function writeEdges(w: ByteWriter, t: Tables, edges: readonly KEdge[]): v
92
92
  let prev = 0;
93
93
  for (const e of edges) { const i = t.str(e.from); w.varint(zigzag(i - prev)); prev = i; }
94
94
  for (const e of edges) w.varint(t.str(e.to));
95
- for (const e of edges) writeWord(w, t, EDGE_KINDS, e.kind);
95
+ for (const e of edges) writeWord(w, t, WRITTEN_EDGE_KINDS, e.kind);
96
96
  for (const e of edges) w.num(e.weight);
97
97
  for (const e of edges) writeEnum(w, ORIGINS, e.origin);
98
98
  const flags = edges.map((e) =>
@@ -5,7 +5,7 @@
5
5
 
6
6
  import type { NodeRef, StoredFact, StoredRelation } from '../types.js';
7
7
  import { assertConsumed, assertFlagsKnown, boundedCount, ByteReader, ByteWriter } from '../varint.js';
8
- import { EDGE_KINDS, STORED_ORIGINS, readEnum, readWord, writeEnum, writeWord, type SectionCodec } from './columns.js';
8
+ import { EDGE_KINDS, STORED_ORIGINS, WRITTEN_EDGE_KINDS, readEnum, readWord, writeEnum, writeWord, type SectionCodec } from './columns.js';
9
9
  import { TAG } from './rows.js';
10
10
 
11
11
  const F_UPDATED = 1, F_BY_NULL = 2, F_BY = 4;
@@ -88,7 +88,7 @@ export const relationSection: SectionCodec = {
88
88
  let prev = 0;
89
89
  for (const x of rows) { const i = t.str(x.from); w.varint(i - prev); prev = i; }
90
90
  for (const x of rows) w.varint(t.str(x.to));
91
- for (const x of rows) writeWord(w, t, EDGE_KINDS, x.kind);
91
+ for (const x of rows) writeWord(w, t, WRITTEN_EDGE_KINDS, x.kind);
92
92
  for (const x of rows) w.num(x.weight);
93
93
  for (const x of rows) writeEnum(w, STORED_ORIGINS, x.origin);
94
94
  const flags = rows.map((x) => (x.confidence !== undefined ? R_CONF : 0) | (x.sourceHash !== undefined ? R_HASH : 0)
@@ -3,10 +3,12 @@
3
3
  import { deleteSection, analysisSection, bucketSection, fileSection, leafSection, scopeSection, staleSection } from './rows.js';
4
4
  import { extrSection } from './extr.js';
5
5
  import { factSection, relationSection } from './facts.js';
6
+ import { siteSection } from './sites.js';
6
7
  import type { SectionCodec } from './columns.js';
7
8
 
9
+ /** SITE comes right after EXTR: it attaches call sites to the edges EXTR decoded (a reader runs these in this order). */
8
10
  export const ROW_SECTIONS: readonly SectionCodec[] = [
9
- fileSection, extrSection, factSection, relationSection, staleSection, deleteSection, scopeSection, analysisSection, leafSection, bucketSection,
11
+ fileSection, extrSection, siteSection, factSection, relationSection, staleSection, deleteSection, scopeSection, analysisSection, leafSection, bucketSection,
10
12
  ];
11
13
 
12
14
  export { TAG } from './rows.js';
@@ -11,7 +11,7 @@ import type { Pack } from '../types.js';
11
11
  import type { SectionCodec } from './columns.js';
12
12
  import { MANIFEST_BUCKETS } from '../manifest.js';
13
13
 
14
- export const TAG = { STR: 1, HASH: 2, FILE: 3, EXTR: 4, FACT: 5, REL: 6, STALE: 7, DEL: 8, SCOPE: 9, ANALYSIS: 10, LEAF: 11, BKT: 12 } as const;
14
+ export const TAG = { STR: 1, HASH: 2, FILE: 3, EXTR: 4, FACT: 5, REL: 6, STALE: 7, DEL: 8, SCOPE: 9, ANALYSIS: 10, LEAF: 11, BKT: 12, SITE: 13 } as const;
15
15
 
16
16
  export const fileSection: SectionCodec = {
17
17
  tag: TAG.FILE,