Skip to content

Commit 247eaac

Browse files
committed
Broadcast after every write handler success (Phase 3)
Add s.broadcaster.publish() at every success exit point in all mutating handlers: handleCreateBead, handleUpdateBead (all 4 success paths including moves), handleDeleteBead (both paths), handleClaimBead, handleClean, handleAddComment, handleLinkBead, and handleUnlinkBead. Add handlers_broadcast_test.go with tests for each handler verifying that a signal is received on a subscribed channel after success and that no signal is received on error paths. Built with Raymond (Agent Orchestrator)
1 parent 6fd0c5e commit 247eaac

4 files changed

Lines changed: 416 additions & 0 deletions

File tree

internal/server/handlers.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ func (s *Server) handleCreateBead(w http.ResponseWriter, r *http.Request) {
143143
return
144144
}
145145
jsonCreated(w, created)
146+
s.broadcaster.publish()
146147
return
147148
}
148149

@@ -160,6 +161,7 @@ func (s *Server) handleCreateBead(w http.ResponseWriter, r *http.Request) {
160161
}
161162

162163
jsonCreated(w, created)
164+
s.broadcaster.publish()
163165
}
164166

165167
// handleGetBead handles GET /api/v1/beads/:id.
@@ -258,6 +260,7 @@ func (s *Server) handleUpdateBead(w http.ResponseWriter, r *http.Request) {
258260
return
259261
}
260262
jsonOK(w, updated)
263+
s.broadcaster.publish()
261264
return
262265
}
263266
// Move into
@@ -268,6 +271,7 @@ func (s *Server) handleUpdateBead(w http.ResponseWriter, r *http.Request) {
268271
return
269272
}
270273
jsonOK(w, updated)
274+
s.broadcaster.publish()
271275
return
272276
}
273277

@@ -347,11 +351,13 @@ func (s *Server) handleUpdateBead(w http.ResponseWriter, r *http.Request) {
347351
unblocked := st.GetUnblocked(existing.ID)
348352
if len(unblocked) > 0 {
349353
jsonOK(w, unblockedResponse{Bead: updated, Unblocked: unblocked})
354+
s.broadcaster.publish()
350355
return
351356
}
352357
}
353358

354359
jsonOK(w, updated)
360+
s.broadcaster.publish()
355361
}
356362

357363
// handleDeleteBead handles DELETE /api/v1/beads/:id.
@@ -397,10 +403,12 @@ func (s *Server) handleDeleteBead(w http.ResponseWriter, r *http.Request) {
397403
unblocked := st.GetUnblocked(existing.ID)
398404
if len(unblocked) > 0 {
399405
jsonOK(w, unblockedResponse{Bead: deleted, Unblocked: unblocked})
406+
s.broadcaster.publish()
400407
return
401408
}
402409

403410
jsonOK(w, deleted)
411+
s.broadcaster.publish()
404412
}
405413

406414
// isTerminalStatus returns true for statuses that could unblock other beads.

0 commit comments

Comments
 (0)