FactoryWager Wiki

Ops summary endpoint

Endpoint GET /api/operations/summary Portal /portal/ops/ Diagnose bun run ops:diagnose Runbook bun run docs:ops-summary-endpoint

Two pipelines serve the same dashboard. Confusing them produces “proofs green but ops empty” or “JSON URL looks broken.”

Two pipelines

Layer 1 — API (server assemble)

Layer 2 — Portal (browser)

Source switch

Read source (and optional fallback) in the JSON body:

Pages edge: functions/api/operations/summary.ts serves snapshot only (no bun:sqlite).

Empty ops ≠ broken API

Verbose fetch scope

BUN_CONFIG_VERBOSE_FETCH logs Bun fetch() / node:http only. Use on:

Not on: curl localhost:3000/api/operations/summary

Debugger breakpoints

Bun --inspect on bun --inspect scripts/serve-public.ts:

Routing artifact note

Embedded routing in the summary is probed against the Pages public origin (ROUTING_PROBE_BASE_URL / default https://score.factory-wager.com), not npm REGISTRY_URL. Bun’s publish/install registry is configured separately (bun publish --registry, root bunfig.toml, .npmrc).

Local serve-public on :3000 is a dev mirror — use bun tools/routing-registry-proof.ts --base http://localhost:3000 for local routing smoke, not REGISTRY_URL=....

bun run ops:diagnose --compare-routing compares embedded fail paths vs live probe on --base-url (default localhost when diagnosing local server).

Triage layers

  1. Raw APIcurl + bun run ops:diagnose; check source / HTTP status / missing blocks
  2. Portal banner — “Operations summary unavailable” after retries → server down, wrong port, or both summary paths failed
  3. Specific panel — summary embed vs separate registry fetch (networking, release-features, etc.)

Ownership

Ratchet