Skip to content

fix(mirror): read the tag list from the source registry - #46

Merged
douglance merged 1 commit into
mainfrom
fix/mirror-source-tags
Aug 21, 2026
Merged

fix(mirror): read the tag list from the source registry#46
douglance merged 1 commit into
mainfrom
fix/mirror-source-tags

Conversation

@douglance

Copy link
Copy Markdown
Collaborator

Fixes a silent-truncation bug that #38 will trigger, and moves the mirror's logic into scripts/ci alongside the other CI helpers.

The bug

The mirror derived its tag list from resolvePublishMatrix, which describes what a release publishes now. #38 narrows that function to the default contracts version:

resolvePublishMatrix('all', 'all')   7 rows, v3.2 only    (was 11 across v2.1 + v3.2)
resolvePublishMatrix('all', 'v2.1')  0 rows

So once #38 lands, mirroring an older release would copy 7 of its 11 tags and report success, and asking for v2.1 would die as an empty matrix. Silent truncation is the worse half: a mirror that copies fewer tags than exist looks like it worked.

The fix

crane ls on the source repository answers what actually exists, rather than what current publishing rules would produce. That also removes the mirror's dependency on publish-time logic it has no reason to share.

Verified against the live package:

input result
v0.2.10, all, all 11 tags, including the four nc2.1
v0.2.10, l3-custom-6, v2.1 exactly 1 tag
v9.9.9, all, all fails

Also

Both steps move to scripts/ci/resolve-mirror-tags.mjs and scripts/ci/mirror-tags.mjs, matching prepare-testnode-context.mjs and friends, so the copy loop is readable and runnable outside a workflow.

Behavior is otherwise unchanged: skip when the destination already carries the source digest, refuse when it differs unless overwrite, and assert the digest after every copy. The Hub API is still what answers "does the destination tag exist", since Docker Hub returns 401 for an unknown repository and that is indistinguishable from bad credentials.

pnpm lint, pnpm typecheck clean; pnpm test:run 245/248 with the 3 pre-existing token-bridge env failures.

The mirror derived its tags from resolvePublishMatrix, which describes what a
release publishes *now*. #38 narrows that function to the default contracts
version, so `resolvePublishMatrix('all', 'all')` drops from 11 rows to 7 and
`(…, 'v2.1')` returns none at all. Mirroring an older release would then copy 7
of its 11 tags and report success, and asking for v2.1 would fail as an empty
matrix.

`crane ls` on the source repository answers what actually exists, so the mirror
copies what a release really published rather than what current rules would
publish. Verified against the live package: v0.2.10 resolves all 11 tags
including the four nc2.1 ones, a single variant+contracts filter resolves exactly
one, and an unknown version fails.

Both steps move into scripts/ci, matching the other CI helpers, so the loop is
readable and testable outside a workflow run. Behavior otherwise unchanged:
skip-if-current, refuse-on-divergence unless overwrite, digest asserted after
every copy.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@douglance
douglance merged commit 683cc9e into main Aug 21, 2026
7 checks passed
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