Skip to content

fix(runs): prune a signed layout into the archive's records/ - #164

Merged
karauda merged 4 commits into
mainfrom
fix/s29-prune-archive
Nov 28, 2026
Merged

karauda merged 4 commits into
mainfrom
fix/s29-prune-archive

Conversation

@karauda

@karauda karauda commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

What changed, and why

runs prune now puts records/'s marker and pruned records in the archive's records/, byte for byte. The archive and its records/ both use mode 0700. State stays in the live state/. An unsigned layout still gets a flat archive with its marker, records, and state. The archive is synced before any tree is removed.

runs list <archive> lists the archived runs, and runs prune <archive> can move expired trees into another archive of the same shape. No plane opens a signed archive as it stands. runs close --key refuses its archived records because they are signed for the live records/. runs open --key still accepts a layout without state/, since a crash during setup can leave one. It can write a new record into the archive. If an operator adds state/, a signed plane can serve the new run and still refuse the archived records.

runs prune now refuses --archive at or under the runs directory through any link or mount, or where its place cannot be judged. Previously, it could create an archive under state/, which the next plane start would refuse. A refusal exits with code 1 without creating an archive or removing a tree.

Invariant or record

None changed. runs prune fails closed when the archive's place cannot be judged (invariant 5).

How it was tested

  • On macOS, the internal/runs and cmd/guardana-control suites passed. The five new internal/runs tests and TestRunsPruneOfASignedLayout passed with -test.count=500.
  • On Linux, internal/runs passed. The cmd/guardana-control suite failed only tests that need the go binary or repository files missing from the container, and a renew race test fixed on main since.
  • make vet and make docs-check passed.
  • Tests cover symlinks and directory identity. A real mount of records/ or state/ elsewhere remains unverified. Refusal of an archived record by react and supervise was checked in code only. CI's make quality on this pull request is the gate.

Documentation

Updated the runs prune paragraph in docs/reference/runs.md to describe archive contents, sync order, and path refusals. Tightened other paragraphs to stay within its 1500-word budget. Added a Fixed entry to CHANGELOG.md.

make docs-impact RANGE=origin/main..HEAD also names docs/reference/cli.md, docs/reference/versions.md and docs/status.md; each was read and still holds: the command's help is unchanged, no format version moved, and the status page's runs prune lines say nothing this change makes untrue.

… under the layout

A prune of a signed layout copied records/'s marker and its envelopes to
the archive's top, which no reader opened: the operator's reader took it
for an unsigned directory and refused the marker's kind. The archive now
holds records/ alone, with its marker, so OpenAdmin and runs list read it
as they read the layout, and no plane opens it, having no state/.

The archive's place was refused only when its parent was the runs
directory, records/ or the layout's directory, so an archive in state/,
or one reached through a link, was made there and the next plane start
refused state/. The path is now judged by identity, walking up from the
nearest existing directory of it as written by "..", and refused, naming
both paths, when it reaches the layout's directory anywhere.

Signed-off-by: Konrad Karauda <konrad@karauda.com>
… the refusal that cannot judge

A mount of records/ or state/ elsewhere leads by ".." away from the
layout, so the walk compared only with the layout's directory let an
archive into it. Each walked directory is now compared with the layout's
directory, records/ and state/.

The refusal for a path whose place cannot be judged had no test. A path
at the kernel's bound, whose walk up passes it while mkdir still fits,
now pins it in state/ and outside the layout.

archiveRecords closes records/ when closing the archive's top fails.

Signed-off-by: Konrad Karauda <konrad@karauda.com>
The reference page's prune paragraph says the archive is synced before
any tree is removed, holds records and state for an unsigned directory
and `records/` alone for a signed one, which `runs list` reads and no
plane opens, and is refused at or under the runs directory through any
link or mount, or where its place cannot be judged. Other paragraphs are
tightened to keep the page within its 1500-word budget. The changelog
names the fix.

Signed-off-by: Konrad Karauda <konrad@karauda.com>
Signed-off-by: Konrad Karauda <konrad@karauda.com>

# Conflicts:
#	CHANGELOG.md
@karauda
karauda requested a review from a team November 28, 2026 19:29
@karauda
karauda requested a review from a team as a code owner November 28, 2026 19:29
@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Failed ❌

View logs ↗
13da4a3 2026-11-28T19:27:13.582Z View logs ↗

@karauda
karauda merged commit 1b0978a into main Nov 28, 2026
12 of 13 checks passed
@karauda
karauda deleted the fix/s29-prune-archive branch November 28, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant