Skip to content

fix(api): skip the first v8 format's revisions/<sha>.json in CMS Releases - #8425

Merged
tlgimenes merged 1 commit into
mainfrom
fix/cms-releases-skip-legacy-revisions
Nov 10, 2026
Merged

tlgimenes merged 1 commit into
mainfrom
fix/cms-releases-skip-legacy-revisions

Conversation

@tlgimenes

@tlgimenes tlgimenes commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On sites migrated to v8 before #8379, the Releases tab opens empty, and the releases only show up after clicking Load more a few times.

revisions/ still holds the first v8 format's flat <commit-sha>.json files (#8062) next to the new <inv-ts>-<uuidv7>/ folders. listCmsReleases does a delimiter LIST with MaxKeys: 50 and keeps only CommonPrefixes. But S3/R2 counts plain objects against MaxKeys too. Plain hex SHAs (0…–e…) sort before the new ids (fe5e… today), so the first pages were all old files and came back with 0 rows and a cursor. On an affected site, pages 0 and 1 had 0 rows and page 2 had all 19 releases.

Fix

The first page uses StartAfter: revisions/<revisionIdFloor(now + 1 day)>. Because the id prefix is 2^48 − 1 − ms, every revision minted so far sorts above that floor. The 1-day margin covers clock skew between Studio instances. Almost every SHA sorts below the floor, so the old files are never listed. A SHA that starts above it (about 1 in 150, e.g. ff…) still takes one slot on a page but never fills a page. Later pages use the continuation token as before; S3 ignores StartAfter when a token is sent, and the store sends only one of them.

  • DeliveryStore.listPage gets an optional startAfter, which the S3 store sends as StartAfter.
  • revisionIdFloor(nowMs) lives in revision-id.ts, next to newRevisionId.
  • The memory test store now works like S3: plain objects and folders share maxKeys, and it honours startAfter. Before, it couldn't reproduce this bug.

The old files aren't deleted. That would be a separate, destructive cleanup.

Tests

  • New: 151 old <sha>.json files (including an ff… one) plus 3 revisions → the first page lists all 3 and has no next cursor. This test fails without the fix.
  • New: a revision minted 23h ahead of this instance's clock is still listed.
  • New (S3): start-after is sent on the first page; on later pages only continuation-token is sent.
  • bun test apps/api/src/hosted: 173 pass. tsc --noEmit, biome and oxlint are clean.

🤖 Generated with Claude Code


Summary by cubic

Fixes the CMS Releases tab opening empty on sites that still carry flat revisions/<commit-sha>.json files from the first v8 format. S3 counts those plain files against MaxKeys, and they sort below the new revision ids, so the first pages returned 0 rows until "Load more" skipped past them.

The first page now lists from a StartAfter floor that every current revision id sorts above. The 24h margin absorbs clock skew between Studio instances; the old files aren't deleted.

Details

  • DeliveryStore.listPage accepts an optional startAfter; the memory test store now mirrors S3's shared MaxKeys and honors it.
  • Added tests for legacy files on the first page, clock-skewed ids, and S3 request parameters.

Written for commit 7af82d8. Summary will update on new commits.

View guided diff Turn on auto-fix

…ases

Sites published under the first v8 format (#8062) still keep flat
`revisions/<commit-sha>.json` files next to the new revision folders.
S3/R2 MaxKeys counts those files together with the CommonPrefixes, and
the plain hex SHAs sort before the inverted-timestamp ids, so the
Releases tab returned empty pages until "Load more" got past them
(osklenbr-faststore-studio: 2 empty pages before the 19 releases).

The first page now LISTs with StartAfter = the revision-id floor of a
day from now. Every id minted so far sorts above it, and almost every
SHA sorts below it, so the old files are never paged through.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the claude PR authored by a coding agent label Nov 10, 2026
@tlgimenes
tlgimenes enabled auto-merge (squash) November 10, 2026 15:30
@tlgimenes
tlgimenes merged commit 2e54d82 into main Nov 10, 2026
24 checks passed
@tlgimenes
tlgimenes deleted the fix/cms-releases-skip-legacy-revisions branch November 10, 2026 15:36
decocms Bot pushed a commit that referenced this pull request Nov 10, 2026
PR: #8425 fix(api): skip the first v8 format's revisions/<sha>.json in CMS Releases
Bump type: patch

- decocms (apps/api/package.json): 4.562.1 -> 4.562.2

Deploy-Scope: server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude PR authored by a coding agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant