Commit Graph
1 Commits
Author SHA1 Message Date
CatoandClaude Opus 5 93a6e3e1f2 refactor(beacon): delete the popup, and gate the class of bug that hid it (#804)
The beacon popup was retired on 2026-06-11 (2391c6f7). That commit deleted the
page and five routes and left everything behind them standing, so for three
months the Settings page offered a "Popup mode" control that changed nothing,
and two live code paths called endpoints that returned 404 into a swallowed
catch.

Production had already said so plainly: beacon_sessions held ONE row, created
2026-06-08 23:39 UTC — three days BEFORE the retirement — and nothing in the
104 days since. All three of its indexes had idx_scan = 0.

DELETED
  scripts/beacon.py, scripts/_beacon_config.py — the launcher. Nothing invoked
    it; the Stop hook that once did has been `exit 0` since the same migration.
  POST /api/beacon — its only caller was that script.
  GET  /api/beacon/recent — zero references in the entire tracked tree.
  beacon_sessions (table, schema, queries) + the Fleet Doctor check that
    demanded it exist and the telemetry row that watched it.
  beacon_settings.popup_mode — stored, echoed, branched on by nothing. Its prod
    DEFAULT was still 'both', a PyQt-era value the app's own zod enum rejects.
  beacon_settings.min_idle_seconds — dropped from the query shape in September
    with the note that "the knob described behaviour that did not exist".
  POPUP_MODES / DEFAULT_POPUP_MODE and the Settings subgroup they fed.
  LEGACY_AUTO_INJECT_MODE_VALUES — its docstring claimed it served a migration
    UPDATE and tolerant parsing; no migration contains that UPDATE and
    normalizeAutoInjectMode never reads the array.
  The /beacon/ disallow in robots.ts, for a page tree that no longer exists.
  recentSwitchAgentStats — orphaned by the route deletion, caught by
    dead-exports-ratchet, which is exactly its job.

FIXED
  use-auto-continue.ts POSTed /api/beacon/cancel — deleted in 2391c6f7 — on
  every toggle-off, with `.catch(() => undefined)` hiding the 404.

KEPT, because they are live features wearing a dead feature's name:
  /api/beacon/queue/[tab] (the prompt queue, 4 call sites incl. desktop
  dispatch), /api/beacon-settings (autopilot + countdown), and
  /api/beacon/transcribe (voice input). Renaming those paths would break every
  shipped Fleet Runner, so the rename needs a deprecation window, not this PR.

Copy corrected along the way: the countdown said "how long the beacon waits"
when it drives the Control ready-banner; voice settings named
~/.cache/whisper/ when faster-whisper caches under ~/.cache/huggingface/, on
the SERVER, not the user's machine; a transcribe error pointed at
"Settings → Beacon", a tab that does not exist.

THE GATE — scripts/test/internal-paths-resolve.ts

Every internal path any file fetches or links must resolve to a route that
exists. Nothing checked this direction: dead-exports asks whether a symbol is
REFERENCED (these were — by each other), tsc cannot type a string, and smoke
could not see it because auth answers 401 before routing.

It resolves through [dynamic] and [...catch-all] segments, treats a template
hole as "any child", and accepts a path that is a prefix of a served route so
matcher lists (DEMO_DENIED_PREFIXES, robots, middleware) do not trip it. 508
references across 6 roots, 0 broken.

Proven by mutation, both directions: reintroduce the /api/beacon/cancel call
and it exits 1; delete src/app/api/orgs and it names all four callers. My first
attempt at that mutation silently failed to apply, and the gate "passed" — the
assert on the mutation itself is what caught it.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-20 09:48:52 -07:00