What the tarball checksum in the tag message proves when a publish is repaired #255

Closed
opened 2026-11-17 22:24:56 +00:00 by Claude · 2 comments
Owner

Part of #87

ansible-galaxy collection build gives a different sha256 on every run (reproduced with the pinned ansible-core). So a tarball rebuilt by a repair run never has the sha256 the tag message holds, and "the tag message carries the tarball's sha256" and "a rerun repairs a failed publish" cannot both hold as decided.

To decide

  1. Which gives way when the tag exists and the asset is missing:
    • (a) the repair run fails and the maintainer deletes the release and tag by hand;
    • (b) the first build is kept where the repair run can fetch it;
    • (c) the tag message carries the checksum of FILES.json from MANIFEST.json, which is the same for every build of one tree, and not the tarball's sha256;
    • (d) the tarball is normalised to be reproducible by a further script;
    • (e) the sha256 leaves the tag message.
  2. What "an existing asset that differs" is compared with. A fresh build always differs.
  3. Which commit a repair run builds from when later commits have landed on main: the tagged commit, or the pushed one.

Waits on this

ci(release): generate the release pull request and publish tagged releases with the tarball is blocked by this ticket. The release ADR issue and the README issue each carry one sentence that follows the answer; a comment is enough there.

Evidence is in the first comment.

Part of #87 `ansible-galaxy collection build` gives a different sha256 on every run (reproduced with the pinned ansible-core). So a tarball rebuilt by a repair run never has the sha256 the tag message holds, and "the tag message carries the tarball's sha256" and "a rerun repairs a failed publish" cannot both hold as decided. ## To decide 1. Which gives way when the tag exists and the asset is missing: - (a) the repair run fails and the maintainer deletes the release and tag by hand; - (b) the first build is kept where the repair run can fetch it; - (c) the tag message carries the checksum of `FILES.json` from `MANIFEST.json`, which is the same for every build of one tree, and not the tarball's sha256; - (d) the tarball is normalised to be reproducible by a further script; - (e) the sha256 leaves the tag message. 2. What "an existing asset that differs" is compared with. A fresh build always differs. 3. Which commit a repair run builds from when later commits have landed on `main`: the tagged commit, or the pushed one. ## Waits on this [ci(release): generate the release pull request and publish tagged releases with the tarball](https://git.rkdr.net/Mortis/Kamino/issues/175) is blocked by this ticket. The release ADR issue and the README issue each carry one sentence that follows the answer; a comment is enough there. Evidence is in the first comment.
Claude added the
Wayfinder
Grilling
label 2026-11-17 22:24:56 +00:00
Defame1297 was assigned by Claude 2026-11-17 22:24:56 +00:00
Author
Owner

Evidence from the review of the map (2026-11-17)

  • Reproduced twice, by two reviewers, with ansible-core 2.22.0: the same tree built twice gives two sha256 values. Member order and file contents are identical. The mtime of MANIFEST.json and FILES.json and the gzip header timestamp differ. SOURCE_DATE_EPOCH does not help. Source: ansible/galaxy/collection/__init__.py:1320, tar_info.mtime = int(time.time()); the other members take the checkout's file times.
  • MANIFEST.json is byte-identical across builds of one tree. It holds the sha256 of FILES.json, which holds a sha256 per file.
  • Release path: fragment check, failed publish and tarball integrity, item 3: "the tarball is uploaded if missing; an existing asset that differs fails loudly". Item 4: "the annotated tag message carries the tarball's sha256 (it catches an asset swapped by any writer except the release bot)".
  • ci(release): generate the release pull request and publish tagged releases with the tarball, comment of 2026-11-16: "publish converges (runs on every push to main, does only what is missing)" and "Test a rerun after a failed upload: it adds the tarball and nothing else."
  • The same comment asks for a pre-existing tag to "point at the expected commit". On a later push the checkout is a later commit.

Not certain: whether Gitea can create a release and attach the asset in one step that keeps the annotated tag. The release path evidence says a draft loses it.

The map's gist for the release path decision ("the tag message carries the tarball's sha256") follows the answer here; it was not edited.

## Evidence from the review of the map (2026-11-17) - Reproduced twice, by two reviewers, with ansible-core 2.22.0: the same tree built twice gives two sha256 values. Member order and file contents are identical. The mtime of `MANIFEST.json` and `FILES.json` and the gzip header timestamp differ. `SOURCE_DATE_EPOCH` does not help. Source: `ansible/galaxy/collection/__init__.py:1320`, `tar_info.mtime = int(time.time())`; the other members take the checkout's file times. - `MANIFEST.json` is byte-identical across builds of one tree. It holds the sha256 of `FILES.json`, which holds a sha256 per file. - [Release path: fragment check, failed publish and tarball integrity](https://git.rkdr.net/Mortis/Kamino/issues/211), item 3: "the tarball is uploaded if missing; an existing asset that differs fails loudly". Item 4: "the annotated tag message carries the tarball's sha256 (it catches an asset swapped by any writer except the release bot)". - [ci(release): generate the release pull request and publish tagged releases with the tarball](https://git.rkdr.net/Mortis/Kamino/issues/175), comment of 2026-11-16: "publish converges (runs on every push to `main`, does only what is missing)" and "Test a rerun after a failed upload: it adds the tarball and nothing else." - The same comment asks for a pre-existing tag to "point at the expected commit". On a later push the checkout is a later commit. Not certain: whether Gitea can create a release and attach the asset in one step that keeps the annotated tag. The release path evidence says a draft loses it. The map's gist for the release path decision ("the tag message carries the tarball's sha256") follows the answer here; it was not edited.
Author
Owner

Resolution

Decided with the maintainer (grilling session, 2026-11-20). Facts read in the ansible-core 2.22.0 source (ansible/galaxy/collection/__init__.py), not run:

  • Installing from a tarball or a URL checks each file against FILES.json. It does not check FILES.json against MANIFEST.json, and nothing checks MANIFEST.json. Tar members not listed in FILES.json are skipped. The exec bit comes from the tar member and no hash covers it.
  • MANIFEST.json holds no timestamp and nothing from the host. It changes only with the files in the tree, galaxy.yml (including the order of its dependencies) and the ansible-core version.
  • ansible-galaxy collection verify --offline on an installed collection checks the whole chain and prints MANIFEST.json hash: <sha256>.
  • Gitea's create-release call has no attachment field, so the asset is always a second call (live swagger, 29.0.0+dev).
  1. Anchor (option c, sharpened): the annotated tag message carries the sha256 of MANIFEST.json, not of the tarball and not the FILES.json checksum. MANIFEST.json is the same for every build of one tree, and it also covers collection_info (version, dependencies), which the FILES.json checksum does not.
  2. Consumer check: for the tarball route, install it, run ansible-galaxy collection verify --offline mortis.kamino, and compare the printed hash with the tag message. The git route pinned to a commit stays the high-assurance install.
  3. Accepted risk: no hash covers the exec bit, so it goes in the accepted-risks register. Extra tar members are dropped on install and need no entry.
  4. What "an existing asset that differs" means: the asset fails one chain check in check_tarball.py: the sha256 of MANIFEST.json must equal the tag message, FILES.json must match MANIFEST.json's chksum_sha256, and each file must match FILES.json. Publish runs this check in three places:
    • on the fresh build before the tag is created (the message is written from that build);
    • on a repair rebuild before upload (a mismatch, for example after the ansible-core pin moved, fails the job instead of uploading different content under the old tag);
    • on an existing asset (a pass is a no-op; a failure fails loudly and CI never replaces the asset).
  5. Which commit a repair run builds from: the tagged commit, built in a worktree of the tag. The run first asserts that the tag's commit is the commit on main's first-parent history where galaxy.yml's version: became the tagged version. That is the definition of "the expected commit" in Release path: fragment check, failed publish and tarball integrity, item 3.

Options not taken: (a) a hand repair brings back a manual gate; (b) keeping the first build needs storage across runs, and Actions artifacts expire; (d) a normalising repack is a custom script that depends on tarfile/gzip output staying stable; (e) dropping the hash loses detection of an asset swapped by a writer on the Releases unit.

No new ADR: one sentence in the release ADR issue. No glossary term. No new backlog issue: the work sits inside ci(release): generate the release pull request and publish tagged releases with the tarball, which this ticket no longer blocks.

## Resolution Decided with the maintainer (grilling session, 2026-11-20). Facts read in the ansible-core 2.22.0 source (`ansible/galaxy/collection/__init__.py`), not run: - Installing from a tarball or a URL checks each file against `FILES.json`. It does not check `FILES.json` against `MANIFEST.json`, and nothing checks `MANIFEST.json`. Tar members not listed in `FILES.json` are skipped. The exec bit comes from the tar member and no hash covers it. - `MANIFEST.json` holds no timestamp and nothing from the host. It changes only with the files in the tree, `galaxy.yml` (including the order of its dependencies) and the ansible-core version. - `ansible-galaxy collection verify --offline` on an installed collection checks the whole chain and prints `MANIFEST.json hash: <sha256>`. - Gitea's create-release call has no attachment field, so the asset is always a second call (live swagger, 29.0.0+dev). 1. **Anchor (option c, sharpened):** the annotated tag message carries the sha256 of `MANIFEST.json`, not of the tarball and not the `FILES.json` checksum. `MANIFEST.json` is the same for every build of one tree, and it also covers `collection_info` (version, dependencies), which the `FILES.json` checksum does not. 2. **Consumer check:** for the tarball route, install it, run `ansible-galaxy collection verify --offline mortis.kamino`, and compare the printed hash with the tag message. The git route pinned to a commit stays the high-assurance install. 3. **Accepted risk:** no hash covers the exec bit, so it goes in the accepted-risks register. Extra tar members are dropped on install and need no entry. 4. **What "an existing asset that differs" means:** the asset fails one chain check in `check_tarball.py`: the sha256 of `MANIFEST.json` must equal the tag message, `FILES.json` must match `MANIFEST.json`'s `chksum_sha256`, and each file must match `FILES.json`. Publish runs this check in three places: - on the fresh build before the tag is created (the message is written from that build); - on a repair rebuild before upload (a mismatch, for example after the ansible-core pin moved, fails the job instead of uploading different content under the old tag); - on an existing asset (a pass is a no-op; a failure fails loudly and CI never replaces the asset). 5. **Which commit a repair run builds from:** the tagged commit, built in a worktree of the tag. The run first asserts that the tag's commit is the commit on `main`'s first-parent history where `galaxy.yml`'s `version:` became the tagged version. That is the definition of "the expected commit" in [Release path: fragment check, failed publish and tarball integrity](https://git.rkdr.net/Mortis/Kamino/issues/211), item 3. Options not taken: (a) a hand repair brings back a manual gate; (b) keeping the first build needs storage across runs, and Actions artifacts expire; (d) a normalising repack is a custom script that depends on `tarfile`/`gzip` output staying stable; (e) dropping the hash loses detection of an asset swapped by a writer on the Releases unit. No new ADR: one sentence in the release ADR issue. No glossary term. No new backlog issue: the work sits inside [ci(release): generate the release pull request and publish tagged releases with the tarball](https://git.rkdr.net/Mortis/Kamino/issues/175), which this ticket no longer blocks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#255