Skip to content

fix(worker): accept date-only published frontmatter in sync-post#173

Open
bbornino wants to merge 2 commits into
playfulprogramming:mainfrom
bbornino:fix/sync-post-date-only-published
Open

fix(worker): accept date-only published frontmatter in sync-post#173
bbornino wants to merge 2 commits into
playfulprogramming:mainfrom
bbornino:fix/sync-post-date-only-published

Conversation

@bbornino

Copy link
Copy Markdown
Contributor

What broke

Post sync failed schema validation whenever published in frontmatter was a bare date (e.g. published: 2024-01-15), which is how it's actually written in post content. PostMetaSchema validated published against TypeBox's date-time format, whose checker (IsDateTime) requires a T time separator (e.g. 2024-01-15T00:00:00Z). Any post without a time component on published was rejected outright, so the sync job threw and the post was never imported.

Fix

Changed published's format from date-time to date in apps/worker/src/tasks/sync-post/types.ts. TypeBox's date format checker (IsDate) validates plain YYYY-MM-DD strings, matching what content actually contains. new Date("2024-01-15") still parses correctly (UTC midnight), so no other processor logic needed to change.

Tests

Updated the published frontmatter fixtures in processor.test.ts from full date-time strings ("2024-01-15T00:00:00Z") to date-only strings ("2024-01-15"), including the publishedAt assertion, so the test data matches what the schema now expects and what content actually looks like. All 37 unit tests pass (pnpm test:unit).

Fixes #172

PostMetaSchema validated `published` against the date-time format,
which requires a time component. Post frontmatter writes `published`
as a bare date (e.g. 2024-01-15), so every post sync failed schema
validation. Switch to the date format, which matches what content
actually contains.
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@bbornino, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 10e11ed5-1083-48c8-854d-1c329d82f329

📥 Commits

Reviewing files that changed from the base of the PR and between 5a4aaf2 and 8dea2e8.

📒 Files selected for processing (2)
  • apps/worker/src/tasks/sync-post/processor.test.ts
  • apps/worker/src/tasks/sync-post/types.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, we actually need to support both time formats. Let's leave these tests with dates as-is and a new test for non-T dates

Per review feedback on playfulprogramming#173, post frontmatter writes published as
either a bare date or a full ISO datetime depending on the source.
Validate published against a union of the date and date-time formats
instead of picking one, and add a regression test for the date-only
case alongside the existing datetime tests.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

fix: sync-post rejects date-only published frontmatter values

2 participants