@descryy/ir 0.1.0
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.
- package/LICENSE +21 -0
- package/dist/capabilities.d.ts +83 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +91 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/conformance/bind.d.ts +82 -0
- package/dist/conformance/bind.d.ts.map +1 -0
- package/dist/conformance/bind.js +157 -0
- package/dist/conformance/bind.js.map +1 -0
- package/dist/conformance/cli.d.ts +25 -0
- package/dist/conformance/cli.d.ts.map +1 -0
- package/dist/conformance/cli.js +137 -0
- package/dist/conformance/cli.js.map +1 -0
- package/dist/conformance/compare.d.ts +74 -0
- package/dist/conformance/compare.d.ts.map +1 -0
- package/dist/conformance/compare.js +140 -0
- package/dist/conformance/compare.js.map +1 -0
- package/dist/conformance/compose.d.ts +79 -0
- package/dist/conformance/compose.d.ts.map +1 -0
- package/dist/conformance/compose.js +167 -0
- package/dist/conformance/compose.js.map +1 -0
- package/dist/conformance/golden.d.ts +110 -0
- package/dist/conformance/golden.d.ts.map +1 -0
- package/dist/conformance/golden.js +252 -0
- package/dist/conformance/golden.js.map +1 -0
- package/dist/conformance/index.d.ts +26 -0
- package/dist/conformance/index.d.ts.map +1 -0
- package/dist/conformance/index.js +18 -0
- package/dist/conformance/index.js.map +1 -0
- package/dist/conformance/manifest-check.d.ts +78 -0
- package/dist/conformance/manifest-check.d.ts.map +1 -0
- package/dist/conformance/manifest-check.js +149 -0
- package/dist/conformance/manifest-check.js.map +1 -0
- package/dist/conformance/manifest.d.ts +83 -0
- package/dist/conformance/manifest.d.ts.map +1 -0
- package/dist/conformance/manifest.js +158 -0
- package/dist/conformance/manifest.js.map +1 -0
- package/dist/conformance/report.d.ts +14 -0
- package/dist/conformance/report.d.ts.map +1 -0
- package/dist/conformance/report.js +87 -0
- package/dist/conformance/report.js.map +1 -0
- package/dist/conformance/run.d.ts +172 -0
- package/dist/conformance/run.d.ts.map +1 -0
- package/dist/conformance/run.js +626 -0
- package/dist/conformance/run.js.map +1 -0
- package/dist/contracts.d.ts +198 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +10 -0
- package/dist/contracts.js.map +1 -0
- package/dist/contradiction.d.ts +112 -0
- package/dist/contradiction.d.ts.map +1 -0
- package/dist/contradiction.js +97 -0
- package/dist/contradiction.js.map +1 -0
- package/dist/finding.d.ts +567 -0
- package/dist/finding.d.ts.map +1 -0
- package/dist/finding.js +491 -0
- package/dist/finding.js.map +1 -0
- package/dist/hypothesis.d.ts +130 -0
- package/dist/hypothesis.d.ts.map +1 -0
- package/dist/hypothesis.js +116 -0
- package/dist/hypothesis.js.map +1 -0
- package/dist/identity.d.ts +295 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +404 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/ir.d.ts +360 -0
- package/dist/ir.d.ts.map +1 -0
- package/dist/ir.js +76 -0
- package/dist/ir.js.map +1 -0
- package/dist/model-tables.d.ts +111 -0
- package/dist/model-tables.d.ts.map +1 -0
- package/dist/model-tables.js +103 -0
- package/dist/model-tables.js.map +1 -0
- package/dist/normalise.d.ts +114 -0
- package/dist/normalise.d.ts.map +1 -0
- package/dist/normalise.js +603 -0
- package/dist/normalise.js.map +1 -0
- package/dist/reliability.d.ts +89 -0
- package/dist/reliability.d.ts.map +1 -0
- package/dist/reliability.js +181 -0
- package/dist/reliability.js.map +1 -0
- package/dist/tool-surface.d.ts +131 -0
- package/dist/tool-surface.d.ts.map +1 -0
- package/dist/tool-surface.js +133 -0
- package/dist/tool-surface.js.map +1 -0
- package/dist/vocabulary.d.ts +73 -0
- package/dist/vocabulary.d.ts.map +1 -0
- package/dist/vocabulary.js +150 -0
- package/dist/vocabulary.js.map +1 -0
- package/package.json +27 -0
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Normaliser — the only door into the graph.
|
|
3
|
+
*
|
|
4
|
+
* Everything an adapter emits passes through here before anything is written.
|
|
5
|
+
* It exists because of one ordering rule in the build plan: **the Normaliser
|
|
6
|
+
* comes before the writer.** Build the writer first and "reject at the boundary"
|
|
7
|
+
* silently becomes "clean up in SQL", which is unrecoverable — once a bad edge
|
|
8
|
+
* is in the store, a dropped bad edge and a missing good one look identical, and
|
|
9
|
+
* §11B.6 recall has no denominator.
|
|
10
|
+
*
|
|
11
|
+
* Two rules govern the whole file:
|
|
12
|
+
*
|
|
13
|
+
* 1. **Drop and log, never repair.** A repair changes what an adapter claimed
|
|
14
|
+
* without telling anyone. The one exception is confidence, which is clamped
|
|
15
|
+
* *down* to a per-resolution ceiling and recorded — lowering a claim cannot
|
|
16
|
+
* manufacture a fact, and every clamp appears in the result.
|
|
17
|
+
* 2. **Trust nothing.** Adapters live in a different repo, on a different
|
|
18
|
+
* release cadence (DEC-001), and are third-party as far as this package is
|
|
19
|
+
* concerned. TypeScript types do not survive that boundary at runtime, so
|
|
20
|
+
* the input is `unknown` and every field is checked structurally.
|
|
21
|
+
*
|
|
22
|
+
* This package has zero dependencies, so it cannot see the store. The "edge
|
|
23
|
+
* references a node that does not exist" check therefore takes a `nodeExists`
|
|
24
|
+
* predicate: the caller supplies the store lookup, and the IR boundary stays
|
|
25
|
+
* dependency-free.
|
|
26
|
+
*/
|
|
27
|
+
import { isEdgeType, isFilelessNodeType, isNodeType } from "./vocabulary.js";
|
|
28
|
+
import { SKIP_REASONS, UNRESOLVED_REF_CLASSES } from "./ir.js";
|
|
29
|
+
import { NODE_ID_PREFIX } from "./identity.js";
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
// Result shape
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
/**
|
|
34
|
+
* Every way a batch, node, edge or reference can be turned away.
|
|
35
|
+
*
|
|
36
|
+
* Typed rather than free-text because these are counted, not just printed:
|
|
37
|
+
* §20.2's "not analysable" category and §11B.6's recall denominator are both
|
|
38
|
+
* aggregates over this list. A rejection whose reason is a sentence cannot be
|
|
39
|
+
* aggregated.
|
|
40
|
+
*/
|
|
41
|
+
export const REJECTION_CODES = [
|
|
42
|
+
// envelope (DEC-015) — any of these rejects the whole batch
|
|
43
|
+
"BATCH_MALFORMED",
|
|
44
|
+
"BATCH_FIELD_INVALID",
|
|
45
|
+
"BATCH_SOURCE_FILES_EMPTY",
|
|
46
|
+
// identity and vocabulary
|
|
47
|
+
"UNKNOWN_NODE_TYPE",
|
|
48
|
+
"UNKNOWN_EDGE_TYPE",
|
|
49
|
+
"MALFORMED_NODE_ID",
|
|
50
|
+
"DUPLICATE_NODE_ID",
|
|
51
|
+
"EMPTY_NAME",
|
|
52
|
+
// provenance
|
|
53
|
+
"MALFORMED_PRODUCED_BY",
|
|
54
|
+
"PRODUCED_BY_MISMATCH",
|
|
55
|
+
"RESOLUTION_OUT_OF_RANGE",
|
|
56
|
+
"RESOLUTION_EXCEEDS_BATCH",
|
|
57
|
+
"R4_WITHOUT_OBSERVED_RUN",
|
|
58
|
+
"OBSERVED_RUN_WITHOUT_R4",
|
|
59
|
+
"CONFIDENCE_INVALID",
|
|
60
|
+
// location
|
|
61
|
+
"ABSOLUTE_PATH",
|
|
62
|
+
"NON_PORTABLE_PATH",
|
|
63
|
+
"FILE_OUTSIDE_SOURCE_FILES",
|
|
64
|
+
"MISSING_FILE",
|
|
65
|
+
"FILE_ON_FILELESS_TYPE",
|
|
66
|
+
"RANGE_WITHOUT_FILE",
|
|
67
|
+
"INVALID_RANGE",
|
|
68
|
+
// skipped files (amends DEC-022)
|
|
69
|
+
"MALFORMED_SKIPPED_FILE",
|
|
70
|
+
"FILE_IN_SOURCE_AND_SKIPPED",
|
|
71
|
+
// the cross-language join node (DEC-014)
|
|
72
|
+
"LANGUAGE_ON_JOIN_NODE",
|
|
73
|
+
// identity scope (DEC-054)
|
|
74
|
+
"UNKNOWN_WORKSPACE",
|
|
75
|
+
// structure
|
|
76
|
+
"MALFORMED_ATTRS",
|
|
77
|
+
"MALFORMED_UNRESOLVED_REF",
|
|
78
|
+
// cascade
|
|
79
|
+
"DANGLING_EDGE_ENDPOINT",
|
|
80
|
+
"EDGE_ENDPOINT_DROPPED",
|
|
81
|
+
];
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
// Confidence ceilings
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
/**
|
|
86
|
+
* The maximum confidence an edge may claim at each resolution level.
|
|
87
|
+
*
|
|
88
|
+
* **The numbers for R0–R2 are provisional.** Architecture §32 item 13 lists
|
|
89
|
+
* `EdgeConfidence` per resolution level as open *tuning*, to be set "once two
|
|
90
|
+
* adapters exist and can be compared" — which is Step 14 of this build, not
|
|
91
|
+
* Step 5. Only two of the five values are actually pinned by the architecture:
|
|
92
|
+
* §12.4 states 1.0 for R3 and R4.
|
|
93
|
+
*
|
|
94
|
+
* What is NOT provisional is the shape, and that is what the tests assert:
|
|
95
|
+
* monotonically non-decreasing in resolution, never above 1.0, and 1.0 exactly
|
|
96
|
+
* at R3 and R4. Tuning the middle three later cannot violate any of those, so
|
|
97
|
+
* measuring them later does not invalidate anything built on this now.
|
|
98
|
+
*
|
|
99
|
+
* Override via `NormaliseOptions.confidenceCeilings` rather than editing here —
|
|
100
|
+
* the accuracy benchmark (§11B.6) will want to sweep them.
|
|
101
|
+
*/
|
|
102
|
+
export const DEFAULT_CONFIDENCE_CEILINGS = {
|
|
103
|
+
0: 0.5,
|
|
104
|
+
1: 0.75,
|
|
105
|
+
2: 0.9,
|
|
106
|
+
3: 1.0,
|
|
107
|
+
4: 1.0,
|
|
108
|
+
};
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
110
|
+
// Primitive validators
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
// Derived from the constant rather than restated, so an id-scheme bump cannot
|
|
113
|
+
// leave the validator matching the previous scheme. DEC-054's n1: -> n2: move
|
|
114
|
+
// found this: a hard-coded pattern would have accepted only stale ids.
|
|
115
|
+
const NODE_ID_PATTERN = new RegExp(`^${NODE_ID_PREFIX}[0-9a-f]{32}$`);
|
|
116
|
+
/** `adapterId@version`, exactly one `@`. */
|
|
117
|
+
const PRODUCED_BY_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*@[A-Za-z0-9][A-Za-z0-9._+-]*$/;
|
|
118
|
+
const DRIVE_LETTER_PATTERN = /^[A-Za-z]:[\\/]/;
|
|
119
|
+
function isRecord(value) {
|
|
120
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
121
|
+
}
|
|
122
|
+
function isResolution(value) {
|
|
123
|
+
return value === 0 || value === 1 || value === 2 || value === 3 || value === 4;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Repo-relative, forward-slashed, no `.`/`..`, no trailing slash.
|
|
127
|
+
*
|
|
128
|
+
* Absolute paths get their own code because they are the measured failure, not
|
|
129
|
+
* a hypothetical one: the prior-art graphs on this machine store absolute paths,
|
|
130
|
+
* which makes a graph non-portable between developers and — because `FILE`
|
|
131
|
+
* identity is the path (DEC-004's documented fallback) — gives the same file a
|
|
132
|
+
* different node id on every machine.
|
|
133
|
+
*
|
|
134
|
+
* The rest are rejected rather than rewritten for the same reason. `src\a.ts`
|
|
135
|
+
* and `src/a.ts` hash to different ids, so quietly rewriting one into the other
|
|
136
|
+
* would change an identity the adapter already committed to.
|
|
137
|
+
*/
|
|
138
|
+
function pathProblem(p) {
|
|
139
|
+
if (p === "")
|
|
140
|
+
return { code: "NON_PORTABLE_PATH", detail: "path is empty" };
|
|
141
|
+
if (p.startsWith("/") || p.startsWith("\\") || DRIVE_LETTER_PATTERN.test(p)) {
|
|
142
|
+
return { code: "ABSOLUTE_PATH", detail: `"${p}" is absolute; paths must be repo-relative` };
|
|
143
|
+
}
|
|
144
|
+
if (p.includes("\\")) {
|
|
145
|
+
return { code: "NON_PORTABLE_PATH", detail: `"${p}" uses backslashes; use forward slashes` };
|
|
146
|
+
}
|
|
147
|
+
if (p.endsWith("/"))
|
|
148
|
+
return { code: "NON_PORTABLE_PATH", detail: `"${p}" has a trailing slash` };
|
|
149
|
+
if (p.includes("//")) {
|
|
150
|
+
return { code: "NON_PORTABLE_PATH", detail: `"${p}" has an empty path segment` };
|
|
151
|
+
}
|
|
152
|
+
const segments = p.split("/");
|
|
153
|
+
if (segments.includes(".") || segments.includes("..")) {
|
|
154
|
+
return { code: "NON_PORTABLE_PATH", detail: `"${p}" is not normalised` };
|
|
155
|
+
}
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
function validRange(value) {
|
|
159
|
+
if (!isRecord(value))
|
|
160
|
+
return false;
|
|
161
|
+
const { startLine, endLine } = value;
|
|
162
|
+
return (Number.isInteger(startLine) &&
|
|
163
|
+
Number.isInteger(endLine) &&
|
|
164
|
+
startLine >= 1 &&
|
|
165
|
+
endLine >= startLine);
|
|
166
|
+
}
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
// The Normaliser
|
|
169
|
+
// ---------------------------------------------------------------------------
|
|
170
|
+
/**
|
|
171
|
+
* Validate and normalise one `IRBatch`.
|
|
172
|
+
*
|
|
173
|
+
* Never throws on bad input — a malformed batch is a result, not an exception,
|
|
174
|
+
* because a run over 40 adapters must report all of them rather than die on the
|
|
175
|
+
* first. It throws only on programmer error in the options.
|
|
176
|
+
*/
|
|
177
|
+
export function normaliseBatch(input, options = {}) {
|
|
178
|
+
const rejections = [];
|
|
179
|
+
const clamps = [];
|
|
180
|
+
const ceilings = options.confidenceCeilings ?? DEFAULT_CONFIDENCE_CEILINGS;
|
|
181
|
+
const nodeExists = options.nodeExists ?? (() => false);
|
|
182
|
+
const rejectBatch = (code, subject, detail) => {
|
|
183
|
+
rejections.push({ code, scope: "batch", subject, detail });
|
|
184
|
+
return { batch: null, rejections, clamps };
|
|
185
|
+
};
|
|
186
|
+
// --- envelope -------------------------------------------------------------
|
|
187
|
+
// Rejected whole, never partially. `sourceFiles` is the invalidation key
|
|
188
|
+
// (DEC-015): the writer deletes everything previously written by `producedBy`
|
|
189
|
+
// for those paths, then inserts. A batch whose key cannot be trusted cannot be
|
|
190
|
+
// written at all, because the delete half would silently do the wrong thing.
|
|
191
|
+
if (!isRecord(input)) {
|
|
192
|
+
return rejectBatch("BATCH_MALFORMED", "<batch>", `expected an object, got ${typeof input}`);
|
|
193
|
+
}
|
|
194
|
+
const { repo, workspace, commitSha, producedBy, sourceFiles, skippedFiles, reachedResolution, nodes, edges, unresolved, } = input;
|
|
195
|
+
if (typeof repo !== "string" || repo === "") {
|
|
196
|
+
return rejectBatch("BATCH_FIELD_INVALID", "<batch>", "repo must be a non-empty string");
|
|
197
|
+
}
|
|
198
|
+
if (workspace !== undefined && (typeof workspace !== "string" || workspace === "")) {
|
|
199
|
+
return rejectBatch("BATCH_FIELD_INVALID", repo, "workspace must be a non-empty string when present");
|
|
200
|
+
}
|
|
201
|
+
if (workspace !== undefined &&
|
|
202
|
+
options.knownWorkspaces !== undefined &&
|
|
203
|
+
!options.knownWorkspaces.includes(workspace)) {
|
|
204
|
+
return rejectBatch("UNKNOWN_WORKSPACE", repo, `workspace ${JSON.stringify(workspace)} is not one of ${JSON.stringify(options.knownWorkspaces)} — ` +
|
|
205
|
+
"an unrecognised workspace id is a typo, and a typo here joins nothing while reporting nothing");
|
|
206
|
+
}
|
|
207
|
+
if (typeof commitSha !== "string" || commitSha === "") {
|
|
208
|
+
return rejectBatch("BATCH_FIELD_INVALID", repo, "commitSha must be a non-empty string");
|
|
209
|
+
}
|
|
210
|
+
if (typeof producedBy !== "string" || !PRODUCED_BY_PATTERN.test(producedBy)) {
|
|
211
|
+
return rejectBatch("MALFORMED_PRODUCED_BY", repo, `batch producedBy must match adapterId@version, got ${JSON.stringify(producedBy)}`);
|
|
212
|
+
}
|
|
213
|
+
if (!isResolution(reachedResolution)) {
|
|
214
|
+
return rejectBatch("RESOLUTION_OUT_OF_RANGE", repo, `reachedResolution must be 0-4, got ${JSON.stringify(reachedResolution)}`);
|
|
215
|
+
}
|
|
216
|
+
if (!Array.isArray(sourceFiles) || !Array.isArray(nodes) || !Array.isArray(edges)) {
|
|
217
|
+
return rejectBatch("BATCH_FIELD_INVALID", repo, "sourceFiles, nodes and edges must all be arrays");
|
|
218
|
+
}
|
|
219
|
+
const unresolvedList = unresolved ?? [];
|
|
220
|
+
if (!Array.isArray(unresolvedList)) {
|
|
221
|
+
return rejectBatch("BATCH_FIELD_INVALID", repo, "unresolved must be an array when present");
|
|
222
|
+
}
|
|
223
|
+
// Absent, not `[]`, is what every producer not yet updated to report
|
|
224
|
+
// skipped files sends — treated the same as `unresolved`'s existing
|
|
225
|
+
// absent-means-none default, not as a rejection. A producer that DOES
|
|
226
|
+
// populate the field is held to it fully below.
|
|
227
|
+
const skippedFilesList = skippedFiles ?? [];
|
|
228
|
+
if (!Array.isArray(skippedFilesList)) {
|
|
229
|
+
return rejectBatch("BATCH_FIELD_INVALID", repo, "skippedFiles must be an array when present");
|
|
230
|
+
}
|
|
231
|
+
for (const f of sourceFiles) {
|
|
232
|
+
if (typeof f !== "string") {
|
|
233
|
+
return rejectBatch("BATCH_FIELD_INVALID", repo, "sourceFiles must contain only strings");
|
|
234
|
+
}
|
|
235
|
+
const problem = pathProblem(f);
|
|
236
|
+
if (problem)
|
|
237
|
+
return rejectBatch(problem.code, repo, `sourceFiles: ${problem.detail}`);
|
|
238
|
+
}
|
|
239
|
+
const sourceFileSet = new Set(sourceFiles);
|
|
240
|
+
if (sourceFileSet.size === 0 && (nodes.length > 0 || edges.length > 0)) {
|
|
241
|
+
// Nothing to delete means nothing is ever invalidated: these rows would
|
|
242
|
+
// outlive the code they describe, with no way to reach them.
|
|
243
|
+
return rejectBatch("BATCH_SOURCE_FILES_EMPTY", repo, "a batch carrying nodes or edges must declare the sourceFiles it was derived from");
|
|
244
|
+
}
|
|
245
|
+
const outSkippedFiles = [];
|
|
246
|
+
for (const raw of skippedFilesList) {
|
|
247
|
+
if (!isRecord(raw)) {
|
|
248
|
+
return rejectBatch("MALFORMED_SKIPPED_FILE", repo, `skippedFiles: expected an object, got ${typeof raw}`);
|
|
249
|
+
}
|
|
250
|
+
const file = raw["file"];
|
|
251
|
+
if (typeof file !== "string") {
|
|
252
|
+
return rejectBatch("MALFORMED_SKIPPED_FILE", repo, "skippedFiles: file must be a string");
|
|
253
|
+
}
|
|
254
|
+
const problem = pathProblem(file);
|
|
255
|
+
if (problem)
|
|
256
|
+
return rejectBatch(problem.code, repo, `skippedFiles: ${problem.detail}`);
|
|
257
|
+
const reason = raw["reason"];
|
|
258
|
+
if (typeof reason !== "string" || !SKIP_REASONS.includes(reason)) {
|
|
259
|
+
return rejectBatch("MALFORMED_SKIPPED_FILE", repo, `skippedFiles: reason must be one of ${JSON.stringify(SKIP_REASONS)}, got ${JSON.stringify(reason)}`);
|
|
260
|
+
}
|
|
261
|
+
const detail = raw["detail"];
|
|
262
|
+
if (typeof detail !== "string" || detail === "") {
|
|
263
|
+
return rejectBatch("MALFORMED_SKIPPED_FILE", repo, `skippedFiles: detail must be a non-empty string for "${file}"`);
|
|
264
|
+
}
|
|
265
|
+
if (sourceFileSet.has(file)) {
|
|
266
|
+
// Rejected whole, same register as BATCH_SOURCE_FILES_EMPTY: a batch
|
|
267
|
+
// that cannot say whether a file was analysed or skipped cannot be
|
|
268
|
+
// trusted to invalidate it correctly either way.
|
|
269
|
+
return rejectBatch("FILE_IN_SOURCE_AND_SKIPPED", repo, `"${file}" is in both sourceFiles and skippedFiles — a file is either analysed or skipped, never both`);
|
|
270
|
+
}
|
|
271
|
+
outSkippedFiles.push({ file, reason: reason, detail });
|
|
272
|
+
}
|
|
273
|
+
// --- nodes ----------------------------------------------------------------
|
|
274
|
+
const accepted = new Map();
|
|
275
|
+
for (const [index, raw] of nodes.entries()) {
|
|
276
|
+
const node = normaliseNode(raw, index, {
|
|
277
|
+
repo,
|
|
278
|
+
producedBy,
|
|
279
|
+
reachedResolution,
|
|
280
|
+
sourceFileSet,
|
|
281
|
+
seen: accepted,
|
|
282
|
+
rejections,
|
|
283
|
+
});
|
|
284
|
+
if (node !== null)
|
|
285
|
+
accepted.set(node.id, node);
|
|
286
|
+
}
|
|
287
|
+
// --- edges ----------------------------------------------------------------
|
|
288
|
+
// Ordered after nodes on purpose: an edge whose endpoint was just dropped must
|
|
289
|
+
// be reported as EDGE_ENDPOINT_DROPPED, not as a dangling reference. Those are
|
|
290
|
+
// different failures — one is a knock-on effect of a node the adapter got
|
|
291
|
+
// wrong, the other is the adapter pointing at something that was never there —
|
|
292
|
+
// and collapsing them is exactly the ambiguity this whole step exists to avoid.
|
|
293
|
+
const droppedNodeIds = new Set(rejections.filter((r) => r.scope === "node").map((r) => r.subject));
|
|
294
|
+
const outEdges = [];
|
|
295
|
+
for (const [index, raw] of edges.entries()) {
|
|
296
|
+
const edge = normaliseEdge(raw, index, {
|
|
297
|
+
producedBy,
|
|
298
|
+
reachedResolution,
|
|
299
|
+
ceilings,
|
|
300
|
+
accepted,
|
|
301
|
+
droppedNodeIds,
|
|
302
|
+
nodeExists,
|
|
303
|
+
rejections,
|
|
304
|
+
clamps,
|
|
305
|
+
});
|
|
306
|
+
if (edge !== null)
|
|
307
|
+
outEdges.push(edge);
|
|
308
|
+
}
|
|
309
|
+
// --- unresolved refs ------------------------------------------------------
|
|
310
|
+
const outUnresolved = [];
|
|
311
|
+
for (const [index, raw] of unresolvedList.entries()) {
|
|
312
|
+
const ref = normaliseUnresolved(raw, index, { producedBy, rejections });
|
|
313
|
+
if (ref !== null)
|
|
314
|
+
outUnresolved.push(ref);
|
|
315
|
+
}
|
|
316
|
+
return {
|
|
317
|
+
batch: {
|
|
318
|
+
repo,
|
|
319
|
+
...(workspace === undefined ? {} : { workspace }),
|
|
320
|
+
commitSha,
|
|
321
|
+
producedBy,
|
|
322
|
+
sourceFiles: sourceFiles,
|
|
323
|
+
skippedFiles: outSkippedFiles,
|
|
324
|
+
reachedResolution,
|
|
325
|
+
nodes: [...accepted.values()],
|
|
326
|
+
edges: outEdges,
|
|
327
|
+
unresolved: outUnresolved,
|
|
328
|
+
},
|
|
329
|
+
rejections,
|
|
330
|
+
clamps,
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
function normaliseNode(raw, index, ctx) {
|
|
334
|
+
const fallbackSubject = `<node #${index}>`;
|
|
335
|
+
const reject = (code, subject, detail) => {
|
|
336
|
+
ctx.rejections.push({ code, scope: "node", subject, detail });
|
|
337
|
+
return null;
|
|
338
|
+
};
|
|
339
|
+
if (!isRecord(raw)) {
|
|
340
|
+
return reject("BATCH_MALFORMED", fallbackSubject, `expected an object, got ${typeof raw}`);
|
|
341
|
+
}
|
|
342
|
+
const id = raw["id"];
|
|
343
|
+
if (typeof id !== "string" || !NODE_ID_PATTERN.test(id)) {
|
|
344
|
+
return reject("MALFORMED_NODE_ID", fallbackSubject, `id must be n1: followed by 32 hex characters, got ${JSON.stringify(id)}`);
|
|
345
|
+
}
|
|
346
|
+
if (ctx.seen.has(id)) {
|
|
347
|
+
// Which of the two is correct is unknowable here, and picking one silently
|
|
348
|
+
// would make the graph depend on adapter emission order. Merge across
|
|
349
|
+
// batches is the Graph Builder's job (DEC-012); a collision *within* one
|
|
350
|
+
// batch is an adapter bug.
|
|
351
|
+
return reject("DUPLICATE_NODE_ID", id, "id already present earlier in this batch");
|
|
352
|
+
}
|
|
353
|
+
const type = raw["type"];
|
|
354
|
+
if (typeof type !== "string" || !isNodeType(type)) {
|
|
355
|
+
return reject("UNKNOWN_NODE_TYPE", id, `not one of the 15 node types: ${JSON.stringify(type)}`);
|
|
356
|
+
}
|
|
357
|
+
const nodeType = type;
|
|
358
|
+
const name = raw["name"];
|
|
359
|
+
if (typeof name !== "string" || name === "") {
|
|
360
|
+
return reject("EMPTY_NAME", id, "name must be a non-empty string");
|
|
361
|
+
}
|
|
362
|
+
if (raw["producedBy"] !== ctx.producedBy) {
|
|
363
|
+
// The writer invalidates by (producedBy, sourceFiles). A node carrying a
|
|
364
|
+
// different producedBy would be inserted by this batch and then never
|
|
365
|
+
// deleted by it.
|
|
366
|
+
return reject("PRODUCED_BY_MISMATCH", id, `node producedBy ${JSON.stringify(raw["producedBy"])} differs from batch ${ctx.producedBy}`);
|
|
367
|
+
}
|
|
368
|
+
const resolution = raw["resolution"];
|
|
369
|
+
if (!isResolution(resolution)) {
|
|
370
|
+
return reject("RESOLUTION_OUT_OF_RANGE", id, `resolution must be 0-4, got ${String(resolution)}`);
|
|
371
|
+
}
|
|
372
|
+
if (resolution > ctx.reachedResolution) {
|
|
373
|
+
// "Reported a resolution it did not reach" — the same failure the
|
|
374
|
+
// conformance harness looks for, caught one layer earlier and cheaper.
|
|
375
|
+
return reject("RESOLUTION_EXCEEDS_BATCH", id, `claims R${resolution} in a batch that reached R${ctx.reachedResolution}`);
|
|
376
|
+
}
|
|
377
|
+
const attrs = raw["attrs"] ?? {};
|
|
378
|
+
if (!isRecord(attrs))
|
|
379
|
+
return reject("MALFORMED_ATTRS", id, "attrs must be an object when present");
|
|
380
|
+
// --- location -------------------------------------------------------------
|
|
381
|
+
const fileless = isFilelessNodeType(nodeType);
|
|
382
|
+
const file = raw["file"] ?? null;
|
|
383
|
+
const range = raw["range"] ?? null;
|
|
384
|
+
if (fileless) {
|
|
385
|
+
if (file !== null) {
|
|
386
|
+
return reject("FILE_ON_FILELESS_TYPE", id, `${nodeType} has no source file (DEC-014), got ${JSON.stringify(file)}`);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
if (typeof file !== "string") {
|
|
391
|
+
return reject("MISSING_FILE", id, `${nodeType} requires a repo-relative file path`);
|
|
392
|
+
}
|
|
393
|
+
const problem = pathProblem(file);
|
|
394
|
+
if (problem)
|
|
395
|
+
return reject(problem.code, id, problem.detail);
|
|
396
|
+
if (!ctx.sourceFileSet.has(file)) {
|
|
397
|
+
// Outside the invalidation key, so the writer's delete would miss it and
|
|
398
|
+
// this node would survive forever after its file stopped producing it.
|
|
399
|
+
return reject("FILE_OUTSIDE_SOURCE_FILES", id, `file "${file}" is not among the batch sourceFiles`);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
if (range !== null) {
|
|
403
|
+
if (file === null)
|
|
404
|
+
return reject("RANGE_WITHOUT_FILE", id, "range requires a file");
|
|
405
|
+
if (!validRange(range)) {
|
|
406
|
+
return reject("INVALID_RANGE", id, `range must be 1-based with endLine >= startLine`);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
// --- provenance -----------------------------------------------------------
|
|
410
|
+
const rawLanguage = raw["language"] ?? null;
|
|
411
|
+
if (rawLanguage !== null && typeof rawLanguage !== "string") {
|
|
412
|
+
return reject("BATCH_FIELD_INVALID", id, "language must be a string or null");
|
|
413
|
+
}
|
|
414
|
+
// The cross-language join node belongs to no single language: it is written by
|
|
415
|
+
// two adapters that never share a line of code, and XL-2 asserts it carries no
|
|
416
|
+
// language. Checking whether one was claimed is not itself a language branch —
|
|
417
|
+
// no language is named here, and the boundary lint distinguishes the two.
|
|
418
|
+
if (nodeType === "API_ENDPOINT" && rawLanguage !== null) {
|
|
419
|
+
return reject("LANGUAGE_ON_JOIN_NODE", id, `API_ENDPOINT is the cross-language join node and must carry no language (DEC-014); got ${JSON.stringify(rawLanguage)}`);
|
|
420
|
+
}
|
|
421
|
+
return {
|
|
422
|
+
id,
|
|
423
|
+
type: nodeType,
|
|
424
|
+
name,
|
|
425
|
+
file: typeof file === "string" ? file : null,
|
|
426
|
+
range: range === null ? null : range,
|
|
427
|
+
language: rawLanguage,
|
|
428
|
+
producedBy: ctx.producedBy,
|
|
429
|
+
resolution,
|
|
430
|
+
attrs,
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
function normaliseEdge(raw, index, ctx) {
|
|
434
|
+
const fallbackSubject = `<edge #${index}>`;
|
|
435
|
+
const reject = (code, subject, detail) => {
|
|
436
|
+
ctx.rejections.push({ code, scope: "edge", subject, detail });
|
|
437
|
+
return null;
|
|
438
|
+
};
|
|
439
|
+
if (!isRecord(raw)) {
|
|
440
|
+
return reject("BATCH_MALFORMED", fallbackSubject, `expected an object, got ${typeof raw}`);
|
|
441
|
+
}
|
|
442
|
+
const from = raw["from"];
|
|
443
|
+
const to = raw["to"];
|
|
444
|
+
const type = raw["type"];
|
|
445
|
+
if (typeof from !== "string" || !NODE_ID_PATTERN.test(from)) {
|
|
446
|
+
return reject("MALFORMED_NODE_ID", fallbackSubject, `from is not a node id: ${String(from)}`);
|
|
447
|
+
}
|
|
448
|
+
if (typeof to !== "string" || !NODE_ID_PATTERN.test(to)) {
|
|
449
|
+
return reject("MALFORMED_NODE_ID", fallbackSubject, `to is not a node id: ${String(to)}`);
|
|
450
|
+
}
|
|
451
|
+
if (typeof type !== "string" || !isEdgeType(type)) {
|
|
452
|
+
return reject("UNKNOWN_EDGE_TYPE", `${from}→${to}`, `not one of the 15 edge types: ${JSON.stringify(type)}`);
|
|
453
|
+
}
|
|
454
|
+
const edgeType = type;
|
|
455
|
+
const subject = `${from}→${to}:${edgeType}`;
|
|
456
|
+
if (raw["producedBy"] !== ctx.producedBy) {
|
|
457
|
+
return reject("PRODUCED_BY_MISMATCH", subject, `edge producedBy ${JSON.stringify(raw["producedBy"])} differs from batch ${ctx.producedBy}`);
|
|
458
|
+
}
|
|
459
|
+
const resolution = raw["resolution"];
|
|
460
|
+
if (!isResolution(resolution)) {
|
|
461
|
+
return reject("RESOLUTION_OUT_OF_RANGE", subject, `resolution must be 0-4, got ${String(resolution)}`);
|
|
462
|
+
}
|
|
463
|
+
if (resolution > ctx.reachedResolution) {
|
|
464
|
+
return reject("RESOLUTION_EXCEEDS_BATCH", subject, `claims R${resolution} in a batch that reached R${ctx.reachedResolution}`);
|
|
465
|
+
}
|
|
466
|
+
const observedByRun = raw["observedByRun"];
|
|
467
|
+
if (resolution === 4) {
|
|
468
|
+
// R4 is the product's core moat: this edge was witnessed, not inferred. An
|
|
469
|
+
// R4 edge with no run behind it is an unfalsifiable claim, and R4 expiry
|
|
470
|
+
// (§32 item 19) has nothing to key on.
|
|
471
|
+
if (typeof observedByRun !== "string" || observedByRun === "") {
|
|
472
|
+
return reject("R4_WITHOUT_OBSERVED_RUN", subject, "R4 requires a non-empty observedByRun");
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
else if (observedByRun !== undefined && observedByRun !== null) {
|
|
476
|
+
return reject("OBSERVED_RUN_WITHOUT_R4", subject, `observedByRun is meaningless below R4; edge claims R${resolution}`);
|
|
477
|
+
}
|
|
478
|
+
const rawConfidence = raw["confidence"];
|
|
479
|
+
if (typeof rawConfidence !== "number" || !Number.isFinite(rawConfidence)) {
|
|
480
|
+
return reject("CONFIDENCE_INVALID", subject, `confidence must be a finite number`);
|
|
481
|
+
}
|
|
482
|
+
if (rawConfidence < 0 || rawConfidence > 1) {
|
|
483
|
+
return reject("CONFIDENCE_INVALID", subject, `confidence must be within 0-1, got ${rawConfidence}`);
|
|
484
|
+
}
|
|
485
|
+
const attrs = raw["attrs"] ?? undefined;
|
|
486
|
+
if (attrs !== undefined && !isRecord(attrs)) {
|
|
487
|
+
return reject("MALFORMED_ATTRS", subject, "attrs must be an object when present");
|
|
488
|
+
}
|
|
489
|
+
// --- endpoints ------------------------------------------------------------
|
|
490
|
+
// A node written by an earlier batch is fine — a call into an unchanged file
|
|
491
|
+
// is the normal case. A node that never existed is not.
|
|
492
|
+
for (const [role, endpoint] of [
|
|
493
|
+
["from", from],
|
|
494
|
+
["to", to],
|
|
495
|
+
]) {
|
|
496
|
+
if (ctx.accepted.has(endpoint) || ctx.nodeExists(endpoint))
|
|
497
|
+
continue;
|
|
498
|
+
if (ctx.droppedNodeIds.has(endpoint)) {
|
|
499
|
+
return reject("EDGE_ENDPOINT_DROPPED", subject, `${role} node ${endpoint} was rejected earlier in this batch`);
|
|
500
|
+
}
|
|
501
|
+
return reject("DANGLING_EDGE_ENDPOINT", subject, `${role} node ${endpoint} is in neither the batch nor the store — record it as an unresolved reference (DEC-016) instead of guessing an edge`);
|
|
502
|
+
}
|
|
503
|
+
// --- confidence clamp -----------------------------------------------------
|
|
504
|
+
// The only value this function changes. Lowering a claim cannot manufacture a
|
|
505
|
+
// fact; raising one could, so `Math.min` is load-bearing rather than defensive.
|
|
506
|
+
const ceiling = ctx.ceilings[resolution];
|
|
507
|
+
const confidence = Math.min(rawConfidence, ceiling);
|
|
508
|
+
if (confidence !== rawConfidence) {
|
|
509
|
+
ctx.clamps.push({ subject, resolution, from: rawConfidence, to: confidence });
|
|
510
|
+
}
|
|
511
|
+
return {
|
|
512
|
+
from,
|
|
513
|
+
to,
|
|
514
|
+
type: edgeType,
|
|
515
|
+
resolution,
|
|
516
|
+
confidence,
|
|
517
|
+
producedBy: ctx.producedBy,
|
|
518
|
+
...(typeof observedByRun === "string" ? { observedByRun } : {}),
|
|
519
|
+
...(attrs === undefined ? {} : { attrs }),
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Unresolved references are deliberately NOT held to the endpoint check: the
|
|
524
|
+
* whole point of the ledger is to record a reference that resolved to nothing.
|
|
525
|
+
* `fromNodeId` still has to be real, or the entry cannot be attributed.
|
|
526
|
+
*
|
|
527
|
+
* Note what does not happen here: a rejected edge does not become an unresolved
|
|
528
|
+
* reference. The ledger measures what the *adapter* could not resolve — an
|
|
529
|
+
* analysis gap, disclosed under §20.2. A rejected edge is an adapter defect.
|
|
530
|
+
* Folding one into the other would inflate the recall denominator with bugs.
|
|
531
|
+
*/
|
|
532
|
+
function normaliseUnresolved(raw, index, ctx) {
|
|
533
|
+
const subject = `<unresolved #${index}>`;
|
|
534
|
+
const reject = (detail) => {
|
|
535
|
+
ctx.rejections.push({ code: "MALFORMED_UNRESOLVED_REF", scope: "unresolved", subject, detail });
|
|
536
|
+
return null;
|
|
537
|
+
};
|
|
538
|
+
if (!isRecord(raw))
|
|
539
|
+
return reject(`expected an object, got ${typeof raw}`);
|
|
540
|
+
const fromNodeId = raw["fromNodeId"];
|
|
541
|
+
if (typeof fromNodeId !== "string" || !NODE_ID_PATTERN.test(fromNodeId)) {
|
|
542
|
+
return reject(`fromNodeId is not a node id: ${String(fromNodeId)}`);
|
|
543
|
+
}
|
|
544
|
+
const edgeType = raw["edgeType"];
|
|
545
|
+
if (typeof edgeType !== "string" || !isEdgeType(edgeType)) {
|
|
546
|
+
return reject(`edgeType is not one of the 15 edge types: ${JSON.stringify(edgeType)}`);
|
|
547
|
+
}
|
|
548
|
+
const rawTarget = raw["rawTarget"];
|
|
549
|
+
if (typeof rawTarget !== "string" || rawTarget === "") {
|
|
550
|
+
return reject("rawTarget must be a non-empty string");
|
|
551
|
+
}
|
|
552
|
+
const reason = raw["reason"];
|
|
553
|
+
if (typeof reason !== "string" || reason === "") {
|
|
554
|
+
return reject("reason must be a non-empty string — it is what gets reported as not analysable");
|
|
555
|
+
}
|
|
556
|
+
if (raw["producedBy"] !== ctx.producedBy) {
|
|
557
|
+
return reject(`producedBy differs from the batch (${ctx.producedBy})`);
|
|
558
|
+
}
|
|
559
|
+
const file = raw["file"] ?? null;
|
|
560
|
+
if (file !== null) {
|
|
561
|
+
if (typeof file !== "string")
|
|
562
|
+
return reject("file must be a string or null");
|
|
563
|
+
const problem = pathProblem(file);
|
|
564
|
+
if (problem)
|
|
565
|
+
return reject(problem.detail);
|
|
566
|
+
}
|
|
567
|
+
const line = raw["line"] ?? null;
|
|
568
|
+
if (line !== null && (!Number.isInteger(line) || line < 1)) {
|
|
569
|
+
return reject("line must be a positive integer or null");
|
|
570
|
+
}
|
|
571
|
+
// attrs.blockedBy / attrs.refusalClass (DEC-223) — both optional, neither
|
|
572
|
+
// defaulted. Shape is checked when present; absence is never an error, the
|
|
573
|
+
// same "drop and log, never repair" rule as everywhere else in this file —
|
|
574
|
+
// a wrong type here is dropped rather than coerced, because coercing
|
|
575
|
+
// `42` into `"42"` would manufacture a handle the producer never claimed.
|
|
576
|
+
const attrs = raw["attrs"] ?? undefined;
|
|
577
|
+
if (attrs !== undefined) {
|
|
578
|
+
if (!isRecord(attrs))
|
|
579
|
+
return reject("attrs must be an object when present");
|
|
580
|
+
const blockedBy = attrs["blockedBy"];
|
|
581
|
+
if (blockedBy !== undefined &&
|
|
582
|
+
blockedBy !== null &&
|
|
583
|
+
(typeof blockedBy !== "string" || blockedBy === "")) {
|
|
584
|
+
return reject(`attrs.blockedBy must be a non-empty string or null when present, got ${JSON.stringify(blockedBy)}`);
|
|
585
|
+
}
|
|
586
|
+
const refusalClass = attrs["refusalClass"];
|
|
587
|
+
if (refusalClass !== undefined &&
|
|
588
|
+
!UNRESOLVED_REF_CLASSES.includes(refusalClass)) {
|
|
589
|
+
return reject(`attrs.refusalClass must be one of ${JSON.stringify(UNRESOLVED_REF_CLASSES)} when present, got ${JSON.stringify(refusalClass)}`);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
return {
|
|
593
|
+
fromNodeId,
|
|
594
|
+
edgeType,
|
|
595
|
+
rawTarget,
|
|
596
|
+
file: typeof file === "string" ? file : null,
|
|
597
|
+
line: typeof line === "number" ? line : null,
|
|
598
|
+
producedBy: ctx.producedBy,
|
|
599
|
+
reason,
|
|
600
|
+
...(attrs === undefined ? {} : { attrs: attrs }),
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
//# sourceMappingURL=normalise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalise.js","sourceRoot":"","sources":["../src/normalise.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAU7E,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E;;;;;;;GAOG;AACH,MAAM,CAAC,MA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