TASK22102: slice5 larger file handler contract cleanup

This commit is contained in:
2026-03-17 13:16:48 +00:00
parent e68319f16c
commit 3048df3cd9
5 changed files with 112 additions and 20 deletions
+35
View File
@@ -1437,3 +1437,38 @@ Validation:
Follow-ups:
- Continue next larger slice on remaining non-proxy file handlers still returning raw error payloads.
---
### CL-039: TASK22102 API contract consistency — Slice 5 (larger file-handler batch)
date: 2026-03-17
author: Cline
scope: `pages/api/file/{uploadsinglefile,setupcontainer,createrepcompletemessage_api,editRepJson}.js`
type: change
rationale: Continue with a larger efficiency-focused slice by migrating remaining high-signal file handlers that still returned raw/empty error responses.
impact: Improves response-contract consistency and avoids leaking raw error payloads in selected file handlers while preserving success behavior and endpoint semantics.
status: completed
Summary:
- Migrated additional file handlers to helper-based responses:
- `uploadsinglefile`
- `setupcontainer`
- `createrepcompletemessage_api`
- `editRepJson`
- Replaced direct `res.status(...).json(...)` error branches (including raw `error` payload and empty responses) with structured:
- `respondError(...)`
- `respondSuccess(...)`
- Preserved existing success semantics:
- `uploadsinglefile` still returns uploaded result + `invalidFiles`
- `setupcontainer` still returns `{ data: "success", output }`
- `editRepJson` still returns success message on completion
Validation:
- `npx next lint --file pages/api/file/uploadsinglefile.js --file pages/api/file/setupcontainer.js --file pages/api/file/createrepcompletemessage_api.js --file pages/api/file/editRepJson.js` -> pass (no warnings/errors)
Follow-ups:
- Continue next larger slice on remaining file handlers with empty 400 responses to complete contract-consistency rollout.