v0.6.356: instance entries removed on graceful shutdown (#1009), safe shared state writes (#1007) #1014

Merged
Cordy merged 7 commits from b8 into main 2026-10-26 11:34:40 +00:00
Owner

Batch 8.

  • #1009: on SIGTERM/SIGINT an instance removes its own entries from tlsstatus.json and directory-checks.json.
    • The removal runs during the HTTP drain, with a re-check one second later.
    • A killed instance still shows "not reporting".
  • #1007: every state write and local store save uses its own unique temp file, including bootstrap, segments and tus.
    • spaces.json, spacemeta.json and spacequota.json re-read and merge before writing, and refuse to overwrite an unreadable file.
    • New WARN when a new space ends up without its default cap.
  • Docs:
    • CHANGELOG v0.6.356.
    • Compose example now sets stop_grace_period: 30s.
    • Handbook updates.
  • Follow-ups: #1010, #1011, #1012, #1013.
  • Reviews: .superpowers/sdd/2026-10-26-batch8/.
Batch 8. - **#1009:** on SIGTERM/SIGINT an instance removes its own entries from `tlsstatus.json` and `directory-checks.json`. - The removal runs during the HTTP drain, with a re-check one second later. - A killed instance still shows "not reporting". - **#1007:** every state write and local store save uses its own unique temp file, including bootstrap, segments and tus. - `spaces.json`, `spacemeta.json` and `spacequota.json` re-read and merge before writing, and refuse to overwrite an unreadable file. - New WARN when a new space ends up without its default cap. - **Docs:** - CHANGELOG v0.6.356. - Compose example now sets `stop_grace_period: 30s`. - Handbook updates. - **Follow-ups:** #1010, #1011, #1012, #1013. - **Reviews:** `.superpowers/sdd/2026-10-26-batch8/`.
On SIGTERM/SIGINT, after the HTTP server stopped and before the state
lock goes, the instance removes its own entry from tlsstatus.json and
directory-checks.json (read-merge-write through WriteShared), bounded
to 5 s; a failure is a WARN and never blocks the shutdown. A killed
instance keeps its entry (not reporting after 15 min, pruned at 24 h).
Bell times are keyed by item and left to the next derivation.
statestore.Write and Local.Save write through a temp file of their own
(os.CreateTemp + rename) instead of the fixed <path>.tmp, so two
instances on one posix state directory, or two goroutines, writing one
file never fail on or rename each other's temp file. WriteShared is now
an alias of Write. The membership store (mutate), spacemeta and
spacequota re-read the file under the process lock and change only
their own record, as the space registry already did. Tests that forced
a failed save with a directory at <path>.tmp now put the directory at
the file's place.
F1: the removal starts once the HTTP server stopped accepting
(RegisterOnShutdown fires after Shutdown closed the listeners), while
in-flight requests still drain; an open /api/events stream held the
drain for its full 15 s, past Docker's 10 s stop timeout.
F2: Remove waits 1 s, re-reads and removes the entry once more when
another instance wrote back a copy it read before the removal.
F4: tlsstatus Remove reports an unparseable document, as dirchecks does.
- api: rate-limited WARN when a new space's default quota cannot be set
  (spaces.go create, spacequota.go OnSpaceRegistered) (B1)
- spacestore, spacemeta, spacequota: a write on a corrupt file fails and
  changes neither file nor cache (tests, B4)
- spacestore: comment the absent-file case of mutate/readLocked (B5)
- config SaveBootstrap, segments rebuild, tus writeMeta: a temp file of
  their own instead of a fixed .tmp name (B7)
Cordy merged commit dfd3b1fce3 into main 2026-10-26 11:34:40 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#1014
No description provided.