Skip to content

Image delete dialog: say what the server deletes, not what the page lists - #902

Merged
schmitch merged 1 commit into
mainfrom
claude/546-image-delete-dialog
Nov 17, 2026
Merged

schmitch merged 1 commit into
mainfrom
claude/546-image-delete-dialog

Conversation

@schmitch

Copy link
Copy Markdown
Member

Fixes #546

The problem

The image page lists at most the newest 1,000 tags and 1,000 manifests of an image (#240), and ImageDeleteDialog worded its irreversible confirmations from those rows. The four cases of the issue and its comment:

Delete Before Now
Whole image counted tags.length / manifests.length ("1,000 tags and 1,000 manifests" for 50,000) counts tags_total / manifests_total, and says "not only the newest this page lists" when the lists are partial
Manifest referrer count and "with its tags …" from the listed rows every tag on the manifest, and the manifests and referrers that go along, as the server counts them
Manifest listed by an index warning only when the index was among the listed 1,000 manifests the indexes that list it and stay, as the server names them
Chart version "Permanently delete version 1.0.0", silent about stable on the same digest "…, and with it the tag stable of the same manifest", plus what goes along and the index warning

How 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}
  • It takes the delete's query and refuses what the delete refuses (the validation is now one function both handlers call), and answers 404 when nothing matches. It mirrors all three deletes (tag, manifest, whole image); the dialog asks it for manifests only.
  • A manifest's answer comes from 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.
  • tags and indexes name 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.md documents 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); delete only shares its query validation with the preview.

Housekeeping

  • Changelog fragment: docs/changes/2.2.0/546.fixed.md. The issue was in Backlog; since what merges to main ships in the next release, I moved it to the 2.2.0 milestone and assigned it.
  • Two new entries in .sqlx/ for the two new queries (cargo xtask prepare against 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:tsc
  • cargo 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_images now 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-features
  • cargo xtask changelog --check, cargo xtask unused, cargo xtask doc-check, cargo xtask docs --check

New 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:

  • The rest of the workspace's tests (cargo xtask test) and cargo xtask e2e: the session ran out of disk linking every integration-test binary, so only the server's unit tests and the registry suite 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

…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
@schmitch
schmitch added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 14248c3 Nov 17, 2026
20 checks passed
@schmitch
schmitch deleted the claude/546-image-delete-dialog branch November 17, 2026 09:27
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.

Image delete dialog: counts from the capped lists, and a chart version's delete does not say it takes the digest's other tags

2 participants