TASK22168 endpoint account contract consistency slice

This commit is contained in:
2026-03-19 12:11:52 +00:00
parent 54820324f5
commit f9c9687cfe
9 changed files with 529 additions and 86 deletions
+49
View File
@@ -753,6 +753,55 @@
- `node tests/phase16/service-behaviour.test.cjs` -> **pass** (4/4)
- `npm run lint` -> **warnings only** (pre-existing `react-hooks/exhaustive-deps` warnings)
## Latest update (2026-03-19 — TASK22168 endpoint account contract consistency slice)
- New branch created from `origin/SIPS-Development` with required work item prefix:
- `TASK22168-endpoint-account-contract-consistency`
- Delivered next coherent low-risk `pages/api/endpoint/**` slice after TASK22109 across:
- `pages/api/endpoint/getaccounts_api.js`
- `pages/api/endpoint/getemailaccountcheck_api.js`
- `pages/api/endpoint/getpreferredlanguage_api.js`
- Scope delivered:
- removed dead/noisy code in touched handlers (unused imports and commented debug remnants)
- standardized structured negative-path handling for:
- missing required `emailAddress`
- catch/failure paths
- preserved success response contracts by returning unchanged upstream `data`
- Added focused phase21 endpoint contract coverage:
- `tests/phase21/endpoint-handler-contract.test.cjs`
- extended `tests/phase21/api-contract-slice1.test.cjs` runner
### Validation snapshot (TASK22168)
- `node tests/phase21/api-contract-slice1.test.cjs` -> **pass**
- helper: 4/4
- file-handler: 11/11
- email-handler: 12/12
- endpoint-handler: 7/7
- `npm run lint` -> **warnings only** (pre-existing `react-hooks/exhaustive-deps` warnings)
### Risks + mitigations (TASK22168)
- Risk: endpoint contract drift in success payloads.
- Mitigation: success responses kept as upstream `data` payload via `respondSuccess`.
- Risk: over-broad behavior change in account/login adjacent APIs.
- Mitigation: scoped to 3 low-risk handlers only; no auth/session/security flow changes.
- Risk: regression in negative-path status/shape expectations.
- Mitigation: added explicit phase21 missing-input and catch-path assertions for each touched endpoint.
### Rollback plan (TASK22168)
1. Revert endpoint files:
- `pages/api/endpoint/getaccounts_api.js`
- `pages/api/endpoint/getemailaccountcheck_api.js`
- `pages/api/endpoint/getpreferredlanguage_api.js`
2. Revert phase21 test updates:
- `tests/phase21/endpoint-handler-contract.test.cjs`
- `tests/phase21/api-contract-slice1.test.cjs`
3. Re-run:
- `node tests/phase21/api-contract-slice1.test.cjs`
- `npm run lint`
### Manual HTTP checks (Phase 16)
- Dev server on `http://localhost:3002`.