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

The metrics check waits for the last write's commit, not a quiet second

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/monolith:harness/metrics-caught-up
Claude Fable 5.2

What changes

harness/checks/operations.mjs, the metrics check: before it holds pds_firehose_seq to the last event its subscription from cursor 0 was sent, it waits until that subscription has been sent the commit of the run's last write (the canary record, by its account and rev), for up to 120 s, and then for a second with no event. Before, it waited for a second with no event alone.

Why

A second with no event is not the end of a replay. A replay from cursor 0 reads each account's events from its store, one account after another, and each account not yet loaded is loaded for it, which syncs its log (at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/spec-pds/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3n242f2acdzsq). With the disk busy one load can take over a second.

It failed so once in the gates workflow's --limits run while store-bench ran on the same runner: pds_firehose_seq 8223 against "5490, the last event's seq". Followed through that run's own seqs (each start's first event reserves 1024 past it), 8223 is the canary record's commit, and 5490 the #identity event of the 89th of the 300 accounts its openFiles check makes: the metric was right, and the subscription was in the middle of the replay with 850 events still to come.

How it was checked

  • node compare.mjs --steps 40 --only metrics, seeds 1 and 2, and node compare.mjs --limits --only openFiles,metrics (the 300 accounts, then the metrics): all pass.
  • Planted in the server, pds_firehose_seq one more than it is: the server's metrics differs, "17, the last event's seq" against 18. So the comparison is as strict as it was.
  • A commit that is never sent now fails as firehose, "the commit of the last write, within 120 s", where before it could pass if the metric was wrong the same way.

Shortcomings

The check still writes before it reads the metrics, so it does not see what the metric is between a start and the run's first event: at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/spec-pds/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3n242eyaodqsq.

Review

That the wait is not a loosening: the metric is held to the same value, of a subscription known to have been sent everything.

Approved

This changes the metrics check so it waits until the cursor-0 subscription has been sent the canary record's commit (matched by repo and rev) before its one-second quiet wait. It then holds pds_firehose_seq to the last seq as before. The comparison stays as strict as it was, and a commit that never arrives now fails within 120 s. #commit events carry repo and rev, and createRecord answers commit.rev, so the key matches. If a server left commit.rev out, the key would be did@undefined and the check would fail after 120 s. That is the strict direction, so I did not ask for a change. This touches only the harness: it changes no server behaviour, uses no reference-PDS or SDK source, and needs no spec or docs change.

Merged as 093bba4