TASK22224: aggressive non-file parity bundle

This commit is contained in:
2026-03-23 18:32:49 +00:00
parent ba9beda65e
commit 411190e403
8 changed files with 249 additions and 116 deletions
+51
View File
@@ -425,3 +425,54 @@ Validation:
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.
---
### CL-011: TASK22224 aggressive non-file bundle (email/admin/endpoint parity)
date: 2026-03-23
author: Cline
scope: `pages/api/email/{getmailinglist,getcaseref,notify}.js`, `pages/api/admin/{getnewappeals_api,getlatestdocuments_api}.js`, `pages/api/endpoint/getportallogin_api.js`, `tests/phase21/endpoint-handler-contract.test.cjs`
type: change
rationale: Execute requested aggressive bundling for remaining non-file modernization/parity candidates: remove legacy promise chains and improve hash compatibility on login endpoint while preserving existing contracts.
impact: Improves consistency and resilience across email/admin/endpoint routes with no contract regressions; adds encoded hash-variant compatibility for portal login hash checks.
status: completed
Summary:
- `pages/api/email/getmailinglist.js`
- converted axios `.then/.catch` to `try/catch`
- preserved flattening behavior and error contract `MAILING_LIST_FETCH_FAILED`
- `pages/api/email/getcaseref.js`
- converted axios `.then/.catch` to `try/catch`
- preserved flattening behavior and error contract `CASE_REF_FETCH_FAILED`
- `pages/api/email/notify.js`
- converted notify client `.then/.catch` to `try/catch`
- preserved success payload and error contract `EMAIL_NOTIFY_FAILED`
- `pages/api/admin/getnewappeals_api.js`
- removed unused `CryptoJS` import
- converted axios `.then/.catch` to `try/catch`
- preserved `@odata.nextLink` normalization and error contract `ADMIN_NEW_APPEALS_FETCH_FAILED`
- `pages/api/admin/getlatestdocuments_api.js`
- converted axios `.then/.catch` to `try/catch`
- preserved flatten/enrich behavior and error contract `ADMIN_LATEST_DOCS_FETCH_FAILED`
- `pages/api/endpoint/getportallogin_api.js`
- retained required query/hash guards
- expanded hash validation to accept raw + encoded `emailAddress` query-path candidates
- preserved error contract `PORTAL_LOGIN_FETCH_FAILED`
- phase21 endpoint tests expanded:
- `getportallogin` encoded hash variant success path
- `getnewappeals_api` catch contract
- `getlatestdocuments_api` catch contract
Validation:
- `node tests/phase21/api-contract-slice1.test.cjs` -> pass
- helper: 4/4
- file-handler: 49/49
- email-handler: 12/12
- endpoint-handler: 152/152
Follow-ups:
- Remaining major modernization candidate is `pages/api/file/generateappealpdf.js` (+ optional `pages/api/file/generatepdf.js`) if we continue final closure slices.