Skip to content

fix: keep post drafts unscheduled by default - #209

Open
drbelt27 wants to merge 1 commit into
trypostit:mainfrom
drbelt27:fix/unscheduled-drafts
Open

fix: keep post drafts unscheduled by default#209
drbelt27 wants to merge 1 commit into
trypostit:mainfrom
drbelt27:fix/unscheduled-drafts

Conversation

@drbelt27

Copy link
Copy Markdown

Summary

This PR fixes the post creation and update scheduling behavior so drafts remain genuinely unscheduled when no schedule is provided.

Previously, creating a post without scheduled_at could silently assign a default schedule of today at 09:00 UTC. That behavior is risky for API/MCP clients because omitting a schedule should mean “create a draft”, not “schedule this content”.

What Changed

  • Updated CreatePost so missing or explicit null scheduled_at resolves to null.
  • Preserved the legacy date parameter behavior: when date is explicitly provided, it still maps to 09:00 UTC for backwards compatibility.
  • Updated the MCP create-post-tool schema/description to document that omitted or null scheduled_at creates an unscheduled draft.
  • Updated MCP update-post-tool validation so status=scheduled requires an explicit scheduled_at.
  • Updated API post update validation with the same rule: scheduled status cannot be set without a schedule.
  • Updated controller/template behavior expectations so post creation without a date leaves scheduled_at null.
  • Confirmed immediate publish behavior is unchanged: publish-now without scheduled_at still publishes immediately and internally records scheduled_at = now().

Why

Draft creation and scheduling are different user intents. API and MCP clients should be able to create draft posts without accidentally placing them on the calendar.

This makes scheduling explicit and fail-safe:

  • draft with no date: accepted, scheduled_at = null
  • scheduled with no date: rejected
  • scheduled with future date: accepted
  • publish now with no date: unchanged immediate publish behavior

Validation

Targeted validation on this branch:

  • ./vendor/bin/pest tests/Unit/Actions/Post/CreatePostTest.php tests/Feature/Mcp/PostToolTest.php tests/Feature/Api/PostApiTest.php tests/Feature/PostControllerTest.php tests/Feature/PostTemplateControllerTest.php
  • Result: 146 passed, 512 assertions

The same fix was also validated in the combined fork branch with the full suite:

  • ./vendor/bin/pest: 2664 passed, 3 skipped, 20372 assertions
  • ./vendor/bin/pint --test on touched files: passed
  • git diff --check: passed

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.

1 participant