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

harness: pds_log_bytes grows across a write that lets nothing go

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/monolith:harness/log-bytes-fold

The metrics check held pds_log_bytes to growing across the canary's createRecord, which a fold or the journal letting go of its records between the two reads breaks (the release pull's gates, seeds 31 and 32). The spec now says when the gauge may fall, and the check holds it to growing across a write during which the data directory shows nothing let go.

Claude Opus 5.5

What changes

spec/OPERATIONS.md, "Metrics". A paragraph after the table says what pds_log_bytes does across a write: it grows by what each write puts in the logs and falls only as the server lets go of what they held, a log's generations folded into its checkpoint (an account's table, STORE.md, "Bounds"), which a write may start and the server may run in the background at any time, and the journal's records once durable where they are kept (DURABILITY.md). It lets go of nothing but as it makes, deletes, replaces or cuts short a file in PDS_DATA_DIR, and no sooner than that leaves the gauge; so across a write during which no file there was made, deleted, replaced or cut short, it grows. "How it is checked" says so in place of "grown by the record".

harness/checks/operations.mjs. The canary reads the data directory (each file's path, inode and size), then the metrics, writes its record, reads the metrics and the directory again; where a file was made, deleted, replaced (another inode) or cut short, it writes another record and tries again, up to 20; the first written with no such change must find the gauge grown, or the run fails. The old check after the firehose and listRepos waits is gone, and bytesUnder reads the directory through the same walk, which no longer throws on a file deleted while it is read.

Why

Fixes The commands run's pds_log_bytes check fails when the log is compacted mid-step

pds_log_bytes counts the logs not yet folded away, their checkpoints and the journal, so it falls whenever a fold or a journal checkpoint lets bytes go, and the old check read it across more than a second of waits for the firehose: the journal alone lets go two quiet seconds after a write. The spec's "grown by the record" was wrong, not the server. Of the ways to hold the gauge to something exact, an equality with the log files' sizes needs the harness to know the server's layout, which the spec leaves to the server, and the files hold room besides their frames; a count of folds in the metrics would be a new server feature. The data directory is what the harness reads already, and any way a server lets log bytes go shows there as a file made, deleted, replaced or cut short, so the check excuses exactly that and nothing else, and is strict on every other write.

How it was checked

  • node compare.mjs --steps 400 --seed 31 --commands and --seed 32, against pds built from this branch: both pass, the first record written with no file changed, the gauge grown by 3805 bytes.
  • Planted: the gauge held at the least it ever read (fetch_min over every scrape in Gauges::of), so it counts what is let go but no write: seed 31 fails, pds_log_bytes after a createRecord "more than 20947", server 20947. Put back.
  • The other way: the canary made to wait 3 s between its write and the second read, past the journal's quiet time, as the old check's waits did. Seed 31 then read 1143750 before and 950739 after, the issue's fall, with files in the data directory changed; the record written again read 950739 and then 954814 with none changed, and the run passed. The wait was taken out after.
  • The gates are the gates workflow's, on this pull.

Shortcomings

A server that changes some file in the data directory on every write, but by growing it, would leave this check unmet in all 20 tries: it is then counted as not held (metrics: pds_log_bytes across a write that let nothing go, an error in the tally), not failed, as the spec does not forbid that. _stats's logBytes between two scrapes is unchanged: with no write between them the gauge only falls, which keeps it between.

Approved

The pull changes the pds_log_bytes check so it no longer fails when a fold or the journal lets bytes go between two reads. spec/OPERATIONS.md now says when the gauge may fall. The canary reads the data directory before the first scrape and after the second. It requires the gauge to grow only across a write during which no file was made, deleted, replaced (new inode) or cut short. Otherwise it writes another record, up to 20 times.

  • Strictness: The check does not loosen anything. Any write with no file change must show growth. The planted-fault run in the body shows it still catches a gauge that never counts writes.
  • Unmet check: If all 20 tries are excused, the check is counted as not held rather than failed. The spec leaves room for that, and the body names it as a shortcoming.
  • Spec and harness: The spec paragraph and the "How it is checked" text match the harness behaviour.
  • Server code and changeset: The pull changes no server code and adds no crates. It makes no change a server runner or caller would see, so no .changeset/ file is needed.
  • Left unchecked: I did not run the gates or either seed.
  • Edge case, not blocking: A replaced file that reuses the old inode with a larger size would not register as a change. That would only make the check stricter, and only where a server replaces files in place, so I don't think it needs a fix.

Ejected at 22:43 by the --store run's start-time limit (The --store run's start-time limit fails pulls that don't touch starting), not this pull: every step before it agreed. Queued again.

All checks have passed

4 passed, 1 skipped

Merged as 5e6c396