Skip to content

fix(hubclient): remove dead GetWSTicket client code - #1435

Closed
ptone wants to merge 2 commits into
mainfrom
fix/dead-route-ws-ticket
Closed

fix(hubclient): remove dead GetWSTicket client code#1435
ptone wants to merge 2 commits into
mainfrom
fix/dead-route-ws-ticket

Conversation

@ptone

@ptone ptone commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Removes the latent GetWSTicket() method from the AuthService interface and its implementation in pkg/hubclient/auth.go
  • Removes the WSTicketResponse type
  • Removes mock stubs from pkg/hub/auth/device_flow_test.go and cmd/hub_auth_test.go

Decision Rationale

Decision: Remove the dead code (rather than implement the missing server route).

Investigation findings:

  1. No production callersGetWSTicket() is only referenced in its own definition (interface + implementation) and two mock stubs in test files. No production code invokes it.
  2. WebSocket auth works without ws-ticket — The web UI's terminal component (web/src/components/pages/terminal.ts) connects via new WebSocket(url) using same-origin session cookies. No ticket-based auth exchange is needed.
  3. No server route existsPOST /api/v1/auth/ws-ticket is not registered on the hub server, so the client method would always fail if called.

Keeping a client method that posts to a non-existent endpoint is misleading and adds unnecessary surface area to the AuthService interface.

Test plan

  • go build ./... passes
  • go vet ./... passes
  • go test ./pkg/hubclient/... ./pkg/hub/auth/... ./cmd/... — all pass

The GetWSTicket() method on AuthService posts to POST /api/v1/auth/ws-ticket,
but no such route is registered on the hub server. No production code calls
GetWSTicket(), and WebSocket connections (e.g. the PTY terminal) authenticate
via session cookies on the same origin — no ticket exchange is needed.

Remove the dead interface method, its implementation, the WSTicketResponse
type, and the corresponding mock stubs in test files.
@ptone

ptone commented Sep 4, 2026

Copy link
Copy Markdown
Owner Author

Code Review: APPROVE ✅

Risk: LOW — Pure dead-code removal (0 additions, 24 deletions).

(Posted as comment because the token cannot self-approve.)

Verified

  • GetWSTicket() method removed from AuthService interface and implementation
  • WSTicketResponse type removed
  • Two mock stubs removed from test files
  • Grep confirms zero orphaned references to GetWSTicket or WSTicketResponse in the tree
  • go build and go vet pass on affected packages
  • No unrelated changes

Notes

  • Correct decision to delete rather than implement a server route with no callers
  • PR body documents the reasoning well (no callers, WS auth via session cookies, no server route)

Clean change. No findings.

@ptone ptone closed this Sep 4, 2026
@ptone
ptone deleted the fix/dead-route-ws-ticket branch September 4, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant