Repository navigation
Image delete dialog: say what the server deletes, not what the page lists - #902
Merged
Merged
Conversation
…ists
The image page lists at most the newest 1,000 tags and 1,000 manifests of
an image, and the delete confirmation counted those rows:
- the whole image is counted by tags_total / manifests_total, and says
when the page lists only part of them;
- a manifest's and a chart version's confirmation ask the server what the
delete would remove: every tag on the manifest (a chart version names
the other tags of its manifest), the manifests and referrers that go
along, and the indexes that list the manifest and stay.
The server answers that as GET
/admin/repositories/{name}/images/delete-preview, with the delete's query
and refusals, from the same decision the delete takes (taken_along),
without locking the image. Until it answers the delete cannot be
confirmed; when it fails, the dialog says what the server does in general.
Fixes #546
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012e6DJZX1cx1yLZg7q6fnDh
This was referenced Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #546
The problem
The image page lists at most the newest 1,000 tags and 1,000 manifests of an image (#240), and
ImageDeleteDialogworded its irreversible confirmations from those rows. The four cases of the issue and its comment:tags.length/manifests.length("1,000 tags and 1,000 manifests" for 50,000)tags_total/manifests_total, and says "not only the newest this page lists" when the lists are partialstableon the same digeststableof the same manifest", plus what goes along and the index warningHow the dialog learns what goes
The whole image uses the totals the page already has. For a manifest (and a chart version, which deletes its manifest) no total helps: which tags sit on the digest, which referrers and listed manifests nothing else needs, and which indexes list it are only known to the server. So the server answers it:
GET /admin/repositories/{name}/images/delete-preview?image=<image>[&reference=<tag|digest>]{"manifests": 3, "listed": 1, "referrers": 1, "tags": ["1.0", "latest"], "tags_total": 2, "indexes": [], "indexes_total": 0}taken_along, the function the delete itself decides with, over an unlocked read of the image (oci_dao::image_for_delete_preview). It is of the moment: the delete decides again under the image's lock.tagsandindexesname at most 50; the totals count all, and the dialog says "and N more".In the dialog, the delete cannot be confirmed until the preview has answered ("Checking what this delete takes along…"). When the preview fails, the dialog counts nothing and says what the server does in general (every tag on the manifest, also unlisted ones; listed manifests and referrers unless still needed; an index that lists it can no longer pull its platform), with the error, and the delete stays possible.
Admin API and its screen
This adds an admin endpoint; its screen is the image page's delete confirmation, in this pull request.
docs/docker.mddocuments the endpoint next to the delete.Not in this pull request
The admin image delete's own behaviour is unchanged (#560, #575 and #771 are not touched);
deleteonly shares its query validation with the preview.Housekeeping
docs/changes/2.2.0/546.fixed.md. The issue was inBacklog; since what merges tomainships in the next release, I moved it to the2.2.0milestone and assigned it..sqlx/for the two new queries (cargo xtask prepareagainst PostgreSQL 18).Verification
Run locally, all passing:
cd web && pnpm run test(47 files, 631 tests),pnpm run tsc,pnpm run knip,pnpm run e2e:tsccargo xtask check(fmt + clippy-D warnings, all targets)cargo test -p forge-server --lib(293 tests, including two new ones on the preview's counts and bounds)cargo test -p forge-server --test registry(53 tests;admins_delete_tags_manifests_and_imagesnow also asks the preview: refusals, 404s, an index, a listed platform manifest, a tag, the whole image, and that nothing was deleted)cargo sqlx prepare --check --workspace -- --all-targets --all-featurescargo xtask changelog --check,cargo xtask unused,cargo xtask doc-check,cargo xtask docs --checkNew web tests (
web/src/routes/ImageDetail.test.tsx): the whole image's wording with partial lists; a manifest whose tags, referrers and second index the page does not list; names past the 50 the server gives; a chart version whose digest carries other tags (and the disabled confirm while the preview is pending); a version with more tags than are named; and the fallback wording when the preview fails.Not verified:
cargo xtask test) andcargo xtask e2e: the session ran out of disk linking every integration-test binary, so only the server's unit tests and theregistrysuite ran. CI runs the rest.cargo xtask web-e2e(Playwright) and the dialog in a real browser against a running server: its wording is covered by the component tests above only.Generated by Claude Code