Skip to content

fix(oci): check for existing manifest before insert to fix re-push FK violation#54

Merged
The127 merged 1 commit intomasterfrom
fix/manifest-repush-fk-violation
Apr 17, 2026
Merged

fix(oci): check for existing manifest before insert to fix re-push FK violation#54
The127 merged 1 commit intomasterfrom
fix/manifest-repush-fk-violation

Conversation

@The127
Copy link
Copy Markdown
Owner

@The127 The127 commented Apr 17, 2026

Summary

  • After the upsert fix in fix(oci): upsert manifests and tags on push to handle re-pushes #53, manifest re-pushes still panicked with interface conversion: interface {} is uint32, not uint followed by a FK violation
  • Root cause: the tag was queued with manifest.GetId() (new UUID) before SaveChanges ran; the manifest upsert returned the existing row's id via SetId, leaving the tag referencing a UUID that was never inserted
  • Fix: query for the existing manifest first — if found, reuse it and skip the insert so the tag always references a valid manifest id
  • Plain INSERT is restored for manifests (check handles sequential re-pushes; DB unique constraint handles concurrent races)
  • Tag upsert from fix(oci): upsert manifests and tags on push to handle re-pushes #53 is kept so re-pushing a tag updates it to the latest manifest

Test plan

  • Push same image twice — second push succeeds
  • Push different image to same tag — tag resolves to new manifest on pull

… violation

The manifest upsert returned the existing row's id via SetId, but the tag had
already been created with the new (uninserted) uuid, causing a FK violation on
every re-push. Fix: query for an existing manifest first; if found, reuse it and
skip the insert so the tag always references a valid manifest id. Plain INSERT is
restored for manifests — the check handles sequential re-pushes and the DB unique
constraint handles true concurrent races. Tag upsert is kept so re-pushing a tag
always updates to the latest manifest.
@The127 The127 enabled auto-merge April 17, 2026 09:51
@The127 The127 merged commit e20923d into master Apr 17, 2026
6 checks passed
@The127 The127 deleted the fix/manifest-repush-fk-violation branch April 17, 2026 09:52
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