feat(registry): live control - queue admin lines for a running server from the admin site #4

Merged
kblack0610 merged 1 commit from feat/web-admin-live into main 2026-10-24 18:41:14 +00:00
Owner

A Live players page on the admin site lists servers that registered with admin: true, shows the roster each one posts, and queues admin lines (the playground's admin grammar) for one player or everyone.

  • Server side: GET /api/v1/servers/{id}/admin/next?wait= long-polls (lease required, max 30 s, woken by the enqueue, no sleep loop); POST .../admin/replies records replies and the roster.
  • Admin side: GET /api/live, POST /api/live/{id}/commands, GET /api/live/{id}/commands. Each line goes to the audit log.
  • Lines unclaimed for 60 s expire; finished lines kept a day; a gone server's lines and waiter are swept.
  • Additive: new table, three new game_servers columns with defaults, new routes.

Tests: go vet + go test -race ./... green (golang:1.22 in docker). Negative control: disabling the admin check and the server_id guard on replies turned TestLiveRefusesWhoShouldNot and TestLiveRepliesOnlyTouchTheirOwnServer red. Driven by hand in a browser against the built image: queued +100 gold from the page, a fake server polled, replied, and the page showed the reply; no horizontal scroll at 400 px.

https://claude.ai/code/session_01Trb4CeVT87r1h1qsNjksMB

A Live players page on the admin site lists servers that registered with `admin: true`, shows the roster each one posts, and queues admin lines (the playground's admin grammar) for one player or everyone. - Server side: `GET /api/v1/servers/{id}/admin/next?wait=` long-polls (lease required, max 30 s, woken by the enqueue, no sleep loop); `POST .../admin/replies` records replies and the roster. - Admin side: `GET /api/live`, `POST /api/live/{id}/commands`, `GET /api/live/{id}/commands`. Each line goes to the audit log. - Lines unclaimed for 60 s expire; finished lines kept a day; a gone server's lines and waiter are swept. - Additive: new table, three new `game_servers` columns with defaults, new routes. Tests: `go vet` + `go test -race ./...` green (golang:1.22 in docker). Negative control: disabling the admin check and the server_id guard on replies turned `TestLiveRefusesWhoShouldNot` and `TestLiveRepliesOnlyTouchTheirOwnServer` red. Driven by hand in a browser against the built image: queued +100 gold from the page, a fake server polled, replied, and the page showed the reply; no horizontal scroll at 400 px. https://claude.ai/code/session_01Trb4CeVT87r1h1qsNjksMB
A server that registers with admin:true long-polls GET /api/v1/servers/{id}/admin/next
(lease required, at most 30 s), runs the lines an admin queued on the new Live players
page, and posts replies plus a roster to .../admin/replies. Lines expire after 60 s
unclaimed, are kept a day, and go with their server. Each queued line is written to the
audit log (channel live, action command).

Claude-Session: https://claude.ai/code/session_01Trb4CeVT87r1h1qsNjksMB
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kblack0610/bnb-game-servers!4
No description provided.