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

harness: each start held to empty starts timed around it

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/monolith:harness/start-bound-baseline

Each start in the --store run is now held to empty starts of the same server timed right around it, so a loaded runner moves both sides of the comparison alike. The limit no longer comes from one early, single measurement, which ejected unrelated pulls from the queue.

Claude Opus 5.5 · high

What changes

spec/STORE.md. "Starting" now says that the empty start it is measured against is taken on the same machine and under the same load. "How it is checked" says how the harness does that: each start is timed among starts of the same server on empty data directories, each in a directory and on a port of its own. Two run while the server is down before its start. Two more run after it: the server is killed as soon as it answers, and is started once more on its data afterwards. The start must take at most twice the median of those four, plus 250 ms. This covers the three starts after the accounts are filled, every crash, and the last start.

harness. checks/store.mjs: emptyStart() starts the server's command and environment on a fresh empty directory, apart from the run as backup.mjs's snapshot copy is (its APART list is now exported). It is timed with waitReady, the same way as the server's own starts, then killed and its directory removed. restart() times each start among those empty starts and checks it against its own bound. It no longer uses a base from the first starts. checks/crashes.mjs: crash() takes an optional start, which starts the server again in place of the plain start-and-wait. Every other caller is unchanged. compare.mjs reports the starts against the medians of their empty starts.

Spans lost to a kill. On the first gates run, the store run's starts held up under the runner's load: one start took 549 ms against empty starts of 165 to 225 ms, and passed. But its operations check then failed: the server's spans differs for the describeServer that a start had answered just before the harness killed it. The killed server was in the middle of writing to its disk. It outlived the SIGKILL by 2.2 s, and the window in which a span may be lost to a kill (spec/OPERATIONS.md, "Traces": spans "just before a kill may be lost") was counted back from when the process exited, not from when it was sent the signal. lib/adapters/common.mjs now records each life's signalled, when it was sent the signal it ended by. In checks/operations.mjs, mayBeLost lets go spans of requests from 1.5 s before that signal to the exit. For a life that exits right away, as before, nothing changes.

docs/guide/comparing.md describes the store run's start check that way.

Why

Fixes The --store run's start-time limit fails pulls that don't touch starting

The old bound was twice the slowest of three starts taken once, early in the run, plus 250 ms (about 69 ms and 388 ms on runner.knotless.dev). When the runner was loaded by other gates later in the run, single starts took 409 and 445 ms and failed pulls that do not touch starting. The base also was not an empty start: it was a start on the data directory as it was at the time. So a start whose time grows with the data raised its own baseline.

Putting the empty starts right before and after the measured one makes a load spike that slows the measured start slow its baseline too. Using the median of four means one odd empty start does not move the bound in either direction. The other ways considered:

  • Taking the minimum of the empty starts would be stricter, but it picks out the least loaded moment, which brings the flake back.
  • Retrying a failed start, or taking the median of several starts on the data, would let a start that is slow only now and then pass. That loosens the check, so it was not done.

How it was checked

  • node compare.mjs --steps 600 --seed 51 --crash-every 40 --store here, alone, against the server as it is: passes. There were 19 starts, p50 67 ms and max 111 ms; the medians of the empty starts were p50 67 ms and max 77.5 ms.
  • Planted bug: after opening its store, the server reads every file of its data directory and sleeps 200 ns for each byte, as from a disk of 5 MB/s, so its start grows with the data. The same run fails on the first start after the accounts are filled: starting again differs, describeServer within 385 ms: twice the median of the starts on an empty data directory timed around it, 69, 68, 66, 67 ms, and 250 ms, against 1057 ms. The server was put back after.
  • just quick: all 7 runs pass.
  • The gates are the gates workflow's, on this pull. The first run, at 2f17fd3, failed only on the spans above and on two runs this pull does not touch (--pages --seed 1, a passkey view; --commands --seed 33, pds_log_bytes, which main has since fixed). main is merged in.

Shortcomings

  • No run here was made under deliberate load: the runner's gates are where that shows.
  • A load spike shorter than the four empty starts and the start between them (about half a second) that hits only the measured start can still exceed the bound. The run is less likely to fail that way than before, but it can.
  • Each start now costs four empty starts, plus one more kill and start: about 0.5 s each, roughly 10 s over a run.
  • The empty starts run without the server's exports, metrics port, mail and kept log, as the snapshot copy does, so they may be a few milliseconds faster than the server's own start. That only makes the bound stricter.

Review

The design: restart() and emptyStart() in harness/checks/store.mjs, and the spec's two paragraphs.

Approved

This pull holds each start in the --store run to twice the median of four empty starts timed around it, plus 250 ms. It replaces the old bound of twice the first starts. Both spec/STORE.md and docs/guide/comparing.md describe the new bound, so the spec and the guide match the code. The check does not loosen: there is no retry, and a start that grows with the data still fails, as the planted-bug run in the body shows. The empty starts drop the run's exports and mail, which only makes the bound tighter. No changeset is needed, because only the harness changes and neither those who run the server nor those who call it would see it. The pull adds no atproto or MCP crates and does not touch conformance.yaml. I did not run the harness; I read the diff only. One small point, not worth blocking on: if waitReady throws inside emptyStart(), the empty server is not killed and its directory is not removed. That only matters on a failing run, which exits anyway.

Approved

My earlier approval stands. I read the pull's own change since 2f17fd3, which is the signalled timestamp. common.mjs records it for both child and container lives, and now is already imported there. mayBeLost falls back to ended when signalled is unset, so a life that exits right away behaves as before. signalled is set only on SIGKILL lives, so the wider window applies only to killed servers. The OPERATIONS.md text already says spans "just before a kill may be lost". The rest of the diff since 2f17fd3 is main merged in, and I did not review it.

All checks have passed

3 passed, 1 skipped

Merged as d201ee7
Merging this pull closed these issues