TASK22168 bundle C endpoint login/account consistency extension

This commit is contained in:
2026-03-19 12:27:17 +00:00
parent f9c9687cfe
commit 26b889d182
9 changed files with 525 additions and 112 deletions
+5
View File
@@ -60,6 +60,11 @@
- endpoint-handler 7/7
- `npm run lint` -> warnings only (pre-existing react-hooks warnings)
- Risk/rollback snapshot:
- risk: broader endpoint touch in one bundle could drift contracts
- mitigation: success payloads preserved as upstream `data`; phase21 endpoint tests expanded to 18/18
- rollback: revert `getlogin_api`, `getportallogin_api`, `getportalloginproxy_api`, `getpersonalaccount_api`, and phase21 endpoint test updates, then rerun phase21 + lint
## Suggested next work package
- Continue API contract consistency in `pages/api/endpoint/**` with the same pattern used in TASK22109:
+49
View File
@@ -1602,3 +1602,52 @@ Validation:
Follow-ups:
- Next coherent endpoint slice can target login-adjacent handler drift (`getlogin_api`) and/or another compact account endpoint group using the same phase21 contract pattern.
---
### CL-043: TASK22168 Bundle C extension — login/portal/account adjacency sweep (phase21)
date: 2026-03-19
author: Cline
scope: `pages/api/endpoint/{getlogin_api,getportallogin_api,getportalloginproxy_api,getpersonalaccount_api}.js`, `tests/phase21/endpoint-handler-contract.test.cjs`
type: change
rationale: User requested a larger same-branch bundle while preserving low-risk contract-consistency scope in endpoint account/login adjacency handlers.
impact: Structured 400 negative-path envelopes and cleanup consistency across additional login/account handlers with success payload contract stability preserved.
status: completed
Summary:
- Continued on branch: `TASK22168-endpoint-account-contract-consistency`.
- Extended endpoint contract-consistency pattern to additional handlers:
- `getlogin_api.js`
- removed dead imports/noisy logging
- standardized required input errors (`EMAIL_ADDRESS_REQUIRED`, `PASSWORD_REQUIRED`)
- standardized catch path (`LOGIN_FETCH_FAILED`)
- `getportallogin_api.js`
- removed dead imports
- standardized missing hash and invalid hash paths (`HASH_REQUIRED`, `INVALID_HASH`)
- standardized catch path (`PORTAL_LOGIN_FETCH_FAILED`)
- `getportalloginproxy_api.js`
- removed dead imports/legacy conditional noise
- standardized required input error (`EMAIL_ADDRESS_REQUIRED`)
- standardized catch path (`PORTAL_LOGIN_PROXY_FETCH_FAILED`)
- `getpersonalaccount_api.js`
- removed dead imports/noisy logging
- standardized required input error (`CONTACT_ID_REQUIRED`)
- standardized catch path (`PERSONAL_ACCOUNT_FETCH_FAILED`)
- Phase21 endpoint suite expansion:
- `tests/phase21/endpoint-handler-contract.test.cjs`
- expanded from 7 to 18 tests to cover Bundle C handlers and success-parity checks for adjacent account endpoints.
Validation:
- `node tests/phase21/api-contract-slice1.test.cjs` -> pass
- helper: 4/4
- file-handler: 11/11
- email-handler: 12/12
- endpoint-handler: 18/18
- `npm run lint` -> warnings only (pre-existing `react-hooks/exhaustive-deps` warnings)
Follow-ups:
- Next slice can target additional endpoint proxy groups only if needed, but current account/login consistency scope is now a meaningful bundle on TASK22168.
+48
View File
@@ -802,6 +802,54 @@
- `node tests/phase21/api-contract-slice1.test.cjs`
- `npm run lint`
## Latest update (2026-03-19 — TASK22168 Bundle C extension on same branch)
- Continued same branch with user-approved larger bundle:
- `TASK22168-endpoint-account-contract-consistency`
- Added contract-consistency coverage for login/portal/account-adjacent endpoints:
- `pages/api/endpoint/getlogin_api.js`
- `pages/api/endpoint/getportallogin_api.js`
- `pages/api/endpoint/getportalloginproxy_api.js`
- `pages/api/endpoint/getpersonalaccount_api.js`
- Scope delivered:
- removed dead imports/commented debug/noisy logging remnants
- standardized structured 400 errors for required-input negative paths and catch/failure paths
- preserved success payload contracts via `respondSuccess` pass-through
- Phase21 endpoint suite expanded in:
- `tests/phase21/endpoint-handler-contract.test.cjs`
- test count grew from 7 to 18 for endpoint handler coverage
### Validation snapshot (TASK22168 Bundle C)
- `node tests/phase21/api-contract-slice1.test.cjs` -> **pass**
- helper: 4/4
- file-handler: 11/11
- email-handler: 12/12
- endpoint-handler: 18/18
- `npm run lint` -> **warnings only** (pre-existing `react-hooks/exhaustive-deps` warnings)
### Risks + mitigations (TASK22168 Bundle C)
- Risk: contract drift from broad endpoint touch surface.
- Mitigation: constrained to login/account adjacency group only and preserved success pass-through behavior.
- Risk: hash-path behavior regression in `getportallogin_api`.
- Mitigation: explicit tests for missing hash, invalid hash, and catch path.
- Risk: inconsistent required-input behavior across adjacent handlers.
- Mitigation: standardized explicit required-input envelopes in all four newly touched handlers.
### Rollback plan (TASK22168 Bundle C)
1. Revert endpoint files:
- `pages/api/endpoint/getlogin_api.js`
- `pages/api/endpoint/getportallogin_api.js`
- `pages/api/endpoint/getportalloginproxy_api.js`
- `pages/api/endpoint/getpersonalaccount_api.js`
2. Revert endpoint contract test updates:
- `tests/phase21/endpoint-handler-contract.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`.
@@ -746,6 +746,39 @@ Status key: `[x] done`, `[ ] pending`
- `node tests/phase21/api-contract-slice1.test.cjs`
- `npm run lint`
### Phase 21 Bundle C extension snapshot (2026-03-19)
Status key: `[x] done`, `[ ] pending`
1. `[x]` Confirm user preference for larger same-branch bundle
- selected: Bundle C
2. `[x]` Extend endpoint consistency in login/portal/account adjacency handlers
- `getlogin_api`
- `getportallogin_api`
- `getportalloginproxy_api`
- `getpersonalaccount_api`
3. `[x]` Apply consistency pattern
- remove dead/noisy imports/logging remnants
- standardize structured negative-path responses (required input + catch/failure)
- preserve success contracts
4. `[x]` Expand phase21 endpoint tests
- `tests/phase21/endpoint-handler-contract.test.cjs` expanded to 18 tests
5. `[x]` Execute required validation
- `node tests/phase21/api-contract-slice1.test.cjs` -> pass
- `npm run lint` -> warnings only (pre-existing)
### Phase 21 Bundle C rollback notes
- Revert files:
- `pages/api/endpoint/getlogin_api.js`
- `pages/api/endpoint/getportallogin_api.js`
- `pages/api/endpoint/getportalloginproxy_api.js`
- `pages/api/endpoint/getpersonalaccount_api.js`
- `tests/phase21/endpoint-handler-contract.test.cjs`
- Re-run:
- `node tests/phase21/api-contract-slice1.test.cjs`
- `npm run lint`
## Safe execution mode for migration chunks (required)
To reduce terminal hangs during bulk migration work, run refactor chunks in **safe stepwise mode** instead of long chained commands.