Skip to content

Stop broadcast failing without saying anything - #32

Open
brzuchal wants to merge 1 commit into
Open-School-Bell:mainfrom
brzuchal:fix/broadcast-silent-failure
Open

brzuchal wants to merge 1 commit into
Open-School-Bell:mainfrom
brzuchal:fix/broadcast-silent-failure

Conversation

@brzuchal

Copy link
Copy Markdown
Contributor

What happens now

Broadcast a sound from the panel, leave the zone select alone, and nothing plays. The page still says "Broadcast sent!".

The zone select starts on "None":

<select name="zone" className={INPUT_CLASSES} defaultValue="_">
  <option value="_">{t('broadcast.zone.noneOption')}</option>

and the finish action skips the send for that value but renders the success page anyway:

if (zone !== '_') {
  await broadcast(zone, queue)
}

broadcast() has two more silent exits: an empty sound queue, and a queue where no audio row has a fileName. Both return with nothing logged, and the user again sees success.

We chased this on a live school bell system. Nothing reached the sounder, nothing was added to the job queue, and the panel said it worked, so it looked like the sounder was broken.

The change

  • The zone select starts on the first zone instead of "None". The "None" option is gone — with the desktop-group branch commented out there was nothing to choose between. If no zones exist the page says so instead of crashing on zones[0].id.
  • No zone, empty queue, or no playable sounds now show a message saying what is missing, instead of the success page. The "Re-broadcast" button is hidden in that case, as it would only fail the same way.
  • broadcast() returns {sent: true} or {sent: false, reason} and logs the reason with console.warn. The two other callers ignore the return value, so they are unaffected.
  • All new strings go through the existing i18n, in both en and pl.

broadcast.zone.noneOption is removed from both locale files; it had exactly one use.

Checks

npm run typecheck, npm run prettier and npm run build pass. npm run lint has 0 errors; its 17 warnings are all pre-existing and none are in the files touched here. The repo has no tests.

Unrelated, not touched

app/routes/broadcast.builder.tsx has the same sounds[0].id crash when there are no sounds in the database, and broadcast() still throws a 500 for a stale zone id instead of a friendly message.

🤖 Generated with Claude Code

The zone select started on "None", so a broadcast sent without
touching it went nowhere and still showed "Broadcast sent!".

The select now starts on the first zone. If no zone is chosen or
the sound queue is empty, the page says what is missing instead of
showing success. broadcast() now says why it did nothing and logs it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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