@gate-forge/core 0.13.10 → 0.14.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/dist/config/index.d.ts +58 -6
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +44 -0
- package/dist/config/index.js.map +1 -1
- package/dist/index.d.ts +13 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/policy/evaluate.d.ts +16 -0
- package/dist/policy/evaluate.d.ts.map +1 -1
- package/dist/policy/evaluate.js +21 -2
- package/dist/policy/evaluate.js.map +1 -1
- package/dist/report/index.d.ts +21 -1
- package/dist/report/index.d.ts.map +1 -1
- package/dist/report/index.js +20 -0
- package/dist/report/index.js.map +1 -1
- package/dist/schemas/behavior-evidence.d.ts +2 -2
- package/dist/schemas/behavior-policy.d.ts +7 -0
- package/dist/schemas/behavior-policy.d.ts.map +1 -1
- package/dist/schemas/behavior-policy.js +7 -0
- package/dist/schemas/behavior-policy.js.map +1 -1
- package/dist/schemas/business-rules.d.ts +3 -3
- package/dist/schemas/classification-policy.d.ts +1 -1
- package/dist/schemas/gate-receipt.d.ts +2 -2
- package/dist/schemas/queue-observer.d.ts +4 -4
- package/dist/schemas/test-catalog.d.ts +12 -12
- package/dist/schemas/test-map.d.ts +4 -4
- package/dist/schemas/verdict.d.ts +5 -0
- package/dist/schemas/verdict.d.ts.map +1 -1
- package/dist/schemas/verdict.js +22 -0
- package/dist/schemas/verdict.js.map +1 -1
- package/dist/strictness.d.ts +1 -1
- package/dist/verdict/http-coverage.d.ts +155 -0
- package/dist/verdict/http-coverage.d.ts.map +1 -0
- package/dist/verdict/http-coverage.js +351 -0
- package/dist/verdict/http-coverage.js.map +1 -0
- package/dist/verdict/http-ledger.d.ts +67 -0
- package/dist/verdict/http-ledger.d.ts.map +1 -0
- package/dist/verdict/http-ledger.js +168 -0
- package/dist/verdict/http-ledger.js.map +1 -0
- package/dist/verdict/index.d.ts +15 -1
- package/dist/verdict/index.d.ts.map +1 -1
- package/dist/verdict/index.js +15 -1
- package/dist/verdict/index.js.map +1 -1
- package/dist/verdict/pack-verifiers.d.ts +66 -11
- package/dist/verdict/pack-verifiers.d.ts.map +1 -1
- package/dist/verdict/pack-verifiers.js +131 -28
- package/dist/verdict/pack-verifiers.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The HTTP call rules R1-R5 (0.14 WP3, plan §4.3) over the exchange
|
|
3
|
+
* ledger.
|
|
4
|
+
*
|
|
5
|
+
* One primitive, three questions the gate could not answer before:
|
|
6
|
+
* - R1 USED: a route a witnessed exchange matched OR a static call site
|
|
7
|
+
* joined. Used routes already owe `http:request-observed` +
|
|
8
|
+
* `http:response-status-ok`: those obligations are generated PRE-RUN by
|
|
9
|
+
* the policy engine from the same `frontendConsumed` join
|
|
10
|
+
* (`policy/evaluate.ts`), so this module never invents an obligation —
|
|
11
|
+
* it reports who is used and who has not been proven yet.
|
|
12
|
+
* - R2: a `nomatch` call is an app defect only with status 404/405
|
|
13
|
+
* (`HTTP_CALL_UNMATCHED`); any other status becomes the report-only
|
|
14
|
+
* `HTTP_ROUTE_NOT_INVENTORIED` advisory because the app answered.
|
|
15
|
+
* - R3: a witnessed call matching several routes equally is
|
|
16
|
+
* `HTTP_CALL_AMBIGUOUS`.
|
|
17
|
+
* - R4: a static call site the join could not resolve, with its
|
|
18
|
+
* `file:line` — `HTTP_CALL_UNRESOLVED`. It reads the unresolved
|
|
19
|
+
* call-site facts the graph ALREADY carries (`FRONTEND_CALL_TARGET_UNRESOLVED`);
|
|
20
|
+
* it never scans anything itself.
|
|
21
|
+
* - R5: served-but-never-used is a COUNT, never a finding: the visible
|
|
22
|
+
* denominator, so an untested route cannot hide behind a green gate.
|
|
23
|
+
*
|
|
24
|
+
* `served` excludes endpoints whose router is never proven mounted
|
|
25
|
+
* (plan finding 13: an unmounted router is not a served route).
|
|
26
|
+
*
|
|
27
|
+
* NOTHING here changes a verdict: the rules add findings and one
|
|
28
|
+
* summary, and the channel those findings block on is the owner's
|
|
29
|
+
* declaration (`http.callFindings`), never this module's judgement.
|
|
30
|
+
*/
|
|
31
|
+
import { compareStrings } from '../graph/util.js';
|
|
32
|
+
import { sha256Canonical } from '../canonical-json.js';
|
|
33
|
+
import { CAUSE_NEXT_ACTIONS } from '../schemas/verdict.js';
|
|
34
|
+
import { HTTP_REQUEST_OBSERVED, HTTP_RESPONSE_STATUS_OK } from '../schemas/behavior-policy.js';
|
|
35
|
+
/** A witnessed call that matches no route in the run's inventory. */
|
|
36
|
+
export const HTTP_CALL_UNMATCHED = 'HTTP_CALL_UNMATCHED';
|
|
37
|
+
/** A witnessed response proves the app answered, but not that inventory is complete. */
|
|
38
|
+
export const HTTP_ROUTE_NOT_INVENTORIED = 'HTTP_ROUTE_NOT_INVENTORIED';
|
|
39
|
+
/** A witnessed call that matches several routes at equal specificity. */
|
|
40
|
+
export const HTTP_CALL_AMBIGUOUS = 'HTTP_CALL_AMBIGUOUS';
|
|
41
|
+
/** A static call site whose URL the join could not compute. */
|
|
42
|
+
export const HTTP_CALL_UNRESOLVED = 'HTTP_CALL_UNRESOLVED';
|
|
43
|
+
/**
|
|
44
|
+
* The static-scanner code for exactly "a frontend call whose target
|
|
45
|
+
* cannot be resolved statically". Read from the graph's unresolved
|
|
46
|
+
* entries; the constant is restated here because core cannot depend on
|
|
47
|
+
* `@gate-forge/http-contract` (same lockstep rule as
|
|
48
|
+
* `HTTP_OBSERVATION_UNTRUSTED` in pack-verifiers).
|
|
49
|
+
*/
|
|
50
|
+
const FRONTEND_CALL_TARGET_UNRESOLVED = 'FRONTEND_CALL_TARGET_UNRESOLVED';
|
|
51
|
+
/** The two contracts R1's routes owe; both satisfied ⇒ proven. */
|
|
52
|
+
const TRANSPORT_CONTRACTS = [HTTP_REQUEST_OBSERVED, HTTP_RESPONSE_STATUS_OK];
|
|
53
|
+
/**
|
|
54
|
+
* Whether one route counts as served. An endpoint is only subtracted
|
|
55
|
+
* from the denominator when the detector emitted mount provenance at all
|
|
56
|
+
* and THIS route carries none of it (plan finding 13's `unmounted`).
|
|
57
|
+
*
|
|
58
|
+
* Args:
|
|
59
|
+
* route: one route of the table.
|
|
60
|
+
* mountProvenanceEmitted: whether the run carries mount proofs.
|
|
61
|
+
*
|
|
62
|
+
* Returns:
|
|
63
|
+
* boolean: true when the route is in the served denominator.
|
|
64
|
+
*/
|
|
65
|
+
function isServed(route, mountProvenanceEmitted) {
|
|
66
|
+
return !mountProvenanceEmitted || route.mountProvenances.length > 0;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Collects the callers of every used route: the witnessing tests whose
|
|
70
|
+
* ledger row matched it, plus its joined static call sites.
|
|
71
|
+
*
|
|
72
|
+
* Args:
|
|
73
|
+
* routes: the run's route table.
|
|
74
|
+
* ledger: the run's exchange ledger (null when there is none).
|
|
75
|
+
* mountProvenanceEmitted: whether the run carries mount proofs.
|
|
76
|
+
*
|
|
77
|
+
* Returns:
|
|
78
|
+
* Map<string, HttpMissingRoute>: one entry per served route with at
|
|
79
|
+
* least one caller (a matched ledger row or a static join).
|
|
80
|
+
*/
|
|
81
|
+
function usedRoutes(routes, ledger, mountProvenanceEmitted) {
|
|
82
|
+
const used = new Map();
|
|
83
|
+
const serve = (route, callers) => {
|
|
84
|
+
const entry = used.get(route.resourceId);
|
|
85
|
+
const ledgerCallers = [...new Set([...(entry?.ledgerCallers ?? []), ...callers])].sort(compareStrings);
|
|
86
|
+
const callSites = [...new Set([...(entry?.callSites ?? []), ...route.callSites])].sort(compareStrings);
|
|
87
|
+
used.set(route.resourceId, { resourceId: route.resourceId, ledgerCallers, callSites });
|
|
88
|
+
};
|
|
89
|
+
for (const route of routes) {
|
|
90
|
+
if (!isServed(route, mountProvenanceEmitted))
|
|
91
|
+
continue;
|
|
92
|
+
if (route.consumed)
|
|
93
|
+
serve(route, []);
|
|
94
|
+
}
|
|
95
|
+
for (const entry of ledger?.rows ?? []) {
|
|
96
|
+
if (entry.kind !== 'api' || entry.resolution !== 'match' || entry.route === null)
|
|
97
|
+
continue;
|
|
98
|
+
const route = routes.find((candidate) => candidate.resourceId === entry.route);
|
|
99
|
+
// A row matched by the resolver can only name a route of the same
|
|
100
|
+
// inventory; an id the table does not carry is never invented here.
|
|
101
|
+
if (route === undefined || !isServed(route, mountProvenanceEmitted))
|
|
102
|
+
continue;
|
|
103
|
+
serve(route, [entry.testId]);
|
|
104
|
+
}
|
|
105
|
+
return used;
|
|
106
|
+
}
|
|
107
|
+
/** The domain tag separating call-finding identities from every other hash. */
|
|
108
|
+
const HTTP_CALL_FINGERPRINT_DOMAIN = 'gateforge.http-call-finding.v1';
|
|
109
|
+
/** A path segment that is an id: all digits, a UUID, or a 16+ char hex run. */
|
|
110
|
+
const ID_SEGMENT = /^(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})$/i;
|
|
111
|
+
/**
|
|
112
|
+
* The shape of a call's path (0.14 WP5 D1): the query and fragment are
|
|
113
|
+
* dropped and every id segment collapses to `:id`, so `/items/42` and
|
|
114
|
+
* `/items/97` are one call shape.
|
|
115
|
+
*
|
|
116
|
+
* Args:
|
|
117
|
+
* path: the raw path the witness recorded.
|
|
118
|
+
*
|
|
119
|
+
* Returns:
|
|
120
|
+
* string: the path shape.
|
|
121
|
+
*/
|
|
122
|
+
function pathShape(path) {
|
|
123
|
+
const bare = path.split(/[?#]/)[0] ?? '';
|
|
124
|
+
return bare.split('/').map((segment) => (ID_SEGMENT.test(segment) ? ':id' : segment)).join('/');
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Reads one ledger row's placement into a finding, or null when the
|
|
128
|
+
* placement is not a defect (a match, or an inventory that could not be
|
|
129
|
+
* attributed — `incomplete` stays unknown, never a finding).
|
|
130
|
+
*
|
|
131
|
+
* Repeated identical calls collapse into ONE finding listing every
|
|
132
|
+
* observed status: one bug is one finding, not a wall of duplicates.
|
|
133
|
+
*
|
|
134
|
+
* Args:
|
|
135
|
+
* rows: the ledger rows sharing one (test, method, path).
|
|
136
|
+
* code: the finding code to mint.
|
|
137
|
+
*
|
|
138
|
+
* Returns:
|
|
139
|
+
* HttpCallFinding | null: the finding, or null when nothing is wrong.
|
|
140
|
+
*/
|
|
141
|
+
function rowFinding(rows, code) {
|
|
142
|
+
const first = rows[0];
|
|
143
|
+
if (first === undefined)
|
|
144
|
+
return null;
|
|
145
|
+
const statuses = [...new Set(rows.map((entry) => String(entry.status)))].sort(compareStrings);
|
|
146
|
+
const call = `'${first.method} ${first.path}'`;
|
|
147
|
+
const shape = pathShape(first.path);
|
|
148
|
+
const identity = {
|
|
149
|
+
domain: HTTP_CALL_FINGERPRINT_DOMAIN,
|
|
150
|
+
code,
|
|
151
|
+
method: first.method,
|
|
152
|
+
pathShape: shape,
|
|
153
|
+
testId: first.testId,
|
|
154
|
+
};
|
|
155
|
+
const named = {
|
|
156
|
+
key: `${code} ${first.method} ${shape} (test ${first.testId})`,
|
|
157
|
+
fingerprint: sha256Canonical(identity),
|
|
158
|
+
};
|
|
159
|
+
if (code === HTTP_CALL_UNMATCHED || code === HTTP_ROUTE_NOT_INVENTORIED) {
|
|
160
|
+
return {
|
|
161
|
+
code,
|
|
162
|
+
resourceId: null,
|
|
163
|
+
location: null,
|
|
164
|
+
...named,
|
|
165
|
+
detail: code === HTTP_CALL_UNMATCHED
|
|
166
|
+
? `test '${first.testId}' called ${call} which matched no route in the run's inventory (HTTP ${statuses.join(', ')})`
|
|
167
|
+
: `the app served ${first.method} ${first.path} (HTTP ${statuses.join(', ')}) but the route inventory has no such route — the inventory is incomplete; check the detector for this framework`,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
const candidates = [
|
|
171
|
+
...new Set(rows.flatMap((entry) => entry.candidates ?? [])),
|
|
172
|
+
].sort(compareStrings);
|
|
173
|
+
return {
|
|
174
|
+
code,
|
|
175
|
+
resourceId: null,
|
|
176
|
+
location: null,
|
|
177
|
+
...named,
|
|
178
|
+
detail: `test '${first.testId}' called ${call} which matches ${String(candidates.length)} routes at ` +
|
|
179
|
+
`equal specificity (${candidates.join('; ')})`,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* The call findings, in a deterministic order: by code, then resource,
|
|
184
|
+
* then detail.
|
|
185
|
+
*
|
|
186
|
+
* Args:
|
|
187
|
+
* ledger: the run's exchange ledger.
|
|
188
|
+
* unresolved: the graph's unresolved entries.
|
|
189
|
+
*
|
|
190
|
+
* Returns:
|
|
191
|
+
* HttpCallFinding[]: the run's call findings.
|
|
192
|
+
*/
|
|
193
|
+
function callFindings(ledger, unresolved) {
|
|
194
|
+
const findings = [];
|
|
195
|
+
const grouped = new Map();
|
|
196
|
+
for (const entry of ledger?.rows ?? []) {
|
|
197
|
+
if (entry.kind !== 'api' || (entry.resolution !== 'nomatch' && entry.resolution !== 'ambiguous'))
|
|
198
|
+
continue;
|
|
199
|
+
const code = entry.resolution === 'ambiguous'
|
|
200
|
+
? HTTP_CALL_AMBIGUOUS
|
|
201
|
+
: entry.status === 404 || entry.status === 405
|
|
202
|
+
? HTTP_CALL_UNMATCHED
|
|
203
|
+
: HTTP_ROUTE_NOT_INVENTORIED;
|
|
204
|
+
const key = `${code}\u0000${entry.testId}\u0000${entry.method}\u0000${pathShape(entry.path)}`;
|
|
205
|
+
const bucket = grouped.get(key);
|
|
206
|
+
if (bucket === undefined)
|
|
207
|
+
grouped.set(key, [entry]);
|
|
208
|
+
else
|
|
209
|
+
bucket.push(entry);
|
|
210
|
+
}
|
|
211
|
+
for (const [key, rows] of grouped) {
|
|
212
|
+
const code = key.slice(0, key.indexOf('\u0000'));
|
|
213
|
+
const finding = rowFinding(rows, code);
|
|
214
|
+
if (finding !== null)
|
|
215
|
+
findings.push(finding);
|
|
216
|
+
}
|
|
217
|
+
for (const entry of unresolved) {
|
|
218
|
+
if (entry.code !== FRONTEND_CALL_TARGET_UNRESOLVED)
|
|
219
|
+
continue;
|
|
220
|
+
const identity = {
|
|
221
|
+
domain: HTTP_CALL_FINGERPRINT_DOMAIN,
|
|
222
|
+
code: HTTP_CALL_UNRESOLVED,
|
|
223
|
+
file: entry.location.file,
|
|
224
|
+
detail: entry.detail,
|
|
225
|
+
};
|
|
226
|
+
findings.push({
|
|
227
|
+
code: HTTP_CALL_UNRESOLVED,
|
|
228
|
+
resourceId: null,
|
|
229
|
+
location: entry.location,
|
|
230
|
+
key: `${HTTP_CALL_UNRESOLVED} ${entry.location.file}: ${entry.detail}`,
|
|
231
|
+
fingerprint: sha256Canonical(identity),
|
|
232
|
+
detail: `${entry.code}: ${entry.detail} — ${entry.location.file}:${String(entry.location.line)}`,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
findings.sort((left, right) => compareStrings(left.code, right.code) ||
|
|
236
|
+
compareStrings(left.resourceId ?? '', right.resourceId ?? '') ||
|
|
237
|
+
compareStrings(left.detail, right.detail));
|
|
238
|
+
// Equal identities are one debt: a repeated call counts once.
|
|
239
|
+
const unique = new Map();
|
|
240
|
+
for (const finding of findings) {
|
|
241
|
+
if (!unique.has(finding.fingerprint))
|
|
242
|
+
unique.set(finding.fingerprint, finding);
|
|
243
|
+
}
|
|
244
|
+
return [...unique.values()];
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Applies R1-R5 to one run.
|
|
248
|
+
*
|
|
249
|
+
* Args:
|
|
250
|
+
* input: the route table, the ledger, the graded obligations, the
|
|
251
|
+
* graph's unresolved entries and the owner's channel declaration.
|
|
252
|
+
*
|
|
253
|
+
* Returns:
|
|
254
|
+
* HttpCoverageResult: the summary line's numbers, the typed findings
|
|
255
|
+
* (identical in both modes) and the used-but-unproven routes with
|
|
256
|
+
* their callers.
|
|
257
|
+
*/
|
|
258
|
+
export function evaluateHttpCoverage(input) {
|
|
259
|
+
const routes = [...input.routes].sort((left, right) => compareStrings(left.resourceId, right.resourceId));
|
|
260
|
+
const ledger = input.ledger ?? null;
|
|
261
|
+
const mountProvenanceEmitted = input.mountProvenanceEmitted === true;
|
|
262
|
+
const used = usedRoutes(routes, ledger, mountProvenanceEmitted);
|
|
263
|
+
const verdicts = input.verdicts ?? [];
|
|
264
|
+
const proven = new Set();
|
|
265
|
+
for (const [resourceId] of used) {
|
|
266
|
+
const states = TRANSPORT_CONTRACTS.map((contract) => verdicts.find((entry) => entry.resourceId === resourceId && entry.contract === contract)?.verdict);
|
|
267
|
+
// A waiver is a recorded forgiveness, not proof: only two
|
|
268
|
+
// `satisfied` verdicts prove the route.
|
|
269
|
+
if (states.every((state) => state === 'satisfied'))
|
|
270
|
+
proven.add(resourceId);
|
|
271
|
+
}
|
|
272
|
+
const missingRoutes = [...used.values()]
|
|
273
|
+
.filter((entry) => !proven.has(entry.resourceId))
|
|
274
|
+
.sort((left, right) => compareStrings(left.resourceId, right.resourceId));
|
|
275
|
+
const rows = ledger?.rows ?? [];
|
|
276
|
+
return {
|
|
277
|
+
summary: {
|
|
278
|
+
served: routes.filter((route) => isServed(route, mountProvenanceEmitted)).length,
|
|
279
|
+
used: used.size,
|
|
280
|
+
proven: proven.size,
|
|
281
|
+
missing: missingRoutes.length,
|
|
282
|
+
unmatched: rows.filter((entry) => entry.kind === 'api' &&
|
|
283
|
+
entry.resolution === 'nomatch' &&
|
|
284
|
+
(entry.status === 404 || entry.status === 405)).length,
|
|
285
|
+
ambiguous: rows.filter((entry) => entry.kind === 'api' && entry.resolution === 'ambiguous').length,
|
|
286
|
+
...((ledger?.summary.inventory ?? (routes.length === 0 ? 'unavailable' : 'complete')) === 'complete'
|
|
287
|
+
? {}
|
|
288
|
+
: { inventory: ledger?.summary.inventory ?? 'unavailable' }),
|
|
289
|
+
},
|
|
290
|
+
findings: callFindings(ledger, input.unresolvedCallSites ?? []),
|
|
291
|
+
missingRoutes,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Projects the call findings onto the report's existing finding channel
|
|
296
|
+
* (`kind: 'finding'`, typed cause, the shared next action), so text, json
|
|
297
|
+
* and SARIF render them like every other finding.
|
|
298
|
+
*
|
|
299
|
+
* The CHANNEL is the caller's decision (the owner's `http.callFindings`):
|
|
300
|
+
* this function only shapes the entries.
|
|
301
|
+
*
|
|
302
|
+
* Args:
|
|
303
|
+
* findings: the run's call findings.
|
|
304
|
+
*
|
|
305
|
+
* Returns:
|
|
306
|
+
* BlockingEntry[]: one entry per finding, deterministically ordered.
|
|
307
|
+
*/
|
|
308
|
+
export function httpCallFindingEntries(findings) {
|
|
309
|
+
return findings.map((finding) => {
|
|
310
|
+
const inventoryGap = finding.code === HTTP_ROUTE_NOT_INVENTORIED;
|
|
311
|
+
return {
|
|
312
|
+
kind: 'finding',
|
|
313
|
+
resourceId: finding.resourceId,
|
|
314
|
+
name: null,
|
|
315
|
+
detail: `${finding.code}: ${finding.detail}`,
|
|
316
|
+
location: finding.location,
|
|
317
|
+
cause: inventoryGap ? null : finding.code,
|
|
318
|
+
nextAction: inventoryGap ? null : CAUSE_NEXT_ACTIONS[finding.code],
|
|
319
|
+
};
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Projects the witness's body-shape findings (0.14 WP4) onto the finding
|
|
324
|
+
* channel: one entry per mismatched or refused exchange, in ledger order.
|
|
325
|
+
* `ok` and `unchecked` rows are not findings. The CHANNEL is the caller's
|
|
326
|
+
* decision (`http.responseShape: report` surfaces them as advisories; the
|
|
327
|
+
* `block` setting fails through the body obligation instead).
|
|
328
|
+
*
|
|
329
|
+
* Args:
|
|
330
|
+
* rows: the run's ledger rows.
|
|
331
|
+
*
|
|
332
|
+
* Returns:
|
|
333
|
+
* BlockingEntry[]: one entry per mismatch or refusal.
|
|
334
|
+
*/
|
|
335
|
+
export function httpResponseShapeEntries(rows) {
|
|
336
|
+
return rows
|
|
337
|
+
.filter((row) => row.kind === 'api' && (row.shape === 'mismatch' || row.shape === 'refused'))
|
|
338
|
+
.map((row) => {
|
|
339
|
+
const cause = row.shape === 'mismatch' ? 'HTTP_RESPONSE_SHAPE_MISMATCH' : 'HTTP_BODY_TOO_LARGE';
|
|
340
|
+
return {
|
|
341
|
+
kind: 'finding',
|
|
342
|
+
resourceId: row.route,
|
|
343
|
+
name: null,
|
|
344
|
+
detail: `${cause}: ${row.testId} ${row.method} ${row.path} (status ${row.status}): ${row.shapeDetail ?? ''}`,
|
|
345
|
+
location: null,
|
|
346
|
+
cause,
|
|
347
|
+
nextAction: CAUSE_NEXT_ACTIONS[cause],
|
|
348
|
+
};
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
//# sourceMappingURL=http-coverage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-coverage.js","sourceRoot":"","sources":["../../src/verdict/http-coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAkB,MAAM,uBAAuB,CAAC;AAI3E,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAE/F,qEAAqE;AACrE,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AACzD,wFAAwF;AACxF,MAAM,CAAC,MAAM,0BAA0B,GAAG,4BAA4B,CAAC;AAEvE,yEAAyE;AACzE,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAEzD,+DAA+D;AAC/D,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,+BAA+B,GAAG,iCAAiC,CAAC;AAqH1E,kEAAkE;AAClE,MAAM,mBAAmB,GAAsB,CAAC,qBAAqB,EA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CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAA8B;IACrE,OAAO,IAAI;SACR,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,UAAU,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;SAC5F,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACX,MAAM,KAAK,GAAc,GAAG,CAAC,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC,qBAAqB,CAAC;QAC3G,OAAO;YACL,IAAI,EAAE,SAAkB;YACxB,UAAU,EAAE,GAAG,CAAC,KAAK;YACrB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,GAAG,KAAK,KAAK,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,YAAY,GAAG,CAAC,MAAM,MAAM,GAAG,CAAC,WAAW,IAAI,EAAE,EAAE;YAC5G,QAAQ,EAAE,IAAI;YACd,KAAK;YACL,UAAU,EAAE,kBAAkB,CAAC,KAAK,CAAC;SACtC,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { HttpRouteCandidate } from './registry.js';
|
|
2
|
+
/** How the one resolver placed one witnessed exchange. */
|
|
3
|
+
export type HttpLedgerResolution = 'match' | 'nomatch' | 'ambiguous' | 'incomplete';
|
|
4
|
+
/** Whether the observed request represents API, page, asset or unknown traffic. */
|
|
5
|
+
export type HttpLedgerKind = 'api' | 'page' | 'asset' | 'unknown';
|
|
6
|
+
/** The witness's body-vs-model verdict as the ledger shows it (0.14 WP4). */
|
|
7
|
+
export type HttpLedgerShape = 'ok' | 'mismatch' | 'unchecked' | 'refused';
|
|
8
|
+
/** One ledger row: one witnessed exchange, attributed. */
|
|
9
|
+
export interface HttpLedgerRow {
|
|
10
|
+
/** The test the exchange belongs to (`page-sweep` for sweep sessions). */
|
|
11
|
+
testId: string;
|
|
12
|
+
/** Uppercase request method. */
|
|
13
|
+
method: string;
|
|
14
|
+
/** The observed path, query stripped (the interpreted path). */
|
|
15
|
+
path: string;
|
|
16
|
+
/** The observed response status. */
|
|
17
|
+
status: number;
|
|
18
|
+
/** Sec-Fetch-Dest classification; only `api` may produce R2/R3 findings. */
|
|
19
|
+
kind: HttpLedgerKind;
|
|
20
|
+
/** The serving route's resource id, or null when unresolved. */
|
|
21
|
+
route: string | null;
|
|
22
|
+
/** The ONE resolver's placement of the exchange. */
|
|
23
|
+
resolution: HttpLedgerResolution;
|
|
24
|
+
/** The equal candidates' identity texts, when the placement is ambiguous. */
|
|
25
|
+
candidates?: string[];
|
|
26
|
+
/** The witness's body-vs-model verdict, when the exchange carried one (0.14 WP4). */
|
|
27
|
+
shape?: HttpLedgerShape;
|
|
28
|
+
/** The first mismatch pointer and message, or the refusal cause. */
|
|
29
|
+
shapeDetail?: string;
|
|
30
|
+
}
|
|
31
|
+
/** Row counts by resolution (exchanges equals the row count). */
|
|
32
|
+
export interface HttpLedgerSummary {
|
|
33
|
+
exchanges: number;
|
|
34
|
+
matched: number;
|
|
35
|
+
unmatched: number;
|
|
36
|
+
ambiguous: number;
|
|
37
|
+
incomplete: number;
|
|
38
|
+
inventory?: 'complete' | 'incomplete' | 'unavailable';
|
|
39
|
+
}
|
|
40
|
+
/** The whole-run ledger embedded report-only in the run report JSON. */
|
|
41
|
+
export interface HttpLedger {
|
|
42
|
+
rows: HttpLedgerRow[];
|
|
43
|
+
summary: HttpLedgerSummary;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Builds the run's exchange ledger from the run's records (the same
|
|
47
|
+
* authorized set the verdict engine grades) and the complete route
|
|
48
|
+
* inventory.
|
|
49
|
+
*
|
|
50
|
+
* Only WITNESSED `http.exchanges` records count (`witnessed` tier with
|
|
51
|
+
* verifying provenance — the same rule `trustOf` applies elsewhere);
|
|
52
|
+
* every well-formed exchange entry of theirs becomes one row, resolved
|
|
53
|
+
* by `matchHttpRoute`. Malformed entries and non-ledger records are
|
|
54
|
+
* skipped, never guessed.
|
|
55
|
+
*
|
|
56
|
+
* Args:
|
|
57
|
+
* records: the run's records (untrusted, lenient).
|
|
58
|
+
* httpRoutes: the complete host-derived route inventory (the same
|
|
59
|
+
* input core passes to `resolveHttpRoute`); null/undefined resolves
|
|
60
|
+
* every row `nomatch` — an empty inventory matches nothing.
|
|
61
|
+
*
|
|
62
|
+
* Returns:
|
|
63
|
+
* HttpLedger: rows sorted by (testId, method, path, status) and the
|
|
64
|
+
* resolution summary.
|
|
65
|
+
*/
|
|
66
|
+
export declare function buildHttpLedger(records: readonly unknown[], httpRoutes: readonly HttpRouteCandidate[] | null | undefined): HttpLedger;
|
|
67
|
+
//# sourceMappingURL=http-ledger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-ledger.d.ts","sourceRoot":"","sources":["../../src/verdict/http-ledger.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExD,0DAA0D;AAC1D,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,YAAY,CAAC;AAEpF,mFAAmF;AACnF,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAElE,6EAA6E;AAC7E,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,CAAC;AAE1E,0DAA0D;AAC1D,MAAM,WAAW,aAAa;IAC5B,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,IAAI,EAAE,cAAc,CAAC;IACrB,gEAAgE;IAChE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,oDAAoD;IACpD,UAAU,EAAE,oBAAoB,CAAC;IACjC,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,qFAAqF;IACrF,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,iEAAiE;AACjE,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,aAAa,CAAC;CACvD;AAED,wEAAwE;AACxE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAgDD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,SAAS,OAAO,EAAE,EAC3B,UAAU,EAAE,SAAS,kBAAkB,EAAE,GAAG,IAAI,GAAG,SAAS,GAC3D,UAAU,CAkFZ"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The verdict-time exchange ledger (0.14 WP2, plan §4.1): every
|
|
3
|
+
* witnessed `http.exchanges` record becomes rows
|
|
4
|
+
* `{testId, method, path (query stripped), status, route, resolution}`
|
|
5
|
+
* resolved through the ONE resolver (`matchHttpRoute`) over the run's
|
|
6
|
+
* complete route inventory — the same inventory
|
|
7
|
+
* `resolveHttpRoute`/the transport verifiers grade against. The ledger
|
|
8
|
+
* is REPORT-ONLY: it never changes a verdict (the satisfaction path
|
|
9
|
+
* never reads `http.exchanges`), and this module is the only consumer
|
|
10
|
+
* of the session-wide kind.
|
|
11
|
+
*/
|
|
12
|
+
import { compareStrings } from '../graph/util.js';
|
|
13
|
+
import { isProvenancedRecord } from '../provenance.js';
|
|
14
|
+
import { HTTP_EXCHANGES_KIND, interpretObservedPath, matchHttpRoute } from './pack-verifiers.js';
|
|
15
|
+
/**
|
|
16
|
+
* Reads one entry into the lenient view; non-objects are ignored (a
|
|
17
|
+
* hostile reporter may emit anything).
|
|
18
|
+
*/
|
|
19
|
+
function asLedgerRecord(value) {
|
|
20
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
21
|
+
return null;
|
|
22
|
+
const record = value;
|
|
23
|
+
return {
|
|
24
|
+
trust: record['trust'],
|
|
25
|
+
testId: record['testId'],
|
|
26
|
+
kind: record['kind'],
|
|
27
|
+
payload: record['payload'],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Reads the witness's body verdict for one exchange (0.14 WP4) into the
|
|
32
|
+
* ledger's display fields. Absent or unrecognized input yields null, so
|
|
33
|
+
* rows for exchanges without a body check keep their existing shape.
|
|
34
|
+
*/
|
|
35
|
+
function ledgerShapeOf(value) {
|
|
36
|
+
if (typeof value !== 'object' || value === null || !('verdict' in value))
|
|
37
|
+
return null;
|
|
38
|
+
const verdict = value.verdict;
|
|
39
|
+
if (verdict === 'ok')
|
|
40
|
+
return { shape: 'ok' };
|
|
41
|
+
if (verdict === 'unchecked')
|
|
42
|
+
return { shape: 'unchecked' };
|
|
43
|
+
if (verdict === 'refused')
|
|
44
|
+
return { shape: 'refused', shapeDetail: 'HTTP_BODY_TOO_LARGE' };
|
|
45
|
+
if (verdict !== 'mismatch')
|
|
46
|
+
return null;
|
|
47
|
+
const errors = 'errors' in value ? value.errors : undefined;
|
|
48
|
+
const first = Array.isArray(errors) ? errors[0] : undefined;
|
|
49
|
+
const pointer = typeof first === 'object' && first !== null && 'pointer' in first ? first.pointer : undefined;
|
|
50
|
+
const message = typeof first === 'object' && first !== null && 'message' in first ? first.message : undefined;
|
|
51
|
+
const where = typeof pointer === 'string' && pointer !== '' ? pointer : '(document root)';
|
|
52
|
+
const what = typeof message === 'string' ? message : 'does not match the declared schema';
|
|
53
|
+
return { shape: 'mismatch', shapeDetail: `${where} ${what}` };
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Builds the run's exchange ledger from the run's records (the same
|
|
57
|
+
* authorized set the verdict engine grades) and the complete route
|
|
58
|
+
* inventory.
|
|
59
|
+
*
|
|
60
|
+
* Only WITNESSED `http.exchanges` records count (`witnessed` tier with
|
|
61
|
+
* verifying provenance — the same rule `trustOf` applies elsewhere);
|
|
62
|
+
* every well-formed exchange entry of theirs becomes one row, resolved
|
|
63
|
+
* by `matchHttpRoute`. Malformed entries and non-ledger records are
|
|
64
|
+
* skipped, never guessed.
|
|
65
|
+
*
|
|
66
|
+
* Args:
|
|
67
|
+
* records: the run's records (untrusted, lenient).
|
|
68
|
+
* httpRoutes: the complete host-derived route inventory (the same
|
|
69
|
+
* input core passes to `resolveHttpRoute`); null/undefined resolves
|
|
70
|
+
* every row `nomatch` — an empty inventory matches nothing.
|
|
71
|
+
*
|
|
72
|
+
* Returns:
|
|
73
|
+
* HttpLedger: rows sorted by (testId, method, path, status) and the
|
|
74
|
+
* resolution summary.
|
|
75
|
+
*/
|
|
76
|
+
export function buildHttpLedger(records, httpRoutes) {
|
|
77
|
+
const rows = [];
|
|
78
|
+
for (const raw of Array.isArray(records) ? records : []) {
|
|
79
|
+
const record = asLedgerRecord(raw);
|
|
80
|
+
if (record === null)
|
|
81
|
+
continue;
|
|
82
|
+
if (record.kind !== HTTP_EXCHANGES_KIND)
|
|
83
|
+
continue;
|
|
84
|
+
if (typeof record.testId !== 'string' || record.testId.length === 0)
|
|
85
|
+
continue;
|
|
86
|
+
// Ledger evidence is witness-issued only: the same provenance rule
|
|
87
|
+
// the verdict engine applies before it trusts a record's tier.
|
|
88
|
+
if (!(record.trust === 'witnessed' && isProvenancedRecord(raw)))
|
|
89
|
+
continue;
|
|
90
|
+
if (typeof record.payload !== 'object' || record.payload === null)
|
|
91
|
+
continue;
|
|
92
|
+
const exchanges = record.payload['exchanges'];
|
|
93
|
+
if (!Array.isArray(exchanges))
|
|
94
|
+
continue;
|
|
95
|
+
for (const entry of exchanges) {
|
|
96
|
+
if (typeof entry !== 'object' || entry === null || Array.isArray(entry))
|
|
97
|
+
continue;
|
|
98
|
+
const exchange = entry;
|
|
99
|
+
const method = exchange['method'];
|
|
100
|
+
const url = exchange['url'];
|
|
101
|
+
const status = exchange['status'];
|
|
102
|
+
if (typeof method !== 'string' || method.length === 0)
|
|
103
|
+
continue;
|
|
104
|
+
if (typeof url !== 'string' || url.length === 0)
|
|
105
|
+
continue;
|
|
106
|
+
if (typeof status !== 'number' || !Number.isInteger(status))
|
|
107
|
+
continue;
|
|
108
|
+
// The same path interpretation the transport verifiers run;
|
|
109
|
+
// an uninterpretable URL degrades to its query-stripped text.
|
|
110
|
+
const interpreted = interpretObservedPath(url);
|
|
111
|
+
const path = interpreted.ok ? interpreted.path : (url.split(/[?#]/, 1)[0] ?? url);
|
|
112
|
+
const shape = ledgerShapeOf(exchange['shape']);
|
|
113
|
+
const fetchDest = exchange['fetchDest'];
|
|
114
|
+
const kind = fetchDest === 'empty'
|
|
115
|
+
? 'api'
|
|
116
|
+
: fetchDest === 'document' || fetchDest === 'iframe'
|
|
117
|
+
? 'page'
|
|
118
|
+
: fetchDest === null || fetchDest === undefined
|
|
119
|
+
? 'unknown'
|
|
120
|
+
: 'asset';
|
|
121
|
+
const resolution = httpRoutes === null || httpRoutes === undefined || httpRoutes.length === 0
|
|
122
|
+
? { status: 'incomplete', reason: 'route inventory unavailable' }
|
|
123
|
+
: matchHttpRoute(method, path, httpRoutes);
|
|
124
|
+
rows.push({
|
|
125
|
+
testId: record.testId,
|
|
126
|
+
method: method.toUpperCase(),
|
|
127
|
+
path,
|
|
128
|
+
status,
|
|
129
|
+
kind,
|
|
130
|
+
route: resolution.status === 'match' ? resolution.matched.resourceId : null,
|
|
131
|
+
resolution: resolution.status,
|
|
132
|
+
...(resolution.status === 'ambiguous' ? { candidates: [...resolution.candidates] } : {}),
|
|
133
|
+
...(shape === null ? {} : shape),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
rows.sort((left, right) => compareStrings(left.testId, right.testId) ||
|
|
138
|
+
compareStrings(left.method, right.method) ||
|
|
139
|
+
compareStrings(left.path, right.path) ||
|
|
140
|
+
compareStrings(String(left.status), String(right.status)));
|
|
141
|
+
const inventory = httpRoutes === null || httpRoutes === undefined || httpRoutes.length === 0
|
|
142
|
+
? 'unavailable'
|
|
143
|
+
: rows.some((row) => row.resolution === 'incomplete')
|
|
144
|
+
? 'incomplete'
|
|
145
|
+
: 'complete';
|
|
146
|
+
const summary = {
|
|
147
|
+
exchanges: rows.length,
|
|
148
|
+
matched: 0,
|
|
149
|
+
unmatched: 0,
|
|
150
|
+
ambiguous: 0,
|
|
151
|
+
incomplete: 0,
|
|
152
|
+
...(inventory === 'complete' ? {} : { inventory }),
|
|
153
|
+
};
|
|
154
|
+
for (const row of rows) {
|
|
155
|
+
if (row.kind !== 'api')
|
|
156
|
+
continue;
|
|
157
|
+
if (row.resolution === 'match')
|
|
158
|
+
summary.matched += 1;
|
|
159
|
+
else if (row.resolution === 'nomatch')
|
|
160
|
+
summary.unmatched += 1;
|
|
161
|
+
else if (row.resolution === 'ambiguous')
|
|
162
|
+
summary.ambiguous += 1;
|
|
163
|
+
else
|
|
164
|
+
summary.incomplete += 1;
|
|
165
|
+
}
|
|
166
|
+
return { rows, summary };
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=http-ledger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-ledger.js","sourceRoot":"","sources":["../../src/verdict/http-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GA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I,GAAG,CAAC,UAAU,KAAK,OAAO;YAAE,OAAO,CAAC,OAAO,IAAI,CAAC,CAAC;aAChD,IAAI,GAAG,CAAC,UAAU,KAAK,SAAS;YAAE,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC;aACzD,IAAI,GAAG,CAAC,UAAU,KAAK,WAAW;YAAE,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC;;YAC3D,OAAO,CAAC,UAAU,IAAI,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC3B,CAAC"}
|
package/dist/verdict/index.d.ts
CHANGED
|
@@ -5,6 +5,20 @@
|
|
|
5
5
|
export { BLOCKING_VERDICTS, GateforgeVerdictError, evaluateObligation, evaluateObligations, parseInstant, volatileEchoSkips, volatileFieldsOf, } from './evaluate.js';
|
|
6
6
|
export type { ObligationVerdict, VerdictContext, VerdictOutcome, WaiverRef, } from './evaluate.js';
|
|
7
7
|
export { registerContractVerifier, verifierFor, registeredNamespaces, registerContractCapabilities, capabilityFor, setContractAvailability, allCapabilities, type ClaimEvidenceInput, type ClaimOutcome, type ContractVerifier, type ContractCapability, type ContractAvailability, type HttpRouteCandidate, } from './registry.js';
|
|
8
|
+
/**
|
|
9
|
+
* The verdict-time exchange ledger (0.14 WP2): witnessed `http.exchanges`
|
|
10
|
+
* rows resolved by the ONE route matcher — report-only input for the run
|
|
11
|
+
* report's `httpLedger`, never a verdict input.
|
|
12
|
+
*/
|
|
13
|
+
export { buildHttpLedger, type HttpLedger, type HttpLedgerResolution, type HttpLedgerRow, type HttpLedgerSummary, } from './http-ledger.js';
|
|
14
|
+
/**
|
|
15
|
+
* The HTTP call rules R1-R5 (0.14 WP3): used/proven/missing counts over
|
|
16
|
+
* the exchange ledger plus the static join, and the typed call findings
|
|
17
|
+
* (`HTTP_CALL_UNMATCHED` / `HTTP_CALL_AMBIGUOUS` /
|
|
18
|
+
* `HTTP_CALL_UNRESOLVED`). Never a verdict input.
|
|
19
|
+
*/
|
|
20
|
+
export { evaluateHttpCoverage, httpCallFindingEntries, httpResponseShapeEntries, HTTP_CALL_UNMATCHED, HTTP_CALL_AMBIGUOUS, HTTP_CALL_UNRESOLVED, HTTP_ROUTE_NOT_INVENTORIED, type HttpCallFinding, type HttpCallFindingCode, type HttpCallFindingsMode, type HttpCoverageInput, type HttpCoverageResult, type HttpCoverageRoute, type HttpCoverageSummary, type HttpCoverageUnresolved, type HttpCoverageVerdict, type HttpMissingRoute, } from './http-coverage.js';
|
|
21
|
+
export { HTTP_EXCHANGES_KIND } from './pack-verifiers.js';
|
|
8
22
|
/**
|
|
9
23
|
* Cause mapping for the shared report model (plan §5.4): stable cause
|
|
10
24
|
* codes + next actions for blocking verdicts, and the precise capability
|
|
@@ -19,7 +33,7 @@ export { causeForVerdict, capabilityGap, strictCapabilityGaps, type VerdictCause
|
|
|
19
33
|
* (same scope, distinct orders, no typed path convertor ahead of the
|
|
20
34
|
* field — 0.14); otherwise ambiguity blocks.
|
|
21
35
|
*/
|
|
22
|
-
export { registerPackVerifiers, bindQueueObserver, interpretObservedPath, resolveHttpRoute, pathMatchesShape, } from './pack-verifiers.js';
|
|
36
|
+
export { registerPackVerifiers, bindQueueObserver, interpretObservedPath, matchHttpRoute, resolveHttpRoute, pathMatchesShape, } from './pack-verifiers.js';
|
|
23
37
|
/**
|
|
24
38
|
* Required-case aggregation (plan 2026-09-19 §4.7, Phase 5): pure
|
|
25
39
|
* semantic grading across an obligation's required behavior cases —
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/verdict/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,wBAAwB,EACxB,WAAW,EACX,oBAAoB,EACpB,4BAA4B,EAC5B,aAAa,EACb,uBAAuB,EACvB,eAAe,EACf,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAC;AACvB;;;;GAIG;AACH,OAAO,EACL,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,YAAY,CAAC;AACpB;;;;;;;GAOG;AACH,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B;;;;GAIG;AACH,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/verdict/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,wBAAwB,EACxB,WAAW,EACX,oBAAoB,EACpB,4BAA4B,EAC5B,aAAa,EACb,uBAAuB,EACvB,eAAe,EACf,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,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