Files
loki/scripts/ci
CatoandClaude Opus 5 4f465c9582 feat(check): does each registered site's widget actually activate (#640)
Two live sites had had no working widget for months and nothing could have told
us. aoz-housing's token was bound to https://aoz-wohnen.orangecat.ch while the
site is served at aoz.orangecat.ch; sbb-lost-found's was bound to
https://sbb.orangecat.ch, renamed to sbbfundbuero.orangecat.ch. The origin is
written once at provisioning and never looked at again; the host is renamed
whenever the project is.

The state is silent. widget.js loads 200, /api/widget-boot authenticates 200 and
answers {"active":false}, the launcher never mounts, nothing is logged, the page
looks finished. Both are fixed — a rebind updates origins in place and keeps the
token value, so neither site needed a rebuild or a redeploy.

THE FIRST VERSION OF THIS CHECK WAS WRONG AND TESTING CAUGHT IT

It compared each token's `origins` against the register's hosts. Run against
real data it flagged four sites that were completely fine: annushka and
orangecat.ch are not register rows but serve working widgets, fleetcrown does
not put a widget on itself, and one token belonged to an OrangeCat project page
that is not a hosted site. The register is not the universe of hosts with
widgets, so "origins ⊆ register" was never the property anyone wanted.

So ask the site instead. For each registered host: fetch the page, take the
token out of it, ask widget-boot with that host as Origin whether it activates.
No database, no name-mapping between register rows and FleetCrown projects
(exactly the mapping that is unreliable — aoz-wohnen is aoz-housing), and it
catches every way a widget can be dead rather than the one way it can be
mis-bound.

AND IT REPORTS THREE ANSWERS, NOT TWO

The token is injected client-side by next/script, so it reaches the HTML only
inside Next's flight payload. surf-your-life and evig put it there later still —
one preloads the script and attaches the token after hydration — so curl sees no
token on two sites whose widgets work. An earlier sweep called that shape
"widget: NO" on four healthy sites. This prints "token not present in the server
HTML — NOT judged either way" and does not fail on it.

It also self-skips when FleetCrown is unreachable: offline, every site would
look dead, and an instrument failure must not print what an outage prints.

Wired into fleet-register-check beside the shape and reality checks — it needs
the network, which CI does not have. Mutation-proven: pointing a register row at
a host its token does not allow makes it fail and name the site. Against the
real fleet: 23 activate, 2 unjudgeable, 0 dead.


Claude-Session: https://claude.ai/code/session_01G2LBioUzJP4oBL9LeH9qAe

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-11 05:00:47 -07:00
..