@dzhechkov/harness-core 0.6.0 → 0.6.1
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/.dz-manifest.json +66 -14
- package/README.md +12 -1
- package/dist/amendment-trace.d.ts +98 -0
- package/dist/amendment-trace.d.ts.map +1 -0
- package/dist/amendment-trace.js +275 -0
- package/dist/amendment-trace.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/patterns.d.ts.map +1 -1
- package/dist/patterns.js +4 -1
- package/dist/patterns.js.map +1 -1
- package/dist/run-records.d.ts +66 -0
- package/dist/run-records.d.ts.map +1 -0
- package/dist/run-records.js +169 -0
- package/dist/run-records.js.map +1 -0
- package/package.json +4 -4
- package/sbom.json +143 -13
- package/src/amendment-trace.ts +348 -0
- package/src/index.ts +24 -0
- package/src/patterns.ts +4 -1
- package/src/run-records.ts +220 -0
package/.dz-manifest.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"files": [
|
|
6
6
|
{
|
|
7
7
|
"path": "CHANGELOG.md",
|
|
8
|
-
"sha256": "
|
|
8
|
+
"sha256": "2ba0bb6639cdc6918fa61ec15a344e9a97988e6a212cc6d9b5c67364307a7359"
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
"path": "README.md",
|
|
12
|
-
"sha256": "
|
|
12
|
+
"sha256": "3d0f40f8e46f15d06ed65efa568ad9f34c36c519c468db401663d8a3badbb734"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"path": "dist/__tests__/golden-baseline.test.d.ts",
|
|
@@ -59,6 +59,22 @@
|
|
|
59
59
|
"path": "dist/agents-policy.js.map",
|
|
60
60
|
"sha256": "08d5c8fe8b5dd9b0d75b382433de8356cf54c41e0b10b028d9a910817e44de72"
|
|
61
61
|
},
|
|
62
|
+
{
|
|
63
|
+
"path": "dist/amendment-trace.d.ts",
|
|
64
|
+
"sha256": "5e38fdb88bf848eaf045f7e8450bd7584dedd89c957d6bcbf3f33688acd59ae8"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"path": "dist/amendment-trace.d.ts.map",
|
|
68
|
+
"sha256": "823cd1ec281dc9e4a368b147413379e3ba6e343b7240acc233affd64eebc04a4"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"path": "dist/amendment-trace.js",
|
|
72
|
+
"sha256": "36373fe71098e0a73fbffa08d0732ab5da526293f0c804c08a4aa6f9cd20c905"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"path": "dist/amendment-trace.js.map",
|
|
76
|
+
"sha256": "4c14ec5efa950f7b13537ccce4c7cc80cb2a54af53760474856153f771407681"
|
|
77
|
+
},
|
|
62
78
|
{
|
|
63
79
|
"path": "dist/apply.d.ts",
|
|
64
80
|
"sha256": "a243a1629c4106584d96fc6496d113a2e298125375bc5cc35338ba500420dd67"
|
|
@@ -605,19 +621,19 @@
|
|
|
605
621
|
},
|
|
606
622
|
{
|
|
607
623
|
"path": "dist/index.d.ts",
|
|
608
|
-
"sha256": "
|
|
624
|
+
"sha256": "417b6de4c4bc836d72513abd1893e6dd84e58fabd85fb3795e2b2bb0f2e89baf"
|
|
609
625
|
},
|
|
610
626
|
{
|
|
611
627
|
"path": "dist/index.d.ts.map",
|
|
612
|
-
"sha256": "
|
|
628
|
+
"sha256": "560c4441d001498a8a1170225b0e766b24ecc95cb2a133ed155f47fbfc555cbf"
|
|
613
629
|
},
|
|
614
630
|
{
|
|
615
631
|
"path": "dist/index.js",
|
|
616
|
-
"sha256": "
|
|
632
|
+
"sha256": "9fa573d21a2aad30341127e8d146fa6338e1e6d2706075971e19b852db2cdc8a"
|
|
617
633
|
},
|
|
618
634
|
{
|
|
619
635
|
"path": "dist/index.js.map",
|
|
620
|
-
"sha256": "
|
|
636
|
+
"sha256": "adf38e34c552a57ac39760f5782b184ab465298a4505110b4e951c66a02da7e1"
|
|
621
637
|
},
|
|
622
638
|
{
|
|
623
639
|
"path": "dist/learning-backend.d.ts",
|
|
@@ -897,15 +913,15 @@
|
|
|
897
913
|
},
|
|
898
914
|
{
|
|
899
915
|
"path": "dist/patterns.d.ts.map",
|
|
900
|
-
"sha256": "
|
|
916
|
+
"sha256": "6cb5a710dcc1d1ca1bb8fa9350c9751da58b6bc8cf48688eb191574cd1e84cf5"
|
|
901
917
|
},
|
|
902
918
|
{
|
|
903
919
|
"path": "dist/patterns.js",
|
|
904
|
-
"sha256": "
|
|
920
|
+
"sha256": "15992b9d7a69a2b91597aaa05901a1656fdcbed54dfa23ffc9d78f25432ead48"
|
|
905
921
|
},
|
|
906
922
|
{
|
|
907
923
|
"path": "dist/patterns.js.map",
|
|
908
|
-
"sha256": "
|
|
924
|
+
"sha256": "c0bdd22f1dede62cc6cc0efa644d4a59bbcf69fbe69a95c13fcd313fda4b1851"
|
|
909
925
|
},
|
|
910
926
|
{
|
|
911
927
|
"path": "dist/plugin.d.ts",
|
|
@@ -1179,6 +1195,22 @@
|
|
|
1179
1195
|
"path": "dist/routing-outcomes.js.map",
|
|
1180
1196
|
"sha256": "c369e33d38ea564f5a59fc0a90fa34fecfc90f2f25c87dfb153dfe20f0b0e0de"
|
|
1181
1197
|
},
|
|
1198
|
+
{
|
|
1199
|
+
"path": "dist/run-records.d.ts",
|
|
1200
|
+
"sha256": "f53f7fba2d81cb1b71127781ca879fb0f8dd4e91f9a21c0230b68c20c4aa6df0"
|
|
1201
|
+
},
|
|
1202
|
+
{
|
|
1203
|
+
"path": "dist/run-records.d.ts.map",
|
|
1204
|
+
"sha256": "c10fc92fda6183599b92abcdf2933ee8408f026ac73a4e8252ac36b693c18545"
|
|
1205
|
+
},
|
|
1206
|
+
{
|
|
1207
|
+
"path": "dist/run-records.js",
|
|
1208
|
+
"sha256": "a88eb998f172e893bd6bcf800e8a2954fd6ca53e4d7b05730748276d23d8e7f0"
|
|
1209
|
+
},
|
|
1210
|
+
{
|
|
1211
|
+
"path": "dist/run-records.js.map",
|
|
1212
|
+
"sha256": "f1219ebf7414b0a8fcf88510b76f9bb82c9580637ef8863e7e02f10409c0c432"
|
|
1213
|
+
},
|
|
1182
1214
|
{
|
|
1183
1215
|
"path": "dist/safla-delta.d.ts",
|
|
1184
1216
|
"sha256": "9fb8db73445acb7af089880d38222dd4a706f58416943893a090aa3f44199ef3"
|
|
@@ -1549,7 +1581,7 @@
|
|
|
1549
1581
|
},
|
|
1550
1582
|
{
|
|
1551
1583
|
"path": "package.json",
|
|
1552
|
-
"sha256": "
|
|
1584
|
+
"sha256": "a79b206556e86f770f3d5e89aea516cf0117402f2cf0505466e2228559a2075c"
|
|
1553
1585
|
},
|
|
1554
1586
|
{
|
|
1555
1587
|
"path": "scripts/refuse-wrong-publisher.mjs",
|
|
@@ -1567,6 +1599,10 @@
|
|
|
1567
1599
|
"path": "src/agents-policy.ts",
|
|
1568
1600
|
"sha256": "1b5bc614dfa670f2c341f926b399300278a3b52a7bf1b6de9239b38c1d7c31e0"
|
|
1569
1601
|
},
|
|
1602
|
+
{
|
|
1603
|
+
"path": "src/amendment-trace.ts",
|
|
1604
|
+
"sha256": "547ee200ce8d1f8c9907dcadc39a0ed386dd5a5491d3f6797e94c20a3a160c64"
|
|
1605
|
+
},
|
|
1570
1606
|
{
|
|
1571
1607
|
"path": "src/apply.ts",
|
|
1572
1608
|
"sha256": "8c98d14157ac6205887b9b64843960e90870de396963da92ee7e19bba264dba0"
|
|
@@ -1705,7 +1741,7 @@
|
|
|
1705
1741
|
},
|
|
1706
1742
|
{
|
|
1707
1743
|
"path": "src/index.ts",
|
|
1708
|
-
"sha256": "
|
|
1744
|
+
"sha256": "f53403a6ae47ca25e436a2fcba9566baa895110132a975f4ce62465db932c0ee"
|
|
1709
1745
|
},
|
|
1710
1746
|
{
|
|
1711
1747
|
"path": "src/learning-backend.ts",
|
|
@@ -1777,7 +1813,7 @@
|
|
|
1777
1813
|
},
|
|
1778
1814
|
{
|
|
1779
1815
|
"path": "src/patterns.ts",
|
|
1780
|
-
"sha256": "
|
|
1816
|
+
"sha256": "9dbc7e3c2746fae37fb481fc153244106071a6da47948e6a7ee6c287f2249416"
|
|
1781
1817
|
},
|
|
1782
1818
|
{
|
|
1783
1819
|
"path": "src/plugin.ts",
|
|
@@ -1843,6 +1879,10 @@
|
|
|
1843
1879
|
"path": "src/routing-outcomes.ts",
|
|
1844
1880
|
"sha256": "66cce181b105b6add863e52f2d9364166f75d95a2e26e48995dbbdb20d8e66dd"
|
|
1845
1881
|
},
|
|
1882
|
+
{
|
|
1883
|
+
"path": "src/run-records.ts",
|
|
1884
|
+
"sha256": "8a000d7ecd6d729b2e5547e12d098ed9f16bd3c27d456e0589130147b2385126"
|
|
1885
|
+
},
|
|
1846
1886
|
{
|
|
1847
1887
|
"path": "src/safla-delta.ts",
|
|
1848
1888
|
"sha256": "55d46a4d2068fc99c4606d744e861c19a1004148d2c7679537ff4862fc38db84"
|
|
@@ -1955,6 +1995,10 @@
|
|
|
1955
1995
|
"path": "test/agents-policy.test.ts",
|
|
1956
1996
|
"sha256": "5977d534adbab0d3b8820eb7341b00b03e10748f895e0383c1d30508fde0e771"
|
|
1957
1997
|
},
|
|
1998
|
+
{
|
|
1999
|
+
"path": "test/amendment-trace.test.ts",
|
|
2000
|
+
"sha256": "fade5a0516b626154a936230ac7f001af048c02e91f338b44270e51a9e81fffd"
|
|
2001
|
+
},
|
|
1958
2002
|
{
|
|
1959
2003
|
"path": "test/apply.test.ts",
|
|
1960
2004
|
"sha256": "9aa54b1dc6b372ad7e81783a8af8fe88dde64c653f801aaa565e2f363135e350"
|
|
@@ -2177,7 +2221,7 @@
|
|
|
2177
2221
|
},
|
|
2178
2222
|
{
|
|
2179
2223
|
"path": "test/feature-adr-training-pairs.test.ts",
|
|
2180
|
-
"sha256": "
|
|
2224
|
+
"sha256": "0e4a7317554dd78d87d729374e21a34c7519075e9ac4547e3de0d06f774fa35d"
|
|
2181
2225
|
},
|
|
2182
2226
|
{
|
|
2183
2227
|
"path": "test/feature-adr-workflow-twin-drift.test.ts",
|
|
@@ -2443,6 +2487,10 @@
|
|
|
2443
2487
|
"path": "test/partition-findings.test.ts",
|
|
2444
2488
|
"sha256": "5ba94ba0c9d7d74c3846de2073ed8186c69fd68e7575ccb93099dfb7579a47de"
|
|
2445
2489
|
},
|
|
2490
|
+
{
|
|
2491
|
+
"path": "test/pattern-boost-unicode.test.ts",
|
|
2492
|
+
"sha256": "bb3716152de8c062b66f8f8ab0333c7d96a57863dd89f1bcfc9565f5b240f8c1"
|
|
2493
|
+
},
|
|
2446
2494
|
{
|
|
2447
2495
|
"path": "test/patterns.test.ts",
|
|
2448
2496
|
"sha256": "2eac0dd5b93e6fe737faf6df5cc3e07eb9e551de8af1cc655e8ad4bec7652900"
|
|
@@ -2515,6 +2563,10 @@
|
|
|
2515
2563
|
"path": "test/routing-outcomes.test.ts",
|
|
2516
2564
|
"sha256": "bbc5c12f2bfcb246369f7428a5b22e64615e00174f08ba8d20f9d962ae8b43e8"
|
|
2517
2565
|
},
|
|
2566
|
+
{
|
|
2567
|
+
"path": "test/run-records.test.ts",
|
|
2568
|
+
"sha256": "8c7e65a5a881f67e2ba426c061f67131536902ec902741cc248a0b30d6963535"
|
|
2569
|
+
},
|
|
2518
2570
|
{
|
|
2519
2571
|
"path": "test/safla-delta.test.ts",
|
|
2520
2572
|
"sha256": "1669198eab1fdda44e137b19454a01954dc42ab7b059725dd056c836b06a5e3e"
|
|
@@ -2677,5 +2729,5 @@
|
|
|
2677
2729
|
}
|
|
2678
2730
|
]
|
|
2679
2731
|
},
|
|
2680
|
-
"signature": "
|
|
2732
|
+
"signature": "ayMtdb4K1haW5FSmsdFKcmE7/Zotxm5U8C6R1Hja+BAGSb++7rAcB4r2T9B3m9Mhwzwnj9fY0H3DvZUTfRzvCg=="
|
|
2681
2733
|
}
|
package/README.md
CHANGED
|
@@ -206,7 +206,18 @@ pause or the file deliverable.
|
|
|
206
206
|
|
|
207
207
|
## Status
|
|
208
208
|
|
|
209
|
-
`0.6.
|
|
209
|
+
`0.6.1` — two new pure modules behind two new commands. `amendment-trace.ts` resolves every `AM-N`
|
|
210
|
+
amendment row to a test found INSIDE the file the row names — matched against the file's parsed TEST
|
|
211
|
+
TITLES, because whole-file matching was forgeable by two comment lines whose letters spell the id, and
|
|
212
|
+
because an existing FILE never stands in for an existing TEST. `run-records.ts` decides whether a
|
|
213
|
+
run-cost row or a training pair may be written: it refuses bad JSON, a wrong-kind payload, an EMPTY
|
|
214
|
+
required field (an empty array or object is not "present"), a stage disagreement and an over-cap line;
|
|
215
|
+
it stamps the timestamp BEFORE serialising; and it treats a mark whose target is absent as STALE
|
|
216
|
+
rather than as a duplicate, because a run that died between taking the mark and writing must not lose
|
|
217
|
+
the record forever. **BEHAVIORAL:** the workflow's ledger and training-pair writers no longer hand a
|
|
218
|
+
subagent a pre-baked shell string — a malformed row is refused instead of appended.
|
|
219
|
+
|
|
220
|
+
**0.6.0** — **BEHAVIORAL:** `STAGE_ARTIFACTS.router` is `'00_complexity_assessment.md'`, was `null`, so a
|
|
210
221
|
consumer reading that constant now gets a filename. Step 0 owes a written artifact and its checkpoint
|
|
211
222
|
is witnessed by one; MEASURED 2026-08-21, 66 of 199 features carried that file and the last four in a
|
|
212
223
|
row did not, which is how a run's tier became unreadable while it was alive and how the K2 acid check
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Amendment traceability — the deterministic half of the Step-8 amendment gate (ADR-001).
|
|
3
|
+
*
|
|
4
|
+
* The gate used to be a paragraph of prompt text asking the QE agent to confirm that every `AM-N`
|
|
5
|
+
* row names a real test. That is layer 4 on the cost-of-detection ladder, and the recalled lesson at
|
|
6
|
+
* reward 1.00 says what happens next: a safety property that lives only in a prompt disappears with
|
|
7
|
+
* the next prompt. `features/qe-scoped-review/08_qe_report.md` recorded the outcome — five ids named,
|
|
8
|
+
* none existing, and the plan writing `## Amendments: None`.
|
|
9
|
+
*
|
|
10
|
+
* Everything here is PURE: text in, verdicts out, file access through an injected reader (NFR-1).
|
|
11
|
+
* The CLI owns I/O and the exit code; this module owns the grammar and the rules.
|
|
12
|
+
*
|
|
13
|
+
* NOT PROVEN HERE: that a resolved test is non-vacuous. `dz discrimination-check` owns "would this
|
|
14
|
+
* test still pass with the protection deleted" (non-goal NG-1, acid case A8). A checker that implied
|
|
15
|
+
* it proved vacuity would be the same lie in a new place.
|
|
16
|
+
*/
|
|
17
|
+
/** One `AM-N` row as it appears in a `## Amendments` section. */
|
|
18
|
+
export interface AmendmentRow {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly testIds: readonly string[];
|
|
21
|
+
readonly file: string | null;
|
|
22
|
+
readonly raw: string;
|
|
23
|
+
}
|
|
24
|
+
export type AmendmentVerdict = 'resolved' | 'placeholder' | 'unnamed' | 'no-file-named' | 'file-missing' | 'name-absent-in-file';
|
|
25
|
+
export interface AmendmentResolution {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly testId: string | null;
|
|
28
|
+
readonly file: string | null;
|
|
29
|
+
readonly verdict: AmendmentVerdict;
|
|
30
|
+
readonly detail: string;
|
|
31
|
+
}
|
|
32
|
+
export type AmendmentOutcome = 'pass' | 'fail' | 'skip' | 'not-established';
|
|
33
|
+
export interface AmendmentDecision {
|
|
34
|
+
readonly outcome: AmendmentOutcome;
|
|
35
|
+
/** Derived FROM the outcome — one mapping, never two (AM-3, acid case A3/A7). */
|
|
36
|
+
readonly exit: 0 | 1 | 3;
|
|
37
|
+
readonly reasons: readonly string[];
|
|
38
|
+
readonly counts: Readonly<Record<AmendmentVerdict, number>>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Below this many normalised characters an id is too short to match anything meaningfully: the
|
|
42
|
+
* substring rule ADR-002 accepts would fire on unrelated prose. Guards the degenerate case the ADR
|
|
43
|
+
* names as its known false-positive risk.
|
|
44
|
+
*/
|
|
45
|
+
export declare const MIN_MATCHABLE_ID_LENGTH = 8;
|
|
46
|
+
/** Case- and separator-folded form. Authors write ids in prose (`a_b_c`); test titles are sentences. */
|
|
47
|
+
/**
|
|
48
|
+
* Every `it()` / `test()` / `describe()` title in a test file. Empty when none parse.
|
|
49
|
+
*
|
|
50
|
+
* Comments are stripped FIRST. A commented-out `it('deny admin writes')` is not a test, and counting
|
|
51
|
+
* it would leave open the very forgery the title basis exists to close — the cross-family reviewer's
|
|
52
|
+
* two-comment-line attack in a slightly better costume. Table forms (`test.each([…])('…')`) carry an
|
|
53
|
+
* argument list between the modifier and the title, so the pattern allows one.
|
|
54
|
+
*/
|
|
55
|
+
export declare function extractTestTitles(body: string): string[];
|
|
56
|
+
export declare function normalizeTestId(s: string): string;
|
|
57
|
+
/** The `## Amendments` section body, or null when the document has none (acid case A5). */
|
|
58
|
+
export declare function amendmentSection(md: string): string | null;
|
|
59
|
+
/** `## Amendments` present but recording nothing to check — distinct from the section being absent. */
|
|
60
|
+
export declare function planSaysNoAmendments(planMd: string): boolean;
|
|
61
|
+
export declare function parseAmendments(md: string): AmendmentRow[];
|
|
62
|
+
export declare function resolveAmendments(rows: readonly AmendmentRow[], opts: {
|
|
63
|
+
readFile: (p: string) => string | null;
|
|
64
|
+
}): AmendmentResolution[];
|
|
65
|
+
export declare function decideAmendmentOutcome(input: {
|
|
66
|
+
sectionPresent: boolean;
|
|
67
|
+
rows: readonly AmendmentRow[];
|
|
68
|
+
resolutions: readonly AmendmentResolution[];
|
|
69
|
+
planSaysNone: boolean;
|
|
70
|
+
readError?: string | null;
|
|
71
|
+
/** Ideation amendments the plan fails to carry — absent, or reworded under the same id. */
|
|
72
|
+
missingFromPlan?: readonly {
|
|
73
|
+
id: string;
|
|
74
|
+
kind: 'dropped' | 'subject-changed';
|
|
75
|
+
}[];
|
|
76
|
+
}): AmendmentDecision;
|
|
77
|
+
/** The one line every caller reads last, in the K2 gate's own shape so the two read alike. */
|
|
78
|
+
export declare function amendmentVerdictLine(d: AmendmentDecision): string;
|
|
79
|
+
/** Printed on every run: this checker does NOT prove a resolved test discriminates (NG-1, A8). */
|
|
80
|
+
export declare const AMENDMENT_VACUITY_NOTE = "note: this checks that each amendment RESOLVES to a real test, not that the test is non-vacuous \u2014 `dz discrimination-check` owns vacuity.";
|
|
81
|
+
/**
|
|
82
|
+
* The amendment's own text with the `→ test …` pointer clause and markdown furniture removed — what
|
|
83
|
+
* "carry AM-N into the plan verbatim" is actually about. The POINTER may legitimately change (tests
|
|
84
|
+
* are named later than ideation guesses); the SUBJECT may not.
|
|
85
|
+
*/
|
|
86
|
+
export declare function amendmentSubject(raw: string): string;
|
|
87
|
+
export interface PlanCoverageGap {
|
|
88
|
+
readonly id: string;
|
|
89
|
+
readonly kind: 'dropped' | 'subject-changed';
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Ideation amendments the plan fails to carry: either absent outright, or present under the same id
|
|
93
|
+
* with a DIFFERENT subject. Cross-family review (Codex gpt-5.6-sol, 2026-08-21) found the second
|
|
94
|
+
* case: comparing ids alone let a plan swap "deny unauthenticated deletes" for "render footer" under
|
|
95
|
+
* the same `AM-1` and still pass.
|
|
96
|
+
*/
|
|
97
|
+
export declare function amendmentsMissingFromPlan(ideationRows: readonly AmendmentRow[], planRows: readonly AmendmentRow[]): PlanCoverageGap[];
|
|
98
|
+
//# sourceMappingURL=amendment-trace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amendment-trace.d.ts","sourceRoot":"","sources":["../src/amendment-trace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,iEAAiE;AACjE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,gB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B,iBAAiB,CAC/B,IAAI,EAAE,SAAS,YAAY,EAAE,EAC7B,IAAI,EAAE;IAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAA;CAAE,GAC/C,mBAAmB,EAAE,CAkBvB;AAoDD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,cAAc,EAAE,OAAO,CAAC;IACxB,IAAI,EAAE,SAAS,YAAY,EAAE,CAAC;IAC9B,WAAW,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC5C,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,2FAA2F;IAC3F,eAAe,CAAC,EAAE,SAAS;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,GAAG,iBAAiB,CAAA;KAAE,EAAE,CAAC;CAClF,GAAG,iBAAiB,CAoDpB;AAED,8FAA8F;AAC9F,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAQjE;AAED,kGAAkG;AAClG,eAAO,MAAM,sBAAsB,mJAC0G,CAAC;AAG9I;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQpD;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,iBAAiB,CAAC;CAC9C;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,SAAS,YAAY,EAAE,EACrC,QAAQ,EAAE,SAAS,YAAY,EAAE,GAChC,eAAe,EAAE,CAkBnB"}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Amendment traceability — the deterministic half of the Step-8 amendment gate (ADR-001).
|
|
3
|
+
*
|
|
4
|
+
* The gate used to be a paragraph of prompt text asking the QE agent to confirm that every `AM-N`
|
|
5
|
+
* row names a real test. That is layer 4 on the cost-of-detection ladder, and the recalled lesson at
|
|
6
|
+
* reward 1.00 says what happens next: a safety property that lives only in a prompt disappears with
|
|
7
|
+
* the next prompt. `features/qe-scoped-review/08_qe_report.md` recorded the outcome — five ids named,
|
|
8
|
+
* none existing, and the plan writing `## Amendments: None`.
|
|
9
|
+
*
|
|
10
|
+
* Everything here is PURE: text in, verdicts out, file access through an injected reader (NFR-1).
|
|
11
|
+
* The CLI owns I/O and the exit code; this module owns the grammar and the rules.
|
|
12
|
+
*
|
|
13
|
+
* NOT PROVEN HERE: that a resolved test is non-vacuous. `dz discrimination-check` owns "would this
|
|
14
|
+
* test still pass with the protection deleted" (non-goal NG-1, acid case A8). A checker that implied
|
|
15
|
+
* it proved vacuity would be the same lie in a new place.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Template placeholders that reach shipped reports. A stub read as an ordinary unresolvable id lets
|
|
19
|
+
* the author believe they merely mistyped a name, so it earns its own verdict (acid case A1).
|
|
20
|
+
*/
|
|
21
|
+
const PLACEHOLDER_IDS = new Set(['test_name', 'test-name', '<test>', '<test_name>', 'tbd', 'todo', 'name']);
|
|
22
|
+
/**
|
|
23
|
+
* Below this many normalised characters an id is too short to match anything meaningfully: the
|
|
24
|
+
* substring rule ADR-002 accepts would fire on unrelated prose. Guards the degenerate case the ADR
|
|
25
|
+
* names as its known false-positive risk.
|
|
26
|
+
*/
|
|
27
|
+
export const MIN_MATCHABLE_ID_LENGTH = 8;
|
|
28
|
+
/** Case- and separator-folded form. Authors write ids in prose (`a_b_c`); test titles are sentences. */
|
|
29
|
+
/**
|
|
30
|
+
* Every `it()` / `test()` / `describe()` title in a test file. Empty when none parse.
|
|
31
|
+
*
|
|
32
|
+
* Comments are stripped FIRST. A commented-out `it('deny admin writes')` is not a test, and counting
|
|
33
|
+
* it would leave open the very forgery the title basis exists to close — the cross-family reviewer's
|
|
34
|
+
* two-comment-line attack in a slightly better costume. Table forms (`test.each([…])('…')`) carry an
|
|
35
|
+
* argument list between the modifier and the title, so the pattern allows one.
|
|
36
|
+
*/
|
|
37
|
+
export function extractTestTitles(body) {
|
|
38
|
+
const code = body.replace(/\/\*[\s\S]*?\*\//g, ' ').replace(/(^|[^:])\/\/[^\n]*/g, '$1');
|
|
39
|
+
const out = [];
|
|
40
|
+
const re = /\b(?:it|test|describe)(?:\.\w+)*(?:\s*\([^()]{0,200}\))?\s*(?:`[^`]*`)?\s*\(\s*(['"`])([\s\S]{1,300}?)\1/g;
|
|
41
|
+
for (let m = re.exec(code); m !== null; m = re.exec(code))
|
|
42
|
+
if (m[2])
|
|
43
|
+
out.push(m[2]);
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
export function normalizeTestId(s) {
|
|
47
|
+
return s.toLowerCase().replace(/[^a-z0-9]+/g, '');
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Row starts, in BOTH shapes the corpus actually contains: a bullet (`- **AM-1 (…):**`) and a table
|
|
51
|
+
* cell (`| **AM-40** |`). A format LEGEND — the literal `AM-N` with an `N` that is not a digit, as in
|
|
52
|
+
* `features/ha-consilium/03.5_ideation_report.md` — is deliberately NOT a row: counting a legend as
|
|
53
|
+
* an amendment would open this feature by falsely accusing a feature that did nothing wrong.
|
|
54
|
+
*/
|
|
55
|
+
const ROW_START = /^(?:[-*]\s+\*{0,2}AM-(\d+)|\|\s*\*{0,2}AM-(\d+))/gm;
|
|
56
|
+
/** The `## Amendments` section body, or null when the document has none (acid case A5). */
|
|
57
|
+
export function amendmentSection(md) {
|
|
58
|
+
const m = /^ {0,3}#{2,4}\s+Amendments\b[^\n]*\n/m.exec(md);
|
|
59
|
+
if (!m)
|
|
60
|
+
return null;
|
|
61
|
+
const start = m.index + m[0].length;
|
|
62
|
+
const rest = md.slice(start);
|
|
63
|
+
const next = /^ {0,3}#{2,4}\s+\S/m.exec(rest);
|
|
64
|
+
return next ? rest.slice(0, next.index) : rest;
|
|
65
|
+
}
|
|
66
|
+
/** `## Amendments` present but recording nothing to check — distinct from the section being absent. */
|
|
67
|
+
export function planSaysNoAmendments(planMd) {
|
|
68
|
+
const sec = amendmentSection(planMd);
|
|
69
|
+
if (sec === null)
|
|
70
|
+
return false;
|
|
71
|
+
return /^\s*(none|n\/a|нет)\b/i.test(sec.trim());
|
|
72
|
+
}
|
|
73
|
+
export function parseAmendments(md) {
|
|
74
|
+
const section = amendmentSection(md);
|
|
75
|
+
if (section === null)
|
|
76
|
+
return [];
|
|
77
|
+
const starts = [];
|
|
78
|
+
ROW_START.lastIndex = 0;
|
|
79
|
+
for (let m = ROW_START.exec(section); m !== null; m = ROW_START.exec(section)) {
|
|
80
|
+
starts.push({ index: m.index, num: (m[1] ?? m[2]) });
|
|
81
|
+
}
|
|
82
|
+
const rows = [];
|
|
83
|
+
for (let i = 0; i < starts.length; i++) {
|
|
84
|
+
const s = starts[i];
|
|
85
|
+
const end = i + 1 < starts.length ? starts[i + 1].index : section.length;
|
|
86
|
+
const raw = section.slice(s.index, end);
|
|
87
|
+
rows.push({ id: `AM-${s.num}`, testIds: extractTestIds(raw), file: extractFile(raw), raw });
|
|
88
|
+
}
|
|
89
|
+
return rows;
|
|
90
|
+
}
|
|
91
|
+
/** `→ test \`a\`` and the two-id shape `→ tests \`a\` and \`b\`` — both are in the corpus. */
|
|
92
|
+
function extractTestIds(raw) {
|
|
93
|
+
const out = [];
|
|
94
|
+
const re = /→\s*tests?\s+`([^`]+)`(?:\s*(?:and|и)\s*`([^`]+)`)?/g;
|
|
95
|
+
for (let m = re.exec(raw); m !== null; m = re.exec(raw)) {
|
|
96
|
+
if (m[1])
|
|
97
|
+
out.push(m[1].trim());
|
|
98
|
+
if (m[2])
|
|
99
|
+
out.push(m[2].trim());
|
|
100
|
+
}
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The `in \`<path>\`` half, which in real reports frequently opens the line AFTER the id. A pattern
|
|
105
|
+
* that cannot cross a newline finds almost nothing here — measured while writing this: three
|
|
106
|
+
* successive shell-written extractors returned 108, 111 and 13 rows over the identical corpus.
|
|
107
|
+
*/
|
|
108
|
+
function extractFile(raw) {
|
|
109
|
+
const m = /→\s*tests?\s+`[^`]+`(?:\s*(?:and|и)\s*`[^`]+`)?[\s\S]{0,40}?\bin\s+`([^`]+)`/.exec(raw);
|
|
110
|
+
return m && m[1] ? m[1].trim() : null;
|
|
111
|
+
}
|
|
112
|
+
export function resolveAmendments(rows, opts) {
|
|
113
|
+
const out = [];
|
|
114
|
+
for (const row of rows) {
|
|
115
|
+
if (row.testIds.length === 0) {
|
|
116
|
+
out.push({
|
|
117
|
+
id: row.id,
|
|
118
|
+
testId: null,
|
|
119
|
+
file: row.file,
|
|
120
|
+
verdict: 'unnamed',
|
|
121
|
+
detail: 'the row carries no `→ test` token — an amendment with no pointer is not a passing amendment',
|
|
122
|
+
});
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
for (const testId of row.testIds) {
|
|
126
|
+
out.push(resolveOne(row, testId, opts.readFile));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return out;
|
|
130
|
+
}
|
|
131
|
+
function resolveOne(row, testId, readFile) {
|
|
132
|
+
const base = { id: row.id, testId, file: row.file };
|
|
133
|
+
if (PLACEHOLDER_IDS.has(testId.trim().toLowerCase())) {
|
|
134
|
+
return { ...base, verdict: 'placeholder', detail: `\`${testId}\` is a template placeholder, not a test name` };
|
|
135
|
+
}
|
|
136
|
+
if (row.file === null) {
|
|
137
|
+
return { ...base, verdict: 'no-file-named', detail: 'the row names a test id but no file to find it in' };
|
|
138
|
+
}
|
|
139
|
+
const body = readFile(row.file);
|
|
140
|
+
if (body === null) {
|
|
141
|
+
return { ...base, verdict: 'file-missing', detail: `\`${row.file}\` does not exist or cannot be read` };
|
|
142
|
+
}
|
|
143
|
+
const needle = normalizeTestId(testId);
|
|
144
|
+
if (needle.length < MIN_MATCHABLE_ID_LENGTH) {
|
|
145
|
+
return {
|
|
146
|
+
...base,
|
|
147
|
+
verdict: 'name-absent-in-file',
|
|
148
|
+
detail: `\`${testId}\` normalises to ${needle.length} characters — below the ${MIN_MATCHABLE_ID_LENGTH}-character floor, so a match would prove nothing`,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
// An existing FILE never stands in for an existing TEST (ADR-002) — and neither does an existing
|
|
152
|
+
// COMMENT. Matching the whole file body is forgeable with two comment lines whose letters happen to
|
|
153
|
+
// spell the id, so the basis is the file's TEST TITLES. Falling back to the body when none parse is
|
|
154
|
+
// stated in the detail rather than done quietly: a silent fallback restores the hole it closes.
|
|
155
|
+
const titles = extractTestTitles(body);
|
|
156
|
+
const basis = titles.length > 0 ? titles.map(normalizeTestId).join('\n') : normalizeTestId(body);
|
|
157
|
+
const basisNote = titles.length > 0 ? `${titles.length} test title(s)` : 'the whole file body — NO test titles parsed, so this match is weaker';
|
|
158
|
+
if (!basis.includes(needle)) {
|
|
159
|
+
return {
|
|
160
|
+
...base,
|
|
161
|
+
verdict: 'name-absent-in-file',
|
|
162
|
+
detail: `\`${row.file}\` exists but no test in it is named \`${testId}\` (searched ${basisNote})`,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
return { ...base, verdict: 'resolved', detail: `found in \`${row.file}\` (searched ${basisNote})` };
|
|
166
|
+
}
|
|
167
|
+
const ZERO_COUNTS = {
|
|
168
|
+
resolved: 0,
|
|
169
|
+
placeholder: 0,
|
|
170
|
+
unnamed: 0,
|
|
171
|
+
'no-file-named': 0,
|
|
172
|
+
'file-missing': 0,
|
|
173
|
+
'name-absent-in-file': 0,
|
|
174
|
+
};
|
|
175
|
+
export function decideAmendmentOutcome(input) {
|
|
176
|
+
const counts = { ...ZERO_COUNTS };
|
|
177
|
+
for (const r of input.resolutions)
|
|
178
|
+
counts[r.verdict]++;
|
|
179
|
+
const reasons = [];
|
|
180
|
+
// Inputs we could not read are never a verdict about the feature (acid case A7).
|
|
181
|
+
if (input.readError) {
|
|
182
|
+
return { outcome: 'not-established', exit: 3, reasons: [`inputs unreadable: ${input.readError}`], counts };
|
|
183
|
+
}
|
|
184
|
+
// Absence is a skip with a stated reason, never a pass and never a silent zero (acid case A5).
|
|
185
|
+
if (!input.sectionPresent) {
|
|
186
|
+
return {
|
|
187
|
+
outcome: 'skip',
|
|
188
|
+
exit: 0,
|
|
189
|
+
reasons: ['no `## Amendments` section — nothing to check (this is an absence, not a pass)'],
|
|
190
|
+
counts,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
// The whole class this feature removes: a check that silently checked nothing (AM-1, acid case A7).
|
|
194
|
+
if (input.rows.length === 0) {
|
|
195
|
+
return {
|
|
196
|
+
outcome: 'not-established',
|
|
197
|
+
exit: 3,
|
|
198
|
+
reasons: [
|
|
199
|
+
'the `## Amendments` section is present but ZERO rows parsed — the grammar matched nothing, which is not the same as nothing being wrong',
|
|
200
|
+
],
|
|
201
|
+
counts,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
// Ideation carries rows while the plan records "None" — this is HIGH-2 itself (acid case A6).
|
|
205
|
+
// Discovered while closing HIGH-2: the pointers belong in the PLAN. Step 6's own instruction is
|
|
206
|
+
// "carry AM-N into 06_implementation_plan.md verbatim", and the ideation report is a historical
|
|
207
|
+
// artifact — editing its rows to match tests that were named later would be rewriting the record
|
|
208
|
+
// rather than closing the trail. So the plan's rows are authoritative when present, and the rule
|
|
209
|
+
// that keeps that honest is coverage: an ideation amendment the plan never mentions is a DROPPED
|
|
210
|
+
// amendment, which is the renegotiating-away failure in a quieter form.
|
|
211
|
+
for (const gap of input.missingFromPlan ?? []) {
|
|
212
|
+
reasons.push(gap.kind === 'dropped'
|
|
213
|
+
? `${gap.id} is an amendment in 03.5_ideation_report.md that 06_implementation_plan.md never carries — an amendment dropped in planning is one nobody can audit`
|
|
214
|
+
: `${gap.id} appears in both documents but the plan describes a DIFFERENT change — "carry verbatim" means the subject survives; only the test pointer may be renamed`);
|
|
215
|
+
}
|
|
216
|
+
if (input.planSaysNone) {
|
|
217
|
+
reasons.push(`the ideation report carries ${input.rows.length} amendment row(s) while 06_implementation_plan.md records \`## Amendments: None\` — the amendments were renegotiated away, and an amendment nobody can resolve is one nobody can audit`);
|
|
218
|
+
}
|
|
219
|
+
for (const r of input.resolutions) {
|
|
220
|
+
if (r.verdict !== 'resolved')
|
|
221
|
+
reasons.push(`${r.id} → ${r.verdict}: ${r.detail}`);
|
|
222
|
+
}
|
|
223
|
+
return { outcome: reasons.length > 0 ? 'fail' : 'pass', exit: reasons.length > 0 ? 1 : 0, reasons, counts };
|
|
224
|
+
}
|
|
225
|
+
/** The one line every caller reads last, in the K2 gate's own shape so the two read alike. */
|
|
226
|
+
export function amendmentVerdictLine(d) {
|
|
227
|
+
const label = d.outcome === 'not-established' ? 'NOT-ESTABLISHED' : d.outcome.toUpperCase();
|
|
228
|
+
const head = `amendment traceability: ${label}`;
|
|
229
|
+
const tail = d.outcome === 'pass'
|
|
230
|
+
? `${d.counts.resolved} row(s) resolved`
|
|
231
|
+
: (d.reasons[0] ?? 'no reason recorded');
|
|
232
|
+
return `${head} — ${tail}`;
|
|
233
|
+
}
|
|
234
|
+
/** Printed on every run: this checker does NOT prove a resolved test discriminates (NG-1, A8). */
|
|
235
|
+
export const AMENDMENT_VACUITY_NOTE = 'note: this checks that each amendment RESOLVES to a real test, not that the test is non-vacuous — `dz discrimination-check` owns vacuity.';
|
|
236
|
+
/**
|
|
237
|
+
* The amendment's own text with the `→ test …` pointer clause and markdown furniture removed — what
|
|
238
|
+
* "carry AM-N into the plan verbatim" is actually about. The POINTER may legitimately change (tests
|
|
239
|
+
* are named later than ideation guesses); the SUBJECT may not.
|
|
240
|
+
*/
|
|
241
|
+
export function amendmentSubject(raw) {
|
|
242
|
+
const withoutPointer = raw.split(/→\s*tests?\s/)[0] ?? '';
|
|
243
|
+
// Strip ONLY the row's furniture: bullet/table marks, the bold id, an optional `(source)` tag and
|
|
244
|
+
// a colon. An earlier version consumed up to 80 characters after the id, which ate the SUBJECT
|
|
245
|
+
// itself whenever a row carried no `(source):` tag — the checker then compared two truncations
|
|
246
|
+
// and called honest rows a mismatch.
|
|
247
|
+
const stripped = withoutPointer.replace(/^[\s|*\-]*\**AM-\d+\**\s*(?:\([^)]{0,80}\))?\s*:?\s*/, '');
|
|
248
|
+
return normalizeTestId(stripped);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Ideation amendments the plan fails to carry: either absent outright, or present under the same id
|
|
252
|
+
* with a DIFFERENT subject. Cross-family review (Codex gpt-5.6-sol, 2026-08-21) found the second
|
|
253
|
+
* case: comparing ids alone let a plan swap "deny unauthenticated deletes" for "render footer" under
|
|
254
|
+
* the same `AM-1` and still pass.
|
|
255
|
+
*/
|
|
256
|
+
export function amendmentsMissingFromPlan(ideationRows, planRows) {
|
|
257
|
+
const byId = new Map(planRows.map((r) => [r.id, r]));
|
|
258
|
+
const gaps = [];
|
|
259
|
+
for (const row of ideationRows) {
|
|
260
|
+
const planRow = byId.get(row.id);
|
|
261
|
+
if (planRow === undefined) {
|
|
262
|
+
gaps.push({ id: row.id, kind: 'dropped' });
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
const want = amendmentSubject(row.raw);
|
|
266
|
+
const got = amendmentSubject(planRow.raw);
|
|
267
|
+
// Containment either way: a plan may append a note ("closes HIGH-2"), and ideation may be the
|
|
268
|
+
// longer prose. What it may not do is describe a different change.
|
|
269
|
+
if (want.length >= MIN_MATCHABLE_ID_LENGTH && !got.includes(want) && !want.includes(got)) {
|
|
270
|
+
gaps.push({ id: row.id, kind: 'subject-changed' });
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return gaps;
|
|
274
|
+
}
|
|
275
|
+
//# sourceMappingURL=amendment-trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amendment-trace.js","sourceRoot":"","sources":["../src/amendment-trace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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AAC,CAAC;YAC3C,SAAS;QACX,CAAC;QACD,MAAM,IAAI,GAAG,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACvC,MAAM,GAAG,GAAG,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC1C,8FAA8F;QAC9F,mEAAmE;QACnE,IAAI,IAAI,CAAC,MAAM,IAAI,uBAAuB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACzF,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -75,6 +75,10 @@ export { step8ClaimGate } from './feature-adr-claim-gate.js';
|
|
|
75
75
|
export type { Step8ClaimCounts, Step8ClaimGate } from './feature-adr-claim-gate.js';
|
|
76
76
|
export { CHECKPOINT_STAGES, STAGE_ARTIFACTS, CHECKPOINT_MAX_RESULT_CHARS, CHECKPOINT_LS_SENTINEL, CKPT_SCHEMA_VERSION, fnv1a, fnv1a64, checkpointInputHash, resumeMode, decideCheckpointResume, serializeCheckpoint, decideCheckpointWrite, parseCheckpointRead, checkpointReadCmd, checkpointAppendCmd, TRAINPAIR_SCHEMA_VERSION, TRAINPAIR_MAX_IO_CHARS, TRAINPAIR_PRIVACY_NOTE, trainingPairFamily, buildTrainingPair, serializeTrainingPair, trainingPairPath, trainingPairAppendCmd, codeCheckpointPersistAllowed, codeStageResultShapeValid, } from './feature-adr-checkpoints.js';
|
|
77
77
|
export type { CheckpointStage, CheckpointEntry, ResumeMode, ResumeDecision, ParsedCheckpointRead, TrainingPairFamily, TrainingPair, TrainingPairEvaluation, TrainingPairProvenance, TrainingPairTruncation, CheckpointWriteVerdict, } from './feature-adr-checkpoints.js';
|
|
78
|
+
export { MIN_MATCHABLE_ID_LENGTH, AMENDMENT_VACUITY_NOTE, normalizeTestId, amendmentSection, planSaysNoAmendments, parseAmendments, resolveAmendments, decideAmendmentOutcome, amendmentVerdictLine, amendmentsMissingFromPlan, amendmentSubject, extractTestTitles, } from './amendment-trace.js';
|
|
79
|
+
export { RECORD_MAX_LINE_CHARS, decideRecordWrite, decideReadBack, recordVerdictLine, } from './run-records.js';
|
|
80
|
+
export type { RecordKind, RecordVerdict, RecordDecision } from './run-records.js';
|
|
81
|
+
export type { AmendmentRow, AmendmentVerdict, AmendmentResolution, AmendmentOutcome, AmendmentDecision, PlanCoverageGap } from './amendment-trace.js';
|
|
78
82
|
export { DOMAIN_LIFT_EXACT, DOMAIN_LIFT_RELATED, normalizeDomain, domainMatch, applyDomainBoost, countDisplacedByCut, renderDomainBoostNote, renderDomainCutNote, } from './recall-domain-boost.js';
|
|
79
83
|
export type { DomainMatch, DomainBoostResult } from './recall-domain-boost.js';
|
|
80
84
|
export { DEFAULT_HELD_OUT_DOMAINS, applyExportHoldout, canonicalDomainKey, heldOutAfterOptIn, renderHoldoutNote, renderSharedStoreAdvice, decideVectorExport, } from './export-holdout.js';
|