summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/DECISIONS.md48
1 files changed, 48 insertions, 0 deletions
diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md
index 2861fed..bded52a 100644
--- a/docs/DECISIONS.md
+++ b/docs/DECISIONS.md
@@ -379,3 +379,51 @@ world mismatch rather than being helpfully fetched, which is correct here but
depends on `plan()` computing the closure honestly. The shim `pacman` models
all of this for real: `-U` refuses bytes that do not hash to the digest their
name claims, and `-Q` reports exactly what landed.
+
+## repo-add names the database; the render happens in scratch space
+
+Publishing needs the index rendered *before* the DB transaction commits and
+renamed into place *after* it, so a crash between the two leaves the old index
+serving (I4). The obvious way to get that was to render to `<db>.tar.gz.tmp`
+beside the live file and rename over it. That is also a filename real `repo-add`
+refuses: its database argument has to be a name pacman would itself accept, and
+a trailing `.tmp` is a usage error to it. Every publish test passed and the first
+real package anyone tried to publish died at the last step, with the database
+already committed and the served index untouched.
+
+**Choice.** `render_db` renders into a scratch directory *under* the served
+directory — `.render-<pid>-<n>-<tag>/` — under the exact name a consumer will
+download. Same filesystem, so the caller's `rename` is still the atomic swap I4
+requires, and the live database is never the file repo-add is writing into. The
+scratch directory is removed on every path this code controls, and
+`reconcile` sweeps leftovers at startup for the paths it does not. `run_repo_add`
+also dropped `-s`: repo-add would sign the database into scratch space that is
+about to be deleted, and `publish::sign` signs the renamed file — one key, one
+code path, signature always over the bytes that shipped.
+
+**Cost.** Three call sites (`publish`, `reconcile`, `withdraw_package`) now share
+the render helper instead of each doing its own tmp-and-rename, and a publish that
+dies between render and rename leaves a directory for the next startup to sweep
+rather than a single stray `.tmp` for a human to notice.
+
+## A shim is as strict as the tool it replaces, or it is not a test of it
+
+The `repo-add` shim wrote the database wherever it was told to. The real tool
+validates the filename first. That asymmetry is the whole reason the previous
+entry was possible: 200+ tests drove a real subprocess through a real publish and
+reported success, because the fake accepted what the real thing rejects.
+
+**Choice.** The shim enforces the accepted set — `.db.tar` with or without a
+compression suffix, nothing else, `.files.*` included in the refusals because
+those belong to `repo-files` — with the real tool's wording and exit status. The
+set was measured against `repo-add (pacman) 7.1.0`, not read out of its docs, and
+`shims::repo_add_db_names_match_the_real_repo_add` re-derives it against the
+installed tool whenever there is one, in the shape of the `vercmp` oracle test.
+The same rule already holds elsewhere — the `pacman` shim refuses bytes that do
+not hash to the digest their name claims — this is that rule, applied where it was
+missing.
+
+**Cost.** The shim now rejects things the pipeline might one day want to do, and
+the rejection has to be updated if pacman's rule changes. That is the correct
+failure: a shim drifting from its tool should break a test loudly, not let a
+production path go untested.