fix(board): reject invalid status and priority on create#3462
Merged
BunsDev merged 2 commits intoJul 19, 2026
Merged
Conversation
added 2 commits
July 19, 2026 03:32
Validate POST /api/board status and priority against STATUSES and PRIORITIES so unknown values cannot enter the board store. Signed-off-by: Tyler Thompson <eijastnt@TNT-3.local>
Register route.test.ts in the app suite so check:tests-wired passes, and use Set<CardStatus>/Set<CardPriority> like enrich-steps. Signed-off-by: Tyler Thompson <eijastnt@TNT-3.local>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the Board create endpoint (POST /api/board) by validating incoming status and priority fields against the canonical board enums, preventing invalid values from being persisted and breaking column/filter logic.
Changes:
- Import
STATUSES/PRIORITIESfrom@/lib/cave-boardand build allowlistSets for runtime validation. - Reject invalid
status/priorityvalues with HTTP 400 and stable error strings ("invalid status","invalid priority"), while still allowing omitted fields to default increateCard. - Add a source-contract test to enforce the validation logic’s presence, and wire it into the app test suite.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/app/api/board/route.ts | Adds enum allowlist validation for status and priority on card creation (400 on invalid values). |
| src/app/api/board/route.test.ts | Adds a source-contract test asserting the validation and stable error strings exist in the route source. |
| scripts/run-tests.mjs | Wires the new board route test into the test:app suite via the SUITES list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Validate
POST /api/boardstatusandpriorityagainst the board enums so unknown values cannot enter the store.Why
createCardpreviously accepted any status/priority string. Invalid values break Board columns/filters and lifecycle inference.Changes
status/prioritywithSTATUSES/PRIORITIES(Set<CardStatus>/Set<CardPriority>)invalid status/invalid priorityerrors when present values are invalid; omitted fields still default increateCardsrc/app/api/board/route.test.ts, wired intoscripts/run-tests.mjs(app suite)Verification
Codex review on the fork PR: no major issues (
chatgpt-codex-connector[bot]on4ba42772b2).Risk + rollout notes
Clients that already send only enum values are unaffected. Malformed agent/hand-edited payloads now get a clear 400 instead of a broken card. PATCH
/api/board/[id]validation is out of scope for this PR.