~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

The server on v0.1.0's data: the upgrade run, in the gates

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/monolith:store/upgrade

STORE.md has always said a server starts on its previous version's data. Now the gates check it: harness/upgrade/ holds the data directories v0.1.0 wrote, and compare.mjs --upgrade holds every later build to what v0.1.0 answered there.

Claude Opus 5.5 · high

What changes

Spec. spec/STORE.md's "Upgrades":

  • The previous version is the last release, tagged v<version>.
  • The rule holds whether that version shut down or was killed.
  • Writes carry on from that version's: a later rev, since its last, and the next seq.

"How it is checked" says what the run makes and reads, and what of an upgrade it leaves unchecked. The line saying the harness cannot check this is gone.

Harness. checks/upgrade.mjs, a run of its own of the server alone:

  • --upgrade-write runs with the previous version's binary and makes four accounts:

    • records written, rewritten and deleted by every write method;
    • a blob in a profile, preferences, an app password, a confirmed email and a changed handle;
    • a memberspace with records and a member;
    • an account deactivated, a record taken down and an account taken down.

    It then reads all of it back. Into harness/upgrade/ it writes:

    • the data directory twice, killed with SIGKILL and shut down with SIGTERM, with empty directories taken out as git would;
    • the variables the directories are bound to;
    • each DID's PLC operations;
    • the 59 answers.

    Both runs set PDS_REPO_BACKFILL_LIMIT_MS to ten years, so the firehose replay is whole whenever the check runs.

  • --upgrade gives the run's PLC directory those operations. Then, on each directory, it starts the server and compares every read: JSON bodies whole, getRepo by root and block CIDs, blobs by type and bytes, and the firehose by every frame's bytes. Then a write must commit at a later rev, its #commit must come after the last seq with since the last rev, and a new account must be made. A start that exits is reported with its standard error.

gates.mjs runs it in compare and quick, about 10 s. gates.yml watches harness/upgrade/**. The README has the run, and a "Releases" section on writing harness/upgrade/ again from each tag's binary.

Why

Without this, the first change to how the server lays out its data that forgets the data already on disk breaks every deployed server at its next upgrade, and nothing here would notice. The answers recorded are the previous version's own. The reference has no data directory to compare against, so this is a check against the spec.

How it was checked

  • Planted bug: the kind of accounts.log entry that holds preferences renamed from preferences to prefs, a format change every fresh run passes. --upgrade fails at once: the server's start differs, cannot recover …: a log entry of no known type: Some("preferences"). Put back.
  • The server as it is passes both directories: 59 reads, and the writes carry on. That holds with the fixture's files at git's 0644 and 0755, not the server's 0600.
  • just quick here; just gates is left to the pull's gates workflow.

Shortcomings

  • Sessions, OAuth's state, mail tokens, invite codes and a handle change in flight across an upgrade are not checked. The spec lists them.
  • harness/upgrade/ is about 520 KB of binary files, rewritten at each release.
  • Paths under it hold did:plc: names, with colons, which a Windows checkout cannot hold.
Approved

This adds the upgrade run. harness/upgrade/ holds the data directories v0.1.0 wrote, one killed and one shut down, with the variables, the PLC operations and the 59 recorded answers. compare.mjs --upgrade starts the server on each directory, holds every read to those answers, and then checks that writes carry on. I read the check, the arg, compare and gates changes, the spec, the README and the workflow. I did not read the binary fixture files (the data directories, plc.json, reads.json, accounts.json), which I take to be output of --upgrade-write. I did not run anything.

  • Spec: spec/STORE.md covers the new behaviour (later rev, since, next seq, killed or shut down) and what the run reads and leaves unchecked. The README says what exists and how to regenerate the fixture, with nothing about how it was built.
  • Harness: the change adds a check and loosens none. Each read says what it is compared with: JSON bodies whole, getRepo by root and block CIDs, blobs by type and bytes, and the firehose by frame bytes. A server that exits on start is reported with its standard error.
  • Server code: untouched, so no reference or SDK source or new crates come in.
  • Conformance: conformance.yaml is not touched.

Nothing needs changing.

Approved

Carried forward: the change this pull makes at 389d08519e2acee2f836145e3782257178e2e99e is the one reviewed at b81e9836ca38b2ff5f2a5a442916c20876f19e15, so that review stands. What is new comes from its base.

Merged as b0c6d78