NEC-95: Pre-deploy copies are pruned by sha, so each new one is deleted as it is made #149

Merged
nectenda-agent merged 2 commits from worktree-nec-95-pre-deploy-copies-are-pruned-by-sha-so-ea into main 2026-09-24 21:26:58 +01:00
Collaborator

Task: NEC-95 — https://projectron.nerchure.com/tasks/95

Pre-deploy database copies were pruned by sorting their whole name, pre-deploy--.db, so the three highest shas survived rather than the three newest copies, and each new copy whose sha sorted low was deleted as it was made (observed on eu1: none of 24 September's three copies survived). pruneMatching now orders by the trailing stamp, then name, and never prunes a name it cannot date. Review found a second route to the same loss, a host clock behind the copies on disk, so preDeployCopy now always spares the copy it just took. New tests use shas that sort against time and reverse readdir order; every rule was mutation-checked. deploy/RESTORE.md tells an operator to check the stamp, since a host not yet deployed with the fix may hold the wrong three. Post-deploy check on eu1 and identity to follow on the card.

Spec: docs/changes/NEC-95-pre-deploy-prune-by-stamp/spec.md

Changelog

The server's pre-deploy database copies now keep the most recent ones, rather than the ones whose release ids happened to sort highest.

Task: NEC-95 — https://projectron.nerchure.com/tasks/95 Pre-deploy database copies were pruned by sorting their whole name, pre-deploy-<sha>-<stamp>.db, so the three highest shas survived rather than the three newest copies, and each new copy whose sha sorted low was deleted as it was made (observed on eu1: none of 24 September's three copies survived). pruneMatching now orders by the trailing stamp, then name, and never prunes a name it cannot date. Review found a second route to the same loss, a host clock behind the copies on disk, so preDeployCopy now always spares the copy it just took. New tests use shas that sort against time and reverse readdir order; every rule was mutation-checked. deploy/RESTORE.md tells an operator to check the stamp, since a host not yet deployed with the fix may hold the wrong three. Post-deploy check on eu1 and identity to follow on the card. Spec: `docs/changes/NEC-95-pre-deploy-prune-by-stamp/spec.md` ## Changelog The server's pre-deploy database copies now keep the most recent ones, rather than the ones whose release ids happened to sort highest.
pruneMatching sorted pre-deploy-<sha>-<stamp>.db by whole name, so it kept
the three highest shas and deleted each new copy whose sha sorted low as it
was made. Observed on eu1: none of the day's three copies survived. It now
orders by the trailing YYYYMMDD-HHMMSS stamp, then by name, and leaves any
name it cannot date alone.

The old test used sha0..sha3, which sort in time order and so could not
fail. The new tests use shas that sort against time and reverse readdir
order so none of them rests on the filesystem listing sorted. RESTORE.md
says to check the stamp, since a host not yet deployed may hold the wrong
three.

Task: NEC-95

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MRLWhdKYZiUm5GyFz96yC8
Never prune the pre-deploy copy just taken, whatever its stamp
Some checks failed
Release note / release-note (pull_request) Successful in 11s
CI / build (pull_request) Successful in 4m56s
CI / e2e (pull_request) Failing after 7m31s
CI / promote (pull_request) Has been skipped
d28576594a
Ordering by stamp fixed the sha sort, but a host whose clock is behind the
copies already on disk would still date its fresh copy oldest and delete it
as it was made: the same silent loss by another route. preDeployCopy now
passes that file to pruneMatching as spare, which keeps it and counts it as
one of the three.

Found in review. Mutation-checked: dropping the spare, or not counting it,
fails the new test.

Task: NEC-95

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MRLWhdKYZiUm5GyFz96yC8
cruelacid force-pushed worktree-nec-95-pre-deploy-copies-are-pruned-by-sha-so-ea from d28576594a
Some checks failed
Release note / release-note (pull_request) Successful in 11s
CI / build (pull_request) Successful in 4m56s
CI / e2e (pull_request) Failing after 7m31s
CI / promote (pull_request) Has been skipped
to d30286f93b
All checks were successful
Release note / release-note (pull_request) Successful in 14s
CI / build (pull_request) Successful in 4m57s
CI / e2e (pull_request) Successful in 5m54s
CI / promote (pull_request) Has been skipped
2026-09-24 16:02:04 +01:00
Compare
cruelacid force-pushed worktree-nec-95-pre-deploy-copies-are-pruned-by-sha-so-ea from d30286f93b
All checks were successful
Release note / release-note (pull_request) Successful in 14s
CI / build (pull_request) Successful in 4m57s
CI / e2e (pull_request) Successful in 5m54s
CI / promote (pull_request) Has been skipped
to d0eb0d048c
Some checks failed
Release note / release-note (pull_request) Successful in 15s
CI / build (pull_request) Successful in 5m16s
CI / e2e (pull_request) Successful in 5m19s
CI / promote (pull_request) Has been skipped
CI / e2e (push) Successful in 5m11s
CI / build (push) Successful in 5m26s
CI / promote (push) Successful in 29s
e2e-soak / soak (push) Failing after 35m9s
2026-09-24 21:20:58 +01:00
Compare
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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
Nectenda/nectenda!149
No description provided.