refactor(document): extract file route builder and normalize query composition

This commit is contained in:
2026-03-25 11:31:39 +00:00
parent ad855fec88
commit 65003bb08c
6 changed files with 336 additions and 106 deletions
+88
View File
@@ -2429,3 +2429,91 @@ Validation:
Follow-ups:
- Optional next widened slice: evaluate consolidating remaining direct `getJson` file-read flows in `documentDirectService` behind `fileClient` for full per-module client symmetry.
---
### CL-069: TASK22260 widened module-completion slice — documentDirectService file-read client symmetry
date: 2026-03-25
author: Cline
scope: `actions/services/documentDirectService.js`
type: change
rationale: Continue widened slice cadence by completing per-module client symmetry in `documentDirectService`, moving all file-read helper calls to `fileClient` instead of mixed endpoint client usage.
impact: Simplifies module dependency shape and centralizes file-route read behavior through a single client abstraction without changing runtime contracts.
status: completed
Summary:
- Removed mixed `endpointClient` usage from `documentDirectService` for file reads.
- Migrated remaining file-read/helper routes from `getJson` to `getFileJson`:
- `getAwaitingSubmissionFromBlob`
- `getRepsFromBlob`
- `getRepsFromBlobProxy`
- `getAwaitingSubmissionFromBlobProxy`
- `getFilesFromBlob`
- `getFilesFromBlobHashed`
- `getProgressFromBlob`
- `createContainerProxy`
- Removed now-unused imports from `documentDirectService`:
- `buildHashedQueryUrl`
- `getJson`
- `requestJson`
Validation:
- `node tests/phase22/index.test.cjs` -> pass
- core-token: 2/2
- client-utils: 5/5
- file-client: 4/4
- phase22 combined: pass
- `node tests/phase7/service-behaviour.test.cjs` -> pass (13/13)
- `npm run lint` -> warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors)
Follow-ups:
- Optional next widened slice: introduce a small `fileClient` URL-builder helper set for repeated query-string composition in `documentDirectService` (container/casefolder/blob parameters) to reduce string-concat drift risk.
---
### CL-070: TASK22260 widened cross-file slice — file route builder extraction + document service query normalization
date: 2026-03-25
author: Cline
scope: `actions/clients/{fileRouteBuilder,index}.js`, `actions/services/documentDirectService.js`, `tests/{serviceHarness,phase22/client-utils-behaviour}.cjs`
type: change
rationale: Deliver a wider-than-previous slice by extracting reusable file-route query composition helpers and applying them across document service paths, reducing repeated string concatenation and encoding drift risk.
impact: Improves maintainability and consistency of file-route URL construction while preserving existing runtime contracts and hash behavior.
status: completed
Summary:
- Added new shared helper module:
- `actions/clients/fileRouteBuilder.js`
- exports:
- `buildFileQuery(path, params, options)` (supports optional encoded query composition)
- `withBaseUrl(baseUrl, route)`
- `appendQuerySuffix(route, suffix)`
- Exported route-builder helpers via `actions/clients/index.js`.
- Refactored `actions/services/documentDirectService.js` to use route-builder helpers across read/delete/download/query flows:
- normalized composition for file routes and hash suffix append behavior
- preserved encoded-path behavior for sensitive params (`casefolderID`, `blobname`) where previously encoded
- preserved base URL prefix behavior and existing logger/catch semantics
- Updated test harness defaults in `tests/serviceHarness.cjs` for new helper symbols:
- `buildFileQuery`
- `withBaseUrl`
- `appendQuerySuffix`
- Expanded phase22 utility coverage in `tests/phase22/client-utils-behaviour.test.cjs` with file route-builder behavior assertions.
Validation:
- `node tests/phase22/index.test.cjs` -> pass
- core-token: 2/2
- client-utils: 6/6
- file-client: 4/4
- phase22 combined: pass
- `node tests/phase7/service-behaviour.test.cjs` -> pass (13/13)
- `npm run lint` -> warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors)
Follow-ups:
- Optional next widened slice: evaluate applying `fileRouteBuilder` to portal/case service file-route call sites for cross-module query-builder consistency.