[enhancement] createSSRequest: fail-fast when storeNumber is missing #5

Closed
opened 2026-07-01 16:06:32 -04:00 by jmcqueen · 1 comment
Owner

Every subType in REQUEST_TYPE_MAP (per ss-fields-*.json) requires Store Number. Currently createSSRequest proceeds when storeNumber is missing, and Jira rejects with a generic required-field error that mentions Jira internals instead of our API contract.

Fix: add a client-side guard at the top of createSSRequest that returns a clear 400 (storeNumber is required for subType "...") before making the API call.

Optional: if a subType is ever added that does not require Store Number, key the guard off a per-subType flag in REQUEST_TYPE_MAP.

Every subType in `REQUEST_TYPE_MAP` (per `ss-fields-*.json`) requires `Store Number`. Currently `createSSRequest` proceeds when `storeNumber` is missing, and Jira rejects with a generic required-field error that mentions Jira internals instead of our API contract. **Fix:** add a client-side guard at the top of `createSSRequest` that returns a clear 400 (`storeNumber is required for subType "..."`) before making the API call. Optional: if a subType is ever added that does *not* require Store Number, key the guard off a per-subType flag in `REQUEST_TYPE_MAP`.
jmcqueen added this to the v1: Jira lifecycle GA milestone 2026-07-01 16:06:32 -04:00
jmcqueen added the
enhancement
label 2026-07-01 16:06:32 -04:00
Author
Owner

Fixed in commit 312448f.

  • New SUBTYPES_REQUIRING_STORE_NUMBER set in services/jira/jsmRequests.js, seeded with every current subType (all 14 mark Store Number required: true in the discovered ss-fields-*.json).
  • createSSRequest now trims storeNumber (rejects whitespace-only) and throws a 400 with "storeNumber is required for subType X" before making any Jira API call.
  • Validation errors now carry err.status = 400 so non-route callers can distinguish client errors from Jira failures.
  • Adding a future subType that does not require Store Number: leave it out of the set. One-line change.

Commits on cursor/hardening-4-5-6-7:

  • c4a0a69 Fix #4
  • 312448f Fix #5
  • b8f2eab Refactor #6

Branch: cursor/hardening-4-5-6-7
Compare: init-repo-and-jira-lifecycle...hardening-4-5-6-7

Fixed in commit `312448f`. - New `SUBTYPES_REQUIRING_STORE_NUMBER` set in `services/jira/jsmRequests.js`, seeded with every current subType (all 14 mark Store Number `required: true` in the discovered `ss-fields-*.json`). - `createSSRequest` now trims `storeNumber` (rejects whitespace-only) and throws a `400` with `"storeNumber is required for subType X"` before making any Jira API call. - Validation errors now carry `err.status = 400` so non-route callers can distinguish client errors from Jira failures. - Adding a future subType that does *not* require Store Number: leave it out of the set. One-line change. **Commits on `cursor/hardening-4-5-6-7`:** - `c4a0a69` Fix #4 - `312448f` Fix #5 - `b8f2eab` Refactor #6 Branch: [cursor/hardening-4-5-6-7](https://git.joesjavajoint.com/jmcqueen/wxccai/src/branch/cursor/hardening-4-5-6-7) Compare: [init-repo-and-jira-lifecycle...hardening-4-5-6-7](https://git.joesjavajoint.com/jmcqueen/wxccai/compare/cursor/init-repo-and-jira-lifecycle...cursor/hardening-4-5-6-7)
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: jmcqueen/wxccai#5
No description provided.