DUP-GO-5: 6 POST-then-204 session handlers share identical boilerplate #39
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#39
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
Six mutating session handlers in
internal/server/handlers_sessions.go(lines 523–675) are structurally identical:handleSessionMessagehandleSessionCommandhandleSessionShellhandleSessionRenamehandleSessionAborthandleSessionCompactPattern
Each handler: reads + unmarshals request → validates fields →
withSessionAdapter→writePlatformErroron error →w.WriteHeader(http.StatusNoContent)on success.~150 lines of near-identical boilerplate.
Fix
Extract the
withSessionAdapter+writePlatformError+ 204 epilogue into a shared dispatch helper. Request struct definitions and field-level validation necessarily remain per-handler.Effort
Medium.