api hardening

This commit is contained in:
2026-03-16 10:46:05 +00:00
parent 598e4a6077
commit 023a8e9e6d
8 changed files with 378 additions and 24 deletions
+16
View File
@@ -610,6 +610,22 @@
- Added focused test file:
- `tests/phase19/service-behaviour.test.cjs` (5/5 pass)
## Phase 20 endpoint consistency slice (2026-03-14)
- Continued on branch:
- `TASK22057-phase17-hardening-closeout`
- Applied a small consistency-only slice across:
- `pages/api/endpoint/getbasicdnssearch_api.js`
- `pages/api/endpoint/getbasicdnsurlsearch_api.js`
- `pages/api/endpoint/getbasicsearchdetailspaged_api.js`
- Scope:
- removed noisy query logging in `getbasicdnssearch_api`
- added early 400 for missing/empty `searchString` in `getbasicdnsurlsearch_api`
- added early 400 for missing required params in `getbasicsearchdetailspaged_api`
- preserved response shapes/signatures
- Added focused test file:
- `tests/phase20/service-behaviour.test.cjs` (5/5 pass)
## Likely next steps
1. Stabilize and simplify breadcrumb/back-link decision logic with focused regression checks.
+44
View File
@@ -1258,3 +1258,47 @@ Validation:
Follow-ups:
- Continue same small-batch consistency pattern for remaining sensitive endpoint handlers only where clear guard/logging drift exists.
---
### CL-034: Phase 20 endpoint consistency slice — dns/basic-search guard + logging cleanup
date: 2026-03-14
author: Cline
scope: `pages/api/endpoint/{getbasicdnssearch_api,getbasicdnsurlsearch_api,getbasicsearchdetailspaged_api}.js`, `tests/phase20/service-behaviour.test.cjs`, `memory-bank/*`
type: change
rationale: Deliver a small reversible consistency-only slice by removing noisy logging and standardizing required-input negative-path handling in additional sensitive endpoint handlers.
impact: Improves endpoint negative-path consistency and logging hygiene while preserving response signatures/shapes.
status: completed
Summary:
- Removed noisy `console.log` query logging in `getbasicdnssearch_api`.
- Added early 400 handling for missing/empty `searchString` in `getbasicdnsurlsearch_api`.
- Added early 400 handling for missing required params (`appealTypeName`, `primaryIdAttribute`, `incidentID`) in `getbasicsearchdetailspaged_api`.
- Added focused behavioural test pack:
- `tests/phase20/service-behaviour.test.cjs` (5 tests)
Validation:
- `node tests/phase6/service-parity.test.cjs` -> pass
- `node tests/phase6/service-behaviour.test.cjs` -> pass (8/8)
- `node tests/phase7/service-behaviour.test.cjs` -> pass (12/12)
- `node tests/phase8/service-behaviour.test.cjs` -> pass (5/5)
- `node tests/phase9/service-behaviour.test.cjs` -> pass (5/5)
- `node tests/phase10/service-behaviour.test.cjs` -> pass (5/5)
- `node tests/phase11/service-behaviour.test.cjs` -> pass (4/4)
- `node tests/phase12/service-behaviour.test.cjs` -> pass (4/4)
- `node tests/phase13/service-behaviour.test.cjs` -> pass (7/7)
- `node tests/phase14/service-behaviour.test.cjs` -> pass (9/9)
- `node tests/phase15/service-behaviour.test.cjs` -> pass (5/5)
- `node tests/phase16/service-behaviour.test.cjs` -> pass (4/4)
- `node tests/phase17/service-behaviour.test.cjs` -> pass (6/6)
- `node tests/phase18/service-behaviour.test.cjs` -> pass (8/8)
- `node tests/phase19/service-behaviour.test.cjs` -> pass (5/5)
- `node tests/phase20/service-behaviour.test.cjs` -> pass (5/5)
- `npm run lint` -> warnings only (pre-existing hook dependency warnings)
Follow-ups:
- Continue same small-batch consistency pattern for remaining endpoint handlers where required-input/logging drift is clear.
+36
View File
@@ -657,6 +657,42 @@
- `node tests/phase19/service-behaviour.test.cjs` -> **pass** (5/5)
- `npm run lint` -> **warnings only** (pre-existing `react-hooks/exhaustive-deps` warnings)
## Latest update (2026-03-14 — Phase 20 endpoint consistency slice)
- Continued on branch:
- `TASK22057-phase17-hardening-closeout`
- Delivered a small additional consistency-only endpoint slice across:
- `pages/api/endpoint/getbasicdnssearch_api.js`
- `pages/api/endpoint/getbasicdnsurlsearch_api.js`
- `pages/api/endpoint/getbasicsearchdetailspaged_api.js`
- Scope delivered:
- removed noisy query logging in `getbasicdnssearch_api`
- standardized missing/empty `searchString` handling in `getbasicdnsurlsearch_api` with early 400
- standardized missing required input handling in `getbasicsearchdetailspaged_api` (`appealTypeName`, `primaryIdAttribute`, `incidentID`) with early 400
- preserved response-shape/signature contracts
- Added focused tests:
- `tests/phase20/service-behaviour.test.cjs` (5/5 passing)
### Validation snapshot (Phase 20)
- `node tests/phase6/service-parity.test.cjs` -> **pass**
- `node tests/phase6/service-behaviour.test.cjs` -> **pass** (8/8)
- `node tests/phase7/service-behaviour.test.cjs` -> **pass** (12/12)
- `node tests/phase8/service-behaviour.test.cjs` -> **pass** (5/5)
- `node tests/phase9/service-behaviour.test.cjs` -> **pass** (5/5)
- `node tests/phase10/service-behaviour.test.cjs` -> **pass** (5/5)
- `node tests/phase11/service-behaviour.test.cjs` -> **pass** (4/4)
- `node tests/phase12/service-behaviour.test.cjs` -> **pass** (4/4)
- `node tests/phase13/service-behaviour.test.cjs` -> **pass** (7/7)
- `node tests/phase14/service-behaviour.test.cjs` -> **pass** (9/9)
- `node tests/phase15/service-behaviour.test.cjs` -> **pass** (5/5)
- `node tests/phase16/service-behaviour.test.cjs` -> **pass** (4/4)
- `node tests/phase17/service-behaviour.test.cjs` -> **pass** (6/6)
- `node tests/phase18/service-behaviour.test.cjs` -> **pass** (8/8)
- `node tests/phase19/service-behaviour.test.cjs` -> **pass** (5/5)
- `node tests/phase20/service-behaviour.test.cjs` -> **pass** (5/5)
- `npm run lint` -> **warnings only** (pre-existing `react-hooks/exhaustive-deps` warnings)
### Manual HTTP snapshot (Phase 15)
- Dev server run on `http://localhost:3002`.
@@ -683,6 +683,34 @@ Status key: `[x] done`, `[ ] pending`
- `tests/phase19/service-behaviour.test.cjs`
- Re-run phase6phase19 baseline tests and lint after rollback.
### Phase 20 endpoint consistency slice snapshot (2026-03-14)
Status key: `[x] done`, `[ ] pending`
1. `[x]` Apply small consistency-only endpoint hardening in selected handlers
- `pages/api/endpoint/getbasicdnssearch_api.js`
- `pages/api/endpoint/getbasicdnsurlsearch_api.js`
- `pages/api/endpoint/getbasicsearchdetailspaged_api.js`
2. `[x]` Standardize negative-path required input handling
- early 400 for missing/empty `searchString` in `getbasicdnsurlsearch_api`
- early 400 for missing required params in `getbasicsearchdetailspaged_api`
3. `[x]` Remove noisy sensitive-path logging
- removed direct query logging in `getbasicdnssearch_api`
4. `[x]` Add focused tests
- `tests/phase20/service-behaviour.test.cjs` (5/5)
5. `[x]` Execute validation bundle
- phase6 parity + phase6phase20 behavioural suites pass
- lint warnings only (pre-existing)
### Phase 20 rollback notes
- Revert files in this slice:
- `pages/api/endpoint/getbasicdnssearch_api.js`
- `pages/api/endpoint/getbasicdnsurlsearch_api.js`
- `pages/api/endpoint/getbasicsearchdetailspaged_api.js`
- `tests/phase20/service-behaviour.test.cjs`
- Re-run phase6phase20 baseline tests and lint after rollback.
## 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.