An archive can be undeclared, and undeclaring one no longer stops the apply (hq issue 162) #90

Merged
mesh-admin merged 1 commits from fix/162-an-archive-can-be-undeclared into main 2026-10-04 10:22:40 +00:00
Contributor

hq issue 162. It was hit live today: a race between two pushes dropped a just-assigned module, and removing its bundle stopped the machine's apply (0 applied) until the next push. Every module with tools is an archive, so none could be unassigned.

  • What an archive unpacked is recorded: store.Unpacked holds the files, the dirs, whether the host made the target, and the parents it made.
  • Removal takes exactly what was placed: the files, then dirs and parents the host made, once empty. It never removes a file it did not place or a directory that existed before. A failed removal is said in the outcome and never fatal.
  • Bundles the runtime reads are renamed aside then deleted, so a reader sees all or nothing.
  • Apply no longer deletes foreign files in a target (ADR 0030):
    • the swap is used only for the host's own directory; otherwise files are merged in one by one;
    • a file the mesh did not place is never written over (unless it is byte-identical);
    • a non-directory at the target is refused.
  • Legacy records (no file list):
    • still declared: the list is learned from the archive's bytes on the next apply;
    • already orphaned: left in place, said and forgotten.

Tests are in archive_removal_test.go (six cases). go build, vet, test and gofmt are clean.

hq issue 162. It was hit live today: a race between two pushes dropped a just-assigned module, and removing its bundle stopped the machine's apply (0 applied) until the next push. Every module with tools is an archive, so none could be unassigned. - **What an archive unpacked is recorded:** `store.Unpacked` holds the files, the dirs, whether the host made the target, and the parents it made. - **Removal takes exactly what was placed:** the files, then dirs and parents the host made, once empty. It never removes a file it did not place or a directory that existed before. A failed removal is said in the outcome and never fatal. - **Bundles the runtime reads** are renamed aside then deleted, so a reader sees all or nothing. - **Apply no longer deletes foreign files in a target** (ADR 0030): - the swap is used only for the host's own directory; otherwise files are merged in one by one; - a file the mesh did not place is never written over (unless it is byte-identical); - a non-directory at the target is refused. - **Legacy records** (no file list): - still declared: the list is learned from the archive's bytes on the next apply; - already orphaned: left in place, said and forgotten. Tests are in `archive_removal_test.go` (six cases). go build, vet, test and gofmt are clean.
mesh-admin added 1 commit 2026-10-04 10:22:35 +00:00
An archive had no removal, so an unassigned one failed as an orphan and
aborted every apply after: a module with tools could not be unassigned,
and a race between two pushes froze a machine against every change.

The record now keeps what an archive unpacked: its files, the
directories the host made inside its path, whether the host made the
path itself, and the parents it made to reach it. Removal takes exactly
that away, directories only once empty, never one that was there
before; a directory that is the host's alone is renamed aside first so a
reader sees the whole bundle or none of it. Whatever cannot be removed
is said and forgotten, never fatal.

A directory found before the archive is no longer swapped away with
what was in it: the archive is moved in file by file, and one that would
write over a file the mesh did not put there is refused before anything
moves. A record from before this change learns its files from the
archive's bytes on the next apply; one already orphaned is left in
place, said and forgotten. A former target is still left in place: the
version before is what a rollback starts (ADR 0141).
mesh-admin merged commit 6431848342 into main 2026-10-04 10:22:40 +00:00
mesh-admin deleted branch fix/162-an-archive-can-be-undeclared 2026-10-04 10:22:40 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: novox/mesh-host#90