Share API types between terdut-server, terdut-operator and terdut-tui #9

Open
opened 2026-10-09 12:43:03 +00:00 by niklas · 0 comments
Owner

internal/tdclient/client.go redefines the server's models by hand (Team, DeadmanSwitch, Integration, the escalation request types, ...), and terdut-tui has a third copy in internal/api/types.go. The workspace rule "any change to a server endpoint or JSON shape must be mirrored" is manual, and only a manual kind pass catches drift; the controller tests use a hand-written fake server.

Options

  • An OpenAPI spec for the server API, with a generated Go client/types used by the operator and the TUI.
  • Or a small shared terdut-api Go module of request/response types.
  • Either way, a contract test that runs the operator's client against the real server router (the server's tests already run it against Postgres).

Why now

The Oct 2026 redesign changed several shapes at once (external_id on teams, username in escalation targets, 409s on duplicate names, the removed endpoints); the only real check was a curl smoke test.

Touches terdut-server and terdut-tui; filed here because the operator is the heaviest consumer.

`internal/tdclient/client.go` redefines the server's models by hand (`Team`, `DeadmanSwitch`, `Integration`, the escalation request types, ...), and terdut-tui has a third copy in `internal/api/types.go`. The workspace rule "any change to a server endpoint or JSON shape must be mirrored" is manual, and only a manual kind pass catches drift; the controller tests use a hand-written fake server. ## Options - An OpenAPI spec for the server API, with a generated Go client/types used by the operator and the TUI. - Or a small shared `terdut-api` Go module of request/response types. - Either way, a contract test that runs the operator's client against the real server router (the server's tests already run it against Postgres). ## Why now The Oct 2026 redesign changed several shapes at once (`external_id` on teams, `username` in escalation targets, 409s on duplicate names, the removed endpoints); the only real check was a curl smoke test. Touches terdut-server and terdut-tui; filed here because the operator is the heaviest consumer.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: niklas/terdut-operator#9