Skip to content

feat(history): the event history is a SQLite file, history.db - #694

Merged
V3RON merged 0 commit into
task/637from
task/629
Oct 19, 2026
Merged

V3RON merged 0 commit into
task/637from
task/629

Conversation

@V3RON

@V3RON V3RON commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #629

Status

Implement: done Review: passed (round 2) Hardware: n/a Gate: waiting for the stack

Assumptions

  • Assumption: the name of a set-aside -wal or -shm file — each file keeps its own name plus .damaged-<now> (history.db-wal.damaged-<now>), the reading of "each to <name>.damaged-<now>" that needs no new naming rule.
  • Assumption: how the port tells "node:sqlite could not be loaded" from "the file is damaged" — NodeSqliteOpener.open throws SqliteUnavailableError for a failed load; any other throw from open is damage.
  • Assumption: the status.get history field stays optional in the schema — making it required breaks about a hundred existing status fixtures in contract, gateway and CLI tests that the spec does not touch; every daemon of this protocol sends it, and the CLI prints no History line when it is absent.
  • Assumption: the protocol is bumped from 42 to 43 (the spec says by one), with the four tests and manuals that name 42 moved to 43.
  • Assumption: after a set-aside the fresh file takes only the events seen since the history was created, not the older ring events, and a ring event emitted before the history existed is written only when nothing was set aside — the red test a file whose quick_check answers something but ok expects only the later event in the fresh file, and the daemon test needs daemon.started, emitted while the set-aside awaits.
  • Assumption: a failed insert or commit sends replay back to the ring, but a projection that throws (a clean rollback) leaves the file readable, so replay still reads it — the red tests a projection that throws leaves neither… and the conformance suite expect the file's rows after a projection failure, replays the ring with sinceTs once writing has stopped expects the ring after an insert failure.
  • Assumption: HISTORY_PROJECTIONS is also exported from src/history/index.ts — the boundary rule lets the daemon import only a component's index, and the host has to hand the registry in.
  • Assumption: the starting form of simlock status prints no History: line — before the socket claim the history is not yet started, so writing: false would read as a fault; --json carries history in that answer.
  • Assumption: simlock config set writes eventLog as {} when rotateBytes was its only key, rather than deleting the block.

Review

Spec review: 2 blocking, 1 fixed, 1 notes. Code review: 3 blocking, 3 fixed, 0 notes. Claims review: 2 blocking, 2 fixed, 3 notes.
Rounds: 2. Tokens: 30.3M.
Assessment: complete

Fixed unreviewed (text, rule 14): src/contract/AGENTS.md:8 Imported by (0c1a557).

Rejected:

  • spec: Assumption 6 (after a projection throws, replay still reads the file) contradicts the spec's "ring once writing has stopped" — [intentional] the assumption is declared, and the spec's own Tests line and the red tests require the file's rows.

Written by an agent.

@V3RON
V3RON marked this pull request as ready for review October 19, 2026 00:41
@V3RON
V3RON added this pull request to stack #691 October 19, 2026 00:41
@V3RON

V3RON commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Review notes

Not blocking, not verified. Each is one reviewer's claim.

  • spec: src/history/index.ts:261 — Assumption 6 differs from the spec's "ring once writing has stopped". Someone may want to settle which rule wins.
  • claims: src/cli/AGENTS.md:5, src/daemon/AGENTS.md:5, src/gateway/AGENTS.md:6 — the Uses lines were fixed in ce9b4dc; recorded here for the ledger.

Written by an agent.

@V3RON V3RON closed this Oct 19, 2026
@V3RON
V3RON merged commit d71eb83 into main Oct 19, 2026
@V3RON
V3RON deleted the task/629 branch October 19, 2026 12:29
V3RON added a commit that referenced this pull request Oct 19, 2026
…stats and console figures (#623) (#626)

Delivers #623: the event history moves to `history.db`, with usage
projections, `simlock stats`, `GET /v1/stats` and the console's figures.
It also includes ADR 0032.

This PR carries the whole feature. The stack's PRs were reviewed one by
one, and then a stack sync pushed every branch to one commit. GitHub
then marked them as merged into each other, never into `main`. Their
reviews stay there:

- ADR 0032 (this PR)
- #635 → #690
- #636 → #692
- #637 → #693
- #629 → #694
- #630 → #695
- #631 → #711
- #632 → #724
- #633 → #727
- #634 → #731

After the sync onto `main`, a fix-check reviewed the conflict
resolutions. Its fix makes `history.db` and its WAL/SHM files owner-only
(0600), as #685 did for `events.jsonl`.

Closes #629, closes #630, closes #631, closes #632, closes #633, closes
#634, closes #635, closes #636, closes #637.

### Status
Implement: done Review: per-task PRs passed; sync fix-check passed
Hardware: n/a Gate: running

## Review

Spec review: skipped. Code review: 4 blocking, 4 fixed, 1 notes. Claims
review: 0 blocking, 0 fixed, 0 notes.
Rounds: 1. Tokens: 29.0M.

*Written by an agent.*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The event history is a SQLite file, history.db

1 participant