fix: normalize scheduled_at comparison on SQLite#1157
Conversation
🦋 Changeset detectedLatest commit: 9253748 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 |
|
All contributors have signed the CLA ✍️ ✅ |
There was a problem hiding this comment.
Pull request overview
Fixes a SQLite/D1-specific scheduled publishing visibility bug caused by lexicographic comparison between ISO-8601 scheduled_at strings (...T...Z) and SQLite’s space-separated datetime('now') output, ensuring scheduled items become visible once due (matching Postgres behavior).
Changes:
- Normalizes the SQLite
scheduled_at <= nowcomparison in the loader’sbuildStatusConditionvia SQLite datetime normalization. - Applies the same SQLite normalization to the snapshot exporter’s published/scheduled WHERE clause.
- Adds a dialect-parametric regression test covering past-vs-future scheduled visibility.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/core/src/loader.ts | Fixes scheduled visibility logic on SQLite/D1 by normalizing scheduled_at comparisons when widening published reads to include due scheduled items. |
| packages/core/src/api/handlers/snapshot.ts | Aligns snapshot export filtering with the corrected SQLite scheduled/published visibility predicate. |
| packages/core/tests/unit/loader-scheduled-publishing.test.ts | Adds regression coverage across supported dialects for due vs not-due scheduled content visibility. |
| .changeset/red-deer-wash.md | Records the patch-level change and user-facing bugfix description for release notes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
53c5f56 to
d1ed904
Compare
|
I have read the CLA Document and I hereby sign the CLA |
89a19cd to
41ab4d6
Compare
41ab4d6 to
b16418e
Compare
b16418e to
1ee373a
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: |
What does this PR do?
In SQLite,
scheduled_atis stored in ISO 8601 format (2026-05-04T17:26:23Z), butdatetime('now')returns2026-05-04 17:26:23. They're compared as strings, so within the same dayTis greater than a space and the row appears to be in the future. As a result, scheduled posts stayed hidden until UTC midnight.This PR switches the right-hand side to
strftime('%Y-%m-%dT%H:%M:%fZ', 'now')so both sides use the same format.api/handlers/snapshot.tshas the same bug. I've split that fix into #1159 (currently draft) and will mark it as ready once this PR is merged.Closes #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