Skip to content

Skip the variations' templates of broadcasts.list without Templates read - #542

Open
pierre-b wants to merge 2 commits into
devfrom
fix/broadcasts-without-templates-read
Open

pierre-b wants to merge 2 commits into
devfrom
fix/broadcasts-without-templates-read

Conversation

@pierre-b

@pierre-b pierre-b commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

What

Follow-up of #536. When broadcasts.list is called with with_templates, BroadcastService.ListBroadcasts looked up each variation's template. It did so even for a caller without Templates read, such as a console member or an API key. Each of those lookups was refused and logged at error level, on every page load.

The service already holds the caller's permissions, so it now skips those lookups for such a caller. The response does not change: the broadcasts come back without their templates, as before, and the console names each template by its ID since #536. The only thing that goes away is the refused calls and their logs.

Why fix this in the service rather than in the console: the console would have had to wait for the members request before listing broadcasts. That adds a serial request for everyone and a new loading state. The service fix also covers API keys.

No migration, no environment variable, no console change. There is no new CHANGELOG line: the 44.0 Fix line of #536 already says these screens no longer request templates such a member cannot read.

Plan and tests

Plan: plans/fix-broadcasts-list-without-templates-read-plan.md.

New cases in internal/service/broadcast_service_test.go:

  • Member without Templates read: no template lookup (the mock is strict), and the broadcast comes back without its template.
  • Owner with no explicit permissions: the templates are still joined.

The two existing WithTemplates cases now authenticate a member who has Templates read.

make test-service passes.

Known, not handled

  • broadcasts.get with with_templates does the same lookups in the handler. The console never asks it for templates.

With with_templates, ListBroadcasts looked up each variation's template even for a caller without Templates read: every lookup was refused and logged at error level. It now skips them for such a caller, who gets the broadcasts without their templates, as before.
@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.97%. Comparing base (6688f19) to head (510ecec).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #542   +/-   ##
=======================================
  Coverage   88.96%   88.97%           
=======================================
  Files         377      377           
  Lines       73836    73836           
=======================================
+ Hits        65688    65692    +4     
+ Misses       5439     5435    -4     
  Partials     2709     2709           
Flag Coverage Δ
unit 88.97% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant