Skip to content

fix(board): reject invalid status and priority on create#3462

Merged
BunsDev merged 2 commits into
OpenCoven:mainfrom
tynamite:fix/board-create-status-priority-validation
Jul 19, 2026
Merged

fix(board): reject invalid status and priority on create#3462
BunsDev merged 2 commits into
OpenCoven:mainfrom
tynamite:fix/board-create-status-priority-validation

Conversation

@tynamite

Copy link
Copy Markdown
Contributor

Summary

Validate POST /api/board status and priority against the board enums so unknown values cannot enter the store.

Why

createCard previously accepted any status/priority string. Invalid values break Board columns/filters and lifecycle inference.

Changes

  • Allowlist status / priority with STATUSES / PRIORITIES (Set<CardStatus> / Set<CardPriority>)
  • Return 400 with stable invalid status / invalid priority errors when present values are invalid; omitted fields still default in createCard
  • Source-contract test in src/app/api/board/route.test.ts, wired into scripts/run-tests.mjs (app suite)

Verification

node --experimental-strip-types src/app/api/board/route.test.ts
node scripts/check-tests-wired.mjs

Codex review on the fork PR: no major issues (chatgpt-codex-connector[bot] on 4ba42772b2).

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.

Tyler Thompson 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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 / PRIORITIES from @/lib/cave-board and build allowlist Sets for runtime validation.
  • Reject invalid status / priority values with HTTP 400 and stable error strings ("invalid status", "invalid priority"), while still allowing omitted fields to default in createCard.
  • 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.

@BunsDev
BunsDev merged commit 3af79d1 into OpenCoven:main Jul 19, 2026
14 checks 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.

3 participants