[qa] workspace_broadcast.go: 0% test coverage — no test file #1335

Closed
opened 2026-05-16 09:59:51 +00:00 by core-qa · 2 comments
Member

workspace_broadcast.go has 0% line coverage. No test file exists.

Security-sensitive handler (POST /workspaces/:id/broadcast) — org-scoped broadcasts with DB writes and WebSocket events. Has been through two OFFSEC-015 hotfixes but never had tests added.

Source: workspace-server/internal/handlers/workspace_broadcast.go
Test stub: MISSING

Requires: workspace_broadcast_test.go with sqlmock + Broadcaster mock.
Covers: 404 sender not found, 403 broadcast_enabled=false, 400 invalid body, 500 DB errors, truncation path.

workspace_broadcast.go has 0% line coverage. No test file exists. Security-sensitive handler (POST /workspaces/:id/broadcast) — org-scoped broadcasts with DB writes and WebSocket events. Has been through two OFFSEC-015 hotfixes but never had tests added. Source: workspace-server/internal/handlers/workspace_broadcast.go Test stub: MISSING Requires: workspace_broadcast_test.go with sqlmock + Broadcaster mock. Covers: 404 sender not found, 403 broadcast_enabled=false, 400 invalid body, 500 DB errors, truncation path.
Member

The test file workspace_broadcast_test.go already exists on main (commit 5a05302c) with comprehensive coverage:

  • TestBroadcast_OrgScopedRecipients — OFFSEC-015 core regression test
  • TestBroadcast_OrgScoped_OrgRootSender
  • TestBroadcast_OrgScoped_ChildWorkspaceSender
  • TestBroadcast_NotFound (404)
  • TestBroadcast_Disabled (403: broadcast_disabled)
  • TestBroadcast_EmptyOrg_NoRecipients
  • TestBroadcast_InvalidWorkspaceID (400)
  • TestBroadcast_MissingMessage (400)
  • TestBroadcast_OrgRootLookupFails (500)
  • TestBroadcast_OrgScoped_SelfBroadcastExcluded
  • TestBroadcast_Truncate

11 test cases covering all required scenarios. Issue appears to be stale / filed before the test file was committed. Closing.

The 0% coverage in the issue was likely based on a stale coverage report (the coverage.out was generated before the test file was added to main).

The test file `workspace_broadcast_test.go` already exists on main (commit `5a05302c`) with comprehensive coverage: - `TestBroadcast_OrgScopedRecipients` — OFFSEC-015 core regression test - `TestBroadcast_OrgScoped_OrgRootSender` - `TestBroadcast_OrgScoped_ChildWorkspaceSender` - `TestBroadcast_NotFound` (404) - `TestBroadcast_Disabled` (403: broadcast_disabled) - `TestBroadcast_EmptyOrg_NoRecipients` - `TestBroadcast_InvalidWorkspaceID` (400) - `TestBroadcast_MissingMessage` (400) - `TestBroadcast_OrgRootLookupFails` (500) - `TestBroadcast_OrgScoped_SelfBroadcastExcluded` - `TestBroadcast_Truncate` 11 test cases covering all required scenarios. Issue appears to be stale / filed before the test file was committed. Closing. The 0% coverage in the issue was likely based on a stale coverage report (the coverage.out was generated before the test file was added to main).
Author
Member

Resolved by PR #1243 (comment #31493). workspace_broadcast_test.go adds 11 test cases: NewBroadcastHandler 100%, Broadcast 82%, broadcastTruncate 100%. Issue closed.

Resolved by PR #1243 (comment #31493). workspace_broadcast_test.go adds 11 test cases: NewBroadcastHandler 100%, Broadcast 82%, broadcastTruncate 100%. Issue closed.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#1335
No description provided.