fix: projects create disabling all platforms by default - #89
Closed
Henry Zhang (caezium) wants to merge 3 commits into
Closed
fix: projects create disabling all platforms by default#89Henry Zhang (caezium) wants to merge 3 commits into
projects create disabling all platforms by default#89Henry Zhang (caezium) wants to merge 3 commits into
Conversation
CLI `projects create` serialized `platforms: []` when --platforms was omitted, overriding the server's omitted-field default of ['imessage'] and creating a project with no platform enabled (SDK then 403s on connect). Make FilledCreate.platforms optional and send undefined (omitted) when the user specifies nothing, in both the non-interactive and interactive paths; the create body type already marks platforms optional. Adds unit coverage. DX-REPORT #25.
The non-interactive create path only guarded the *absent* --platforms flag; a blank or whitespace-only value (e.g. `--platforms ""` from a script whose $PLATFORMS var is unset) still parsed to `[]`, which the server reads as "disable every platform" — the exact footgun the platform-default fix exists to avoid. Fold that normalization into a shared resolvePlatformsFlag() used by both the interactive and non-interactive paths, so empty input always omits the field. Also make tests/unit/create-platforms.test.ts hermetic: it calls fillCreateOpts() in-process, and `bun test` from a real terminal attaches a TTY to stdin/stdout, sending the test into the interactive path where it blocked on a clack prompt. Pin the non-interactive path and add blank/whitespace edge-case coverage.
📝 WalkthroughWalkthroughProject creation now treats omitted or blank platform selections as undefined, while explicit values remain validated and deduplicated. Contract tests capture project creation request bodies and verify both behaviors. ChangesProject platform selection
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This was referenced Jul 29, 2026
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.
Summary
platformswhen--platformsis absent or blank, allowing the Dashboard API to apply its iMessage default.getApi(), and Eden treaty.Why
photon projects createpreviously serializedplatforms: []when no platform was provided. The server interprets an explicit empty array as no platforms enabled, while an omitted field defaults to["imessage"]. This created projects that could subsequently return 403 when connecting.Upstream version
Routes added/removed/changed
Snapshot changes
New runtime dependencies
Test plan
nvm use 24~/.bun/bin/bun run check— typecheck, 93 tests, and build passed~/.bun/bin/bun test tests/contract/projects.contract.test.ts--platformsChecklist
bun run checkpasses locallyNeed help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Note
Low Risk
Scoped to project-create CLI serialization and prompt copy; behavior fix aligns with API defaults and is covered by new contract tests.
Overview
photon projects createno longer sendsplatforms: []when--platformsis missing or only whitespace/commas. The create payload now leavesplatformsout so the Dashboard API can apply its iMessage default instead of treating an empty array as “no platforms enabled.”Non-interactive and interactive flows both go through
normalizeOptionalPlatforms, which still parses, trims, dedupes, and validates explicit values. The interactive prompt now states that a blank answer uses the iMessage default.Contract tests assert the serialized POST
/api/projectsbody via the mock server (absent/empty--platformsomits the field; explicit lists are preserved).Reviewed by Cursor Bugbot for commit 87763c7. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
Bug Fixes
--platformsor entering a blank value now preserves the default behavior instead of sending an empty platform list.Tests