fix: normalize scheduled_at comparison in snapshot export#1159
Draft
jp-knj wants to merge 2 commits into
Draft
Conversation
🦋 Changeset detectedLatest commit: f646db7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
18 tasks
c77b05d to
cc64a0e
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a SQLite/D1 snapshot export bug where scheduled rows could be omitted due to comparing scheduled_at (ISO string) against datetime('now') (space-separated), causing incorrect lexicographic ordering until UTC midnight.
Changes:
- Normalize the SQLite “now” value in the snapshot export query to ISO 8601 via
strftime('%Y-%m-%dT%H:%M:%fZ', 'now'). - Add integration tests to ensure scheduled rows are included/excluded based on whether
scheduled_atis past/future. - Add a patch changeset documenting the fix.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
packages/core/src/api/handlers/snapshot.ts |
Updates the SQLite snapshot export WHERE clause to compare against an ISO-formatted “now”. |
packages/core/tests/integration/snapshot/snapshot.test.ts |
Adds coverage for scheduled content inclusion/exclusion in snapshot generation. |
.changeset/cold-boats-joke.md |
Patch changeset describing the snapshot export fix for SQLite/D1. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cc64a0e to
6bd3446
Compare
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/blocks
@emdash-cms/cloudflare
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
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.
What does this PR do?
Same bug as #917, but in
snapshot.ts:297. The WHERE clause comparesscheduled_atwithdatetime('now')as raw text. On SQLite the formats differ, so scheduled rows were missing from snapshots until UTC midnight.This PR mirrors #1157: use
strftime('%Y-%m-%dT%H:%M:%fZ', 'now').It is a draft for now. I will set it ready after #1157 is merged.
Follow-up to #917.
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runmessages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain.AI-generated code disclosure