Feat v0.6.3 dead code sweep (#38)
All checks were successful
All checks were successful
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #38.
This commit is contained in:
@@ -113,14 +113,14 @@ func TestRouteFor(t *testing.T) {
|
||||
{"pong", DirToClient},
|
||||
// Tool bridge routes
|
||||
{"tool.call.abc123", DirToClient},
|
||||
{"tool.result.abc123", DirBoth}, // v0.32.0: DirBoth for cross-pod WaitFor
|
||||
{"tool.result.abc123", DirBoth},
|
||||
// Extension lifecycle
|
||||
{"extension.loaded", DirLocal},
|
||||
{"extension.error", DirLocal},
|
||||
// Realtime (v0.5.0)
|
||||
// Realtime
|
||||
{"realtime.chat.message", DirToClient},
|
||||
{"realtime.custom.event", DirToClient},
|
||||
// Room management (v0.5.0)
|
||||
// Room management
|
||||
{"room.subscribe", DirFromClient},
|
||||
{"room.unsubscribe", DirFromClient},
|
||||
}
|
||||
@@ -227,7 +227,6 @@ func TestToolCallRouteToClient(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestToolResultRouteBoth(t *testing.T) {
|
||||
// v0.32.0: tool.result is DirBoth so results cross pods for WaitFor.
|
||||
// The WS subscriber explicitly filters out tool.result events to
|
||||
// prevent re-sending to clients (see subscribeToBus in ws.go).
|
||||
if !ShouldAcceptFromClient("tool.result.abc123") {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package events
|
||||
|
||||
// v0.32.0: TicketValidatorAdapter bridges the context-aware store.TicketStore
|
||||
// to the middleware.TicketValidator interface (which has no context parameter).
|
||||
// Replaces the in-memory TicketStore that lived in this file previously.
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ type Event struct {
|
||||
Payload json.RawMessage `json:"payload"`
|
||||
Ts int64 `json:"ts"`
|
||||
|
||||
// v0.32.0: Cross-pod targeted delivery. When set, only connections
|
||||
// belonging to this user receive the event. Serialized for pg_broadcast
|
||||
// (harmless if clients see it — they ignore unknown fields).
|
||||
TargetUserID string `json:"target_user_id,omitempty"`
|
||||
@@ -38,8 +37,8 @@ var routeTable = map[string]Direction{
|
||||
// User/presence
|
||||
"user.presence": DirToClient,
|
||||
"user.status": DirToClient,
|
||||
"user.mentioned": DirToClient, // v0.23.2: targeted @mention notification
|
||||
"typing.user": DirToClient, // v0.23.2: human typing in DM/channel
|
||||
"user.mentioned": DirToClient,
|
||||
"typing.user": DirToClient,
|
||||
|
||||
// System
|
||||
"system.notify": DirToClient,
|
||||
@@ -48,16 +47,16 @@ var routeTable = map[string]Direction{
|
||||
// Model/provider status
|
||||
"model.status": DirToClient,
|
||||
|
||||
// Role alerts (v0.17.0)
|
||||
// Role alerts
|
||||
"role.fallback": DirToClient,
|
||||
|
||||
// Notifications (v0.20.0)
|
||||
// Notifications
|
||||
"notification.new": DirToClient, // targeted via Hub.PublishToUser, not room-based
|
||||
"notification.read": DirToClient, // badge sync across tabs
|
||||
|
||||
// Workspace (v0.21.5)
|
||||
// Workspace
|
||||
|
||||
// Workflow (v0.27.0, v0.3.2, v0.3.3)
|
||||
// Workflow
|
||||
"workflow.started": DirToClient, // instance started
|
||||
"workflow.assigned": DirToClient, // new assignment → team members
|
||||
"workflow.claimed": DirToClient, // assignment claimed → team + claimer
|
||||
@@ -65,10 +64,10 @@ var routeTable = map[string]Direction{
|
||||
"workflow.completed": DirToClient, // workflow finished → instance participants
|
||||
"workflow.cancelled": DirToClient, // instance cancelled
|
||||
"workflow.error": DirToClient, // engine/hook error
|
||||
"workflow.sla_breach": DirToClient, // SLA exceeded → team + admins (v0.3.3)
|
||||
"workflow.stale": DirToClient, // instance marked stale (v0.3.3)
|
||||
"workflow.signoff": DirToClient, // signoff submitted (v0.3.4)
|
||||
"workflow.rejected": DirToClient, // rejection triggered cancel/reroute (v0.3.4)
|
||||
"workflow.sla_breach": DirToClient, // SLA exceeded → team + admins
|
||||
"workflow.stale": DirToClient, // instance marked stale
|
||||
"workflow.signoff": DirToClient, // signoff submitted
|
||||
"workflow.rejected": DirToClient, // rejection triggered cancel/reroute
|
||||
|
||||
// Plugin hooks — never cross the wire
|
||||
"plugin.hook.": DirLocal,
|
||||
@@ -77,20 +76,20 @@ var routeTable = map[string]Direction{
|
||||
|
||||
// Tool execution (browser tools bridge)
|
||||
"tool.call.": DirToClient, // Server → specific client (browser tool invocation)
|
||||
"tool.result.": DirBoth, // v0.32.0: DirBoth — result must cross pods for WaitFor
|
||||
"tool.result.": DirBoth,
|
||||
|
||||
// Extension lifecycle
|
||||
"extension.loaded": DirLocal, // Client-only
|
||||
"extension.error": DirLocal,
|
||||
|
||||
// Trigger system (v0.2.2)
|
||||
// Trigger system
|
||||
"trigger.fired": DirLocal, // Trigger invocation event (observability)
|
||||
"trigger.error": DirLocal, // Trigger execution error
|
||||
|
||||
// Realtime (v0.5.0): extension-published events, room-scoped
|
||||
// Realtime: extension-published events, room-scoped
|
||||
"realtime.": DirToClient,
|
||||
|
||||
// Room management (v0.5.0): client room join/leave
|
||||
// Room management: client room join/leave
|
||||
"room.subscribe": DirFromClient,
|
||||
"room.unsubscribe": DirFromClient,
|
||||
|
||||
|
||||
@@ -174,7 +174,6 @@ func (h *Hub) IsConnected(userID string) bool {
|
||||
}
|
||||
|
||||
// PublishToUser sends an event to a specific user via the bus.
|
||||
// v0.32.0: Cross-pod safe — the bus broadcast hook fans out via pg_notify.
|
||||
// All replicas receive the event; only the one with the user's connection delivers it.
|
||||
func (h *Hub) PublishToUser(userID string, event Event) {
|
||||
event.TargetUserID = userID
|
||||
@@ -238,13 +237,11 @@ func (c *Conn) subscribeToBus() {
|
||||
return
|
||||
}
|
||||
|
||||
// v0.32.0: Targeted delivery — only deliver to the intended user.
|
||||
// Targeted events skip room filtering (user-scoped, not room-scoped).
|
||||
if e.TargetUserID != "" && e.TargetUserID != c.userID {
|
||||
return
|
||||
}
|
||||
|
||||
// v0.32.0: tool.result travels cross-pod for WaitFor (DirBoth) but
|
||||
// must not be forwarded to WebSocket clients — they sent it.
|
||||
if strings.HasPrefix(e.Label, "tool.result.") {
|
||||
return
|
||||
@@ -316,7 +313,6 @@ func (c *Conn) readPump() {
|
||||
continue
|
||||
}
|
||||
|
||||
// v0.5.0: Room management — intercept before bus publish (like ping)
|
||||
if event.Label == "room.subscribe" {
|
||||
var req struct {
|
||||
Room string `json:"room"`
|
||||
|
||||
Reference in New Issue
Block a user