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

harness: migrate-blobs killed once finished; issuers' keys' spec gaps closed

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/monolith:harness/migrate-kill-race

Fixes the --migrate run's flake, which ejected the blobstore pull once. A pds migrate-blobs killed after it marked its move finished, but before it exited, was taken as unfinished. This also closes three gaps the server agent found in "Issuers' keys", each now with a check.

Claude Opus 5.5 · high

What changes

Migrate run (harness/checks/migrate.mjs, spec/BLOBS.md). A kill can land between step 7's finish mark and the exit. Such a run is finished, and the check now allows for that two ways:

  • On the first kill, the pds serve that must refuse a moving directory may instead start, with the environment of the place the blobs went. It is then held to --to that place moving nothing ({"moved":0,"bytes":0}).
  • After any kill, the next run may print {"moved":0,"bytes":0}.

The serve that may start logs apart from the run's server (PDS_LOG_DIR empty). It is shut down by SIGTERM 5 s after its start line, so its shutdown leaves no recovery for the next start.

Issuers' keys (spec/SPACES-CREDENTIALS.md). The spec now says three things the server already does:

  • An account "here" is active, deactivated or taken down, but not deleted. A deleted account's DID is any other issuer's.
  • The keys are written at a shutdown by SIGTERM or SIGINT (OPERATIONS.md).
  • A key read since the start is kept over the file's, and counts as used later than all of the file's.

Checks:

  • plcLocalIssuer (LIMITS.md): a delegation token the server gave an account that has since been deleted must read that account's document.
  • issuers.mjs: a key forgotten before a SIGTERM restart and read again after it must outlive a SIGINT restart. The spaces run's restartWith now takes the signal.

Why

The blobstore pull's first queue run failed --migrate --seed 71: pds serve started on a directory the check took as mid-move. The same seed passed locally and on the second queue run. The window is the time between mark_moving(dir, None) and process::exit.

How it was checked

  • Migrate. A server built with an 800 ms sleep in that window makes the kill land there often.
    • The check as on main fails both ways: seed 71, pds serve not refused; seed 72, moved: 0 against the 14 blobs held.
    • The new check passes seeds 71–74 on that server, and 71–72 on the real one.
    • Two problems surfaced on the way and are fixed here. The serve that may start had been writing to the run's kept log, which failed _logs. And killing it left a recovery that failed the next start's no-recovered check.
  • SIGINT. On a server planted to skip the write on SIGINT, the spaces run fails at "after a shutdown (SIGINT) and a start". The real server passes the whole spaces run.
  • Deleted account. The check passes on the real server. A planted server that would treat a deleted account as local could not be made: the server's account lookup (by_did) does not return deleted accounts. The check holds the spec all the same.

Shortcomings

  • That a key read since the start is kept over the file's has no harness check. It would need a call inside the read-back's few milliseconds. The server's unit test covers it.
Approved

This pull makes the --migrate check accept a pds migrate-blobs that was killed after it marked the move finished but before it exited. It also closes three gaps in the spec's "Issuers' keys" section, each with a check, except the key-read-since-start rule, which has none (stated in the body). I read the whole diff.

  • Spec: The spec edits in BLOBS.md, LIMITS.md and SPACES-CREDENTIALS.md match the harness changes. The SIGINT wording in SPACES-CREDENTIALS.md is backed by OPERATIONS.md, which already lists SIGTERM or SIGINT for the shutdown line.
  • Strictness: The migrate check is looser, but only for the finished-after-kill window. It still requires serve to refuse an unfinished move. A serve that starts must be on the place the blobs went, and --to that place must then move nothing. The new issuers.mjs and deleted-account checks are stricter.
  • Changeset: None is needed. The change touches only the harness and spec, and nothing a server's operator or caller sees.
Some checks were not successful

1 failed, 4 passed, 1 skipped

Merged as ff58fc8