Skip to content

refactor(api): extract SSE broadcaster into internal/api/sse leaf (ADR-0011)#452

Merged
krisarmstrong merged 2 commits into
mainfrom
refactor/stem-api-sse
Jun 16, 2026
Merged

refactor(api): extract SSE broadcaster into internal/api/sse leaf (ADR-0011)#452
krisarmstrong merged 2 commits into
mainfrom
refactor/stem-api-sse

Conversation

@krisarmstrong

@krisarmstrong krisarmstrong commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Second ADR-0011 internal/api decomposition slice: extract the SSE broadcaster/streaming engine into the isolated leaf package internal/api/sse (stdlib-only, no transport awareness), mirroring niac's pattern + the merged ratelimit leaf. The SSE HTTP handler stays in transport and consumes sse.Frame. Adds the api-sse-isolated depguard rule. Endpoints, event types, and publish sites are unchanged.

Linked Issue

Related to #450

Testing Evidence

go build ./...                                           BUILD OK
golangci-lint run ./internal/api/... ./internal/api/sse/  0 issues
go test ./internal/api/sse/...                           ok (5 tests)
go test ./internal/api/...                               ok
check-route-policy.sh                                    pass
check-output-escaping.sh                                 pass
STRICT=1 check-file-size.sh                              0 red flags

(Independently re-verified by Opus from a clean worktree of the branch.)

Security and Release Checklist

  • SSE behavior unchanged (endpoints, event types, publish sites identical)
  • Leaf cannot import the api transport layer (CI-enforced api-sse-isolated depguard)
  • No secrets; no new deps; no compat shim

@github-actions

Copy link
Copy Markdown
Contributor

License Compliance Report

All dependencies pass license compliance checks

Go Dependencies

  • Unknown: 33 package(s)
  • MIT: 26 package(s)
  • BSD-3-Clause: 16 package(s)
  • Apache-2.0: 11 package(s)
  • BSD-2-Clause: 1 package(s)

npm Dependencies

See full report in workflow artifacts

Allowed Licenses: MIT, Apache-2.0, BSD-*, ISC, CC0-1.0, MPL-2.0
Forbidden: GPL, AGPL, SSPL (strong copyleft)

Comment thread internal/api/sse/broadcaster.go Fixed
@krisarmstrong krisarmstrong enabled auto-merge (squash) June 16, 2026 19:12
auto-merge was automatically disabled June 16, 2026 20:07

Pull request was closed

@krisarmstrong krisarmstrong reopened this Jun 16, 2026
@krisarmstrong krisarmstrong enabled auto-merge (squash) June 16, 2026 20:07
@github-actions

Copy link
Copy Markdown
Contributor

License Compliance Report

All dependencies pass license compliance checks

Go Dependencies

  • Unknown: 33 package(s)
  • MIT: 26 package(s)
  • BSD-3-Clause: 16 package(s)
  • Apache-2.0: 11 package(s)
  • BSD-2-Clause: 1 package(s)

npm Dependencies

See full report in workflow artifacts

Allowed Licenses: MIT, Apache-2.0, BSD-*, ISC, CC0-1.0, MPL-2.0
Forbidden: GPL, AGPL, SSPL (strong copyleft)

…rflow)

CodeQL go/allocation-size-overflow flagged make([]byte,0,len(data)+const)
(a practically-impossible overflow, but pre-existing on main in sse.go).
Since the extraction moves this code, fix it properly: slices.Concat sizes
internally with its own overflow guard — no hand-rolled make-capacity for
the analyzer to flag. Behavior identical.
@github-actions

Copy link
Copy Markdown
Contributor

License Compliance Report

All dependencies pass license compliance checks

Go Dependencies

  • Unknown: 33 package(s)
  • MIT: 26 package(s)
  • BSD-3-Clause: 16 package(s)
  • Apache-2.0: 11 package(s)
  • BSD-2-Clause: 1 package(s)

npm Dependencies

See full report in workflow artifacts

Allowed Licenses: MIT, Apache-2.0, BSD-*, ISC, CC0-1.0, MPL-2.0
Forbidden: GPL, AGPL, SSPL (strong copyleft)

@krisarmstrong krisarmstrong merged commit 21d0d27 into main Jun 16, 2026
39 of 41 checks passed
@krisarmstrong krisarmstrong deleted the refactor/stem-api-sse branch June 16, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants