refactor(actions): extract fileClient with phase22 coverage

This commit is contained in:
2026-03-25 10:59:20 +00:00
parent 93eb19d028
commit a66d55af80
6 changed files with 214 additions and 28 deletions
+46
View File
@@ -2266,3 +2266,49 @@ Validation:
Follow-ups:
- Optional next bounded slice: add focused phase22 behavioural coverage for any future shared client wrappers introduced beyond `endpointClient`/`relayClient`.
---
### CL-065: TASK22260 next slice — fileClient extraction + phase22 behavioural coverage
date: 2026-03-25
author: Cline
scope: `actions/clients/{fileClient,index}.js`, `actions/services/documentDirectService.js`, `tests/phase22/{file-client-behaviour,index}.test.cjs`
type: change
rationale: Continue bounded shared-client decomposition by extracting repeated file-route request patterns into `fileClient` and hardening behaviour with dedicated phase22 tests.
impact: Reduces request-boilerplate duplication in document service and increases regression confidence for extracted file client helper contracts.
status: completed
Summary:
- Added new shared client wrapper: `actions/clients/fileClient.js`:
- `getFileJson(url)`
- `getSignedFileJson(queryUrl)`
- `downloadFileBlob(url)`
- Exported `fileClient` from `actions/clients/index.js` (and therefore via `actions/index.js` barrel path).
- Migrated a bounded subset of `actions/services/documentDirectService.js` call sites to `fileClient` while preserving catch-path logging behavior:
- `getFilesFromBlobproxy` -> `getFileJson`
- `deleteAwaitingSubmissionsFromBlob` -> `getSignedFileJson`
- `deleteMyRepresentationsFromBlob` -> `getSignedFileJson`
- `deleteBlob` -> `getFileJson`
- `deleteRepBlob` -> `getFileJson`
- `downloadBlob` -> `downloadFileBlob`
- Added `tests/phase22/file-client-behaviour.test.cjs` covering:
- delegation to `getJson`
- signed URL generation + `requestJson` invocation
- blob download config contract (`responseType: "blob"`)
- Updated aggregate runner `tests/phase22/index.test.cjs` to include file-client suite.
Validation:
- `node tests/phase22/file-client-behaviour.test.cjs` -> pass (3/3)
- `node tests/phase22/index.test.cjs` -> pass
- core-token: 2/2
- client-utils: 5/5
- file-client: 3/3
- phase22 combined: pass
- `npm run lint` -> warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors)
Follow-ups:
- Optional next bounded slice: evaluate whether additional `documentDirectService` file-route call sites can adopt `fileClient` without altering current behavior contracts.