@fractalsynapse/dsh-chapters 0.2.32 → 0.2.34
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/cordis.patch.yml +17 -6
- package/docs/architecture.md +305 -1
- package/docs/backlog.md +36 -1
- package/docs/contract.md +79 -2
- package/docs/development.md +45 -1
- package/docs/host-compaction-seam.md +68 -0
- package/docs/plans-carriage.md +32 -2
- package/docs/project-state.md +180 -2
- package/docs/verify.md +70 -0
- package/lib/archive.d.ts +11 -0
- package/lib/archive.js +27 -1
- package/lib/archive.js.map +1 -1
- package/lib/auto-save.js +7 -3
- package/lib/auto-save.js.map +1 -1
- package/lib/client.js +1 -1
- package/lib/client.js.map +1 -1
- package/lib/continue-core.d.ts +18 -3
- package/lib/continue-core.js +48 -16
- package/lib/continue-core.js.map +1 -1
- package/lib/engine-core.d.ts +95 -10
- package/lib/engine-core.js +90 -21
- package/lib/engine-core.js.map +1 -1
- package/lib/engine.d.ts +34 -0
- package/lib/engine.js +124 -8
- package/lib/engine.js.map +1 -1
- package/lib/goal-carriage.d.ts +62 -0
- package/lib/goal-carriage.js +92 -0
- package/lib/goal-carriage.js.map +1 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.js +210 -108
- package/lib/index.js.map +1 -1
- package/lib/injections.d.ts +5 -1
- package/lib/injections.js +27 -4
- package/lib/injections.js.map +1 -1
- package/lib/log-shape.d.ts +55 -1
- package/lib/log-shape.js +85 -1
- package/lib/log-shape.js.map +1 -1
- package/lib/preset.d.ts +17 -2
- package/lib/preset.js +23 -2
- package/lib/preset.js.map +1 -1
- package/lib/prompt.d.ts +11 -0
- package/lib/prompt.js +79 -7
- package/lib/prompt.js.map +1 -1
- package/lib/registry.d.ts +23 -2
- package/lib/registry.js +18 -3
- package/lib/registry.js.map +1 -1
- package/lib/render.d.ts +104 -5
- package/lib/render.js +299 -60
- package/lib/render.js.map +1 -1
- package/lib/repair-run.js +2 -0
- package/lib/repair-run.js.map +1 -1
- package/lib/repair.d.ts +1 -1
- package/lib/repair.js +40 -0
- package/lib/repair.js.map +1 -1
- package/lib/save-core.d.ts +20 -0
- package/lib/save-core.js +71 -20
- package/lib/save-core.js.map +1 -1
- package/lib/store.d.ts +3 -1
- package/lib/store.js +7 -2
- package/lib/store.js.map +1 -1
- package/lib/tools-row.js +8 -1
- package/lib/tools-row.js.map +1 -1
- package/lib/tools.js +57 -10
- package/lib/tools.js.map +1 -1
- package/lib/types.d.ts +7 -0
- package/lib/types.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +5 -1
package/docs/development.md
CHANGED
|
@@ -696,6 +696,29 @@ commands were *verified*.
|
|
|
696
696
|
`docs/contract.md`'s file:line citations are from the `examples/` snapshot (rc.1-era), not the rc.2 fork —
|
|
697
697
|
re-anchor them against whichever version a test actually boots.
|
|
698
698
|
|
|
699
|
+
### An undeclared runtime import is invisible locally (#353)
|
|
700
|
+
|
|
701
|
+
`@deepseek-ai/dsh-llm` was imported as a VALUE (value imports survive compilation and must resolve at
|
|
702
|
+
runtime) from `src/index.ts`, `src/engine.ts` and `src/aux-message.ts`, while appearing only in
|
|
703
|
+
`devDependencies`. It worked, because a profile is installed with `nodeLinker: hoisted` and
|
|
704
|
+
`autoInstallPeers: false` (`app-boot/src/profile.ts:248-253`), so the package is reachable from the
|
|
705
|
+
hoisted tree regardless of what this manifest says. It is not a dev dependency of a test-only helper: it
|
|
706
|
+
is the host's LLM surface, loaded the moment the host plane activates.
|
|
707
|
+
|
|
708
|
+
Two habits keep this from recurring:
|
|
709
|
+
|
|
710
|
+
- **Declare host packages as optional peers** (the pattern the manifest already uses for cordis,
|
|
711
|
+
`dsh-tools`, `dsh-storage-domain`, …). Optional because the host provides them; declared because the
|
|
712
|
+
linker contract is not ours to rely on implicitly.
|
|
713
|
+
- **`tests/unit/wiring-truth.test.ts` enforces it**: every `@deepseek-ai/*` VALUE import in `src/` must
|
|
714
|
+
appear in `dependencies` or `peerDependencies`. `import type` is deliberately excluded — it is erased
|
|
715
|
+
at compile time, and a first draft of the gate missed that and flagged three nonexistent problems,
|
|
716
|
+
which is how such a gate gets switched off.
|
|
717
|
+
|
|
718
|
+
Related, same theme: a package installed with `--no-save` is pruned the next time anything else is
|
|
719
|
+
installed with `--no-save` (see the traps below) — so unsaved local helpers must go in ONE command, and
|
|
720
|
+
nothing the shipped code needs should ever be `--no-save`d in the first place.
|
|
721
|
+
|
|
699
722
|
### Running the TS tests on this box (node 22, no native type stripping)
|
|
700
723
|
|
|
701
724
|
Measured 2026-10-16: `npm test` (`node --test tests/unit/*.test.ts`) needs node ≥ 23 for type
|
|
@@ -710,7 +733,18 @@ npx c8 --check-coverage --statements 85 --branches 85 --functions 85 --lines 85
|
|
|
710
733
|
node --import tsx --test tests/unit/*.test.ts tests/integration/*.test.ts
|
|
711
734
|
```
|
|
712
735
|
|
|
713
|
-
|
|
736
|
+
Traps measured while finding that:
|
|
737
|
+
|
|
738
|
+
- **A cancelled test is NOT a failing one, and the summary says so in the wrong direction.** Under
|
|
739
|
+
`node --import tsx`, 21 of 28 rows in `client-doors.test.ts` were reported `not ok …
|
|
740
|
+
failureType: cancelledByParent` while the tail of the same run printed **`# fail 0`**. The rows were
|
|
741
|
+
not failing — they had never run, because `makeDoorRunner` awaited a `setTimeout` handle it had just
|
|
742
|
+
`.unref()`'d, so the loop drained with the promise unresolved (#358). Reading `# fail 0` as green, or
|
|
743
|
+
grepping the TAP for `^not ok` without also checking `# cancelled`, turns a whole untested subsystem
|
|
744
|
+
into a passing suite. **Check `# cancelled` is 0 before calling the suite green on any runner.** After
|
|
745
|
+
the fix the same file reports 29 pass / 0 fail / 0 cancelled: the #77 adoption, roster and
|
|
746
|
+
verification path is now actually observed on this toolchain, having silently not been for as long as
|
|
747
|
+
the await path was reachable here.
|
|
714
748
|
|
|
715
749
|
- **`npm install --no-save A` then `--no-save B` removes A.** npm prunes what is not in the manifest,
|
|
716
750
|
so unsaved helpers must be installed in a single command (`unrun` disappeared the moment `tsx` was
|
|
@@ -871,6 +905,16 @@ Rules that follow, in the order they bite:
|
|
|
871
905
|
rather than a judgement call; logging keys, store paths and `maxBytes` are deliberately outside the anchor, and a
|
|
872
906
|
manifest file that contributes no tokens fails its own row, so a silently-dead extraction rule cannot masquerade as
|
|
873
907
|
protection.
|
|
908
|
+
|
|
909
|
+
1a. **A file belongs in the anchor only while it contains literals that reach the model (#362).** `src/preset.ts` was
|
|
910
|
+
listed on the stated premise that it *is* the persona; it is not — the persona is `cordis.patch.yml`'s
|
|
911
|
+
`prefix`/`suffix`, already covered — and the whole-file extraction it used matched `'([^'\n]*)'`, so two apostrophes
|
|
912
|
+
on one line of ordinary JSDoc manufactured a token out of comment prose. All 77 of its "model-facing bytes" were
|
|
913
|
+
artifacts of that rule, and editing a comment moved `promptAnchor`: a green corpus was declared stale and the tool
|
|
914
|
+
demanded a full re-record of every project. It is removed from `PROMPT_SURFACE`, with a tripwire row that fails if
|
|
915
|
+
persona literals ever appear in that file, so the removal cannot quietly become a hole. The general shape to guard
|
|
916
|
+
against is the one the item above already names for the opposite case: a rule that measures more than the model
|
|
917
|
+
sees trains people to route around it, exactly like a rule that measures nothing.
|
|
874
918
|
2. **`PROVENANCE.md` per leg is necessary, not sufficient.** It records the host and regime; it cannot
|
|
875
919
|
say "this leg predates three plugin commits". The stamp is what says that, and #156's split is what stops the stamp from
|
|
876
920
|
crying wolf on every rebuild.
|
|
@@ -223,3 +223,71 @@ the node's tokens, and the ceiling it failed.
|
|
|
223
223
|
|
|
224
224
|
Rows: `tests/unit/last-resort.test.ts` (the ceiling math, `null` on incomplete inputs, and the anti-vacuity ordering row) plus the engine lifecycle suite; below the ceiling, untouched;
|
|
225
225
|
switch off, untouched even after a decline; and the warning carries the numbers.
|
|
226
|
+
|
|
227
|
+
## Engine ownership must be witnessed, not assumed (#360, measured 2026-11-15)
|
|
228
|
+
|
|
229
|
+
Composing the `chapters` preset does not by itself prove the chapters engine served the session. Two
|
|
230
|
+
real sessions on this machine — `agentPreset: "chapters"` in the durable header — were compacted
|
|
231
|
+
entirely by the host's basic engine: 6 and 8 `compaction/summary` events carrying provider
|
|
232
|
+
`qwen-token-plan`, **zero** with `dsh-chapters`, no TOC in any checkpoint, and no store directory in
|
|
233
|
+
either workspace. They ran that way for a week. The LLM summariser was billed, and the archive that
|
|
234
|
+
this whole plugin exists to write was never written.
|
|
235
|
+
|
|
236
|
+
Nothing noticed, because the one place in the code that looks at summary provenance
|
|
237
|
+
(`scanChaptersSummaries`) answers a *different* question — "which summaries can I reconstruct?" — and
|
|
238
|
+
answers it by skipping anything that is not ours. A `continue` that was correct for reconstruction was
|
|
239
|
+
the only signal about ownership, and it was silent by construction.
|
|
240
|
+
|
|
241
|
+
The rule now: **ownership is counted and reported, separately from reconstruction.**
|
|
242
|
+
|
|
243
|
+
- `summarizeProvenance(session)` counts ours vs foreign `compaction/summary` events, names the foreign
|
|
244
|
+
providers, and keeps the seqs so a human can go read the event that fired.
|
|
245
|
+
- At each compaction entry the realm engine runs it, warns **once per session**, and records the count
|
|
246
|
+
under `engine.foreignCompaction:<sessionId>` in the shared settings table. That channel is deliberate:
|
|
247
|
+
the host plane and the preset realm are **separate module instances** under isolation, so a
|
|
248
|
+
process-local map would read permanently empty from `/chapters-status` — a green signal not connected
|
|
249
|
+
to the thing it certifies, which is the bug class, not a workaround for it.
|
|
250
|
+
- `/chapters-status` prints the counts, and prints an explicit **"absence is NOT proof"** line when
|
|
251
|
+
there is nothing to report. A session that never needed compacting looks identical, in the absence of
|
|
252
|
+
this note, to a session whose engine silently never ran.
|
|
253
|
+
|
|
254
|
+
**Deliberately not a refusal.** An operator may disable the `chapters-engine` row on purpose; a hard
|
|
255
|
+
failure would break their sessions to report their own configuration. The posture is: say it loudly,
|
|
256
|
+
once, in a file and in status, and let them decide.
|
|
257
|
+
|
|
258
|
+
**Also corrected here:** the line above this section claimed *"the archive keeps every byte"* as the
|
|
259
|
+
reason overriding an economy knob is defensible. For shadowed tool results that was **false** until
|
|
260
|
+
#334 — the renderer archived arrival's ~500-byte stub and discarded the payload, hashing the stub so
|
|
261
|
+
cleanly that every integrity check passed. The claim is now earned by that fix rather than by the
|
|
262
|
+
mechanism's intent, and existing archives written before it still hold stubs for any session where
|
|
263
|
+
arrival shadowing fired.
|
|
264
|
+
|
|
265
|
+
Rows: `tests/unit/engine-provenance.test.ts` — fixtures built from the real `compaction/summary` key
|
|
266
|
+
set read out of the affected production log (not an imagined shape), covering all-foreign, ours-including-
|
|
267
|
+
`-degraded`, mixed, never-compacted, and no-provider-field; with an anti-vacuity control pinning that
|
|
268
|
+
`scanChaptersSummaries` still sees only our own, so the two questions cannot be merged by someone
|
|
269
|
+
"fixing" the silence in the wrong place.
|
|
270
|
+
|
|
271
|
+
## The composer must speak the host's shape (#399, measured 2026-11-16)
|
|
272
|
+
|
|
273
|
+
Pressure compaction topic-splits the shadowed span only when `reconstructShadowedSeqs` maps the prepared
|
|
274
|
+
summarize region back onto durable seqs. Two host facts bind that mapping, both pinned against the installed
|
|
275
|
+
bundle (`@deepseek-ai/dsh-session` 0.2.0-rc.2):
|
|
276
|
+
|
|
277
|
+
- `SessionSurface.nodes` is a **plain seq array** (`readonly SessionSeq[]`, `lib/types/surface.d.ts:120`) —
|
|
278
|
+
numbers, not `{seq}` records. The `tokenMeter` measurement nodes have `.seq`; the surface nodes do not.
|
|
279
|
+
- `Session#deriveEventMessage` is a **class method** that resolves projections through `this`
|
|
280
|
+
(`lib/index.js:1576`) — captured into a local and called bare, it throws. Reading it as a value and
|
|
281
|
+
invoking `derive(ev)` is the same r28 defect wearing a different hat.
|
|
282
|
+
|
|
283
|
+
When either is violated the function returns "no match" and the engine falls to the legacy single-chapter
|
|
284
|
+
path — silently at first, because nothing throws. The mapping result is therefore **discriminated**
|
|
285
|
+
(`{ok:true,seqs} | {ok:false,reason}`) and the engine names the reason on every fallback:
|
|
286
|
+
`no-surface-api` and `ambiguous` are honest degradations (note level); **`no-match` is a drift alarm** (warn:
|
|
287
|
+
the region was present and nothing mapped). The composed checkpoint carries the same lead sections in the
|
|
288
|
+
same order as the legacy one — plan, rules, plot — so activating the composed path cannot silently drop the
|
|
289
|
+
plot the plugin just paid its bounded elicited call to produce.
|
|
290
|
+
|
|
291
|
+
Corpus consequence: the composed arm has never run against a real host, so recording it changes composed
|
|
292
|
+
checkpoint bytes for the first time when it activates. That is an activation, not a regression; the
|
|
293
|
+
legacy-only legs stay byte-identical by construction.
|
package/docs/plans-carriage.md
CHANGED
|
@@ -173,6 +173,12 @@ minus the text), `modeActive`, and `livePlans` — plans whose `seq > archiveCei
|
|
|
173
173
|
precisely the mid-review case), explicitly labelled *not archived, parent log only*. Ranges stay the
|
|
174
174
|
model's call and chapter text stays the plugin's (invariant 4); the model never guesses a verdict again.
|
|
175
175
|
|
|
176
|
+
**The ceiling is a fact about the CALLER's own log, in the caller's own seq space** (#396). Continuation
|
|
177
|
+
children restart their event numbering at 0, so a maximum taken across the ancestor path can exceed the
|
|
178
|
+
caller's live tail and silently reclassify a still-open plan as archived. The continuation notice applies
|
|
179
|
+
the same rule: its live/archived split is the caller's watermark (committed rows plus what this door is
|
|
180
|
+
about to commit), never an ancestry max.
|
|
181
|
+
|
|
176
182
|
### 6. Composition and titles
|
|
177
183
|
|
|
178
184
|
- Forced split points: an `exit_plan_mode` call seq is a topic boundary — feed them to
|
|
@@ -508,12 +514,36 @@ shape (`isSeeded:false`, `inheritedEventCount:0`):
|
|
|
508
514
|
| is it surface-visible? | **no** — surface nodes stay `[0]`, matching the host's own log-only `plan/mode` |
|
|
509
515
|
| does the HOST's own projection fold it? | **yes** — `planProjectionDefinition.apply` over the child's log yields `active: true`; the one-event control yields `active: false` |
|
|
510
516
|
|
|
517
|
+
**Amended by #338 (2026-11-14) — the first row of this table is retired, and its retirement is
|
|
518
|
+
what broke continuations.** #319 part 2 moved the TOC notice out of the seed (a seeded
|
|
519
|
+
`user/message` at `surface[0]` is what the host's cold-load validator refuses — #314), leaving
|
|
520
|
+
`plan/mode` as the **only** seed event. It kept the number it had when the notice was `seq 0`, so
|
|
521
|
+
the seed became `[plan/mode@1]` with nothing at index 0, and the kernel rejects it outright:
|
|
522
|
+
`seed event at index 0 has seq 1 (expected 0); seed must be contiguous from 0`
|
|
523
|
+
(`dsh-session` `lib/index.js:1330`, reproduced against the installed dist). Every continuation from
|
|
524
|
+
an active-plan session failed at `agents.create`, after the archive had already been written.
|
|
525
|
+
|
|
526
|
+
| probe (re-measured, `dsh-session@0.2.0-rc.2`) | result |
|
|
527
|
+
|---|---|
|
|
528
|
+
| seed `[plan/mode@1]` accepted? | **no** — contiguity rejection above |
|
|
529
|
+
| seed `[plan/mode@0]` accepted? | **yes** — log becomes `0:plan/mode → 1:session/end-seed → …` |
|
|
530
|
+
| surface-visible / projection fold | unchanged from the 0.1.5 measurement above: log-only, and the host's own projection yields `active: true` |
|
|
531
|
+
|
|
532
|
+
So the rule is now stated by **position, not by count**: the seed is contiguous from `seq 0` and
|
|
533
|
+
holds synthetic state events only. Invariant 2 constrains *what* may be seeded (never a slice of the
|
|
534
|
+
parent's log), not *how many* — the old "exactly one event" letter is gone from this file and from
|
|
535
|
+
`docs/contract.md`, which is where a future re-anchor should look.
|
|
536
|
+
|
|
511
537
|
So the seeded child is genuinely gated, not merely told. The surface validator narrows by type
|
|
512
538
|
rather than whitelisting (`assertSessionEventEnvelope` checks the envelope and continuity),
|
|
513
539
|
which is why this works without touching the kernel. **Invariant 2 is intact in substance**: the
|
|
514
540
|
seeded event is a synthetic fact this plugin authors about the boundary, never a slice of the
|
|
515
|
-
parent's log
|
|
516
|
-
|
|
541
|
+
parent's log.
|
|
542
|
+
|
|
543
|
+
The durable lesson is recorded in #355 item Z: this passed 1,275 green tests because the row here
|
|
544
|
+
asserted the *number* the kernel rejects (`continue-plans.test.ts`) and the drift gate above pinned
|
|
545
|
+
a shape the code no longer produced. A seed claim is only as good as the current installed kernel
|
|
546
|
+
row that admits it — see `tests/unit/host-seed-contract.test.ts`.
|
|
517
547
|
|
|
518
548
|
Seeding is refused — correctly, not defensively — when the fold says inactive, which is the
|
|
519
549
|
normal case after an approval: **approving a plan exits plan mode**, so a continuation whose plan
|
package/docs/project-state.md
CHANGED
|
@@ -11,6 +11,117 @@ history of a decision, not before every task.** The rules that lived inside it a
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
13
|
## Start Here
|
|
14
|
+
## 2026-11-15 (later) — 0.2.33 is on npm: the release steps, and what they proved
|
|
15
|
+
|
|
16
|
+
**Executed:** PR #385 merged to `main` (`42d66c7`) -> annotated tag `0.2.33` pushed -> tag-triggered release run
|
|
17
|
+
`43753268463` green end to end -> `main` merged back into `staging` (`c7de7c0`).
|
|
18
|
+
|
|
19
|
+
**What the release job proved, in its own words rather than mine:**
|
|
20
|
+
- `version / tag consistency` passed — the tag string equals `package.json.version`.
|
|
21
|
+
- The deterministic suite ran under the **85/85/85/85 coverage gate on pinned Node 24** — the DoD line this
|
|
22
|
+
audit could never evidence locally (Node 22.22.1) is satisfied by CI, at the shipping commit.
|
|
23
|
+
- Publish carried a **sigstore provenance attestation** (logIndex 3909060018), so the documented 409
|
|
24
|
+
publish-without-attestation fallback was not needed this time. Worth stating because the fallback exists
|
|
25
|
+
precisely so that a transport collision cannot hold a release hostage — and a silent success would not
|
|
26
|
+
tell us whether it fired.
|
|
27
|
+
- **The published tarball was re-downloaded and unpacked: its `package.json` and `package/lib/version.js`
|
|
28
|
+
both read `0.2.33`.** That is the 0.2.20 class caught at the only point it can be caught — after
|
|
29
|
+
publication, from the registry, not from the working tree.
|
|
30
|
+
|
|
31
|
+
**Census after release, read back from GitHub rather than totalled by hand: 23 findings closed, 7 issues
|
|
32
|
+
open** — #335 (maintainer decision), #340 and #379 (built and green except the tape chain, held for one
|
|
33
|
+
`prompt`-leg re-record; the runbook is on #340), #349 (fallback merged post-cut, so 0.2.34; the rest needs a
|
|
34
|
+
live host and an authority decision), #372 (browser rig), #389 (the deferred corpus gate), and the umbrella
|
|
35
|
+
#355.
|
|
36
|
+
|
|
37
|
+
**Landed after the cut, therefore shipping in 0.2.34:** #391 (goal carried into the child's notice as text,
|
|
38
|
+
with the sentence that only a human can arm it), #392 (item Z's host-shape contract gate), #394 (#393's
|
|
39
|
+
tag-protection mis-attribution). None of them changes what 0.2.33 does; #394 in particular only corrects
|
|
40
|
+
comments in the release tooling plus adds a test that pins the real semver gate.
|
|
41
|
+
|
|
42
|
+
**One thing this release did not do, and should not be mistaken for having done:** the audit's own headline
|
|
43
|
+
finding — a check that cannot fail — was found **twice more in the release machinery itself** while cutting
|
|
44
|
+
this version (#386: the manual trigger published by default; #393: a claimed tag-protection rule that does
|
|
45
|
+
not exist on this repo). Both were fixed, one inside the release and one after it. The standing lesson is that
|
|
46
|
+
verifying "did the release run green" is not the same as verifying "does the guard it relies on exist", which
|
|
47
|
+
is the same distinction as testing a metric versus checking the mechanism behind it.
|
|
48
|
+
|
|
49
|
+
## 2026-11-15 — #355: the audit worked end to end, and shipped as 0.2.33
|
|
50
|
+
|
|
51
|
+
**What was asked.** Deep-analyze the implementation, file the findings, fix them one at a time with tests
|
|
52
|
+
and docs-first commits, ship 0.2.33. The audit produced 24 issues (#334–#355 plus #358, #360, #362, #379);
|
|
53
|
+
**24 PRs merged** into `staging` — 22 audit findings (#348 took two PRs) plus #386 and the install-page docs fix — with 2 findings held for one tape re-record, and the release candidate is this range.
|
|
54
|
+
|
|
55
|
+
**The finding underneath the findings.** Not individual bugs — a class. Checks that cannot fail, signals
|
|
56
|
+
that measure their own name, statements that outlived their truth:
|
|
57
|
+
|
|
58
|
+
| claim | reality, measured |
|
|
59
|
+
| --- | --- |
|
|
60
|
+
| "preset rows: all active" | `fiberState` is a **number**, compared to `'active'` — false under every condition (#339) |
|
|
61
|
+
| "integrity verified: bytes == original" | the hash covered arrival's stub, so truncation passed cleanly (#334) |
|
|
62
|
+
| "the suite passes here" | `# fail 0` with **22 cancelled** — the tests had never run (#358) |
|
|
63
|
+
| "seven tools + three doors mounted" | the strict `commands` lookup returned undefined and no door mounted (#353) |
|
|
64
|
+
| "this is the complete configuration reference" | 19 host keys absent, two defaults stale, one key on the wrong plane (#354) |
|
|
65
|
+
| "omitted: host-injected span" | 2,518 characters of a **human's own instruction** (#347) |
|
|
66
|
+
| "Saved: 0 chapter(s) archived" | a success-shaped line for an oversize **refusal**, on every deterministic door (#344) |
|
|
67
|
+
| "coverage is missing event types" | the biggest gap (2 MB, `agent/inbox/spliced`) is **658/659 already-rendered duplicate** (#346) |
|
|
68
|
+
| "the archive keeps every byte" | untrue for shadowed results until #334; the seam doc still said it (#360) |
|
|
69
|
+
| "the anchor pins the prompt surface" | it hashed **comment prose**, so docs edits demanded re-anchors while a real prompt change could slip past (#362) |
|
|
70
|
+
|
|
71
|
+
**Method that earned its keep, because it kept catching me.** Reproduce against real bytes before changing
|
|
72
|
+
anything; assert every patch and mutation actually applied; run a new gate against the defect **and**
|
|
73
|
+
against known-good input; never default a field an assertion depends on; treat `# fail 0` as unproven until
|
|
74
|
+
`# cancelled` is read. Applied to my own work this produced: a fixture of the shape the host does not emit
|
|
75
|
+
(#355's item Z), a gate whose first draft flagged three **nonexistent** problems, a tautological "oracle"
|
|
76
|
+
that called the function under test, an assertion passing for the wrong reason (`case`+`break` never
|
|
77
|
+
reaching `default:`), a benchmark measuring 1/700th of its own claim, a `measure()`-vs-`assemble()` drift
|
|
78
|
+
guard written only because the shortcut needed one, a fixture containing the string its assertion counted
|
|
79
|
+
(twice), and `npx tsc | head; echo $?` reporting **`head`'s** exit status — which had been quietly
|
|
80
|
+
validating several "tsc=0" lines all session.
|
|
81
|
+
|
|
82
|
+
**One classification I had backwards for half the work.** I queued items into a "needs re-anchor" wave
|
|
83
|
+
because they "change bytes". Seven of them replayed green. The actual rule: **only bytes inside the
|
|
84
|
+
recorded model request matter** — archive, registry and door-output bytes are not in the hashed prefix.
|
|
85
|
+
Re-derived properly for #351 by reading `rig-pins.ts` and `globalSetup.ts:106` (only the `arrival` leg pins
|
|
86
|
+
`toolResultArtifactTokens`; every other leg inherits the default, so a default change **is** a request-byte
|
|
87
|
+
change). The wave was three: #340, #379, #351. **CI then disagreed with me on #351** — I predicted its floor change would move request bytes and need a re-anchor; all ten legs came back green, because no committed fixture has a result in the 1,600–8,000 band on a recorded-request path. It merged (22nd fix), and the general rule was wrong where it met this corpus. Two PRs remain held: #340, #379.
|
|
88
|
+
|
|
89
|
+
**A design rejected by measurement, recorded because the acceptance text asked for it.** #379's criterion
|
|
90
|
+
said the newest turn must hold a guaranteed share of the director's input. The literal implementation —
|
|
91
|
+
bounding history against the protected content — collapsed the whole input to **2 KB**: a perfect ratio
|
|
92
|
+
obtained by deleting the context the director exists to weigh. Replaced with an absolute ceiling, and a row
|
|
93
|
+
now asserts a real trajectory survives, so the regression fails loudly. **A criterion I wrote myself was
|
|
94
|
+
the source of the wrong design**; measuring beat obeying.
|
|
95
|
+
|
|
96
|
+
**Deferred, not dropped.** #334 repaired the archive going forward — sessions whose arrival shadowing
|
|
97
|
+
fired before this release still hold stubs, and #334's report is the inventory. #336/#337 damage stays
|
|
98
|
+
report-only pending an operator decision under the deletion exception (#348's per-workspace `cwd` is what
|
|
99
|
+
makes deciding possible). #335 awaits the maintainer. #372 needs a browser rig and was left unbuilt rather
|
|
100
|
+
than shipped as unobserved wiring — that would have been the same defect being fixed.
|
|
101
|
+
|
|
102
|
+
**#349 was mislabelled here for four rounds and is corrected in place:** I recorded it as "needs a browser
|
|
103
|
+
rig", conflating it with #372. Its data is server-side; what actually blocks its fuller ask is (a) a
|
|
104
|
+
**live host plus a real model call** for the acceptance item "a child whose goal view reports the objective
|
|
105
|
+
and whose first reply follows it", and (b) a **maintainer authority decision** on plugin-authored
|
|
106
|
+
`goals.create`, which the issue itself reserves. The issue also names a fallback — carry the objective into
|
|
107
|
+
the child's notice and say loudly that only a human can arm it — and **that fallback is now built**
|
|
108
|
+
(PR #391), which is the point of re-reading a blocker rather than repeating it.
|
|
109
|
+
|
|
110
|
+
**Verification state at the candidate — re-measured on this tree, not carried forward from when the
|
|
111
|
+
paragraph was first drafted.** Per-PR: all four checks green at each of the 24 merged heads. Integrated here:
|
|
112
|
+
typecheck clean · unit **1,404 tests / 1,403 pass / 0 fail / 0 cancelled** · integration 189 pass /
|
|
113
|
+
5 `treedx-live` (service unreachable — that suite fails rather than skips) · `corpus:check` agreeing with
|
|
114
|
+
the build (`lib=3674369893be9447`, `promptAnchor=b40304ee3e35a94f`). The earlier text of this section claimed
|
|
115
|
+
1,388 tests and a different `lib` hash; both were stale by one merged PR (#388 added rows and changed
|
|
116
|
+
`index.ts`), which is precisely the failure this release is a study in, caught in my own release record.
|
|
117
|
+
|
|
118
|
+
**The chain has now run at this head and passed.** `acceptance — ten tape-replay legs` and the
|
|
119
|
+
coverage-gated job are green on the candidate's own PR run — the only place it can be measured, since
|
|
120
|
+
`ci.yml` triggers on `push: [main]` and `pull_request` and staging deliberately carries no push CI. Per the
|
|
121
|
+
release procedure the chain must be green on the candidate before a maintainer merges to `main`; agents do
|
|
122
|
+
not approve or merge it, so the merge, the tag and publication remain the maintainer's.
|
|
123
|
+
approve or merge it.
|
|
124
|
+
|
|
14
125
|
## 2026-11-14 — #330: the tools go where the user pointed, and the agent stops reading gauges (shipped in 0.2.32)
|
|
15
126
|
|
|
16
127
|
**The defect, measured.** The `chapters_*` tools registered on the HOST plane, and a host-plane tool
|
|
@@ -48,8 +159,16 @@ annotate-title nondeterminism — the annotate prompt embeds the async-renamed s
|
|
|
48
159
|
and replay diverge by construction; masked per the HOSTPORT/MSGCOUNT family, deeper fix stays open as
|
|
49
160
|
#331. A rig incident, recorded honestly: a symlink mistake of mine while building a control worktree
|
|
50
161
|
clobbered `var/ms-playwright` mid-session (two apparent enrich failures were that, not the product);
|
|
51
|
-
browsers were reinstalled via the documented path and every affected leg re-run.
|
|
52
|
-
|
|
162
|
+
browsers were reinstalled via the documented path and every affected leg re-run. **Post-tag, shipped**
|
|
163
|
+
(2026-11-14): #333 merged to main (`4be41cb`), annotated tag `0.2.32` pushed at that commit, Release run
|
|
164
|
+
43636628508 success. Registry verified directly, not by CLI cache: `0.2.32` present, `latest` moved,
|
|
165
|
+
provenance attested, shasum `1fd309081de32a47d92b9a6c4994e1e9b01f88a3`; the published tarball was
|
|
166
|
+
unpacked and inspected (manifest, `lib/version.js`, the `chapters-tools` row in the shipped
|
|
167
|
+
`cordis.patch.yml`, the gauge-free arrival stub, the host registering no tools — all agree with the
|
|
168
|
+
tag); installed-package smoke: a clean `npm install @fractalsynapse/dsh-chapters@0.2.32` resolves
|
|
169
|
+
`./tools-row` (`ChaptersToolsRow`, inject list) and both registrars. Staging reconciled by back-merge.
|
|
170
|
+
REMAINING OPEN CLAIM: live-host verification — a running DSH process loaded with 0.2.32 lands with the
|
|
171
|
+
next restart of each deployment; not separately performed here.
|
|
53
172
|
|
|
54
173
|
## 2026-10-22/23 — the host 0.2.0-rc.2 acceptance sweep (#56)
|
|
55
174
|
|
|
@@ -767,3 +886,62 @@ and that is stated wherever the claim is made. What the tape leg keeps is everyt
|
|
|
767
886
|
|
|
768
887
|
Full chronology, measurements and which round proved what: **`docs/project-state.md`**.
|
|
769
888
|
Next things to pick up: **`docs/backlog.md`**. Verification checklist: **`docs/verify.md`**.
|
|
889
|
+
|
|
890
|
+
## 2026-11-16 — external context-handling audit: findings, two corrections, and what shipped
|
|
891
|
+
|
|
892
|
+
A full read of the plugin against the pinned harness (`node_modules/@deepseek-ai/*` 0.2.0-rc.2) and
|
|
893
|
+
`examples/cordis` produced five findings; four became issues and PRs, one died against a governing record:
|
|
894
|
+
|
|
895
|
+
- **#399 (the headliner, PR pending)** — `reconstructShadowedSeqs` assumed a host shape that does not exist
|
|
896
|
+
(`surface.nodes` read as `{seq}[]`; `deriveEventMessage` called unbound), so pressure compaction archived
|
|
897
|
+
ONE legacy chapter on every real host while unit rows stayed green against a stub of the invented shape —
|
|
898
|
+
the r28 lesson re-run inside the composer. The composed arm also dropped the plot section.
|
|
899
|
+
- **#395 (PR #400)** — the continuation budget's header bound read two of the three DISJOINT usage arms,
|
|
900
|
+
under-counting on cache-writing turns; now `input + cacheRead + cacheWrite`.
|
|
901
|
+
- **#396 (PR #401)** — two watermark derivations still used forms #336 retired (`tools.ts` two-clause,
|
|
902
|
+
`auto-save.ts` hand-rolled max), and the notice's live-plan ceiling took an ancestry-wide max over mixed
|
|
903
|
+
per-session seq spaces, silently dropping a pending live-tail plan. One predicate everywhere; scan-gated.
|
|
904
|
+
- **#398 (PR #402)** — the prompt bar's `planOf` read `row.planDocs`, a field that exists only on chapter
|
|
905
|
+
RECORDS (and without the full text `carryActivePlan` folds): the documented plan input was dead wiring.
|
|
906
|
+
Now folds `detectPlans(session.events)` exactly like the engine's checkpoint carry.
|
|
907
|
+
- **#397 — closed, NOT implemented.** The proposal (pass `meta.parentSession` at `agents.create`) collided
|
|
908
|
+
with `docs/contract.md` § "Lineage: Kernel Fields We Must Not Lean On": the header field is seed lineage
|
|
909
|
+
and the registry is the sole ancestry authority by recorded decision. Amending that is a maintainer call;
|
|
910
|
+
the issue carries the one-line change if the decision flips.
|
|
911
|
+
|
|
912
|
+
**Correction to the audit's own claims, measured after the fact:** it reported the e2e plane as "red — the
|
|
913
|
+
harness that could catch these bugs cannot compile." Wrong gate model: `scripts/e2e-typecheck-ratchet.sh`
|
|
914
|
+
baselines tests/e2e at 58 type errors by explicit decision (#83) and CI enforces NO-GROWTH; Playwright
|
|
915
|
+
transpiles specs without type-checking, and the tape-replay acceptance job runs ten real-host legs in CI
|
|
916
|
+
regardless. The debt is real and ratcheted; the claim that no real-host coverage exists was withdrawn.
|
|
917
|
+
Node-24 note for rigs: this box's system node is 22; the repo-vendored `var/toolchain/node-v24.22.0` is
|
|
918
|
+
what CI and the ratchet use, and the deterministic ledger (1,625+/1,631 with the five credential-gated
|
|
919
|
+
`live:` TreeDX rows the only non-passes) was run on it.
|
|
920
|
+
|
|
921
|
+
## 2026-11-17 — 0.2.34 cut prepared from staging `9bab463`
|
|
922
|
+
|
|
923
|
+
The 2026-11-15/16 context-handling audit lands as **0.2.34**: #395, #396, #398, #399 (merged PRs #400–#403),
|
|
924
|
+
plus the corpus re-stamp #404 and the post-0.2.33 tail of the previous wave (#390, #391→partial #349, #392,
|
|
925
|
+
#394). Versions: `package.json` / `package-lock.json` root / `package-lock.json` `packages[""]` /
|
|
926
|
+
`src/version.ts` — all four at **0.2.34**, the agreement row in `tests/unit/release-gate.test.ts` green.
|
|
927
|
+
|
|
928
|
+
Verified at the integrated base `9bab463` before this branch: deterministic ledger 1,632/1,638 (5
|
|
929
|
+
credential-gated `live:` TreeDX rows, 1 `#314 WISH` todo); **full 11-leg tape-replay chain green on the
|
|
930
|
+
merged staging tree**, each leg under its own boot; `typecheck`/`typecheck:client` clean; ratchet 58=58;
|
|
931
|
+
`corpus:stamp` re-stamped on that green replay with `promptAnchor` unchanged — no re-record required by
|
|
932
|
+
anything in this range. The acceptance gate for the candidate itself remains this release PR's own
|
|
933
|
+
`acceptance — ten tape-replay legs` run: `ci.yml` triggers on `pull_request` and `push: [main]` only.
|
|
934
|
+
|
|
935
|
+
Open and named: `docs/verify.md` **C3** — no live-class run has yet OBSERVED a composed checkpoint (the
|
|
936
|
+
heavy leg owns that first sight, same family as #143's bound). #349 remains open (goal-carriage partial
|
|
937
|
+
landed via #391; the rig-dependent rest stands). The five `live:` TreeDX rows require credentials.
|
|
938
|
+
**#397 was closed by decision, not code**: passing `meta.parentSession` at `agents.create` collides with
|
|
939
|
+
`docs/contract.md` § Lineage ("seed lineage; the registry is the sole ancestry authority"); amendment is a
|
|
940
|
+
maintainer call and the issue carries the one-line change if it flips.
|
|
941
|
+
|
|
942
|
+
Maintainer direction recorded on 2026-11-17: **#383 (#379) and #368 (#340) are NOT in this cut** — they
|
|
943
|
+
roll into **0.2.35** along with the `prompt`-leg re-record that gates them.
|
|
944
|
+
|
|
945
|
+
The audit self-correction stays recorded above rather than edited away: the claim that "the e2e harness
|
|
946
|
+
cannot compile so no real-host coverage exists" was wrong — the ratchet baselines 58 errors by design and
|
|
947
|
+
the replay chain runs real boots regardless. Withdrawn where the findings are written.
|
package/docs/verify.md
CHANGED
|
@@ -77,6 +77,68 @@ result only for a live `Session`, so pin such claims in the leg or on a pure fun
|
|
|
77
77
|
(b) a field printed from a config key the realm does not carry reads `?` forever — measure the shape you *read*
|
|
78
78
|
(#153's `window=?`).
|
|
79
79
|
|
|
80
|
+
### A quoted sample is a contract (#389)
|
|
81
|
+
|
|
82
|
+
When a page shows output and tells the reader to compare against it — `operations/install.md` does exactly
|
|
83
|
+
this, and adds that anything else is a named problem — the quoted string stops being prose and becomes an
|
|
84
|
+
interface. It then has two failure modes, and the second is worse: the code changes and the sample goes
|
|
85
|
+
stale (a correct install looks broken, which happened for the roster line's trailing clause, fixed in #388),
|
|
86
|
+
or **the check built to catch that cannot fail.**
|
|
87
|
+
|
|
88
|
+
So the standing rule, and `tests/unit/doc-line-contract.test.ts` enforces all of it:
|
|
89
|
+
|
|
90
|
+
- **Derive, or compare to the derived value.** The strongest form is what #388 did — export the function
|
|
91
|
+
that builds the line and have the test compose the documented sample from it. A general matcher is a
|
|
92
|
+
backstop, not a substitute.
|
|
93
|
+
- **Whole-line anchored, always.** Prefix matching structurally cannot see truncation, which is the exact
|
|
94
|
+
defect class.
|
|
95
|
+
- **Exclude vacuous patterns and say so out loud.** `dsh-chapters: ${m}` is a log wrapper, not a message;
|
|
96
|
+
as a matcher it accepts every line. The first version of this audit reported a clean zero-findings that
|
|
97
|
+
way, and the tell was a match attributed to the wrong file — a suspicious *attribution*, not a suspicious
|
|
98
|
+
count. The gate asserts the excluded set is non-empty and prints it on every run.
|
|
99
|
+
- **Plant the failure.** The gate must reject a fabricated line AND accept the real one; without both, a
|
|
100
|
+
zero means nothing.
|
|
101
|
+
- **Discover the corpus, do not list it.** A hand-written list of ten pages here contained two paths that
|
|
102
|
+
never existed, and its own completeness check caught that — walking the tree found 37 real pages instead.
|
|
103
|
+
A list narrows silently whenever anyone renames something.
|
|
104
|
+
- **Exclude history on purpose.** Changelog, project-state and backlog quote what older builds printed.
|
|
105
|
+
"Fixing" them would erase the record, which is why they are filtered by an explicit pattern rather than
|
|
106
|
+
omitted by silence.
|
|
107
|
+
|
|
108
|
+
Honest scope note: measured across those 37 current-state pages there are exactly **two** quoted
|
|
109
|
+
`dsh-chapters:` lines today, both in `install.md`, both matching. The value of the gate is prospective —
|
|
110
|
+
it is cheap insurance that the next quoted sample cannot drift the way this one did, and it is only trusted
|
|
111
|
+
because it demonstrably rejects a line that was never emitted.
|
|
112
|
+
|
|
113
|
+
### Host-shaped readers are checked against the installed dist (#355 item Z)
|
|
114
|
+
|
|
115
|
+
AGENTS has the rule — *"Inspect actual host payload fields and use fixtures of the real shape"* — and this
|
|
116
|
+
release proved the rule right and the enforcement missing: a fixture hand-written in the shape the code
|
|
117
|
+
*expected* passes against a reader that cannot work on real bytes. Three separate findings were that bug
|
|
118
|
+
(#339's `fiberState` stubs, #345's block-level `isError`, #355's item Z list), and every fix so far was
|
|
119
|
+
case-by-case. The mechanical form of the rule is now `tests/unit/host-shape-contract.test.ts`, which parses
|
|
120
|
+
the **installed** packages and asserts both directions:
|
|
121
|
+
|
|
122
|
+
- **What the host declares.** `@deepseek-ai/dsh-llm`'s `ToolResultMessage` carries `isError?: boolean` at
|
|
123
|
+
**message** level, and the type surface contains **no block-level `isError` at all** — the fact that made
|
|
124
|
+
the old reader return false for 13 of 13 real failures. `cordis`'s `FiberState` is a **numeric
|
|
125
|
+
`const enum`** (`PENDING=0 … ACTIVE=2 … UNLOADING=5`), which is why comparing it to `'active'` is always
|
|
126
|
+
false — the #339 defect.
|
|
127
|
+
- **What our code does with it.** `src/log-shape.ts` must read the message-level field; `src/preset.ts` must
|
|
128
|
+
not compare `fiberState` to a string literal. A reader that silently stops matching the declared shape
|
|
129
|
+
fails here rather than in production.
|
|
130
|
+
|
|
131
|
+
Every assertion is **non-vacuous by construction**: the test requires the interface it searched for to have
|
|
132
|
+
been found (`throw` if absent), so a renamed type or a moved declaration fails the run instead of quietly
|
|
133
|
+
producing an empty match set — the failure mode that made this release's first version of the corpus gate
|
|
134
|
+
report a false all-clear. Versions are printed on each run, so a dependency bump shows up as changed facts
|
|
135
|
+
rather than a green suite.
|
|
136
|
+
|
|
137
|
+
What this does **not** claim: that every fixture is dist-derived. It pins the two host shapes this audit
|
|
138
|
+
actually got wrong, and the mechanism by which new ones can be added. The residual gap (a fixture for some
|
|
139
|
+
other host field, unverified) stays open on #355 item Z rather than being ticked by the existence of this
|
|
140
|
+
file.
|
|
141
|
+
|
|
80
142
|
### Correctness Checks
|
|
81
143
|
|
|
82
144
|
| # | Check | Procedure | Passes when |
|
|
@@ -565,3 +627,11 @@ which 483 `test-litter` and 143 `empty-artifact`. Registry backups sit at
|
|
|
565
627
|
| # | Claim | How it is verified | Result |
|
|
566
628
|
|---|---|---|---|
|
|
567
629
|
| B1 | A `persisted off` cannot strand the bar across a reload (#272/#276) | Browser leg `tests/e2e/prompt-off-revival.spec.ts`, its own boot (`prompt-revival`, port 41743 — measured reason in rig-pins: as the fifth session on the prompt boot it destabilized new-session creation for every spec): carry a session to a ready offer, seed a stale `off` mirror via `addInitScript` so it pre-dates all app JS, reload, and require (a) the bar visible and (b) the dock's `__dshPromptReply` seam showing the wire answered `suggested next step: …` — a veto never pulls, so an empty seam or missing bar fails the leg | **PASS** — recorded on the scripted stub (3 entries, own boot 41743), `prompt`+`prompt-off`+`prompt-revival` replay green model-free each under its own boot; mutation-proof: restoring the pre-#272 `off`-veto reddens EXACTLY this leg (`expect(locator).toBeVisible` — the veto never pulls), the canonical runner restores green. Local record needs `CHOKIDAR_USEPOLLING=1` on this box: 128 inotify instances are machine-exhausted (real ENOSPC, unrelated to the leg; CI runners never hit it) |
|
|
630
|
+
|
|
631
|
+
## The compaction composer on the real host's shape (#399, measured 2026-11-16)
|
|
632
|
+
|
|
633
|
+
| # | Claim | Class | How it is verified | Result |
|
|
634
|
+
|---|---|---|---|---|
|
|
635
|
+
| C1 | `reconstructShadowedSeqs` maps the summarize region against the ACTUAL host surface shape (plain-seq nodes, bound `deriveEventMessage`) | deterministic + pinned-host replay | `tests/unit/host-composer-shape.test.ts` row 1 hands the composer a session built by the INSTALLED `dsh-session` class (`Session.create`, RUN/SKIP-guarded); row 2 pins the host `.d.ts` source text; `tests/unit/engine-core.test.ts` fakes now wear the host shape (unbound `derive` throws); `engine-lifecycle` drives the real `summarize()` over two stored topics and demands a ≥2-chapter manifest + carried plot | **PASS** — red before the fix (proven at the test commit), green after; full deterministic ledger 1,627/1,633 with only the five credential-gated `live:` TreeDX rows non-passing |
|
|
636
|
+
| C2 | Activating the composed path churns NO committed tape | pinned-host tape replay | Full chain: `E2E_MODEL=replay bash scripts/ci-replay.sh` (11 legs, own boot each); durable-log sweep: all 25 session logs in the run's homes grepped for `compaction/summary` | **PASS** — chain green; **zero** compaction events exist in ANY replayed durable log (the compaction-heavy `heavy` project is the live class, never replayed), so no recorded bytes can depend on the composer; `npm run corpus:check`: corpus matches the build (promptAnchor unchanged); e2e typecheck ratchet 58=58 |
|
|
637
|
+
| C3 | A real-host pressure compaction now COMPOSES (multi-chapter checkpoints converging on the 32K window) | live provider | The `heavy` live leg (its bound is #143's open row, and it was already failing its own bound BEFORE this change) | **OPEN** — deliberately unclaimed: this change makes the composed arm reachable and gives operators a named `reason=` line per fallback, but no live run has yet observed it. The claim stands unverified until the heavy leg is next run on a live model. |
|
package/lib/archive.d.ts
CHANGED
|
@@ -140,6 +140,17 @@ export interface WriteInput {
|
|
|
140
140
|
cwd?: string | undefined;
|
|
141
141
|
/** Directory key — the root of the ancestry tree, not the per-fork id. One dir per tree. */
|
|
142
142
|
rootSessionId: string;
|
|
143
|
+
/**
|
|
144
|
+
* The session AUTHOURING this chapter — the one whose registry row owns the numbers. #337: the tree
|
|
145
|
+
* directory is keyed by chain root ("one dir per tree") while chapter numbers are per authoring
|
|
146
|
+
* session, and every freshSession starts at 1. A continuation child therefore mints `001-<slug>.md`
|
|
147
|
+
* into the SAME directory as its parent's. With a matching title the paths are identical, the write
|
|
148
|
+
* was an unconditional overwrite, and the per-call `seenFile` guard could not see the earlier one.
|
|
149
|
+
* Measured live: 40 paths claimed by two chapters with DIFFERENT sha256; 393 (tree dir, number)
|
|
150
|
+
* pairs owned by more than one session. Absent, the collision is still refused — only the
|
|
151
|
+
* disambiguated name is less informative.
|
|
152
|
+
*/
|
|
153
|
+
authorSessionId?: string | undefined;
|
|
143
154
|
chapters: readonly RenderedChapter[];
|
|
144
155
|
/** Reuse a prior attempt's allocation when this is a retry of identical work. */
|
|
145
156
|
attemptId: string;
|
package/lib/archive.js
CHANGED
|
@@ -81,7 +81,33 @@ export async function writeArchive(input) {
|
|
|
81
81
|
warnings.push(`title collision resolved for "${chapter.range.title}" → ${fileName}`);
|
|
82
82
|
}
|
|
83
83
|
seenFile.add(fileName);
|
|
84
|
-
|
|
84
|
+
let chapterPath = join(treeDir, 'chapters', fileName);
|
|
85
|
+
// #337: a chapter body is IMMUTABLE, so landing a DIFFERENT chapter on an existing path is data
|
|
86
|
+
// loss with a citation left pointing at the wrong bytes. Identical bytes are a retry — rewriting
|
|
87
|
+
// them is a no-op by definition, so the attempt key's idempotence is untouched.
|
|
88
|
+
if (await fs.exists(chapterPath)) {
|
|
89
|
+
const held = await fs.read(chapterPath);
|
|
90
|
+
if (held !== undefined && held !== chapter.markdown) {
|
|
91
|
+
const tag = input.authorSessionId !== undefined
|
|
92
|
+
? String(input.authorSessionId).replace(/^ch-/, '').slice(-8)
|
|
93
|
+
: 'session-' + String(number);
|
|
94
|
+
const altName = fileName.replace(/\.md$/, '-' + tag + '.md');
|
|
95
|
+
const altPath = join(treeDir, 'chapters', altName);
|
|
96
|
+
const altHeld = await fs.read(altPath);
|
|
97
|
+
if (altHeld !== undefined && altHeld !== chapter.markdown) {
|
|
98
|
+
// Both names are held. Refuse: inventing names until one is free would strand the record
|
|
99
|
+
// that cites this path, and a silent overwrite is the bug being fixed.
|
|
100
|
+
throw new Error(`writeArchive: ${chapterPath} and ${altPath} are both held by different chapter bodies — `
|
|
101
|
+
+ 'refusing to overwrite an immutable chapter (#337). This is a registry/tree collision: run '
|
|
102
|
+
+ '/chapters-repair and supersede one of the two under a new number.');
|
|
103
|
+
}
|
|
104
|
+
warnings.push(`chapter path collision resolved for "${chapter.range.title}" (number ${String(number)} is already `
|
|
105
|
+
+ `authored in this tree by another session): wrote ${altName} instead of overwriting ${fileName} (#337)`);
|
|
106
|
+
fileName = altName;
|
|
107
|
+
chapterPath = altPath;
|
|
108
|
+
seenFile.add(altName);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
85
111
|
// 2. Artifacts first: the chapter body cites these paths, so they must exist before it does.
|
|
86
112
|
for (const artifact of chapter.artifacts) {
|
|
87
113
|
const existing = seenArtifact.get(artifact.sha256);
|
package/lib/archive.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archive.js","sourceRoot":"","sources":["../src/archive.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAiFpC,uGAAuG;AACvG,MAAM,UAAU,OAAO,CAAC,KAAa;IACnC,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;IACpF,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AACxD,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY,CAAC,GAAuB,EAAE,CAAS;IAC7D,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,CAAA;IACnE,MAAM,GAAG,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,GAAG,GAAG,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A;IACvC,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IACxC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,MAAM;QAAE,OAAO,UAAU,CAAA;IACrD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/lib/auto-save.js
CHANGED
|
@@ -25,9 +25,11 @@
|
|
|
25
25
|
* non-archive is either a quiet, expected skip (wrong preset, no completed turn)
|
|
26
26
|
* or a LOUD warn (unreadable, save failed).
|
|
27
27
|
*/
|
|
28
|
+
import { CHAPTERS_PRESET_ID } from "./preset.js";
|
|
28
29
|
import { diagnosticWarn } from "./diag.js";
|
|
29
30
|
import { formatWarnings } from "./warnings.js";
|
|
30
31
|
import { isActiveChapter } from "./registry.js";
|
|
32
|
+
import { nextUnarchivedSeq } from "./render.js";
|
|
31
33
|
import { saveSession } from "./save-core.js";
|
|
32
34
|
import { lineageOf } from "./types.js";
|
|
33
35
|
const hasCompletedTurn = (events) => events.some((e) => e.type === 'turn/end');
|
|
@@ -178,8 +180,8 @@ export async function readDurableSession(get, sessionId, onError) {
|
|
|
178
180
|
export function shouldForceChildArchive(input) {
|
|
179
181
|
if (!input.enabled)
|
|
180
182
|
return { fire: false, reason: 'childAutoArchive is off in config' };
|
|
181
|
-
if (input.header.agentPreset !==
|
|
182
|
-
return { fire: false, reason: 'not a chapters-preset session' };
|
|
183
|
+
if (input.header.agentPreset !== CHAPTERS_PRESET_ID)
|
|
184
|
+
return { fire: false, reason: 'not a chapters-preset session' }; // #353: the durable preset id had a second literal copy outside its single predicate
|
|
183
185
|
// door 5 owns delegation; two doors on one child would double-write the same span
|
|
184
186
|
if (input.header.origin === 'subagent')
|
|
185
187
|
return { fire: false, reason: 'owned by subagent settlement (door 5)' };
|
|
@@ -229,7 +231,9 @@ export function makeChildArchiveListener(deps) {
|
|
|
229
231
|
// live turn boundary.
|
|
230
232
|
const store = await deps.store();
|
|
231
233
|
const state0 = await store.get(id);
|
|
232
|
-
|
|
234
|
+
// #396: the ONE watermark predicate. (This line used to hand-roll the max, seeded -1 —
|
|
235
|
+
// equal in value, second in count, and exactly how #336's two derivations drifted.)
|
|
236
|
+
const lastArchived = nextUnarchivedSeq(state0.chapters) - 1;
|
|
233
237
|
const completed = events.filter((e) => e.type === 'turn/end' && e.seq > lastArchived && e.seq <= anchor).length;
|
|
234
238
|
const gate = shouldForceChildArchive({
|
|
235
239
|
header,
|