# DS4 0.5.1

## Changes

- Repair rebuildable summary projections after an external session purge removes original source entries or child nodes. Discard only unavailable graphs and their transitive parents; retain valid nodes and other sessions.
- Skip canonical graph records whose original provenance is unavailable instead of degrading startup because cascading source-link deletion left incompatible metadata.
- Preserve the surviving canonical summary in the next compaction as a new warning-level unverified `branch` node. Do not inherit missing raw-source or child links; record `previous-summary-provenance-unavailable` alongside the existing unverified-summary marker.
- Preserve IDs declared in canonical compaction metadata even after their derived rows are discarded. Publish in-memory graph changes only after successful database persistence.
- Reject unindexed current-segment sources before generation. Recovery itself makes no additional model requests; new recovery diagnostics contain counters only.
- Add six synthetic regressions covering startup, a previously cleared derived graph, next-compaction recovery, restart, retained canonical text, cross-session isolation, transitive child loss, strict malformed-metadata rejection, and pre-generation failure for unindexed current sources.

## Scope and limitations

- Canonical JSONL is never changed by this repair. Deleted raw history is not recovered or presented as verified evidence; the retained summary is explicitly unverified.
- The separate synchronous FTS deletion cost when rebuilding a large externally truncated index is not fixed here. Non-destructive session rebase remains preferable to purge.
- Schema, immutable-node, source-link, topology and generated-summary validation remain strict. Compaction budgets, transport retries, semantic retrieval, memory/pin contracts, native continuation and feature defaults are unchanged.
- Provider calls were not made for this patch; compaction generation in the regression tests uses local mocks. Windows behavior and the reporting host's current JSONL/database have not been verified directly.
- The independent real-context BPE/auto-tuning objective remains unverified and is not completed by these synthetic regressions.
- Contract: [summary graph recovery](../SUMMARY_GRAPH.md#external-history-removal).

## Validation

On final coordinated 0.5.1 source after the acquired-policy reload:

- `npm ci` completed successfully on supported Node 22.23.1.
- `jev_verify all` passed `node-typecheck`, `node-test` and `git-diff-check` after installation.
- `npm run quality:compare` completed successfully.
- `npm run schema:context-persistence` passed: 1,266 bytes / 317 estimated tokens; the existing memory-tool schema remains unchanged.
- `npm run pack:check` passed on Node 22.23.1: core 275 files, reference adapter 7 files, Pi extension 136 files, exercised in a clean consumer.
- `npm audit --omit=dev` reported zero production vulnerabilities. The dev-inclusive installation audit reported five vulnerabilities: three moderate and two high.

The Windows and additional Node CI matrix were not executed locally. Subsequent publication-record edits are documentation-only; reuse the source/behavior results only while code, tests, dependencies and configuration remain unchanged.

## Publication and registry verification

Published manually to npm on 2026-10-05 by `alucard_24`, in dependency order:

1. `ds4-context-core@0.5.1`
2. `ds4-context-reference-adapter@0.5.1`
3. `ds4-context-engine@0.5.1`

All publication commands succeeded. The initial fresh-cache registry check returned `ETARGET` for the newly published core; a delayed fresh-cache `npm run registry:check -- 0.5.1` then verified all three exact artifacts on Node 22.23.1. Separate `npm dist-tag ls` checks confirmed `latest: 0.5.1` for every package.

The annotated `v0.5.1` tag was created at release-preparation commit `de4a74a` and pushed to origin after registry verification. [GitHub Release v0.5.1](https://github.com/Alucard24/ds4-context-engine/releases/tag/v0.5.1) was created from that verified tag. CI remains validation-only with no publishing credentials.
