Skip to content

fix(record-bin): capture current versions before deletion - #171

Merged
roger-datocms merged 1 commit into
masterfrom
fix/record-bin-capture-current-version
Nov 3, 2026
Merged

roger-datocms merged 1 commit into
masterfrom
fix/record-bin-capture-current-version

Conversation

@roger-datocms

@roger-datocms roger-datocms commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

(Claude here [Opus 5.5])

Fixes the follow-up report in #152: Record Bin 3.1.0 refuses to delete records and shows "Record Bin could not verify a complete archive."

Cause

Lambda-less capture reads records with GET /items?filter[ids]=… and sends no version parameter. The default for that list depends on a project upgrade:

  • Projects with the "Improving the items listing in CMA" upgrade (site.meta.improved_items_listing: true) default to current.
  • Older projects without it default to published.

On older projects, the list omits never-published records. Capture then fails with "Selected record was omitted from the complete capture response", and Record Bin cancels the deletion. Records with unpublished changes pass the check, but Record Bin archives their stale published content. 3.0.x read each record with items.rawFind, which always returns the current version, so it had neither problem.

Fix

Both capture reads (nested capture and verification) now send version: 'current'. A new unit test mocks the legacy default: it hides draft records unless the request asks for version: 'current'. The test fails without the fix.

Testing

I tested in a sandbox of a project with improved_items_listing: false:

Record 3.1.0 This branch
Draft Deletion blocked Archived and deleted
Published, with unpublished changes Archived the published content Archived the current content

Before: deleting a draft with 3.1.0 keeps the record and shows the notice.

before-draft-delete-blocked

After: with this branch, the same deletion succeeds and the draft is in the Record Bin.

after-draft-archived

npm test (104 tests), tsc --noEmit and Biome pass in record-bin.

🤖 Generated with Claude Code

Lambda-less capture listed records without a `version` parameter. On
projects without the improved items listing upgrade, the CMA defaults
that list to `published`. Draft records were then missing from the
response, so Record Bin cancelled every draft deletion. Records with
unpublished changes were archived with their stale published content.

Request `version: 'current'` for both the capture and verification
reads.

Refs #152

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@roger-datocms

roger-datocms commented Nov 3, 2026 •

Copy link
Copy Markdown
Member Author

This should be fixed now too.

I tested it manually and with Claude:

record-bin-171-172-walkthrough.mp4

Both this one and #172 should be good to merge and release as a new version.

@roger-datocms
roger-datocms merged commit bd7a9e0 into master Nov 3, 2026
@roger-datocms
roger-datocms deleted the fix/record-bin-capture-current-version branch November 3, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants