Merged PR 2428: Add documents API grouping facade slice

Add documents API grouping facade slice

Related work items: #23754
This commit is contained in:
Robert Bond
2026-06-25 08:24:58 +00:00
parent 153f0d679e
commit 33dcb6b863
7 changed files with 308 additions and 3 deletions
+72
View File
@@ -18,6 +18,78 @@ Follow-ups:
---
### CL-2026-06-25-API-GROUPING-FACADE-DOCUMENTS-VERTICAL-SLICE: active published-document metadata grouping and service adoption
date: 2026-06-25
author: Cline
scope: `pages/api/documents/get-search-document-details.js`, `pages/api/documents/get-search-document-details-paged.js`, `pages/api/documents/get-search-document-types.js`, `actions/services/searchDirectService.js`, `tests/phase22/api-grouping-facade-documents.test.cjs`, `context/api-grouping-adoption-roadmap.md`
type: change
rationale: Implement the second additive API grouping façade vertical slice by grouping the active published-document metadata journey under `pages/api/documents/` and adopting the grouped routes only in the existing common document metadata service layer, while preserving the existing download route and legacy endpoint handlers unchanged.
impact: Runtime behaviour is intended to remain unchanged; grouped document façade routes now cover the active metadata/type journey calls, `actions/services/searchDirectService.js` now targets those grouped routes, legacy endpoint handlers remain canonical, the existing grouped download route remains unchanged, and no migration, route deletion, auth change, CRM query change, hash-link generation change, payload change, or response-contract change has occurred.
status: completed
Summary:
- Confirmed the required context was read before implementation:
- `context/api-grouping-plan.md`
- `context/api-grouping-adoption-roadmap.md`
- `context/journey-architecture-map.md`
- `context/api-route-map.md`
- `context/architecture.md`
- `memory-bank/change-log.md`
- Performed a bounded audit of the active published-documents journey across services, API handlers, and frontend components.
- Audit findings established that:
- active document metadata retrieval is surfaced through `components/case/documents.js`
- active document metadata/type calls already route through the common service layer `actions/services/searchDirectService.js`
- published-document downloads already use the grouped runtime route `pages/api/documents/download/[id].js`
- legacy metadata handlers generate `pinswg_hashlink` values that continue to point at the unchanged grouped download route
- `getsearchdocumenthistory_api.js` and `getsearchdocumenthistorypaged_api.js` remain present but were not surfaced in the currently active UI journey and therefore remained outside grouped adoption scope
- Added grouped façade routes under `pages/api/documents/` for the active metadata journey only:
- `get-search-document-details.js`
- `get-search-document-details-paged.js`
- `get-search-document-types.js`
- Implemented each façade as the smallest safe compatibility wrapper:
- import the existing legacy endpoint handler
- delegate `req` and `res` directly to that existing handler
- Updated only the suitable common service layer in `actions/services/searchDirectService.js` to target grouped façade routes for:
- `getSearchDocumentDetails`
- `getSearchDocumentDetailsPaged`
- `getSearchDocumentTypes`
- Left the following unchanged:
- CRM queries
- download behaviour
- hash-link generation
- authentication
- response contracts
- payloads
- file locations of legacy handlers
- Added focused characterization coverage to prove:
- grouped document façade routes delegate correctly
- active document service methods now target grouped document routes
- legacy document endpoint handlers remain present
- active service-layer query-contract cues remain unchanged
- the runtime download path remains `/api/documents/download/[id]`
- Updated the adoption roadmap to record the active documents grouping slice and its bounded scope.
Validation:
- Focused validation only intended for this slice:
- `npx eslint actions/services/searchDirectService.js pages/api/documents/get-search-document-details.js pages/api/documents/get-search-document-details-paged.js pages/api/documents/get-search-document-types.js tests/phase22/api-grouping-facade-documents.test.cjs context/api-grouping-adoption-roadmap.md memory-bank/change-log.md`
- `node tests/phase22/api-grouping-facade-documents.test.cjs`
- No repository-wide validation run.
Follow-ups:
- The active Documents journey is now a complete vertical grouping slice for the bounded published-document metadata/type path:
- grouped façade routes
- active service-layer adoption
- legacy canonical handlers retained
- unchanged grouped download path
- unchanged behaviour
- Any future expansion beyond this bounded scope should be a separate slice, for example if history/support routes are later proven to be part of an actively adopted user journey.
---
### CL-2026-06-25-API-GROUPING-FACADE-SUBSCRIPTIONS-VERTICAL-SLICE-COMPLETION: watched-case proxy read adoption and scope closure
date: 2026-06-25