@dzhechkov/harness-core 0.7.11 → 0.8.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 +287 -87
- package/README.md +60 -1
- package/dist/amendment-trace.d.ts +12 -1
- package/dist/amendment-trace.d.ts.map +1 -1
- package/dist/amendment-trace.js +22 -4
- package/dist/amendment-trace.js.map +1 -1
- package/dist/book-kb.d.ts.map +1 -1
- package/dist/book-kb.js +17 -0
- package/dist/book-kb.js.map +1 -1
- package/dist/feature-adr-checkpoints.d.ts +61 -0
- package/dist/feature-adr-checkpoints.d.ts.map +1 -1
- package/dist/feature-adr-checkpoints.js +116 -2
- package/dist/feature-adr-checkpoints.js.map +1 -1
- package/dist/feature-adr-routing.d.ts +69 -12
- package/dist/feature-adr-routing.d.ts.map +1 -1
- package/dist/feature-adr-routing.js +117 -7
- package/dist/feature-adr-routing.js.map +1 -1
- package/dist/index.d.ts +23 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -4
- package/dist/index.js.map +1 -1
- package/dist/learning-backend.d.ts +39 -0
- package/dist/learning-backend.d.ts.map +1 -1
- package/dist/learning-backend.js +31 -11
- package/dist/learning-backend.js.map +1 -1
- package/dist/lesson-bandit.d.ts +116 -0
- package/dist/lesson-bandit.d.ts.map +1 -0
- package/dist/lesson-bandit.js +235 -0
- package/dist/lesson-bandit.js.map +1 -0
- package/dist/lesson-payoff.d.ts +260 -0
- package/dist/lesson-payoff.d.ts.map +1 -0
- package/dist/lesson-payoff.js +597 -0
- package/dist/lesson-payoff.js.map +1 -0
- package/dist/loop-blobs.generated.js +2 -2
- package/dist/loop-blobs.generated.js.map +1 -1
- package/dist/mutation-gate.d.ts +31 -8
- package/dist/mutation-gate.d.ts.map +1 -1
- package/dist/mutation-gate.js +57 -16
- package/dist/mutation-gate.js.map +1 -1
- package/dist/named-lock.d.ts.map +1 -1
- package/dist/named-lock.js +11 -9
- package/dist/named-lock.js.map +1 -1
- package/dist/native-dep-probe.d.ts +11 -0
- package/dist/native-dep-probe.d.ts.map +1 -0
- package/dist/native-dep-probe.js +100 -0
- package/dist/native-dep-probe.js.map +1 -0
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +82 -1
- package/dist/operations.js.map +1 -1
- package/dist/parser-safe-region.d.ts +47 -0
- package/dist/parser-safe-region.d.ts.map +1 -0
- package/dist/parser-safe-region.js +47 -0
- package/dist/parser-safe-region.js.map +1 -0
- package/dist/patterns.d.ts +21 -0
- package/dist/patterns.d.ts.map +1 -1
- package/dist/patterns.js +52 -4
- package/dist/patterns.js.map +1 -1
- package/dist/profile.d.ts +202 -0
- package/dist/profile.d.ts.map +1 -0
- package/dist/profile.js +536 -0
- package/dist/profile.js.map +1 -0
- package/dist/project-skills-root.d.ts +44 -0
- package/dist/project-skills-root.d.ts.map +1 -0
- package/dist/project-skills-root.js +62 -0
- package/dist/project-skills-root.js.map +1 -0
- package/dist/publish.d.ts +5 -3
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +46 -8
- package/dist/publish.js.map +1 -1
- package/dist/qe-rounds.d.ts +75 -0
- package/dist/qe-rounds.d.ts.map +1 -0
- package/dist/qe-rounds.js +174 -0
- package/dist/qe-rounds.js.map +1 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +5 -1
- package/dist/registry.js.map +1 -1
- package/dist/run-records.d.ts.map +1 -1
- package/dist/run-records.js +8 -1
- package/dist/run-records.js.map +1 -1
- package/dist/setup.d.ts +35 -4
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +86 -23
- package/dist/setup.js.map +1 -1
- package/dist/sign.d.ts +29 -24
- package/dist/sign.d.ts.map +1 -1
- package/dist/sign.js +183 -61
- package/dist/sign.js.map +1 -1
- package/dist/store-location.d.ts +56 -0
- package/dist/store-location.d.ts.map +1 -0
- package/dist/store-location.js +56 -0
- package/dist/store-location.js.map +1 -0
- package/dist/store-lock.d.ts +1 -0
- package/dist/store-lock.d.ts.map +1 -1
- package/dist/store-lock.js +7 -1
- package/dist/store-lock.js.map +1 -1
- package/dist/store-merge.d.ts +55 -0
- package/dist/store-merge.d.ts.map +1 -0
- package/dist/store-merge.js +77 -0
- package/dist/store-merge.js.map +1 -0
- package/dist/teach-target.d.ts +61 -0
- package/dist/teach-target.d.ts.map +1 -0
- package/dist/teach-target.js +105 -0
- package/dist/teach-target.js.map +1 -0
- package/dist/vector-tier.d.ts +30 -0
- package/dist/vector-tier.d.ts.map +1 -1
- package/dist/vector-tier.js +178 -20
- package/dist/vector-tier.js.map +1 -1
- package/package.json +13 -13
- package/sbom.json +591 -87
- package/src/amendment-trace.ts +34 -4
- package/src/book-kb.ts +17 -0
- package/src/feature-adr-checkpoints.ts +111 -2
- package/src/feature-adr-routing.ts +146 -7
- package/src/index.ts +55 -3
- package/src/learning-backend.ts +62 -11
- package/src/lesson-bandit.ts +279 -0
- package/src/lesson-payoff.ts +728 -0
- package/src/loop-blobs.generated.ts +2 -2
- package/src/mutation-gate.ts +74 -17
- package/src/named-lock.ts +10 -8
- package/src/native-dep-probe.ts +118 -0
- package/src/operations.ts +77 -1
- package/src/parser-safe-region.ts +65 -0
- package/src/patterns.ts +76 -6
- package/src/profile.ts +593 -0
- package/src/project-skills-root.ts +63 -0
- package/src/publish.ts +43 -7
- package/src/qe-rounds.ts +226 -0
- package/src/registry.ts +5 -1
- package/src/run-records.ts +9 -1
- package/src/setup.ts +87 -23
- package/src/sign.ts +180 -60
- package/src/store-location.ts +76 -0
- package/src/store-lock.ts +8 -1
- package/src/store-merge.ts +91 -0
- package/src/teach-target.ts +126 -0
- package/src/vector-tier.ts +236 -21
package/README.md
CHANGED
|
@@ -3,6 +3,32 @@
|
|
|
3
3
|
Shared logic for the DZ harness — the engine behind `@dzhechkov/harness-cli`
|
|
4
4
|
and any other consumer.
|
|
5
5
|
|
|
6
|
+
## Lesson payoff (bandit re-rank)
|
|
7
|
+
|
|
8
|
+
`lesson-bandit.ts` / `lesson-payoff.ts` add a **payoff axis** to lesson recall: a Beta posterior per
|
|
9
|
+
`(domain, lesson)` that answers *"has this lesson ever actually helped?"* — the question neither
|
|
10
|
+
cosine similarity nor SAFLA-delta asks.
|
|
11
|
+
|
|
12
|
+
Public surface: `contextKeyFor`, `classifySignal`, `makeRewardEvent`, `recordReward`,
|
|
13
|
+
`recordExposures`, `payoffTermsFor`, `narrowBanditReport`, `banditStats`, `renderBanditHealth`,
|
|
14
|
+
`resolveBanditConfig`, and the vendored `LessonBandit` engine.
|
|
15
|
+
|
|
16
|
+
Load-bearing properties, each pinned by a test that goes RED when the property is mutated out:
|
|
17
|
+
- **Disarmed by default.** `memory.learning.banditRerank` absent ⇒ the module is not even loaded and
|
|
18
|
+
ranking is byte-identical.
|
|
19
|
+
- **A view is not a reward.** `kind:'recall-hit'` is recorded as an EXPOSURE; only an explicit
|
|
20
|
+
confirmation moves the posterior.
|
|
21
|
+
- **Quarantine-closed.** Quarantined lessons never receive trial impressions unless
|
|
22
|
+
`banditExploration` is armed explicitly — that flag weakens an existing guarantee, so it ships off.
|
|
23
|
+
- **Bounded.** The term is added, never assigned, and capped; similarity still selects the candidates.
|
|
24
|
+
- **No lost update.** State writes go through a named lock; the reproducer test asserts both halves.
|
|
25
|
+
- **Unicode-scoped.** Domain keys keep letters in any script — Cyrillic and CJK domains stay distinct
|
|
26
|
+
instead of sharing one posterior.
|
|
27
|
+
|
|
28
|
+
The engine is vendored (215 lines, MIT, zero imports) rather than imported: its upstream path is not
|
|
29
|
+
in `agentdb`'s exports map, and a ranking feature that quietly stops ranking looks exactly like one
|
|
30
|
+
that works.
|
|
31
|
+
|
|
6
32
|
## What it provides
|
|
7
33
|
|
|
8
34
|
| Module | Exports | Purpose |
|
|
@@ -11,7 +37,7 @@ and any other consumer.
|
|
|
11
37
|
| `apply` | `applyEmitResult` | Write an adapter `EmitResult` to disk — **additively** |
|
|
12
38
|
| `targets` | `TARGETS`, `TargetName`, `isTargetName`, `resolveTargetName`, `TARGET_ALIASES`, `TARGET_NAMES_SORTED`, `formatTargetProblem`, `formatTargetAliasNote`, `normalizeTargetToken` | `--target` name → platform adapter, plus the resolution layer in front of it. `isTargetName`/`TARGETS`/`TARGET_NAMES` are UNCHANGED: `boundaries.json` names `isTargetName` as the scanned `--target` validation boundary, and every resolution ends in exactly that guard — the boundary is routed THROUGH, never relocated. `resolveTargetName` is total and pure, with fixed precedence: exact canonical → normalised canonical (case/padding/separators: `Claude_Code`, `claudecode`) → an explicit `TARGET_ALIASES` row → unique normalised prefix → Levenshtein ≤ 3 strictly better than the runner-up → nothing. **Aliases ACCEPT; prefix and Levenshtein only SUGGEST** — an alias row is an owner decision recorded in DATA (adding one is one line and zero control flow), while a fuzzy match is a guess, and installing to the wrong target on a guess is worse than one round-trip. An ambiguous prefix (`co` → `codex`/`copilot`) is terminal with NO suggestion, for the same reason. `formatTargetProblem` renders the two-line refusal, keeping the literal `--target must be one of:` substring that shipped assertions pin |
|
|
13
39
|
| `agents-policy` | `POLICY_SOURCES`, `extractPolicyBlocks`, `renderPolicySections`, `detectPolicyDrift`, `measureAgentsMdBudget` | Pure anchored policy extraction, 12-hex source stamps, drift classification and Codex project-doc byte-budget measurement. The stamps prove source/target synchronization only; they do not prove that a runtime read or obeyed the text |
|
|
14
|
-
| `sign`
|
|
40
|
+
| `sign` | `listPackFiles`, `listSignablePackFiles`, `verifyManifest`, `verifySbomAgainstManifest` | Shared node_modules/.git exclusions; verify sees MORE than sign (smuggled symlinks still fail). After authenticating the Ed25519 manifest, verification derives the canonical CycloneDX document from those signed entries and requires the no-follow `sbom.json` read to match it exactly. Current/v3 signing refuses malformed, duplicate-key, or precision-losing root `package.json` JSON and preserves object order throughout `exports`, `imports`, and `typesVersions`, so condition-order entry-point changes cannot hide behind packer-noise canonicalisation. Readers retain v1/v2 compatibility |
|
|
15
41
|
| `guard` | `evaluateGuard`, `resolveRules`, `scanSecrets`, `DEFAULT_RULES`, `parsePnpmLockImporters` | Declarative HARD/SOFT constraint engine behind `dz guard` (publish/teach/consolidate pre-flight; fail-closed). The SOFT `lockfile-in-sync` rule compares each workspace package's `@dzhechkov/*` dep specs against the specifier `pnpm-lock.yaml` records for that importer — the `ERR_PNPM_OUTDATED_LOCKFILE` CI break, caught at publish. Its lockfile reader (`parsePnpmLockImporters`) is a pure RECOGNISE-OR-REFUSE parser (no YAML dependency): it reads only the `lockfileVersion: 9`+ importer layout and returns `undefined` for a legacy v5/v6 file, a truncated one, or any shape that leaves an importer with zero specifiers — because a half-parse reports every real dependency as "not recorded". The rule FAILS OPEN on that `undefined` (no violation) and is pinned SOFT-only via `SOFT_ONLY_RULES`, so no config can turn a parser that admits uncertainty into a publish blocker. The HARD `licence-hold` rule (+ `LICENCE_HOLD_PENDING_MARKER`) is the machine side of a declared licence precondition (`package.json.licenseHold`, ADR-001 hermes-claude-adaptation): silent while the pack stays `private:true` (the npm layer refuses it), it HARD-blocks publish the moment the pack becomes publishable with the hold unsatisfied — LICENSE absent/empty or still carrying the `<!-- PENDING:` grant placeholder, no `Grant-Confirmation: <url>` line, empty THIRD_PARTY_NOTICES, or a non-SPDX license field |
|
|
16
42
|
| `backlog` + `backlog-embed` | `dedupIdea`, `classifyDedup`, `dedupPairBand`, `dedupEmbedText`, `lexicalContainment`, `ensureBacklogEmbedForm`, `recordAbsorption`, `alignIdea`, `spinRoulette`, `readGoalMapDetailed`, `parseEffort`, `ensureBacklogGitignored`, `harmonizeBacklog`, `transitionIdeas`, `checkTransition`, `resolveIdPrefix`, `IDEA_TRANSITIONS` | The Smart Backlog engine behind `dz backlog`: status lifecycle via `transitionIdeas` (`ship`/`drop`/`reopen` against the `IDEA_TRANSITIONS` table — unique-short-prefix resolution, idempotent ship/drop no-ops, non-idempotent reopen, all-or-nothing fail-closed batches, line-preserving atomic JSONL rewrite that keeps every non-status byte of untouched records); content-addressed idea records in `.dz/backlog/ideas.jsonl`, semantic dedup over the REUSED agentdb vector namespace (`dz-backlog` — no second store), weighted-max GoalMap alignment, and a seeded weighted roulette. Dedup is TWO-SIGNAL since the register-inflation fix (MEASURED 2026-08-11 on the real 105-idea store: full-length embeds INVERTED the signal on long texts — genuine paraphrases 0.35–0.61 vs topically disjoint long-RU pairs up to 0.9195): `dedupEmbedText` embeds a bounded 400-char excerpt (`backlog-embed.ts`, one form shared by query/mirror/reindex so vectors can never split spaces; `ensureBacklogEmbedForm` re-mirrors v1 stores once, batched), and `dedupPairBand` requires a cosine-threshold DUPLICATE to also share subject vocabulary (`lexicalContainment` ≥ 0.3, else demoted to RELATED with the pair reported — the 0.941 register-only absorption) while promoting a same-idea re-capture at a different length (containment ≥ 0.95, cosine ≥ 0.75) to a subset duplicate; `recordAbsorption` keeps every absorbed text in `absorbed.jsonl` so a wrong verdict is reversible (mutation-defended: `backlog-dedup-demotion-corroboration`, hand-verified 6 red). Every band/weight decision is a PURE function. `classifyDedup` also reports the top-1 match id alongside the cosine (the calibration surface for the 0.92 duplicate band — observational, it never moves the verdict); `readGoalMapDetailed` returns the entries the defensive reader DROPPED with a reason AND the fields it REPAIRED with their raw values (a weight clamped before validation made the validator's out-of-range branch dead code), so `goals --validate` can never report a vacuous "valid (0 goals)" nor hide a `weight: 7`; `parseEffort` returns a printable note for every clamp; `ensureBacklogGitignored` gitignores the store on first write (raw ideas are private prompt-class content) — atomically, preserving the file's dominant EOL, recognising every plain spelling of an existing rule (`/.dz/`, `.dz/**`, …) via `backlogIgnoreStatus`, and obeying a `!` negation as an explicit user opt-out instead of overriding it |
|
|
17
43
|
| `no-stubs` | `scanStubs`, `checkNoStubs`, `scannableStubPath`, `STUB_MARKERS`, `STUB_PHRASES`, `STUB_SCAN_EXTENSIONS` | Pure unfinished-stub scanner behind the SOFT `no-stubs` publish rule (backlog 0b403a0106103901, Karpathy-Michaels rule XI): bare markers (`TODO`/`FIXME`/`HACK`/`XXX`/`PLACEHOLDER`) case-SENSITIVE with hard word boundaries (`hackathon`/`todos`/a marker inside a hash never fire; MEASURED: relaxing case doubles this repo's hits and adds only prose) + the `implement later` phrase case-insensitive. SCOPE = the CHANGE-SET (the working-tree `git status --porcelain -uall` diff — `-uall` so a brand-new untracked DIRECTORY is scanned file-by-file instead of collapsing to one invisible `?? newdir/` line; `.gitignore` semantics unchanged), never the whole tree — MEASURED: a tree-wide scan is 32+25 hits of mostly ancient legitimate markers, i.e. noise that gets a gate switched off. Markdown gets PROSE scoping (fenced blocks + backticked spans are QUOTES, not stubs). Waiver-with-REASON only, per line (`no-stubs: <reason>`) or per path (`.dz/guard.json` `stubWaivers`, the feature-adr-setup --guards shape); a reasonless waiver is REFUSED as its own finding and exempts nothing. Self-exemption is STRUCTURAL: every marker in the module and its tests is assembled from string fragments, so the gate's own source scans clean — a tested property, not a path skip. Fail-open on missing evidence (no change fact / ungathered contents ⇒ nothing reported) but never fail-SILENT: skipped scannable files (deleted/oversize/unreadable/beyond the file cap) surface as ONE aggregate `notes` entry in the `GuardResult` + audit record — information that can never move the verdict. KNOWN LIMITS are documented at the top of `no-stubs.ts` instead of implied away (whole-line inline waiver token = layer-4 auditability defence; reason QUALITY not judged; boolean fence model, not CommonMark; git-quoted paths undecoded; TS-monorepo extension allowlist; worktree-not-index reads; exact-string config-waiver paths). Mutation-defended (`no-stubs-bare-marker-fires` observed 10 red, `no-stubs-skipped-note-emitted` observed 2 red) |
|
|
@@ -236,8 +262,41 @@ Four changes, each replacing a statement derived from configuration with one der
|
|
|
236
262
|
|
|
237
263
|
A count that cannot be computed is reported as `undefined` — never as `0`.
|
|
238
264
|
|
|
265
|
+
## The operator profile module (`profile.ts`)
|
|
266
|
+
|
|
267
|
+
WHO is being talked to, as data: register (`pro | pro-lite | plain`), dialogue language, deep
|
|
268
|
+
domains (full pro, no scaffolding) and weak domains (one plain sentence every time), stored per
|
|
269
|
+
USER at `~/.dz/profile.json` — written `0600`, never inside a project, because a project `.dz/`
|
|
270
|
+
gets committed and personal data there would leak by construction. Delivery is a marked block in
|
|
271
|
+
`~/.claude/CLAUDE.md` (`renderProfileBlock` + `mergeProfileBlock`): foreign content survives
|
|
272
|
+
byte-for-byte, every modifying write leaves a timestamped backup, and a malformed marker state is
|
|
273
|
+
REFUSED with a named kind rather than guessed at. `checkProfileDrift` says whether the block still
|
|
274
|
+
matches the store.
|
|
275
|
+
|
|
276
|
+
Contracts the exports actually keep (each with its proving test in `test/profile.test.ts`):
|
|
277
|
+
|
|
278
|
+
- **`validateProfile` is TOTAL.** It is the boundary every no-throw caller (`readProfile`,
|
|
279
|
+
`writeProfile`, `syncProfileBlock`) relies on, so it may never leak a throw: a shape check that
|
|
280
|
+
itself throws (`JSON.stringify(2n)` is a TypeError) becomes a refusal verdict, and the catch
|
|
281
|
+
path formats the thrown value under its own try with a fixed fallback — conversion hooks run on
|
|
282
|
+
the THROWN value, so a hostile getter throwing `Object.create(null)` must not blow up the catch
|
|
283
|
+
either.
|
|
284
|
+
- **No profile field may contain a block marker literal.** A marker smuggled into a value poisons
|
|
285
|
+
every later sync (the first writes it INSIDE the generated block, the next reads it as legacy
|
|
286
|
+
nested state and refuses). Refused at the one validation seam all write paths cross — `set`,
|
|
287
|
+
`--json`, init, and a hand-edited store file; `updatedAt` included, because an unparseable one
|
|
288
|
+
is rendered into the block heading.
|
|
289
|
+
- **`syncProfileBlock` revalidates its input.** It is a public write path; a consumer calling it
|
|
290
|
+
directly with a poisoned in-memory profile skips `writeProfile` entirely. Invalid → verdict, no
|
|
291
|
+
write, no backup.
|
|
292
|
+
|
|
239
293
|
## Status
|
|
240
294
|
|
|
295
|
+
`0.8.1` — **the operator profile module, hardened by four cross-family review rounds until round 8
|
|
296
|
+
came back clean** (the contract list above IS the round-by-round finding list — echo deferral lives
|
|
297
|
+
in the CLI, the two totality fixes and the seam refusals live here). Tests: `test/profile.test.ts`
|
|
298
|
+
22/22 (MEASURED — reproducer `npx vitest run test/profile.test.ts`).
|
|
299
|
+
|
|
241
300
|
`0.7.11` — **the observability pass, and a publisher that stops rewriting history.** Republished so the newest heading matches the version that carries it: `0.7.10` shipped with its own heading reading `0.7.9`, because no changelog entry syncs automatically any more and the author writes that line. Five gaps were measured in this repo's own telemetry and
|
|
242
301
|
closed. `CheckpointEntry` gains an optional `ts` and `stampCheckpointLine` applies it at the append —
|
|
243
302
|
deliberately OUTSIDE the blob-mirrored serializer, because the sandboxed workflow has no `Date` and a
|
|
@@ -21,7 +21,18 @@ export interface AmendmentRow {
|
|
|
21
21
|
readonly file: string | null;
|
|
22
22
|
readonly raw: string;
|
|
23
23
|
}
|
|
24
|
-
export type AmendmentVerdict = 'resolved' | 'placeholder'
|
|
24
|
+
export type AmendmentVerdict = 'resolved' | 'placeholder'
|
|
25
|
+
/**
|
|
26
|
+
* The plan RETRACTED this amendment and named its successor. A first-class outcome, never a
|
|
27
|
+
* failure: a plan is allowed to change its mind, and until 2026-08-25 this checker had no concept
|
|
28
|
+
* of it at all (`grep superseded` over this file returned nothing), so a legitimately retracted
|
|
29
|
+
* amendment read as `unnamed` and failed the run. C6 has accepted the form since it was written —
|
|
30
|
+
* this is the half of the contract that was missing here.
|
|
31
|
+
*
|
|
32
|
+
* Honest limit, stated in ADR-001: nothing verifies that the named successor EXISTS, or that the
|
|
33
|
+
* retraction was justified. Refusing retraction outright is what produced the false failures.
|
|
34
|
+
*/
|
|
35
|
+
| 'superseded' | 'unnamed' | 'no-file-named' | 'file-missing' | 'name-absent-in-file';
|
|
25
36
|
export interface AmendmentResolution {
|
|
26
37
|
readonly id: string;
|
|
27
38
|
readonly testId: string | null;
|
|
@@ -1 +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,CAA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H,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"}
|
package/dist/amendment-trace.js
CHANGED
|
@@ -57,7 +57,11 @@ export function normalizeTestId(s) {
|
|
|
57
57
|
* `features/ha-consilium/03.5_ideation_report.md` — is deliberately NOT a row: counting a legend as
|
|
58
58
|
* an amendment would open this feature by falsely accusing a feature that did nothing wrong.
|
|
59
59
|
*/
|
|
60
|
-
|
|
60
|
+
// The bullet is OPTIONAL, and `AM-CP-N` is a row like any other. MEASURED 2026-08-25: requiring a
|
|
61
|
+
// bullet drops 104 of the corpus's 347 real amendment rows out of the check entirely, and a
|
|
62
|
+
// bullet-less row made this tool return `not-established` — which the pipeline's own gate text calls
|
|
63
|
+
// "NEVER a pass". C6 has always treated the bullet as optional; this is that half of the contract.
|
|
64
|
+
const ROW_START = /^(?:[-*|]\s*)?\*{0,2}AM-(?:CP-)?(\d+)/gm;
|
|
61
65
|
/** The `## Amendments` section body, or null when the document has none (acid case A5). */
|
|
62
66
|
export function amendmentSection(md) {
|
|
63
67
|
const m = /^ {0,3}#{2,4}\s+Amendments\b[^\n]*\n/m.exec(md);
|
|
@@ -93,10 +97,14 @@ export function parseAmendments(md) {
|
|
|
93
97
|
}
|
|
94
98
|
return rows;
|
|
95
99
|
}
|
|
100
|
+
/** `superseded by AM-N` / `AM-CP-N` — the retraction form C6 has always accepted. */
|
|
101
|
+
const SUPERSEDED = /superseded by AM-(?:CP-)?\d+/i;
|
|
96
102
|
/** `→ test \`a\`` and the two-id shape `→ tests \`a\` and \`b\`` — both are in the corpus. */
|
|
97
103
|
function extractTestIds(raw) {
|
|
98
104
|
const out = [];
|
|
99
|
-
|
|
105
|
+
// Both arrows. C6 accepted `->` from the start and this file only accepted `→`, so an ASCII row
|
|
106
|
+
// read as `unnamed` here while passing there — an accident of two authors, not a decision.
|
|
107
|
+
const re = /(?:\u2192|->)\s*tests?\s+`([^`]+)`(?:\s*(?:and|и)\s*`([^`]+)`)?/g;
|
|
100
108
|
for (let m = re.exec(raw); m !== null; m = re.exec(raw)) {
|
|
101
109
|
if (m[1])
|
|
102
110
|
out.push(m[1].trim());
|
|
@@ -111,12 +119,18 @@ function extractTestIds(raw) {
|
|
|
111
119
|
* successive shell-written extractors returned 108, 111 and 13 rows over the identical corpus.
|
|
112
120
|
*/
|
|
113
121
|
function extractFile(raw) {
|
|
114
|
-
const m =
|
|
122
|
+
const m = /(?:\u2192|->)\s*tests?\s+`[^`]+`(?:\s*(?:and|и)\s*`[^`]+`)?[\s\S]{0,40}?\bin\s+`([^`]+)`/.exec(raw);
|
|
115
123
|
return m && m[1] ? m[1].trim() : null;
|
|
116
124
|
}
|
|
117
125
|
export function resolveAmendments(rows, opts) {
|
|
118
126
|
const out = [];
|
|
119
127
|
for (const row of rows) {
|
|
128
|
+
// A retraction is checked BEFORE the missing-pointer branch: a row that says it was superseded
|
|
129
|
+
// is not a row that forgot its test.
|
|
130
|
+
if (SUPERSEDED.test(row.raw)) {
|
|
131
|
+
out.push({ id: row.id, testId: null, file: row.file, verdict: 'superseded', detail: 'the plan retracted this amendment and named its successor' });
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
120
134
|
if (row.testIds.length === 0) {
|
|
121
135
|
out.push({
|
|
122
136
|
id: row.id,
|
|
@@ -172,6 +186,7 @@ function resolveOne(row, testId, readFile) {
|
|
|
172
186
|
const ZERO_COUNTS = {
|
|
173
187
|
resolved: 0,
|
|
174
188
|
placeholder: 0,
|
|
189
|
+
superseded: 0,
|
|
175
190
|
unnamed: 0,
|
|
176
191
|
'no-file-named': 0,
|
|
177
192
|
'file-missing': 0,
|
|
@@ -222,7 +237,10 @@ export function decideAmendmentOutcome(input) {
|
|
|
222
237
|
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`);
|
|
223
238
|
}
|
|
224
239
|
for (const r of input.resolutions) {
|
|
225
|
-
|
|
240
|
+
// `superseded` is an OUTCOME, not a defect: the plan retracted the amendment and said so. It is
|
|
241
|
+
// reported in the counts and never becomes a reason, which is the whole point — refusing
|
|
242
|
+
// retraction is what produced the false failures this change removes.
|
|
243
|
+
if (r.verdict !== 'resolved' && r.verdict !== 'superseded')
|
|
226
244
|
reasons.push(`${r.id} → ${r.verdict}: ${r.detail}`);
|
|
227
245
|
}
|
|
228
246
|
return { outcome: reasons.length > 0 ? 'fail' : 'pass', exit: reasons.length > 0 ? 1 : 0, reasons, counts };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amendment-trace.js","sourceRoot":"","sources":["../src/amendment-trace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"amendment-trace.js","sourceRoot":"","sources":["../src/amendment-trace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA+CH;;;GAGG;AACH,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE5G;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAEzC,wGAAwG;AACxG;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,qBAAq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,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACjC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,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/book-kb.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"book-kb.d.ts","sourceRoot":"","sources":["../src/book-kb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"book-kb.d.ts","sourceRoot":"","sources":["../src/book-kb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,2DAA2D;AAC3D,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;I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CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,GAAG,KAAK,CAAA;CAAO,GACnF,OAAO,CAAC;IAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAwChD"}
|
package/dist/book-kb.js
CHANGED
|
@@ -14,6 +14,7 @@ import { join, dirname } from 'node:path';
|
|
|
14
14
|
import { existsSync, mkdirSync } from 'node:fs';
|
|
15
15
|
import { pathToFileURL } from 'node:url';
|
|
16
16
|
import { createRequire } from 'node:module';
|
|
17
|
+
import { describeNativeDep, exerciseSqliteOpen, probeNativeDep } from './native-dep-probe.js';
|
|
17
18
|
/** Default lexical store path — a `memory/` sibling of the pattern store, never `agentdb.db`. */
|
|
18
19
|
export function bookKbPath(projectRoot) {
|
|
19
20
|
return join(projectRoot, '.dz', 'memory', 'books.sqlite');
|
|
@@ -23,6 +24,12 @@ const SCHEMA = `CREATE VIRTUAL TABLE IF NOT EXISTS book_knowledge USING fts5(
|
|
|
23
24
|
name, problem, content, chapter UNINDEXED, pages UNINDEXED, metadata UNINDEXED
|
|
24
25
|
);`;
|
|
25
26
|
async function openDb(projectRoot, dbPath) {
|
|
27
|
+
const verdict = probeNativeDep(projectRoot, 'better-sqlite3', exerciseSqliteOpen, 'sqlite-open');
|
|
28
|
+
if (verdict.state === 'absent') {
|
|
29
|
+
return { error: 'better-sqlite3 not installed in project (run: dz setup --memory agentdb)' };
|
|
30
|
+
}
|
|
31
|
+
if (verdict.state === 'unusable')
|
|
32
|
+
return { error: describeNativeDep(verdict) };
|
|
26
33
|
let sqliteUrl;
|
|
27
34
|
try {
|
|
28
35
|
const req = createRequire(join(projectRoot, 'package.json'));
|
|
@@ -31,6 +38,16 @@ async function openDb(projectRoot, dbPath) {
|
|
|
31
38
|
catch {
|
|
32
39
|
return { error: 'better-sqlite3 not installed in project (run: dz setup --memory agentdb)' };
|
|
33
40
|
}
|
|
41
|
+
// The probe above absorbs the DEPENDENCY failures — absent, or present-but-unloadable — which is
|
|
42
|
+
// what cross-family review (F2) required: those are instrument failures and must be RETURNED.
|
|
43
|
+
//
|
|
44
|
+
// What follows must still THROW, and that is deliberate. `dz recall --books` distinguishes two
|
|
45
|
+
// states by throw-vs-return, and collapsing them loses a shipped honesty contract (measured
|
|
46
|
+
// 2026-08-27, `books-recall-honesty.test.ts`):
|
|
47
|
+
// throws -> the STORE ITSELF is unreadable -> exit 1, naming the path and a cure
|
|
48
|
+
// {error} -> the INSTRUMENT did not run -> exit 3 under --semantic, never a clean 0-hit
|
|
49
|
+
// A corrupted `books.sqlite` is the first state. Wrapping it into `{error}` made a corrupt store
|
|
50
|
+
// read as a missing instrument and exit 0 — a false clean pass over unreadable data.
|
|
34
51
|
const path = dbPath ?? bookKbPath(projectRoot);
|
|
35
52
|
mkdirSync(dirname(path), { recursive: true });
|
|
36
53
|
const { default: Database } = (await import(sqliteUrl));
|
package/dist/book-kb.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"book-kb.js","sourceRoot":"","sources":["../src/book-kb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"book-kb.js","sourceRoot":"","sources":["../src/book-kb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAA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O;YACL,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACrB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO;gBAC/F,GAAG,CAAC,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACrD,GAAG,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACxE,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,yBAAyB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;IAC1G,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -291,6 +291,67 @@ export declare function trainingPairPath(slug: string, stage: string): string;
|
|
|
291
291
|
/** README dropped once into the capture dir. The caveat is documented ON DISK because the
|
|
292
292
|
* directory is deliberately not gitignored (explicit owner decision, 2026-08). */
|
|
293
293
|
export declare const TRAINPAIR_PRIVACY_NOTE = "feature-adr TRAINING PAIRS (backlog 70e0f083): per-stage SFT records - STAGE INPUT (full prompt/context) -> STAGE OUTPUT (artifact/result) -> EVALUATION (QE grade + injected lessons) with model+family provenance; one JSONL file per stage per slug. PRIVACY: pairs may contain TARGET-REPO CODE and full prompts. This directory is NOT gitignored yet by explicit owner decision - review contents before sharing or publishing anything that embeds it. ts is the CAPTURE time. On a record with captureMode: 'backfill' that is the RECONSTRUCTION time, NOT the stage's observation time \u2014 the original stage's timing lives in that run's .fa-state checkpoint.";
|
|
294
|
+
/** Coerce a stage input/output to text: strings pass through; objects serialize to JSON;
|
|
295
|
+
* an unserializable value degrades to String(v) — buildTrainingPair NEVER throws (capture
|
|
296
|
+
* is non-blocking by contract). */
|
|
297
|
+
/** Marker pair of the operator-profile block (feature operator-profile, ADR-001 Decision 5).
|
|
298
|
+
* DELIBERATE LOCAL COPIES of profile.ts's PROFILE_MARKER_START/END: this module stays import-free
|
|
299
|
+
* so the workflow can mirror it inline. `test/profile-redaction.test.ts` pins the pairs equal. */
|
|
300
|
+
export declare const TP_PROFILE_MARKER_START = "<!-- dz:profile:start -->";
|
|
301
|
+
export declare const TP_PROFILE_MARKER_END = "<!-- dz:profile:end -->";
|
|
302
|
+
/** What a redacted block is replaced with — visible in the dataset, so a missing profile is
|
|
303
|
+
* distinguishable from a never-present one. */
|
|
304
|
+
export declare const TP_PROFILE_REDACTED = "[dz:profile REDACTED]";
|
|
305
|
+
/**
|
|
306
|
+
* Strip every operator-profile block from `text` BEFORE a training pair is persisted.
|
|
307
|
+
*
|
|
308
|
+
* Why here and not "the guard already says never write the profile into a project": training-pair
|
|
309
|
+
* capture records the FULL prompt as the model received it into `.dz/fa-training/`, which is
|
|
310
|
+
* deliberately NOT gitignored — so a profile injected into context would reach a committable
|
|
311
|
+
* directory, and the never-in-a-project guard would be defeated through this path (ADR-001
|
|
312
|
+
* Decision 5, exit 3). Redaction at the single assembly seam closes it for capture AND backfill.
|
|
313
|
+
*
|
|
314
|
+
* Semantics: every complete `start…end` span is replaced (markers included) with
|
|
315
|
+
* {@link TP_PROFILE_REDACTED}. A START marker with no matching END fails CLOSED — everything from
|
|
316
|
+
* the marker to the end of the text is dropped (over-redaction is a lost training sample;
|
|
317
|
+
* under-redaction is a personal-data leak). Text without markers passes through byte-identical.
|
|
318
|
+
* Works on JSON-stringified payloads too: the marker literals contain no characters JSON escapes.
|
|
319
|
+
*/
|
|
320
|
+
export declare function redactProfileBlock(text: string): string;
|
|
321
|
+
/**
|
|
322
|
+
* Deep redaction over an already-PARSED training-pair payload — the PERSIST-SIDE half of CF-6.
|
|
323
|
+
*
|
|
324
|
+
* Why a second entry point next to {@link redactProfileBlock}: the DEFAULT-ON capture in the
|
|
325
|
+
* canonical workflow builds its pair with an INLINE mirror of buildTrainingPair and hands the
|
|
326
|
+
* serialised JSON to `dz feature-adr-record` — a path that never passes through the core builder.
|
|
327
|
+
* Redacting at the builder alone therefore guarded the path that does NOT run (Codex cross-family
|
|
328
|
+
* finding, 2026-08-28: guard 1 defeated through guard 3, one seam further down — the exact shape
|
|
329
|
+
* ADR-001 Decision 5 names). This function runs inside `decideRecordWrite` (run-records.ts), the
|
|
330
|
+
* one decision every witnessed training-pair write funnels through, so a FUTURE pair builder is
|
|
331
|
+
* covered without patching its caller.
|
|
332
|
+
*
|
|
333
|
+
* Semantics: every string leaf (keys included) goes through {@link redactProfileBlock} — same
|
|
334
|
+
* fail-closed rule on an unterminated block; arrays and plain objects are walked; numbers,
|
|
335
|
+
* booleans and null pass through untouched. A payload with no markers anywhere round-trips to a
|
|
336
|
+
* deep-equal value.
|
|
337
|
+
*
|
|
338
|
+
* Two mechanics, both cross-family findings (2026-08-28), both load-bearing:
|
|
339
|
+
*
|
|
340
|
+
* - Rebuilt objects have a NULL prototype, so every JSON key — `__proto__` included — lands as an
|
|
341
|
+
* OWN property. The previous `{}` + assignment invoked the inherited `__proto__` SETTER for a
|
|
342
|
+
* payload like `{"slug":"s","stage":"code","__proto__":{"input":"i","output":"o"}}`: the result
|
|
343
|
+
* then INHERITED input/output (the shape check passed) while serialization dropped them — an
|
|
344
|
+
* invalid pair reported `written`. With own-key reconstruction the JSON keys round-trip exactly
|
|
345
|
+
* and that payload fails the shape check honestly.
|
|
346
|
+
* - The walk is ITERATIVE (explicit stack), not recursive: ~5000 nested arrays is a ~10 KB payload
|
|
347
|
+
* that passes JSON.parse and sits under the line cap, but a recursive map hit RangeError before
|
|
348
|
+
* any size guard — a throw escaping a seam whose callers promise non-blocking verdicts. The
|
|
349
|
+
* iterative walk chose over a caught-RangeError→`refused` wrapper because it keeps the honest
|
|
350
|
+
* outcome for deep-but-valid payloads (they get redacted and judged on their merits) instead of
|
|
351
|
+
* refusing them at an arbitrary engine-dependent depth. A repeated container is walked once and
|
|
352
|
+
* reused (WeakMap), so a shared or cyclic reference can never loop the walk either.
|
|
353
|
+
*/
|
|
354
|
+
export declare function redactTrainingPayload(v: unknown): unknown;
|
|
294
355
|
/** Assemble one SFT-ready training pair. Deterministic (ts passed in). Applies the oversize
|
|
295
356
|
* guard: when input+output exceed TRAINPAIR_MAX_IO_CHARS combined, each over-budget side is
|
|
296
357
|
* truncated with a marker naming the cut char count + the fnv1a64 of its FULL text (the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-adr-checkpoints.d.ts","sourceRoot":"","sources":["../src/feature-adr-checkpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;qGACqG;AACrG,eAAO,MAAM,YAAY,UAAU,CAAC;AAEpC;;0DAE0D;AAC1D,eAAO,MAAM,iBAAiB,8DAA+D,CAAC;AAC9F,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE;;;;8EAI8E;AAC9E,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAUlE,CAAC;AAEF,iEAAiE;AACjE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IA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;IACnE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,2EAA2E;IAC3E,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,sBAAsB;IACrC,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,MAAM,EAAE,kBAAkB,CAAC;IAC3B,6FAA6F;IAC7F,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC,wFAAwF;IACxF,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wFAAwF;AACxF,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,iNAAiN;IACjN,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,sBAAsB,CAAC;IACnC,UAAU,EAAE,sBAAsB,CAAC;IACnC,SAAS,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACzC,WAAW,EAAE,SAAS,GAAG,UAAU,CAAC;IACpC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,2EAA2E;AAC3E,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED;kFACkF;AAClF,eAAO,MAAM,sBAAsB,kpBACymB,CAAC;
|
|
1
|
+
{"version":3,"file":"feature-adr-checkpoints.d.ts","sourceRoot":"","sources":["../src/feature-adr-checkpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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AC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5B,GAAG,sBAAsB,CAqBzB"}
|
|
@@ -312,6 +312,118 @@ export const TRAINPAIR_PRIVACY_NOTE = "feature-adr TRAINING PAIRS (backlog 70e0f
|
|
|
312
312
|
/** Coerce a stage input/output to text: strings pass through; objects serialize to JSON;
|
|
313
313
|
* an unserializable value degrades to String(v) — buildTrainingPair NEVER throws (capture
|
|
314
314
|
* is non-blocking by contract). */
|
|
315
|
+
/** Marker pair of the operator-profile block (feature operator-profile, ADR-001 Decision 5).
|
|
316
|
+
* DELIBERATE LOCAL COPIES of profile.ts's PROFILE_MARKER_START/END: this module stays import-free
|
|
317
|
+
* so the workflow can mirror it inline. `test/profile-redaction.test.ts` pins the pairs equal. */
|
|
318
|
+
export const TP_PROFILE_MARKER_START = '<!-- dz:profile:start -->';
|
|
319
|
+
export const TP_PROFILE_MARKER_END = '<!-- dz:profile:end -->';
|
|
320
|
+
/** What a redacted block is replaced with — visible in the dataset, so a missing profile is
|
|
321
|
+
* distinguishable from a never-present one. */
|
|
322
|
+
export const TP_PROFILE_REDACTED = '[dz:profile REDACTED]';
|
|
323
|
+
/**
|
|
324
|
+
* Strip every operator-profile block from `text` BEFORE a training pair is persisted.
|
|
325
|
+
*
|
|
326
|
+
* Why here and not "the guard already says never write the profile into a project": training-pair
|
|
327
|
+
* capture records the FULL prompt as the model received it into `.dz/fa-training/`, which is
|
|
328
|
+
* deliberately NOT gitignored — so a profile injected into context would reach a committable
|
|
329
|
+
* directory, and the never-in-a-project guard would be defeated through this path (ADR-001
|
|
330
|
+
* Decision 5, exit 3). Redaction at the single assembly seam closes it for capture AND backfill.
|
|
331
|
+
*
|
|
332
|
+
* Semantics: every complete `start…end` span is replaced (markers included) with
|
|
333
|
+
* {@link TP_PROFILE_REDACTED}. A START marker with no matching END fails CLOSED — everything from
|
|
334
|
+
* the marker to the end of the text is dropped (over-redaction is a lost training sample;
|
|
335
|
+
* under-redaction is a personal-data leak). Text without markers passes through byte-identical.
|
|
336
|
+
* Works on JSON-stringified payloads too: the marker literals contain no characters JSON escapes.
|
|
337
|
+
*/
|
|
338
|
+
export function redactProfileBlock(text) {
|
|
339
|
+
if (typeof text !== 'string' || text === '')
|
|
340
|
+
return typeof text === 'string' ? text : '';
|
|
341
|
+
let out = '';
|
|
342
|
+
let rest = text;
|
|
343
|
+
for (;;) {
|
|
344
|
+
const start = rest.indexOf(TP_PROFILE_MARKER_START);
|
|
345
|
+
if (start === -1)
|
|
346
|
+
return out + rest;
|
|
347
|
+
out += rest.slice(0, start) + TP_PROFILE_REDACTED;
|
|
348
|
+
const end = rest.indexOf(TP_PROFILE_MARKER_END, start + TP_PROFILE_MARKER_START.length);
|
|
349
|
+
if (end === -1)
|
|
350
|
+
return out; // unterminated block: fail closed, drop the tail
|
|
351
|
+
rest = rest.slice(end + TP_PROFILE_MARKER_END.length);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Deep redaction over an already-PARSED training-pair payload — the PERSIST-SIDE half of CF-6.
|
|
356
|
+
*
|
|
357
|
+
* Why a second entry point next to {@link redactProfileBlock}: the DEFAULT-ON capture in the
|
|
358
|
+
* canonical workflow builds its pair with an INLINE mirror of buildTrainingPair and hands the
|
|
359
|
+
* serialised JSON to `dz feature-adr-record` — a path that never passes through the core builder.
|
|
360
|
+
* Redacting at the builder alone therefore guarded the path that does NOT run (Codex cross-family
|
|
361
|
+
* finding, 2026-08-28: guard 1 defeated through guard 3, one seam further down — the exact shape
|
|
362
|
+
* ADR-001 Decision 5 names). This function runs inside `decideRecordWrite` (run-records.ts), the
|
|
363
|
+
* one decision every witnessed training-pair write funnels through, so a FUTURE pair builder is
|
|
364
|
+
* covered without patching its caller.
|
|
365
|
+
*
|
|
366
|
+
* Semantics: every string leaf (keys included) goes through {@link redactProfileBlock} — same
|
|
367
|
+
* fail-closed rule on an unterminated block; arrays and plain objects are walked; numbers,
|
|
368
|
+
* booleans and null pass through untouched. A payload with no markers anywhere round-trips to a
|
|
369
|
+
* deep-equal value.
|
|
370
|
+
*
|
|
371
|
+
* Two mechanics, both cross-family findings (2026-08-28), both load-bearing:
|
|
372
|
+
*
|
|
373
|
+
* - Rebuilt objects have a NULL prototype, so every JSON key — `__proto__` included — lands as an
|
|
374
|
+
* OWN property. The previous `{}` + assignment invoked the inherited `__proto__` SETTER for a
|
|
375
|
+
* payload like `{"slug":"s","stage":"code","__proto__":{"input":"i","output":"o"}}`: the result
|
|
376
|
+
* then INHERITED input/output (the shape check passed) while serialization dropped them — an
|
|
377
|
+
* invalid pair reported `written`. With own-key reconstruction the JSON keys round-trip exactly
|
|
378
|
+
* and that payload fails the shape check honestly.
|
|
379
|
+
* - The walk is ITERATIVE (explicit stack), not recursive: ~5000 nested arrays is a ~10 KB payload
|
|
380
|
+
* that passes JSON.parse and sits under the line cap, but a recursive map hit RangeError before
|
|
381
|
+
* any size guard — a throw escaping a seam whose callers promise non-blocking verdicts. The
|
|
382
|
+
* iterative walk chose over a caught-RangeError→`refused` wrapper because it keeps the honest
|
|
383
|
+
* outcome for deep-but-valid payloads (they get redacted and judged on their merits) instead of
|
|
384
|
+
* refusing them at an arbitrary engine-dependent depth. A repeated container is walked once and
|
|
385
|
+
* reused (WeakMap), so a shared or cyclic reference can never loop the walk either.
|
|
386
|
+
*/
|
|
387
|
+
export function redactTrainingPayload(v) {
|
|
388
|
+
if (typeof v === 'string')
|
|
389
|
+
return redactProfileBlock(v);
|
|
390
|
+
if (v === null || typeof v !== 'object')
|
|
391
|
+
return v;
|
|
392
|
+
const makeDst = (src) => Array.isArray(src) ? new Array(src.length) : Object.create(null);
|
|
393
|
+
const dstOf = new WeakMap();
|
|
394
|
+
const root = makeDst(v);
|
|
395
|
+
dstOf.set(v, root);
|
|
396
|
+
const stack = [v];
|
|
397
|
+
const walkChild = (child) => {
|
|
398
|
+
if (typeof child === 'string')
|
|
399
|
+
return redactProfileBlock(child);
|
|
400
|
+
if (child === null || typeof child !== 'object')
|
|
401
|
+
return child;
|
|
402
|
+
let dst = dstOf.get(child);
|
|
403
|
+
if (dst === undefined) {
|
|
404
|
+
dst = makeDst(child);
|
|
405
|
+
dstOf.set(child, dst);
|
|
406
|
+
stack.push(child);
|
|
407
|
+
}
|
|
408
|
+
return dst;
|
|
409
|
+
};
|
|
410
|
+
while (stack.length > 0) {
|
|
411
|
+
const src = stack.pop();
|
|
412
|
+
const dst = dstOf.get(src);
|
|
413
|
+
if (Array.isArray(src)) {
|
|
414
|
+
const arr = dst;
|
|
415
|
+
for (let i = 0; i < src.length; i++)
|
|
416
|
+
arr[i] = walkChild(src[i]);
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
const obj = dst;
|
|
420
|
+
// null prototype ⇒ this assignment defines an OWN property even for the key '__proto__'
|
|
421
|
+
for (const [key, value] of Object.entries(src))
|
|
422
|
+
obj[redactProfileBlock(key)] = walkChild(value);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
return root;
|
|
426
|
+
}
|
|
315
427
|
function coerceText(v) {
|
|
316
428
|
if (typeof v === 'string')
|
|
317
429
|
return v;
|
|
@@ -333,8 +445,10 @@ function coerceText(v) {
|
|
|
333
445
|
* a real evaluation. Provenance: an explicit valid family wins; otherwise it is DERIVED from
|
|
334
446
|
* the model spec via modelFamily (an invalid family never leaks into the dataset). */
|
|
335
447
|
export function buildTrainingPair(opts) {
|
|
336
|
-
|
|
337
|
-
|
|
448
|
+
// Operator-profile redaction FIRST — before the oversize guard, so the truncation hashes are
|
|
449
|
+
// hashes of the redacted text and the full-text fnv1a64 never fingerprints personal data.
|
|
450
|
+
let input = redactProfileBlock(coerceText(opts.input));
|
|
451
|
+
let output = redactProfileBlock(coerceText(opts.output));
|
|
338
452
|
let truncated = null;
|
|
339
453
|
if (input.length + output.length > TRAINPAIR_MAX_IO_CHARS) {
|
|
340
454
|
truncated = { inputChars: input.length, outputChars: output.length, inputHash: fnv1a64(input), outputHash: fnv1a64(output) };
|