TASK22224: modernize involvement and updatecase handlers

This commit is contained in:
2026-03-23 18:23:54 +00:00
parent 3f2b945172
commit ba9beda65e
5 changed files with 195 additions and 60 deletions
+46
View File
@@ -379,3 +379,49 @@ Validation:
Follow-ups:
- Optional next big slice: bring remaining proxy/message routes using raw axios promise chains (`createcaseinvolvement_api.js`, `createrepinvolvement_api.js`, `updatecase_api.js`) onto the same async/await + explicit contract pattern.
---
### CL-010: TASK22224 involvement/update route async contract hardening bundle
date: 2026-03-23
author: Cline
scope: `pages/api/file/{createcaseinvolvement_api,createrepinvolvement_api,updatecase_api}.js`, `tests/phase21/file-handler-contract.test.cjs`
type: change
rationale: Execute the next requested slice by modernizing remaining relay-backed involvement/update handlers that still used axios promise chains and legacy dead imports.
impact: Improves reliability/readability and preserves existing response contracts, including 412 "record exists" semantics for involvement creation flows.
status: completed
Summary:
- `createcaseinvolvement_api.js`
- removed unused `CryptoJS` import
- refactored axios `.then/.catch` to explicit `try/catch`
- preserved conflict behavior: status 412 -> success `{ record: "exists" }`
- preserved failure contract: `CREATE_CASE_INVOLVEMENT_FAILED`
- `createrepinvolvement_api.js`
- removed unused `CryptoJS` import
- refactored axios `.then/.catch` to explicit `try/catch`
- preserved conflict behavior: status 412 -> success `{ record: "exists" }`
- preserved failure contract: `CREATE_REP_INVOLVEMENT_FAILED`
- `updatecase_api.js`
- removed unused `CryptoJS` import
- refactored axios `.then/.catch` to explicit `try/catch`
- preserved failure contract: `UPDATE_CASE_FAILED`
- Phase21 tests expanded:
- createcaseinvolvement 412 conflict success contract
- createrepinvolvement dependency failure contract
- updatecase dependency failure contract
Validation:
- `node tests/phase21/file-handler-contract.test.cjs` -> pass (49/49)
- `node tests/phase21/api-contract-slice1.test.cjs` -> pass
- helper: 4/4
- file-handler: 49/49
- email-handler: 12/12
- endpoint-handler: 149/149
Follow-ups:
- Optional: apply equivalent modernization to any remaining relay-backed handlers outside `pages/api/file/` that still use raw axios promise chains and have no explicit phase21 contract assertions.