The known-rough-edge section described POST /api/receipts as still
present but scheduled for removal — the refactor already removed it.
Replaced with a table of what each file now owns.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
server.mjs mixed SQL schema, HTML-rendering functions, and route
handling in one 476-line file. Split by concern:
- src/db.mjs — schema + migrations (openDb())
- src/views.mjs — pure render functions: layout, incidentForm,
publicMarkdown/Incident/Detail, no db or network access
- src/style.mjs — the stylesheet, now genuinely shared instead of
duplicated (receipts.mjs's /events page had its own near-copy,
which is exactly what let their <nav> definitions drift out of
sync a few commits ago)
- src/http-utils.mjs — form()/redirect(), used by more than one route
- src/routes/incidents.mjs — the private notebook + Git inbox +
publish/unpublish, auth-gated once at the top instead of per-route
- src/routes/public-failures.mjs — the read-only /api/v1/public/failures*
projection
server.mjs is now 79 lines of composition: open the db, build each
route module, wire the dispatch order, listen.
Also dropped the old POST /api/receipts endpoint and its `receipts`
table — dead since the v1 events API replaced it, already flagged as
"scheduled for removal" in the README.
Verified behavior is unchanged, not just "looks the same": full route
smoke test (401/200/404 in the right places, incident create→publish→
public-projection round trip, receipt ingestion), tests pass, and
before/after screenshots of every page are pixel-identical.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Every route handler was written as one dense semicolon-chained line
(server.mjs's main handler was over 2000 characters wide) — real
width, not a VSCode wrapping artifact. Ran Prettier to break statement
structure into properly indented multi-line code; left template
literal string contents untouched since Prettier doesn't reformat
inside those, so the large HTML-generating return strings are still
single long lines by nature, just no longer compounded by unformatted
surrounding JS. Verified: tests pass, node --check passes, and the
app renders identically before/after (screenshotted the diff).
No devDependency added — npx prettier@3.9.5 pinned in the new scripts
keeps the zero-runtime-dependency pledge intact; formatting is a dev-
time concern only.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Its inline <style> block never defined nav{display:flex;gap:...} like
the shared stylesheet does, so the three links ran together with no
spacing as soon as the previous commit added them. Screenshotted to
confirm before committing.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The operational-events page existed and worked but was never linked
from the incident notebook (or vice versa) — reachable only if you
already knew the URL. Both layouts now share the same three-item nav.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Full walkthrough of the private incident notebook (timeline,
hypotheses, publishing), an endpoint reference table for the receipts
API, real curl examples for both receipt types, a config reference,
and an honest note about the dead pre-v1 /api/receipts endpoint
instead of leaving it undocumented.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>