feat(ide): emit build start lifecycle notifications

Advertise and emit build.start when a bridged build enters a running state, alongside the existing complete/fail lifecycle events.

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-02 11:14:17 +00:00
parent dd48cc16f8
commit ed4efcbd55
3 changed files with 31 additions and 0 deletions

View file

@ -335,6 +335,8 @@ func (s *Subsystem) emitBuildLifecycle(build BuildInfo) {
channel := ""
switch build.Status {
case "running", "in_progress", "started":
channel = "build.start"
case "success", "succeeded", "completed", "passed":
channel = "build.complete"
case "failed", "error":

View file

@ -356,6 +356,34 @@ func TestBuildStatus_Good_EmitsLifecycle(t *testing.T) {
}
}
// TestBuildStatus_Good_EmitsStartLifecycle verifies running builds broadcast a start event.
func TestBuildStatus_Good_EmitsStartLifecycle(t *testing.T) {
sub := newNilBridgeSubsystem()
notifier := &recordingNotifier{}
sub.SetNotifier(notifier)
sub.handleBridgeMessage(BridgeMessage{
Type: "build_status",
Data: map[string]any{
"buildId": "build-2",
"repo": "core-php",
"branch": "main",
"status": "running",
},
})
if notifier.channel != "build.start" {
t.Fatalf("expected build.start channel, got %q", notifier.channel)
}
payload, ok := notifier.data.(map[string]any)
if !ok {
t.Fatalf("expected payload map, got %T", notifier.data)
}
if payload["id"] != "build-2" {
t.Fatalf("expected build id build-2, got %v", payload["id"])
}
}
// TestBuildList_Good_NilBridge verifies buildList returns an empty list without a bridge.
func TestBuildList_Good_NilBridge(t *testing.T) {
sub := newNilBridgeSubsystem()

View file

@ -197,6 +197,7 @@ func channelCapability() map[string]any {
// experimental capability.
func channelCapabilityChannels() []string {
return []string{
"build.start",
"agent.complete",
"agent.blocked",
"agent.status",