@descryy/core 0.2.0 → 0.3.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/budget/index.d.ts +2 -0
- package/dist/budget/index.d.ts.map +1 -1
- package/dist/budget/index.js +1 -0
- package/dist/budget/index.js.map +1 -1
- package/dist/budget/reply.d.ts +67 -0
- package/dist/budget/reply.d.ts.map +1 -0
- package/dist/budget/reply.js +76 -0
- package/dist/budget/reply.js.map +1 -0
- package/dist/contracts/engine.d.ts.map +1 -1
- package/dist/contracts/engine.js +11 -1
- package/dist/contracts/engine.js.map +1 -1
- package/dist/contracts/orphans.d.ts +17 -0
- package/dist/contracts/orphans.d.ts.map +1 -1
- package/dist/contracts/orphans.js +19 -2
- package/dist/contracts/orphans.js.map +1 -1
- package/dist/graph/cross-language.d.ts +0 -7
- package/dist/graph/cross-language.d.ts.map +1 -1
- package/dist/graph/cross-language.js +36 -2
- package/dist/graph/cross-language.js.map +1 -1
- package/dist/graph/index.d.ts +2 -0
- package/dist/graph/index.d.ts.map +1 -1
- package/dist/graph/index.js +1 -0
- package/dist/graph/index.js.map +1 -1
- package/dist/graph/observed-tests.d.ts +118 -0
- package/dist/graph/observed-tests.d.ts.map +1 -0
- package/dist/graph/observed-tests.js +123 -0
- package/dist/graph/observed-tests.js.map +1 -0
- package/dist/query/index.d.ts +5 -1
- package/dist/query/index.d.ts.map +1 -1
- package/dist/query/index.js +3 -1
- package/dist/query/index.js.map +1 -1
- package/dist/query/prominence.d.ts +73 -0
- package/dist/query/prominence.d.ts.map +1 -0
- package/dist/query/prominence.js +79 -0
- package/dist/query/prominence.js.map +1 -0
- package/dist/query/test-coverage.d.ts +65 -0
- package/dist/query/test-coverage.d.ts.map +1 -0
- package/dist/query/test-coverage.js +95 -0
- package/dist/query/test-coverage.js.map +1 -0
- package/dist/query/traverse.d.ts +60 -2
- package/dist/query/traverse.d.ts.map +1 -1
- package/dist/query/traverse.js +0 -0
- package/dist/query/traverse.js.map +1 -1
- package/dist/sources/git/diff.d.ts +14 -6
- package/dist/sources/git/diff.d.ts.map +1 -1
- package/dist/sources/git/diff.js +33 -10
- package/dist/sources/git/diff.js.map +1 -1
- package/dist/store/schema.d.ts +5 -4
- package/dist/store/schema.d.ts.map +1 -1
- package/dist/store/schema.js +42 -2
- package/dist/store/schema.js.map +1 -1
- package/package.json +2 -2
package/dist/budget/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { applySerializedSizeBudget } from "./size.ts";
|
|
2
2
|
export type { SerializedSizeBudgetOptions, SerializedSizeBudgetResult } from "./size.ts";
|
|
3
|
+
export { applyReplySizeBudget } from "./reply.ts";
|
|
4
|
+
export type { ReplySizeBudgetOptions, ReplySizeBudgetResult } from "./reply.ts";
|
|
3
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/budget/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AACtD,YAAY,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/budget/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AACtD,YAAY,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,YAAY,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/budget/index.js
CHANGED
package/dist/budget/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/budget/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/budget/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `applyReplySizeBudget` — the same discipline as `size.ts`, applied to the
|
|
3
|
+
* *whole* serialized reply rather than to one field inside it.
|
|
4
|
+
*
|
|
5
|
+
* `applySerializedSizeBudget` bounds the sum of the payloads it is pointed at
|
|
6
|
+
* and nothing else. That is what shipped as the fix for `get_git_diff`'s
|
|
7
|
+
* missing aggregate cap, and re-running the same real 48-file branch diff
|
|
8
|
+
* against it is what showed the fix was necessary but not sufficient: the
|
|
9
|
+
* patch budget *was* enforced (13 files carried patch text where 44 had
|
|
10
|
+
* before) and the call still failed outright, at 84,516 characters, because
|
|
11
|
+
* the per-file status/additions/deletions rows for all 48 files, plus the
|
|
12
|
+
* reply's own disclosures and envelope, sit outside that budget entirely.
|
|
13
|
+
*
|
|
14
|
+
* The lesson is the same one `size.ts` records one level down, and it has now
|
|
15
|
+
* been learned twice: **a cap over one part of a reply bounds nothing about
|
|
16
|
+
* the reply.** So this budget takes everything it does not own as
|
|
17
|
+
* `overheadBytes` and shrinks in two stages, most-destructive last:
|
|
18
|
+
*
|
|
19
|
+
* 1. **Withhold payloads.** Prefix rule, exactly as `size.ts`: leading items
|
|
20
|
+
* keep theirs, later ones are withheld carrying a named reason.
|
|
21
|
+
* 2. **Drop trailing items** — only when the fully-withheld list *still* does
|
|
22
|
+
* not fit, i.e. the metadata alone is over budget. Reported as a count, so
|
|
23
|
+
* a caller re-requests narrowed rather than reading a silently short list
|
|
24
|
+
* as a complete one.
|
|
25
|
+
*
|
|
26
|
+
* **Breadth before depth**: if stage 2 had to fire, no payload is restored for
|
|
27
|
+
* the survivors even when bytes remain. Spending the last of a budget on patch
|
|
28
|
+
* text while files are being dropped from the list is the wrong trade, and a
|
|
29
|
+
* reply that is both short *and* deep is harder to act on than one that is
|
|
30
|
+
* short and says so.
|
|
31
|
+
*/
|
|
32
|
+
export interface ReplySizeBudgetOptions<T> {
|
|
33
|
+
/** The cap on `overheadBytes` plus the serialized size of every kept item. */
|
|
34
|
+
readonly maxTotalBytes: number;
|
|
35
|
+
/**
|
|
36
|
+
* What the rest of the reply costs — envelope, headline, disclosures,
|
|
37
|
+
* everything this budget does not own. Measured by the caller, not guessed:
|
|
38
|
+
* an under-stated overhead is exactly how the first fix came in over the
|
|
39
|
+
* ceiling anyway.
|
|
40
|
+
*/
|
|
41
|
+
readonly overheadBytes: number;
|
|
42
|
+
/**
|
|
43
|
+
* This item's own serialized cost in bytes, **including** whatever separator
|
|
44
|
+
* it carries in the encoded list (a comma, for JSON). Called on both the
|
|
45
|
+
* full and the withheld form of an item.
|
|
46
|
+
*/
|
|
47
|
+
readonly sizeOf: (item: T) => number;
|
|
48
|
+
/** True while this item still carries a payload the budget could withhold. */
|
|
49
|
+
readonly hasPayload: (item: T) => boolean;
|
|
50
|
+
/** Rebuild this item without its payload, carrying a reason the caller can read. */
|
|
51
|
+
readonly withhold: (item: T, spentBytes: number) => T;
|
|
52
|
+
}
|
|
53
|
+
export interface ReplySizeBudgetResult<T> {
|
|
54
|
+
/**
|
|
55
|
+
* Order preserved. Shorter than the input exactly when `droppedCount > 0` —
|
|
56
|
+
* see that field, and never without it being reported.
|
|
57
|
+
*/
|
|
58
|
+
readonly items: readonly T[];
|
|
59
|
+
/** How many kept items had a payload withheld by this budget. */
|
|
60
|
+
readonly withheldCount: number;
|
|
61
|
+
/** How many trailing items are absent from `items` entirely. */
|
|
62
|
+
readonly droppedCount: number;
|
|
63
|
+
/** `overheadBytes` plus every kept item — an upper bound, never an under-count. */
|
|
64
|
+
readonly totalBytes: number;
|
|
65
|
+
}
|
|
66
|
+
export declare function applyReplySizeBudget<T>(items: readonly T[], options: ReplySizeBudgetOptions<T>): ReplySizeBudgetResult<T>;
|
|
67
|
+
//# sourceMappingURL=reply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../src/budget/reply.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,8EAA8E;IAC9E,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IACrC,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;IAC1C,oFAAoF;IACpF,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC,CAAC;CACvD;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,gEAAgE;IAChE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,mFAAmF;IACnF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,GACjC,qBAAqB,CAAC,CAAC,CAAC,CA+C1B"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `applyReplySizeBudget` — the same discipline as `size.ts`, applied to the
|
|
3
|
+
* *whole* serialized reply rather than to one field inside it.
|
|
4
|
+
*
|
|
5
|
+
* `applySerializedSizeBudget` bounds the sum of the payloads it is pointed at
|
|
6
|
+
* and nothing else. That is what shipped as the fix for `get_git_diff`'s
|
|
7
|
+
* missing aggregate cap, and re-running the same real 48-file branch diff
|
|
8
|
+
* against it is what showed the fix was necessary but not sufficient: the
|
|
9
|
+
* patch budget *was* enforced (13 files carried patch text where 44 had
|
|
10
|
+
* before) and the call still failed outright, at 84,516 characters, because
|
|
11
|
+
* the per-file status/additions/deletions rows for all 48 files, plus the
|
|
12
|
+
* reply's own disclosures and envelope, sit outside that budget entirely.
|
|
13
|
+
*
|
|
14
|
+
* The lesson is the same one `size.ts` records one level down, and it has now
|
|
15
|
+
* been learned twice: **a cap over one part of a reply bounds nothing about
|
|
16
|
+
* the reply.** So this budget takes everything it does not own as
|
|
17
|
+
* `overheadBytes` and shrinks in two stages, most-destructive last:
|
|
18
|
+
*
|
|
19
|
+
* 1. **Withhold payloads.** Prefix rule, exactly as `size.ts`: leading items
|
|
20
|
+
* keep theirs, later ones are withheld carrying a named reason.
|
|
21
|
+
* 2. **Drop trailing items** — only when the fully-withheld list *still* does
|
|
22
|
+
* not fit, i.e. the metadata alone is over budget. Reported as a count, so
|
|
23
|
+
* a caller re-requests narrowed rather than reading a silently short list
|
|
24
|
+
* as a complete one.
|
|
25
|
+
*
|
|
26
|
+
* **Breadth before depth**: if stage 2 had to fire, no payload is restored for
|
|
27
|
+
* the survivors even when bytes remain. Spending the last of a budget on patch
|
|
28
|
+
* text while files are being dropped from the list is the wrong trade, and a
|
|
29
|
+
* reply that is both short *and* deep is harder to act on than one that is
|
|
30
|
+
* short and says so.
|
|
31
|
+
*/
|
|
32
|
+
export function applyReplySizeBudget(items, options) {
|
|
33
|
+
const { maxTotalBytes, overheadBytes, sizeOf, hasPayload, withhold } = options;
|
|
34
|
+
// The withheld form's size is measured with `maxTotalBytes` as the spent
|
|
35
|
+
// figure because the reason text carries that number and no figure this
|
|
36
|
+
// budget can report is wider than the cap itself. Measuring with the widest
|
|
37
|
+
// possible number can only over-estimate, and over-estimating is the safe
|
|
38
|
+
// direction: the fitted reply lands under the ceiling, never over it.
|
|
39
|
+
const bare = items.map((item) => (hasPayload(item) ? withhold(item, maxTotalBytes) : item));
|
|
40
|
+
const bareBytes = bare.map(sizeOf);
|
|
41
|
+
let total = overheadBytes;
|
|
42
|
+
for (const bytes of bareBytes)
|
|
43
|
+
total += bytes;
|
|
44
|
+
let kept = items.length;
|
|
45
|
+
while (kept > 0 && total > maxTotalBytes) {
|
|
46
|
+
kept -= 1;
|
|
47
|
+
total -= bareBytes[kept];
|
|
48
|
+
}
|
|
49
|
+
const droppedCount = items.length - kept;
|
|
50
|
+
const out = bare.slice(0, kept);
|
|
51
|
+
let withheldCount = 0;
|
|
52
|
+
for (let i = 0; i < kept; i += 1)
|
|
53
|
+
if (hasPayload(items[i]))
|
|
54
|
+
withheldCount += 1;
|
|
55
|
+
if (droppedCount === 0) {
|
|
56
|
+
for (let i = 0; i < kept; i += 1) {
|
|
57
|
+
const item = items[i];
|
|
58
|
+
if (!hasPayload(item))
|
|
59
|
+
continue;
|
|
60
|
+
// Negative when a tiny payload costs less than the sentence explaining
|
|
61
|
+
// its absence — a real case, and restoring it is then strictly better.
|
|
62
|
+
const delta = sizeOf(item) - bareBytes[i];
|
|
63
|
+
if (total + delta > maxTotalBytes)
|
|
64
|
+
break; // prefix rule — see the header
|
|
65
|
+
total += delta;
|
|
66
|
+
out[i] = item;
|
|
67
|
+
withheldCount -= 1;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Every item still withheld is rebuilt with the figure actually spent rather
|
|
71
|
+
// than the cap-width estimate above. `total <= maxTotalBytes` here, so the
|
|
72
|
+
// rebuilt reason is never wider than what was measured — the bound holds.
|
|
73
|
+
const finalItems = out.map((item, i) => item === items[i] || !hasPayload(items[i]) ? item : withhold(items[i], total));
|
|
74
|
+
return { items: finalItems, withheldCount, droppedCount,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AAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,kFAAkF;IAClF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,gFAAgF;IAChF,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC7B;AAED,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,8DAA8D;IAC9D,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC9B;AAqGD,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,GAAE,eAAoB,GAC5B,WAAW,CAAC,aAAa,CAAC,CAwL5B"}
|
package/dist/contracts/engine.js
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
* this is closed; the consumer half is not.
|
|
44
44
|
*/
|
|
45
45
|
import { createResolutionFloor } from "../query/resolution-floor.js";
|
|
46
|
-
import { findContractOrphans } from "./orphans.js";
|
|
46
|
+
import { findContractOrphans, PATH_LEVEL_ONLY_NOTE, } from "./orphans.js";
|
|
47
47
|
import { compareShapes, readShape } from "./shapes.js";
|
|
48
48
|
/** Shapes a caller declared on its `USES_API` edge, by direction. */
|
|
49
49
|
function consumerShapes(provider, caller, edgeAttrs) {
|
|
@@ -265,6 +265,16 @@ export function checkContracts(provider, options = {}) {
|
|
|
265
265
|
"by rank would decide it by whichever row the index reached first.");
|
|
266
266
|
}
|
|
267
267
|
if (shapes.ran) {
|
|
268
|
+
// The path half disclosed that no shape was compared, because from inside
|
|
269
|
+
// that half it is true. It is false here, and a coverage disclosure that
|
|
270
|
+
// denies the comparison reported beside it is worse than a wrong summary:
|
|
271
|
+
// the disclosure list is the part a caller is told to trust about what an
|
|
272
|
+
// answer does not cover, so a correct finding arrives discounted by the
|
|
273
|
+
// tool's own footnote. Retracted by identity rather than by pattern, so a
|
|
274
|
+
// reworded note cannot silently stop being retracted.
|
|
275
|
+
const stale = notes.indexOf(PATH_LEVEL_ONLY_NOTE);
|
|
276
|
+
if (stale !== -1)
|
|
277
|
+
notes.splice(stale, 1);
|
|
268
278
|
notes.push(`${comparable} shape pair(s) were compared and ${mismatches.length} disagreed. A field the ` +
|
|
269
279
|
"reading side ignores is not reported — only one the reading side needs and the writing " +
|
|
270
280
|
"side does not supply.");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/contracts/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAKH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/contracts/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAKH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GAGrB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,SAAS,EAAoC,MAAM,aAAa,CAAC;AA+CzF,qEAAqE;AACrE,SAAS,cAAc,CACrB,QAA2B,EAC3B,MAAc,EACd,SAAkC;IAElC,MAAM,GAAG,GAA2C,EAAE,CAAC;IAEvD,KAAK,MAAM,SAAS,IAAI,CAAC,SAAS,EAAE,UAAU,CAAU,EAAE,CAAC;QACzD,MAAM,KAAK,GAAG,GAAG,SAAS,MAAM,CAAC;QACjC,MAAM,SAAS,GAAG,GAAG,SAAS,QAAQ,CAAC;QAEvC,MAAM,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AC1F,yFAAyF;YACzF,uBAAuB,CAC1B,CAAC;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,OAAO,CAAC,MAAc;IAC7B,OAAO;QACL,GAAG,EAAE,KAAK;QACV,UAAU,EAAE,CAAC;QACb,UAAU,EAAE,EAAE;QACd,YAAY,EAAE,CAAC;QACf,YAAY,EAAE,CAAC;QACf,WAAW,EAAE,CAAC;QACd,mBAAmB,EAAE,CAAC;QACtB,QAAQ,EAAE,CAAC,MAAM,CAAC;KACnB,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CACf,QAA2B,EAC3B,KAAqB,EACrB,MAAkB,EAClB,UAAuC,EACvC,KAAwB,EACxB,aAA8B,CAAC;IAE/B,2EAA2E;IAC3E,gFAAgF;IAChF,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,CAC9B,UAAU,CAAC,KAAK,CAAC,eAAe,EAChC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CACT,CAAC;IACrB,MAAM,KAAK,GAAe,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,EAAE,eAAe,EAAE,CAAC;IACvE,OAAO;QACL,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;QACvB,KAAK;QACL,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC;KAClB,CAAC;AACJ,CAAC"}
|
|
@@ -83,6 +83,23 @@ export interface ContractReport {
|
|
|
83
83
|
/** True when the R3 shape comparison did not run. Always true in this half. */
|
|
84
84
|
readonly shapesCompared: boolean;
|
|
85
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* The path half's own coverage disclosure, exported so the shape half can retract
|
|
88
|
+
* it rather than restate it.
|
|
89
|
+
*
|
|
90
|
+
* This function is the path half and cannot know whether a shape comparison
|
|
91
|
+
* followed, so it always says one did not. That was true for as long as the path
|
|
92
|
+
* half was the only half that ran, and it stopped being true the moment a
|
|
93
|
+
* producer attached direction to a route's DTOs — leaving `contracts` reporting
|
|
94
|
+
* a shape mismatch above a disclosure denying any shape was compared. Measured
|
|
95
|
+
* against the real binary, UAT phase 2.
|
|
96
|
+
*
|
|
97
|
+
* A caller that runs the shape half removes this note when a comparison actually
|
|
98
|
+
* happened. It is a constant rather than a regex on the caller's side because a
|
|
99
|
+
* disclosure matched by pattern is a disclosure that silently stops being
|
|
100
|
+
* retracted the day someone rewords it.
|
|
101
|
+
*/
|
|
102
|
+
export declare const PATH_LEVEL_ONLY_NOTE: string;
|
|
86
103
|
export interface OrphanOptions {
|
|
87
104
|
/** Cap on endpoints enumerated. Truncation is reported, never silent. */
|
|
88
105
|
readonly limit?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orphans.d.ts","sourceRoot":"","sources":["../../src/contracts/orphans.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,KAAK,EAAE,iBAAiB,EAAc,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACvF,OAAO,EAAiC,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE1E,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;AAEzE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,uEAAuE;IACvE,QA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,WAAW,aAAa;IAC5B,yEAAyE;IACzE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAYD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,GAAE,aAAkB,GAC1B,WAAW,CAAC,cAAc,CAAC,CA0M7B"}
|
|
@@ -46,6 +46,24 @@
|
|
|
46
46
|
* another service, curl. It is a lead, not a defect, and the wording says so.
|
|
47
47
|
*/
|
|
48
48
|
import { nearestMiss } from "./paths.js";
|
|
49
|
+
/**
|
|
50
|
+
* The path half's own coverage disclosure, exported so the shape half can retract
|
|
51
|
+
* it rather than restate it.
|
|
52
|
+
*
|
|
53
|
+
* This function is the path half and cannot know whether a shape comparison
|
|
54
|
+
* followed, so it always says one did not. That was true for as long as the path
|
|
55
|
+
* half was the only half that ran, and it stopped being true the moment a
|
|
56
|
+
* producer attached direction to a route's DTOs — leaving `contracts` reporting
|
|
57
|
+
* a shape mismatch above a disclosure denying any shape was compared. Measured
|
|
58
|
+
* against the real binary, UAT phase 2.
|
|
59
|
+
*
|
|
60
|
+
* A caller that runs the shape half removes this note when a comparison actually
|
|
61
|
+
* happened. It is a constant rather than a regex on the caller's side because a
|
|
62
|
+
* disclosure matched by pattern is a disclosure that silently stops being
|
|
63
|
+
* retracted the day someone rewords it.
|
|
64
|
+
*/
|
|
65
|
+
export const PATH_LEVEL_ONLY_NOTE = "Path level only. Request and response shapes were not compared — that requires R3 on both " +
|
|
66
|
+
"sides, because it compares shapes rather than names.";
|
|
49
67
|
const DEFAULT_MAX_FINDINGS = 25;
|
|
50
68
|
function keyOf(endpoint) {
|
|
51
69
|
const method = endpoint.attrs["method"];
|
|
@@ -193,8 +211,7 @@ export function findContractOrphans(provider, options = {}) {
|
|
|
193
211
|
"explanation is a service outside this workspace, and the honest statement is that their " +
|
|
194
212
|
"provider was never read.");
|
|
195
213
|
}
|
|
196
|
-
notes.push(
|
|
197
|
-
"sides, because it compares shapes rather than names.");
|
|
214
|
+
notes.push(PATH_LEVEL_ONLY_NOTE);
|
|
198
215
|
let floor = 4;
|
|
199
216
|
for (const finding of kept)
|
|
200
217
|
if (finding.resolution < floor)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orphans.js","sourceRoot":"","sources":["../../src/contracts/orphans.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAKH,OAAO,EAAE,WAAW,EAAmC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"orphans.js","sourceRoot":"","sources":["../../src/contracts/orphans.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAKH,OAAO,EAAE,WAAW,EAAmC,MAAM,YAAY,CAAC;AAwC1E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAC/B,4FAA4F;IAC5F,sDAAsD,CAAC;AAYzD,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC,SAAS,KAAK,CAAC,QAAgB;IAC7B,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACxC,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACpD,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,YAAY,KAAK,QAAQ;QACnE,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE;QAC1B,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,QAA2B,EAC3B,UAAyB,EAAE;IAE3B,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,oBAAoB,CAAC;IAChE,MAAM,GAAG,GAAG,QAAQ,CAAC,WAAW,CAC9B,cA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2B,EAC3B,IAAoB,EACpB,eAAgC,EAChC,SAAkB,EAClB,KAAe;IAEf,MAAM,KAAK,GAAe,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,EAAE,eAAe,EAAE,CAAC;IACvE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AAC3C,CAAC"}
|
|
@@ -59,12 +59,5 @@ export interface CrossLanguageResult {
|
|
|
59
59
|
readonly resolved: readonly IREdge[];
|
|
60
60
|
readonly ambiguous: readonly CrossLanguageAmbiguity[];
|
|
61
61
|
}
|
|
62
|
-
/**
|
|
63
|
-
* @param batches Every batch in this build, from every adapter.
|
|
64
|
-
* @param namespaceOf A batch's `producedBy` (`adapterId@version`) to its
|
|
65
|
-
* declared namespace, if any. The caller supplies this because a
|
|
66
|
-
* `CapabilityMatrix` is a per-adapter fact, not a per-batch one, and this
|
|
67
|
-
* pass is deliberately kept ignorant of how an adapter is instantiated.
|
|
68
|
-
*/
|
|
69
62
|
export declare function resolveCrossLanguage(batches: readonly IRBatch[], namespaceOf: (producedBy: string) => NamespaceDeclaration | undefined): CrossLanguageResult;
|
|
70
63
|
//# sourceMappingURL=cross-language.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cross-language.d.ts","sourceRoot":"","sources":["../../src/graph/cross-language.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,KAAK,EAAY,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5E,mFAAmF;AACnF,eAAO,MAAM,oBAAoB,8BAA8B,CAAC;AAEhE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED;4DAC4D;AAC5D,MAAM,WAAW,sBAAsB;IACr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utualPeer(a, b) {
|
|
|
53
53
|
* `CapabilityMatrix` is a per-adapter fact, not a per-batch one, and this
|
|
54
54
|
* pass is deliberately kept ignorant of how an adapter is instantiated.
|
|
55
55
|
*/
|
|
56
|
+
/**
|
|
57
|
+
* A batch's `unresolved` list, tolerating the producer that has never heard of
|
|
58
|
+
* the field.
|
|
59
|
+
*
|
|
60
|
+
* `normaliseBatch` — every batch's gatekeeper on the way to the store — treats
|
|
61
|
+
* `unresolved` as absent-means-none, and says why in its own comment: absent is
|
|
62
|
+
* what a producer not yet updated to report it sends. Adapters are versioned
|
|
63
|
+
* and released on their own cadence exactly so that can happen, so a batch this
|
|
64
|
+
* pass rejects is one the Normaliser would have accepted.
|
|
65
|
+
*
|
|
66
|
+
* This is the same unguarded `.length` that crashed a real `analyze` run
|
|
67
|
+
* (b9044b2), reported as the *adapter* failing while the adapter was returning
|
|
68
|
+
* over a thousand perfectly good nodes. This pass is not reachable from
|
|
69
|
+
* `analyze` today, so it was latent rather than live — which is a reason to
|
|
70
|
+
* close it while the reason is written down, not a reason to leave it.
|
|
71
|
+
*
|
|
72
|
+
* Absent and malformed stay different, the line the Normaliser draws too: a
|
|
73
|
+
* missing field is an older producer, a field holding a string is a broken one,
|
|
74
|
+
* and defaulting the second away would hide a real defect. The producer is
|
|
75
|
+
* named in the message because that is the one thing a reader needs and cannot
|
|
76
|
+
* recover from the stack.
|
|
77
|
+
*/
|
|
78
|
+
function referencingRefs(batch) {
|
|
79
|
+
const raw = batch.unresolved;
|
|
80
|
+
if (raw === undefined || raw === null)
|
|
81
|
+
return [];
|
|
82
|
+
if (!Array.isArray(raw)) {
|
|
83
|
+
throw new Error(`${batch.producedBy} produced a batch whose "unresolved" is not an array. Absent is ` +
|
|
84
|
+
"accepted — it is what a producer compiled before the field existed sends — but a " +
|
|
85
|
+
"present, non-array value is a defect in the producer, not an older version of it.");
|
|
86
|
+
}
|
|
87
|
+
return raw;
|
|
88
|
+
}
|
|
56
89
|
export function resolveCrossLanguage(batches, namespaceOf) {
|
|
57
90
|
// One entry per batch that actually declared a namespace. A batch with no
|
|
58
91
|
// declaration contributes nothing to either side — it is neither a source
|
|
@@ -67,9 +100,10 @@ export function resolveCrossLanguage(batches, namespaceOf) {
|
|
|
67
100
|
const resolved = [];
|
|
68
101
|
const ambiguous = [];
|
|
69
102
|
for (const referencing of declaring) {
|
|
70
|
-
|
|
103
|
+
const refs = referencingRefs(referencing.batch);
|
|
104
|
+
if (refs.length === 0)
|
|
71
105
|
continue;
|
|
72
|
-
for (const ref of
|
|
106
|
+
for (const ref of refs) {
|
|
73
107
|
const candidates = [];
|
|
74
108
|
for (const declaringSide of declaring) {
|
|
75
109
|
if (declaringSide.batch === referencing.batch)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cross-language.js","sourceRoot":"","sources":["../../src/graph/cross-language.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAIH,mFAAmF;AACnF,MAAM,CAAC,MAAM,oBAAoB,GAAG,2BAA2B,CAAC;AAoBhE,SAAS,YAAY,CAAC,CAAuB,EAAE,CAAuB;IACpE,OAAO,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAA2B,EAC3B,WAAqE;IAErE,0EAA0E;IAC1E,0EAA0E;IAC1E,wCAAwC;IACxC,MAAM,SAAS,GAAG,OAAO;SACtB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;SACrE,MAAM,CACL,CAAC,KAAK,EAAgE,EAAE,CACtE,KAAK,CAAC,SAAS,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gBAC1B,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,CAAC,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAC,CAAC;gBAChG,SAAS;YACX,CAAC;YAED,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,GAAG,CAAC,UAAU;gBACpB,EAAE,EAAE,UAAU,CAAC,CAAC,CAAE;gBAClB,IAAI,EAAE,GAAG,CAAC,QAA2B;gBACrC,UAAU,EAAE,CAAC;gBACb,UAAU,EAAE,CAAC;gBACb,UAAU,EAAE,oBAAoB;aACjC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AACjC,CAAC"}
|
package/dist/graph/index.d.ts
CHANGED
|
@@ -8,4 +8,6 @@ export { resolveCrossLanguage, RESOLVER_PRODUCED_BY } from "./cross-language.ts"
|
|
|
8
8
|
export type { NamespaceDeclaration, CrossLanguageAmbiguity, CrossLanguageResult } from "./cross-language.ts";
|
|
9
9
|
export { applyRuntimeObservations, reapplyEarnedOverlays, observedEdges, edgeCorrections, recordEdgeCorrection, RUNTIME_ADAPTER_ID, RUNTIME_ADAPTER_VERSION, RUNTIME_PRODUCER, } from "./runtime-confirmation.ts";
|
|
10
10
|
export type { Clock, EdgeCorrectionRow, ObservedEdgeRow, RuntimeConfirmationInput, RuntimeConfirmationResult, RuntimeObservationRefusal, StaleR4Observation, } from "./runtime-confirmation.ts";
|
|
11
|
+
export { applyObservedTests, observedTests } from "./observed-tests.ts";
|
|
12
|
+
export type { ObservedTestObservation, ObservedTestOutcome, ObservedTestRefusal, ObservedTestRow, ObservedTestsInput, ObservedTestsResult, } from "./observed-tests.ts";
|
|
11
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graph/index.ts"],"names":[],"mappings":"AA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,CAAC;AACpB,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACjF,YAAY,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE7G,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,KAAK,EACL,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACxE,YAAY,EACV,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC"}
|
package/dist/graph/index.js
CHANGED
|
@@ -3,4 +3,5 @@ export { persistGraph } from "./persist.js";
|
|
|
3
3
|
export { preferIncoming, mergeEdge, mergeNode, corroborators, identityFingerprint, EDGE_MERGE_CONDITION, NODE_MERGE_CONDITION, } from "./merge.js";
|
|
4
4
|
export { resolveCrossLanguage, RESOLVER_PRODUCED_BY } from "./cross-language.js";
|
|
5
5
|
export { applyRuntimeObservations, reapplyEarnedOverlays, observedEdges, edgeCorrections, recordEdgeCorrection, RUNTIME_ADAPTER_ID, RUNTIME_ADAPTER_VERSION, RUNTIME_PRODUCER, } from "./runtime-confirmation.js";
|
|
6
|
+
export { applyObservedTests, observedTests } from "./observed-tests.js";
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
package/dist/graph/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/graph/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,OAAO,EACL,cAAc,EACd,SAAS,EACT,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAGjF,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/graph/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,OAAO,EACL,cAAc,EACd,SAAS,EACT,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAGjF,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAUnC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `observed_tests` — the EARNED record of which tests actually ran.
|
|
3
|
+
*
|
|
4
|
+
* This is the coverage axis, and coverage is deliberately not confidence: AI
|
|
5
|
+
* layer §20 separates *"what I actually verified"* from *"how sure am I"*, and
|
|
6
|
+
* the five report categories say nothing about the first. This module is the
|
|
7
|
+
* carrier for that separation, ruled in
|
|
8
|
+
* `documents/decisions-inbox/DEC-NEXT-test-run-coverage-has-no-carrier.md`.
|
|
9
|
+
*
|
|
10
|
+
* ## Why this is a table and not an R4 edge promotion
|
|
11
|
+
*
|
|
12
|
+
* The obvious-looking design is to run the suite and promote each `TESTS` edge
|
|
13
|
+
* it exercised to R4, reusing {@link applyRuntimeObservations}. That is not
|
|
14
|
+
* available, and the reason is the same one `observe-runtime.ts`'s header
|
|
15
|
+
* already gives for refusing to derive edges from correlated evidence.
|
|
16
|
+
*
|
|
17
|
+
* An edge needs **two endpoints and a witnessed relationship between them**. A
|
|
18
|
+
* test-runner's evidence carries no stack — every item it emits has
|
|
19
|
+
* `stackTrace: null` — so an observed test names exactly one node, its own
|
|
20
|
+
* `TEST_CASE`. Nothing in the run witnesses which function that test reached.
|
|
21
|
+
* Pairing the test with a function that merely co-occurred in the same run
|
|
22
|
+
* would mint an edge from temporal coincidence, which is precisely the
|
|
23
|
+
* wrong-direction failure rule 2 exists to prevent, arriving through the one
|
|
24
|
+
* mechanism built to make the graph *more* trustworthy.
|
|
25
|
+
*
|
|
26
|
+
* So the honest fact a test run establishes is a fact about **one node**: this
|
|
27
|
+
* test case executed, and this is what happened. That is not an edge and R4 in
|
|
28
|
+
* this store is a property of an edge, so it needs a carrier of its own.
|
|
29
|
+
*
|
|
30
|
+
* ## Why EARNED
|
|
31
|
+
*
|
|
32
|
+
* Same argument as `observed_edges`, one step over. Nothing in the source says
|
|
33
|
+
* which tests ran — the source says which tests *exist*. A rebuild that dropped
|
|
34
|
+
* this table would silently turn "what I actually verified" back into "what
|
|
35
|
+
* might be affected", which is the exact collapse the coverage axis exists to
|
|
36
|
+
* prevent.
|
|
37
|
+
*
|
|
38
|
+
* ## What this module refuses to do
|
|
39
|
+
*
|
|
40
|
+
* - **Invent a node.** An observation naming a node this graph does not hold is
|
|
41
|
+
* refused with its reason, never created — rule 2, and the same posture
|
|
42
|
+
* {@link applyRuntimeObservations} takes for an edge endpoint.
|
|
43
|
+
* - **Accept a category error.** A test outcome against a node that is not a
|
|
44
|
+
* `TEST_CASE` is refused rather than written. The graph holds the id, so this
|
|
45
|
+
* is not a missing-node refusal; it is a claim that would make every later
|
|
46
|
+
* coverage read meaningless, and it is far more likely to be a resolver bug
|
|
47
|
+
* than a real observation.
|
|
48
|
+
* - **Judge anything.** No finding, no hypothesis, no report category. It
|
|
49
|
+
* records what ran; whether that is *enough* is a judgement for a layer above
|
|
50
|
+
* this one.
|
|
51
|
+
*
|
|
52
|
+
* @see `packages/core/src/graph/runtime-confirmation.ts` — the edge half.
|
|
53
|
+
*/
|
|
54
|
+
import type { SqlDriver } from "../store/driver/driver.ts";
|
|
55
|
+
/** What a runner reported for one test. `skipped` covers `.skip` and `.todo` alike. */
|
|
56
|
+
export type ObservedTestOutcome = "passed" | "failed" | "skipped";
|
|
57
|
+
export interface ObservedTestObservation {
|
|
58
|
+
/** The `TEST_CASE` node this test resolved to. Resolution happens above this module. */
|
|
59
|
+
readonly nodeId: string;
|
|
60
|
+
/**
|
|
61
|
+
* The runner's own suite-prefixed name, kept verbatim.
|
|
62
|
+
*
|
|
63
|
+
* Stored even though `nodeId` already identifies the test, because the two
|
|
64
|
+
* can disagree later: the node id survives a rename, the recorded name is
|
|
65
|
+
* what the run actually printed, and a reader comparing them is how a
|
|
66
|
+
* mis-resolution becomes visible instead of silently plausible.
|
|
67
|
+
*/
|
|
68
|
+
readonly qualifiedName: string;
|
|
69
|
+
readonly outcome: ObservedTestOutcome;
|
|
70
|
+
/** Null when the runner did not report one — never defaulted to zero, which would read as "instant". */
|
|
71
|
+
readonly durationMs: number | null;
|
|
72
|
+
}
|
|
73
|
+
export interface ObservedTestsInput {
|
|
74
|
+
/** The run that witnessed these. Part of the row identity — see the schema comment. */
|
|
75
|
+
readonly runId: string;
|
|
76
|
+
/** The commit the tests were run against, so a later reader can tell whether the code has moved under the observation. */
|
|
77
|
+
readonly commitSha: string;
|
|
78
|
+
readonly observations: readonly ObservedTestObservation[];
|
|
79
|
+
}
|
|
80
|
+
/** One observation this pass declined to act on, with the resolver's own reason. */
|
|
81
|
+
export interface ObservedTestRefusal {
|
|
82
|
+
readonly nodeId: string;
|
|
83
|
+
readonly qualifiedName: string;
|
|
84
|
+
readonly reason: string;
|
|
85
|
+
}
|
|
86
|
+
export interface ObservedTestsResult {
|
|
87
|
+
/** Node ids written. */
|
|
88
|
+
readonly recorded: readonly string[];
|
|
89
|
+
readonly refused: readonly ObservedTestRefusal[];
|
|
90
|
+
}
|
|
91
|
+
export interface ObservedTestRow {
|
|
92
|
+
readonly nodeId: string;
|
|
93
|
+
readonly runId: string;
|
|
94
|
+
readonly qualifiedName: string;
|
|
95
|
+
readonly outcome: ObservedTestOutcome;
|
|
96
|
+
readonly durationMs: number | null;
|
|
97
|
+
readonly commitSha: string;
|
|
98
|
+
readonly observedAt: number;
|
|
99
|
+
}
|
|
100
|
+
/** A clock, injected so a test can pin `observed_at` — same shape the store's own tests use. */
|
|
101
|
+
export interface Clock {
|
|
102
|
+
now(): number;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Record a run's test observations.
|
|
106
|
+
*
|
|
107
|
+
* Total over its input: every observation lands in exactly one of
|
|
108
|
+
* {@link ObservedTestsResult.recorded} or {@link ObservedTestsResult.refused},
|
|
109
|
+
* so a caller can account for all of them without inspecting the store. Never
|
|
110
|
+
* throws for an observation it cannot act on — that is a refusal, per the
|
|
111
|
+
* five-result-states rule the tool contract applies one layer up.
|
|
112
|
+
*/
|
|
113
|
+
export declare function applyObservedTests(driver: SqlDriver, input: ObservedTestsInput, clock?: Clock): ObservedTestsResult;
|
|
114
|
+
/** Read the EARNED ledger, newest observation first, optionally for one run. */
|
|
115
|
+
export declare function observedTests(driver: SqlDriver, options?: {
|
|
116
|
+
readonly runId?: string;
|
|
117
|
+
}): readonly ObservedTestRow[];
|
|
118
|
+
//# sourceMappingURL=observed-tests.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