Files
deepseek-harness/docs/subsystems/persistence.i18n.yaml
T
imccyuandimccyu e25df02c51 refactor(session): prepare Session validation and header building for SessionData (#8676)
* refactor(session): move Session log validation into a module

Move header, seed-event envelope, and inherited-cut validation out of the
Session constructor into validation.ts without changing check order or error
text. Export needsInheritedSeedMarker for the fork marker rule the
constructor applies.

* feat(session): validate a Session log without constructing a Session

validateSessionLog composes the header, seed-event, surface, and
inherited-cut checks of Session construction in the same order. Omitting
eventState matches Session.create; an event state matches
Session.fromRestore.

* refactor: validate stored Session logs with validateSessionLog

The chat importer, session-query readSession, the format catalog, and JSONL
generation verification constructed a discarded Session only to validate a
log. They now call validateSessionLog with the same mode, inherited count,
and message interpreters.

* refactor(session): extract buildSessionHeader

Move new-Session header construction out of SessionStore.prepare into the
exported buildSessionHeader and name its input SessionHeaderMeta.
Automatic ids and duplicate checks stay in prepare.

* refactor(session): move header and fork error helpers out of the session index

Move buildSessionHeader into validation.ts and SessionForkError with
SessionForkErrorCode into fork.ts so later modules can import them without
importing index.ts. index.ts re-exports both under the same names. Complete
the JSDoc of the exported validation helpers.

* refactor(session): extract checkSessionLog from the Session constructor

Move header validation, seed acceptance with surface admission, and the inherited-cut check into checkSessionLog in validation.ts, keeping the constructor's order and errors. The Session constructor and validateSessionLog call it.

* test(session): cover Session log validation and construction helpers

Cover validateSessionLog against Session.create and Session.fromRestore in
every event state, buildSessionHeader, needsInheritedSeedMarker,
Session.readEvents range semantics, and the fork subpath export of
SessionForkError.

* docs(session): document Session log validation

Document validateSessionLog, buildSessionHeader, needsInheritedSeedMarker,
Session.readEvents, and the SessionForkError subpath export in the package
README. Align the Session and CreateSessionOptions type blocks, add
SessionHeaderMeta, regenerate the Cordis, event graph, and persistence
catalogs, and update the plugin entry, unknown-cast, and package dependency
registries.

---------

Co-authored-by: imccyu <[email protected]>
2026-11-20 00:11:27 +08:00

38 lines
1.4 KiB
YAML

# Bilingual-pair consistency record for persistence.md (docs/i18n/README.md): per heading
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/subsystems/persistence.md
/session-persistence:
en: d6ca00339e679318
zh: 917896dfe65cd710
/session-persistence/sessionhandle-one-open-channel-onto-a-stored-session:
en: 283765de86ff454d
zh: ef8fcf55a3071243
/session-persistence/the-flush-checkpoint:
en: a751d1952a47d938
zh: f0ae8447fdc26dfb
/session-persistence/crash-recovery-preserves-an-interrupted-turn:
en: 534044a0ce482d52
zh: d2e8a7dfeb066946
/session-persistence/sessionlocation-per-session-artifact-metadata:
en: e310ff426d848262
zh: 8a7667349b0549a7
/session-persistence/sessionheader-metadata-beside-the-log:
en: 5795ae03d2d163cd
zh: a46ceeb22cfbb6a1
/session-persistence/format-refusal-logs-a-build-cannot-faithfully-read:
en: fa822e9185bf758b
zh: 7fcdbe2f69f848b9
/session-persistence/createsessionoptions-seeding-and-metadata:
en: eb217ed58be9dce3
zh: ea4fe6250567e854
/session-persistence/preparation-and-restoration-ownership:
en: 8a37d5ec058058e5
zh: 9c54c2c06c167c0b
/session-persistence/lightweight-source-revisions:
en: 142ff3bed547efcf
zh: a73ca5ea4743d3e8
/session-persistence/the-backend:
en: 21a9fe85d24e0284
zh: f333e4d0645fd2da