DUP-TS-1: 20 raw fetch calls bypass postJSON in api.ts #38
Labels
No labels
backend
bug
chore
duplication
effort:complex
effort:medium
effort:trivial
enhancement
frontend
fullstack
priority:high
ready-for-agent
refactor
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dries/ocman#38
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
20 POST methods in
frontend/src/lib/api.tsuse rawfetch()+if (!resp.ok) throw new Error(...)instead of the existingpostJSONhelper.Affected methods include:
archiveSession,markSessionSeen,pinSession,calcCost,addFavorite,removeFavorite,respondPermission,respondQuestion,rejectQuestion,abortSession,tmuxSwitch,tmuxLaunchOpencode,worktree.createAndLaunch,compactSession,executeCommand,runShell,renameSession,setAutoApprove,setPromptSections, and others.Problem
Raw callers miss
AuthErrorpropagation — 401s surface as a genericErrorinstead ofAuthError, breaking the auth fan-out.Fix
Migrate all raw POST callers to the
postJSONhelper (~lines 171–200) which already has perf-ring instrumentation and 401 fan-out.Effort
Low — mostly mechanical substitution.