Skip to content

Emergency banner: publish / follow-up / remove via GitHub Action #221

Description

@ciotlosm

Problem

When we break something on the GTFS-RT pipeline, the producer, or the PWA
itself, there is currently no channel to tell affected users. They just
see broken behaviour and leave. We also have no clean way to say
"fixed" once the issue is resolved.

We need a lightweight in-app banner that admins can publish, append
follow-ups to, and clear — without standing up a backend.

Proposal

A file-driven banner, served by Cloudflare Pages as a static asset and
fetched by the PWA at load time and on a short polling interval.

Data shape

A single JSON file, e.g. static/emergency.json:

{
  "active": true,
  "severity": "info" | "warning" | "critical",
  "title": "Live vehicle positions are stale in Cluj-Napoca",
  "body": "We are investigating. Last update ~30 min ago.",
  "postedAt": "2026-07-06T18:00:00Z",
  "updatedAt": "2026-07-06T18:00:00Z",
  "followUps": [
    { "at": "2026-07-06T18:45:00Z", "body": "Root cause identified — GTFS-RT producer restart in progress." }
  ]
}

When active is false, or the file is absent, the PWA shows no banner.

PWA side

  • Fetch emergency.json on app load and every 60s while the app is
    open (cache-busted with ?v=<updatedAt> or similar).
  • If active: true, render a banner above the main view:
    • info → neutral background
    • warning → amber background
    • critical → red background, dismissable in-session only
  • Render followUps as a collapsible thread under the main body so
    users see progression (issue → updates → resolved), newest first.
  • Banner is purely additive to the existing UI; no map / list changes.

Admin side — three operations, one file

The whole publisher is the JSON file plus (optionally) one workflow
file. No new service, no new secrets.

  1. Publish — write the JSON with active: true, commit to main.
  2. Follow up — append a new entry to followUps, bump updatedAt.
  3. Remove — set active: false (or delete the file), commit.

The simplest path is edit static/emergency.json in the GitHub web
UI and commit
— Cloudflare Pages auto-deploys on push to main.

The polished path is a .github/workflows/emergency-message.yml
workflow with workflow_dispatch inputs (action, severity, title,
body, followUp) that rewrites the JSON and commits it. Same end
state, but no hand-editing of JSON, and it works from the GitHub
mobile app.

Ship the file + PWA read path first, layer the workflow on top once we
are happy with the data shape.

Acceptance criteria

  • static/emergency.json exists with the shape above
  • PWA fetches the file at load + every 60s, with cache-busting
  • Banner renders for active: true, hidden for active: false or
    missing file
  • Three severity styles (info / warning / critical)
  • followUps rendered as a collapsible list under the main body,
    newest first
  • Dismissable in-session for critical (resets on reload)
  • GitHub Action emergency-message.yml supports publish /
    follow-up / remove via workflow_dispatch
  • Hand-editing the JSON still works end-to-end (no hard coupling
    to the workflow)
  • Documented in docs/operations.md (or equivalent) with the three
    operations and an example payload

Out of scope (v1)

  • Push notifications (web push, FCM)
  • Per-feed / per-region targeting (one banner covers all users for now)
  • Scheduled expiry of a banner (expiresAt is a nice-to-have, not v1)
  • Banner analytics (impressions, dismissals)
  • Localisation (RO / EN) — English-only in v1
  • In-app message centre / history of past messages

Activity

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or improvement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions