# DS4 Context Engine 0.3.0-beta.3

Status: published on 2026-09-03 under the npm `beta` dist-tag.

This coordinated beta fixes storage maintenance on Windows and carries forward beta.2 without changing canonical records, SQLite schema, runtime contracts, retention limits, privacy policy, compaction validation, or fallback semantics.

## Fixed since beta.2

- `compactStorage()` now opens stage/state/source files for the durability flush with write access (`"r+"`). `fsyncPath` previously opened them read-only, which fails on Windows with `EPERM` (`FlushFileBuffers` requires write access), aborting `compact` with `stage=compact; category=maintenance-failed` before the backup could be verified. The failure was confirmed on Windows with a minimal probe:

  ```text
  fsync-on-readonly-handle: FAIL code=EPERM
  ```

- The flush now mirrors `fsyncDirectory`'s best-effort policy for platforms that cannot flush (`EINVAL`, `ENOTSUP`, `EBADF`, `EPERM`, `EACCES`), while still flushing normally on supported platforms. No content is written by the `"r+"` open.

- Coordinated package versions moved to `0.3.0-beta.3`.

There are no functional storage-format or provider-path changes relative to beta.2.

## Safety and compatibility

Unchanged from beta.2: Pi JSONL remains canonical and append-only; SQLite remains disposable and rebuildable; physical maintenance remains explicit, offline, local-TTY-only, and unavailable to model-callable tools; every `context_persistence` write still requires a fresh positive local UI decision.

Compatibility remains unchanged:

- SQLite schema: `15`;
- configuration: `ds4-context-config-v1`;
- runtime adapter: `runtime-adapter-v1`;
- persistence tool: `ds4-context-persistence-tool-v1`;
- persistence result: `ds4-context-persistence-result-v1`;
- Pi: `0.84.3`;
- Node.js: `>=22.19.0`.

## Package/version policy

The coordinated version is `0.3.0-beta.3` for:

```text
ds4-context-core
ds4-context-reference-adapter
ds4-context-engine
```

Both adapters depend exactly on `ds4-context-core@0.3.0-beta.3`. Publication used the explicit npm `beta` dist-tag for all three packages. npm `latest` remains stable `0.2.0`, and GitHub Actions remains validation-only with OIDC and package-write permissions denied.

## Candidate validation

Local candidate verification on Node.js `26.5.1`:

- `npm run check`: 69 files and 341 tests passed.
- `npm run quality:compare`: candidate quality `0.9875` versus baseline `0.808156`.
- `npm run schema:context-persistence`: 1,266 bytes and 317 estimated tokens; below the 1,500 absolute and 320 relative limits.
- `npm run pack:check`: verified core (223 files), reference adapter (7 files), and Pi adapter (68 files) in a clean consumer.
- `npm pack --dry-run --json` for all three packages passed with the same inventories and no forbidden local/session/storage files.
- `git diff --check` passed; the only pre-existing untracked path is `.serena/`, which is excluded from commits and package inventories.
- Version, exact core dependencies, package-lock entries, extension constant, and reference-adapter constant are synchronized to `0.3.0-beta.3`.

Validation-only CI run [`33771957691`](https://github.com/Alucard24/ds4-context-engine/actions/runs/33771957691) passed on Node.js `22.19.0` and `24.x` for commit `8c4abf6106b675aa1af1ee163f6ca07b5e1c0ef3`.

## Registry evidence

Exact post-publication verification passed for all three `0.3.0-beta.3` packages. The clean registry consumer verified exact adapter/core dependencies, public core exports, compiled reference-adapter conformance, packaged quality corpus, packaged Pi extension startup, and the installed `ds4-context-storage` CLI declaration, shim, and usage probe.

Published package shasums:

```text
ds4-context-core:              0428629e03cf2d02a7033fa3e016344dff3af399
ds4-context-reference-adapter: 53924c98d6c9672709076edb5cf70bf3f98c1915
ds4-context-engine:            d0ae468daae4f4e4970497282fd5c18b86f847d5
```

For all three packages, npm `beta` resolves to `0.3.0-beta.3`, `alpha` remains `0.3.0-alpha.5`, `rc` remains `0.2.0-rc.1`, and `latest` remains `0.2.0`.

Annotated tag `v0.3.0-beta.3` targets `8c4abf6106b675aa1af1ee163f6ca07b5e1c0ef3`. The GitHub prerelease is published at <https://github.com/Alucard24/ds4-context-engine/releases/tag/v0.3.0-beta.3>.

## Documentation

- [`../STORAGE_MAINTENANCE.md`](../STORAGE_MAINTENANCE.md)
- [`../STORAGE.md`](../STORAGE.md)
- [`../COMPACTION.md`](../COMPACTION.md)
- [`../RELEASING.md`](../RELEASING.md)
- [`0.3.0-beta.2.md`](0.3.0-beta.2.md)
