Feat v0.5.0 realtime primitive + dialog audit + permissions UI
All checks were successful
CI/CD / detect-changes (pull_request) Successful in 18s
CI/CD / test-frontend (pull_request) Successful in 5s
CI/CD / test-go-pg (pull_request) Successful in 2m42s
CI/CD / test-sqlite (pull_request) Successful in 2m59s
CI/CD / build-and-deploy (pull_request) Successful in 1m24s

Add realtime pub/sub: Starlark realtime.publish() module gated by
new realtime.publish permission, WS room protocol (room.subscribe/
room.unsubscribe intercepted in readPump with 100-room cap), and
SDK sw.realtime.subscribe() with auto room join/leave and reconnect
recovery.

Migrate 5 bare confirm() calls to sw.confirm() with destructive
styling in tasks, schedules, notes (×2), and editor packages.

Add admin permissions UI: per-permission grant/revoke drawer,
Grant All bulk action, pending_review/suspended status badges,
disabled enable toggle when pending. Closes v0.4.7 permissions
UI gap.

8 new Go tests, all passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-30 10:40:24 +00:00
parent eb9a2d7d27
commit 0af1c51ae9
21 changed files with 680 additions and 22 deletions

View File

@@ -2,6 +2,44 @@
All notable changes to Switchboard Core are documented here.
## v0.5.0 — Realtime Primitive + Dialog Audit + Permissions UI
### Added
- **Realtime Starlark module**: `realtime.publish(channel, event, data)` lets
extensions publish events to WebSocket channels. Gated by the new
`realtime.publish` permission. Payloads limited to 7KB (pg_notify safe).
Reserved event prefixes (`system.`, `workflow.`, etc.) are blocked.
- **WS room protocol**: Clients send `room.subscribe` / `room.unsubscribe`
messages to join/leave rooms. Intercepted in the WebSocket readPump before
the bus publish gate (like ping). Per-connection cap of 100 rooms.
- **SDK realtime module**: `sw.realtime.subscribe(channel, [event], callback)`
manages room join/leave over WebSocket and filters incoming `realtime.*`
events by room. Returns unsubscribe handle. Auto re-joins all rooms on
WebSocket reconnect. `sw.realtime.channels()` debug helper.
- **Admin permissions UI**: Packages page gains a "Permissions" button for
packages with declared permissions. Inline drawer shows each permission with
Grant/Revoke toggle, granted-by user ID, and a "Grant All" bulk action.
- **Status badges**: `pending_review` (amber) and `suspended` (red) badges on
package rows. Enable toggle disabled with hint when `pending_review`.
- **SDK API client**: `permissions()`, `grantPerm()`, `revokePerm()`,
`grantAllPerms()` methods added to `sw.api.admin.packages`.
- **`starlarkToGoVal()` helper**: Converts Starlark values to Go `any` for
JSON marshaling (reverse of existing `goValToStarlark`).
- **8 new Go tests**: Route table cases for `realtime.*` and `room.*`,
realtime module publish (happy path, empty data, missing args, reserved
prefix, payload too large), `starlarkToGoVal` type conversion.
### Changed
- **Dialog audit**: 5 bare `confirm()` calls migrated to `await sw.confirm()`
with `{ destructive: true }` styling in tasks, schedules, notes (×2), and
editor packages. Package archives rebuilt.
- SDK version bumped from 0.2.3 to 0.5.0.
- Event route table: `realtime.` → DirToClient, `room.subscribe` /
`room.unsubscribe` → DirFromClient.
- Runner gains `bus` field and `SetBus()` method; wired in main.go.
## v0.4.7 — Note Graph
### Added