chadtmiller.com/monolith
An atproto PDS
0
0
Gates in ~10 minutes: the long crash runs and perf move to a nightly run
.knotless/workflows/gates.yml+9−12
| @@ -1,8 +1,9 @@ | ||
# The gates, as `just gates` runs them: the code gates (cargo fmt, clippy, | ||
# cargo deny, no unsafe code), the server's own tests, every harness run of | ||
# the server against the reference PDS, several at once, and then the | ||
# performance step, alone. On every pull into main, so the merge queue waits | ||
# on them, and on every push to main. | ||
# cargo deny, no unsafe code), the server's own tests, and the harness runs | ||
# of the server against the reference PDS, several at once, a short crashing | ||
# run among them. On every pull into main, so the merge queue waits on them, | ||
# and on every push to main. The long crash runs and the performance step | ||
# are nightly.yml's. | ||
# | ||
# Node, the harness's packages, cargo-deny and the build are kept between runs. | ||
image: rust:1.98 | ||
| @@ -38,11 +39,7 @@ steps: | ||
cargo test | ||
- name: build | ||
run: cargo build --release -p pds | ||
- name: compare | ||
run: cd harness && PATH=/opt/node/bin:$PATH node gates.mjs compare | ||
- name: crash | ||
run: cd harness && PATH=/opt/node/bin:$PATH node gates.mjs crash | ||
- name: commands | ||
run: cd harness && PATH=/opt/node/bin:$PATH node gates.mjs commands | ||
- name: perf | ||
run: cd harness && PATH=/opt/node/bin:$PATH node gates.mjs perf | ||
# compare and commands in one step, so the short runs of each fill in | ||
# around the longest. | ||
- name: harness | ||
run: cd harness && PATH=/opt/node/bin:$PATH node gates.mjs compare commands | ||
.knotless/workflows/nightly.ymlnew+26−0
| @@ -0,0 +1,26 @@ | ||
# The nightly gates, as `just nightly` runs them, on main's tip every night | ||
# at 10:00 UTC, and when the owner asks: the long crash runs, the server | ||
# killed while it writes every 15 steps over runs of 1000, several at once; | ||
# then the runs that time the server, alone. Too long to make every pull | ||
# wait on (gates.yml runs a short crashing run instead); a failure here is | ||
# fixed by a pull, as any other. | ||
# | ||
# Node, the harness's packages and the build are kept between runs. | ||
image: rust:1.98 | ||
runners: [runner.knotless.dev] | ||
on: | ||
schedule: | ||
- cron: '0 10 * * *' | ||
asked: {refs: [refs/heads/main]} | ||
cache: [target, /usr/local/cargo/registry, /usr/local/rustup, /opt/node, harness/node_modules] | ||
steps: | ||
- uses: chadtmiller.com/steps/node@1 | ||
with: {version: 24.22.1} | ||
- uses: chadtmiller.com/steps/npm-ci@1 | ||
with: {dir: harness} | ||
- name: build | ||
run: cargo build --release -p pds | ||
- name: crash | ||
run: cd harness && PATH=/opt/node/bin:$PATH node gates.mjs crash | ||
- name: perf | ||
run: cd harness && PATH=/opt/node/bin:$PATH node gates.mjs perf | ||
harness/gates.mjs+13−9
| @@ -1,7 +1,7 @@ | ||
// Runs the gates, several at once, and says which failed, with each | ||
// failure's whole output. | ||
// | ||
// node gates.mjs [--jobs N] <suite>... suites: quick, code, compare, crash, commands, perf | ||
// node gates.mjs [--jobs N] <suite>... suites: quick, code, compare, commands, crash, perf | ||
// | ||
// The spaces run needs its own packages: `cd spaces && npm ci` once. | ||
// | ||
| @@ -10,8 +10,10 @@ | ||
// how many go at once; it defaults to one for each of the machine's cores, | ||
// and four at most. A run takes about half a core: it waits most of its | ||
// time, a third of a crash run's on the 350 and 400 ms both sides take | ||
// over every login. `quick` is a short run of each kind, for while working; | ||
// `code`, `compare`, `crash`, `commands` and `perf` are the gates. `code` is | ||
// over every login. `quick` is a short run of each kind, for while working. | ||
// `code`, `compare` and `commands` are the gates every pull and push runs; | ||
// `crash` and `perf`, the long crash runs and the runs that time the | ||
// server, are the nightly gates, run on main's tip every night. `code` is | ||
// cargo's checks of the source, with the cargo CARGO names (`cargo` by | ||
// default). `perf` runs alone, after everything else has finished, as it | ||
// times both servers. | ||
| @@ -46,7 +48,9 @@ const SUITES = { | ||
// with the rate limits on, then what the server holds (spec/LIMITS.md); | ||
// the lifecycle run, of 30 changes, about 5 minutes beside the other runs | ||
// (40 took 6); the store, churned and killed while it compacts | ||
// (spec/STORE.md); and the spaces run, against the pinned spaces alpha. | ||
// (spec/STORE.md); the spaces run, against the pinned spaces alpha; and a | ||
// short crashing run with the firehose, so that every pull has the server | ||
// killed while it writes. | ||
compare: [ | ||
run(125, 'spaces/compare.mjs', '--seed', 1), | ||
...[[1, 80], [2, 55], [3, 85], [4, 80], [5, 65]].map(([n, secs]) => run(secs, 'compare.mjs', '--steps', 400, '--seed', n)), | ||
| @@ -54,11 +58,11 @@ const SUITES = { | ||
run(125, 'compare.mjs', '--limits'), | ||
run(95, 'compare.mjs', '--steps', 600, '--seed', 51, '--crash-every', 40, '--store'), | ||
run(185, 'compare.mjs', '--lifecycle', '--steps', 30), | ||
run(150, 'compare.mjs', '--steps', 400, '--seed', 24, '--crash-every', 15, '--firehose'), | ||
], | ||
// The server killed while it writes, every 15 steps: plain, with the | ||
// firehose, and with the firehose through the MCP tools and CLI commands. | ||
// The longest runs, a suite of their own so that each suite fits the | ||
// runner's limit on one step. | ||
// Nightly: the server killed while it writes, every 15 steps, over long | ||
// runs: plain, with the firehose, and with the firehose through the MCP | ||
// tools and CLI commands. | ||
crash: [ | ||
...[[21, 445], [22, 330]].map(([n, secs]) => run(secs, 'compare.mjs', '--steps', 1000, '--seed', n, '--crash-every', 15)), | ||
...[[21, 380], [22, 345], [23, 395]].map(([n, secs]) => run(secs, 'compare.mjs', '--steps', 1000, '--seed', n, '--crash-every', 15, '--firehose')), | ||
| @@ -70,7 +74,7 @@ const SUITES = { | ||
...[[31, 55], [32, 55], [33, 55]].map(([n, secs]) => run(secs, 'compare.mjs', '--steps', 400, '--seed', n, '--commands')), | ||
run(7, 'conformance.mjs'), | ||
], | ||
// The runs that measure time: the server's speed against the reference's | ||
// Nightly: the runs that measure time: the server's speed against the reference's | ||
// (spec/OPERATIONS.md), and the scale run, which holds each start to | ||
// twice the start on an empty data directory and 250 ms (spec/STORE.md): | ||
// a start with 2000 accounts, 160 ms by itself, took 270 and 436 ms beside | ||
AGENTS.md+4−1
| @@ -45,7 +45,10 @@ PDS, so a change goes in this order: | ||
4. **Proof that the check bites.** Plant the bug the new check is for in | ||
the server, see the harness fail, and put the server back. | ||
5. **The gates.** `just gates`, once, at the end; the `gates` workflow runs | ||
them again on the pull. While working, `just quick`. | ||
them again on the pull. While working, `just quick`. A change to how the | ||
server stores or syncs, or to its speed, runs `just nightly` too: the | ||
long crash runs and the performance step, which otherwise only the | ||
`nightly` workflow runs, on `main`, after it merges. | ||
| ||
The README says what is built, not how it came to be: no history, plans or | ||
sessions in it, or in the spec. | ||
Justfile+8−5
| @@ -1,10 +1,13 @@ | ||
cargo := "rustup run stable cargo" | ||
| ||
# Everything a change must pass before its pull: the code gates, the tests and every harness run, side by side; then the performance step, alone. | ||
gates: checks perf | ||
| ||
# What every pull and push must pass: the code gates, the tests and the harness runs, a short crashing one among them, side by side. | ||
[parallel] | ||
checks: code test harness | ||
gates: code test harness | ||
| ||
# The nightly gates, on main's tip every night: the long crash runs, then the performance step, alone. | ||
nightly: build | ||
cd harness && node gates.mjs crash | ||
cd harness && node gates.mjs perf | ||
| ||
# While working: a plain harness run, a crashing one and one through the MCP tools and CLI commands, a minute or so. | ||
quick: build | ||
| @@ -20,7 +23,7 @@ code: | ||
| ||
# The server against the reference, over XRPC and through its MCP tools and CLI commands. | ||
harness: build | ||
cd harness && node gates.mjs compare crash commands | ||
cd harness && node gates.mjs compare commands | ||
| ||
# The server's speed against the reference's, alone on the machine. | ||
perf: build | ||
README.md+10−4
| @@ -131,14 +131,20 @@ just test # the crates' own tests | ||
just quick # a short harness run of each kind, for while working | ||
just code # the code gates (Checks, below) | ||
just perf # the performance step | ||
just gates # the code gates, the tests and every harness run, then the performance step | ||
just gates # the code gates, the tests and the harness runs | ||
just nightly # the long crash runs, then the performance step | ||
``` | ||
| ||
`just gates` runs the code gates, the tests and the harness side by side, | ||
the harness several runs at once (`harness/gates.mjs`; `GATES_JOBS` sets | ||
how many), and then the performance step alone: the server's speed against | ||
the reference's, then the scale run, which measures the server's starts. | ||
The `gates` workflow runs them on every pull into `main`. | ||
how many), a short run with the server killed every 15 steps among them. | ||
The `gates` workflow runs them on every pull into `main` and every push | ||
to it. `just nightly` runs the long crash runs, the server killed every 15 | ||
steps over runs of 1000, then the performance step alone: the server's | ||
speed against the reference's, then the scale run, which measures the | ||
server's starts. The `nightly` workflow runs them on `main`'s tip every | ||
night at 10:00 UTC, and when the owner asks for it | ||
(`knotless run rerun --ref main --workflow nightly`). | ||
| ||
Behind a reverse proxy, set `PDS_TRUSTED_PROXIES` to the proxy's addresses: | ||
the server reads `X-Forwarded-For` only from those peers, so without it | ||