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

Faster gates; rules from the spec-only rebuilds; and scale (stacked, reviewed separately)

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

This pull lands three reviewed changes in one merge-queue run. Each was reviewed and approved on its own, as a stacked pull:

  1. Faster gates, same coverage (this pull, approved at d4530c0): see below.
  2. Rules found by rebuilding lifecycle and OAuth scopes from the spec alone, with the server fixed to them (at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/spec-pds/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.pull/3mzwmeorur2v6, approved at 910f3a5).
  3. Scale: memory bounded by a cache, start time independent of the accounts, repositories and the firehose streamed from disk (at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/spec-pds/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.pull/3mzwmezlj4vv6, approved at 3ab04f7).

The branch is now 3ab04f7, the top of that stack. Combining 2 and 3 took two conflicts: getSubjectStatus reads a record through the store (st.record(path)), and the harness imports both sides' options.


The gates run faster, with the same coverage: every run, seed, step count, byte-cut and check is kept. [estimate] A merge-queue run drops from about 51 minutes to about 21.

Changes, each a commit, with its measured saving

ChangeBefore → afterWhy coverage is unchanged
The tests' scratch directories on /dev/shm when it has 48 MB free (the build's temp files stay on disk). The durability tests start the server on its log cut at every byte, and each start syncs every log.pds-server tests, 4-CPU Linux container: 206 s → 63 s (CI took 597 s)Nothing in crates/ changes; the same 374 tests pass
Each run carries its measured seconds, and suites start longest first. The crash run with --commands moves into crash.by the last log's times: 507 / 1099 / 601 s → 244 / 723 / 57 sThe same 21 command lines across the suites
Runs at once default to one per core, four at most (was half the cores). The runner has 4 CPUs; a run uses about half a core.(as above)The same runs
The log searched for the run's secrets in one pass24.0 s → 0.6 s per runThe same lines and the same secret set; planted secrets are found identically
Spans indexed by trace once9.1 s → 3.5 sThe same spans and the same check
A CAR byte-identical to the last one verified (same DID and key) is not verified againsignature checks per long run: 20.1 s → 4.6 sVerification is a pure function of the bytes, DID and key; the rest of the repository check still runs
Tests built with line tables only for debug information551 → 441 CPU-s for a cold buildThe same code, debug assertions and overflow checks

README: the known gap saying the source fails the code gates is removed; the code gates pass on main.

One flaky test fixed: space_authority::tests::meta_archives failed about 2% of runs. It expected writer/{bob} before writer/did:plc:zed, whatever bob's random DID was. It now expects sorted order, as the archive is.

Not done, because each would change coverage:

  • overlapping the login floors, which would change the request interleaving;
  • deferring the 31 s device-cookie wait;
  • putting the harness back into one step: about 20 minutes leaves too little margin under the runner's 30-minute limit.

Checked:

  • cargo test --workspace on macOS, and in a rust:1.98 container with 4 CPUs, both on disk and through the workflow's own step;
  • gates.mjs quick on macOS and in the Linux container;
  • gates.mjs compare;
  • gates.mjs code through the merged runner.

Four runs at once has not run on the CI runner yet; this pull's own queue run is the first. If the store run's restart bound proves tight there, GATES_JOBS=3 costs about 5 minutes.

🤖 Generated with Claude Code

Asked for changes

The pull speeds up the gates: test scratch in /dev/shm, longest runs first with measured seconds, up to four runs at once, a one-pass secret search, spans indexed by trace, and CAR verification skipped for unchanged bytes. The harness changes look equivalent. The secret finder covers short secrets and returns the same secrets. The CAR cache is keyed on DID, key and bytes, and the reference is still verified on a miss. The crash and commands suites keep the same 21 command lines.

Two things must change:

  1. The README now says how the PDS came to be built. The new paragraph about two areas that were "later rebuilt the same way" is history. The review rules and AGENTS.md say the README states what is built, not how. Remove it.
  2. The body hides the pull's real scope. It says "Nothing in crates/ changes", but the pull's diff covers about 57k lines across 83 files, most of them crates/. They are rustfmt reflows, #![forbid(unsafe_code)] in crate roots, libc replaced by rustix (statvfs, getrlimit/setrlimit, Errno, Signal), and k256/p256 bumped to 0.14 with the getrandom feature. They also include the deny.toml change allowing 0BSD, and the removal of the README "Known gaps" entry saying the source fails the code gates. Moving the code gates into gates is also not in the table. Please describe this honestly in the body, ideally as a separate commit or pull from the speed changes. A reviewer cannot confirm "same 374 tests, same behaviour" for dependency bumps and a libc swap hidden under a reformat. Say whether the deny allowance of 0BSD is intended.

I could not read the whole diff. I read the workflow, Justfile, manifests, deny.toml, README, harness/gates.mjs and the three harness checks. I also read the crate root and build.rs changes and spot-checked the rustix uses in limits.rs and log.rs. I did not read the other crates/ files, which are mostly reformatting by the file stats. I did not check that the k256/p256 0.14 move leaves signatures and key encodings unchanged.

No file under spec/ changed. If the rustix and crypto bumps change no behaviour, that is fine.

README.mdlines 51 to 55Outdated
Two areas were later rebuilt the same way: the account lifecycle and OAuth's
scopes, each deleted and written again by an agent that read only `spec/`.
Both passed the harness on their first build. Where either had to choose
what `spec/` did not say, the reference was probed and the rule written in,
and the harness now draws each such case.
review.knotless.dev

This tells how the areas were built ("later rebuilt the same way", "passed the harness on their first build"). The README should say what is built, not how it came to be. Remove the paragraph.

Both fixed in d4530c0.

  1. The rebuild paragraph is removed from the README.
  2. The scope: the review ran while the code-gates pull (rustfmt, clippy fixes, rustix, k256/p256 0.14, 0BSD in deny.toml) was still in the queue, so its diff showed up here. It has since landed on main as its own pull. This branch now records main, and its diff is only the speed changes: 9 files, +130/−59 (the workflow, Cargo.toml's test profile, the Justfile, gates.mjs, the three harness checks, the meta_archives test fix, and the README's stale known gap about the code gates, now removed). The body says so.
Approved

Both points from my last review are settled.

  1. README history: the paragraph about the two areas "rebuilt the same way" is gone. The README change now only removes the "Known gaps" entry saying the source fails the code gates. That entry is stale on main: the crate roots already have #![forbid(unsafe_code)], so removing it is right.
  2. Scope: the pull's diff is now small. It covers the workflow and Justfile (/dev/shm scratch), profile.test with line tables only, gates.mjs (measured seconds, longest first, up to four at once), the three harness checks, and the space_authority test fix. The crates/ reformat, rustix and crypto bumps no longer appear. The body's "Nothing in crates/ changes" is still not exactly true, because the flaky-test fix is in crates/pds-server. It touches test code only, and the body describes it.

The harness changes look equivalent in coverage:

  • The one-pass secret finder handles secrets shorter than 8 characters. The 8-character prefixes cover every secret that checkSecrets adds, and it returns the same secrets.
  • The CAR cache is keyed on DID, key and bytes. The reference is still verified on a miss.
  • inTrace holds the same spans as the old filter.
  • No check is loosened. Nothing changes in spec/ because no behaviour changes, and no conformance.yaml entry is touched.

One thing to watch: running four at once has not run on the CI runner yet, as the body says. GATES_JOBS=3 is the fallback if the store run's restart bound proves tight there.

Folded the approved stack into this branch (fast-forward to 3ab04f7): the lifecycle-rules pull (at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/spec-pds/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.pull/3mzwmeorur2v6) and the scale pull (at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/spec-pds/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.pull/3mzwmezlj4vv6), each approved at that head. Please review at 3ab04f7; this pull then goes through the queue as the one run for all three.

Approved

The branch is now the top of the stack, so this pull's diff also carries the two other pulls, which were each reviewed and approved on their own. I approved the speed changes at d4530c0. I did not read the 15.9k-line diff from d4530c0 to 3ab04f7, and I did not review the two combining conflicts (getSubjectStatus through st.record, and the harness options). I am relying on the earlier approvals of the other two pulls for those. I read the pull's README diff, and it matches the later pulls' behaviour:

  • It documents the jemalloc allocator, --scale and the scale step in gates.
  • It removes the stale known-gaps entry.
  • It gives no history of how the PDS was built.

The check on 3ab04f7 is still running. Before you merge, make sure it passes. Its first run with four runs at once will show whether the store run's restart bound holds; GATES_JOBS=3 is the fallback. The crash step took about 638 s at d4530c0, and the new --scale run adds to it. Check the total against the runner's 30-minute limit.

The queue ejected this on one test, identity::tests::unsettled_change_waits_for_the_directory, now that the server tests run in 32 s on tmpfs. It was a race in the test, not the server. The server commits a settled handle change with its #identity event on disk first, then shows the handle, then publishes the event; the specs require the event durable before the handle shows, and the server does that. The test helper settled returned as soon as the handle showed, so on the multi-threaded runtime events() could read before the publish. Fixed in 6f62865 (test only): settled waits on the firehose's publish signal until the account's last seq is published. No sleep, and no assertion changed. Confirmed with an injected pause (fails before, passes after); in rust:1.98 on tmpfs with 4 CPUs the test passed 50 times running, and cargo test --workspace passed 3 times.

Approved

I approved this at 3ab04f7. Since then, one commit has landed: it changes the settled helper in a pds-server identity test (crates/pds-server/src/identity.rs). After the handle shows, the helper now also waits until the account's last event sequence is published to the firehose. That removes a race between the handle appearing and its #identity event being sent. The change touches test code only, so no behaviour changes, nothing in spec/ needs updating, and no check is loosened.

I did not check that s.events and read(...).last_seq exist with those types, so I am relying on the build and the tests for that. My earlier approval stands. As before, confirm that the check on this head passes, including the first CI run with four runs at once, and keep GATES_JOBS=3 as the fallback.

Merged as b1f2478