Trim comments to the non-obvious why
Test and deploy / test (push) Successful in 28s
Test and deploy / deploy (push) Successful in 31s

Drop narration, history and restated-code comments across the repo,
keep short ones for security boundaries, upstream quirks and ordering
constraints, and record the convention in CLAUDE.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-24 20:49:03 +00:00
co-authored by Claude Opus 5.5
parent effddd2794
commit 4530cb8dc4
222 changed files with 1173 additions and 5423 deletions
+2 -11
View File
@@ -1,16 +1,7 @@
<script setup>
/**
* Route `/architecture` — how the whole site fits together, drawn.
*
* One long page of hand-written SVG diagrams, grouped into five sections
* (sections/*Section.vue), each of which lists its diagrams
* (diagrams/<section>/*.vue). Every diagram sits in a <DiagramFigure> and draws
* with the `dg-` classes in diagram.css; DiagramDefs supplies the shared
* arrowheads. No chart or graph library: the diagrams are static pictures of
* the code, so plain SVG is the smallest thing that does the job.
*
* The diagrams describe the code as it was when they were drawn. When a
* behaviour they show changes, redraw the diagram in the same commit.
* Route `/architecture`: hand-drawn SVG diagrams of the site. When a behaviour
* a diagram shows changes, redraw it in the same commit.
*/
import "./diagram.css";
import Header from "@/components/text/Header.vue";
+2 -11
View File
@@ -1,15 +1,6 @@
/*
* The diagram kit: every SVG on /architecture draws with these classes, so
* fifty-odd diagrams written separately still read as one set. Colours come
* from the site's design tokens (assets/styles.css), never literals.
*
* Not scoped: the classes are applied to elements inside each diagram
* component's own template, and a scoped block would only reach its own file.
* Everything is prefixed `dg-` so nothing leaks into the rest of the site.
*
* Arrowheads are <marker>s defined once on the page by DiagramDefs.vue and
* referenced by the edge classes below, so diagrams never declare their own
* (duplicate ids across many inline SVGs would collide).
* Shared, unscoped `dg-` diagram classes. Arrowhead markers live once in
* DiagramDefs.vue, since duplicate ids across inline SVGs collide.
*/
.dg {
@@ -5,7 +5,7 @@
AuthContextMiddleware -> gqlgen -> directive -> resolver. Everything ends at
handlers.Store.
Reflects: backend/main.go (r.Use, route groups, gqlSrv setup),
handlers/handle_auth.go (AuthMiddlewear, AdminMiddleware),
handlers/handle_auth.go (AuthMiddleware, AdminMiddleware),
graph/middleware.go, graph/directives.go, nginx/nginx_routes.conf.template.
-->
<template>
@@ -69,7 +69,7 @@
<text class="dg-code" x="340" y="275">GET /spotify/listening · GET /spotify/recent · GET /ws · GET /</text>
<!-- Lane 2: protected -->
<text class="dg-group-label" x="100" y="316">PROTECTED GROUP · r.Group("/", AuthMiddlewear)</text>
<text class="dg-group-label" x="100" y="316">PROTECTED GROUP · r.Group("/", AuthMiddleware)</text>
<rect class="dg-box dg-box--pink" x="100" y="330" width="190" height="60" rx="4" />
<text class="dg-title dg-title--sm dg-title--pink" x="195" y="354" text-anchor="middle">AUTHMIDDLEWEAR</text>
<text class="dg-text dg-text--pink" x="195" y="374" text-anchor="middle">bad token → 401</text>
@@ -81,7 +81,7 @@
<text class="dg-small" x="560" y="384">private=true checks the admin claim itself (requestIsAdmin)</text>
<!-- Lane 3: admin -->
<text class="dg-group-label" x="100" y="426">ADMIN GROUP · AuthMiddlewear, AdminMiddleware</text>
<text class="dg-group-label" x="100" y="426">ADMIN GROUP · AuthMiddleware, AdminMiddleware</text>
<rect class="dg-box dg-box--pink" x="100" y="450" width="190" height="60" rx="4" />
<text class="dg-title dg-title--sm dg-title--pink" x="195" y="474" text-anchor="middle">AUTHMIDDLEWEAR</text>
<text class="dg-text dg-text--pink" x="195" y="494" text-anchor="middle">bad token → 401</text>
@@ -147,7 +147,7 @@
<code>TrafficLogFormatter</code> and <code>Recovery</code>. After that there are four kinds of chain:
open routes ① that check cookies themselves if they need to, the <code>protected</code> group ②,
the <code>admin</code> group ③ (whose <code>AdminMiddleware</code> reads the claims
<code>AuthMiddlewear</code> stored, so the order matters), and GraphQL ④ (the animated path),
<code>AuthMiddleware</code> stored, so the order matters), and GraphQL ④ (the animated path),
which has no guard in front of it at all: each field's directive decides. Pink marks the auth
checks. <code>SetTrustedProxies</code> pins the Docker network so <code>ClientIP()</code>, which
the login rate limiter keys on, can't be spoofed with <code>X-Forwarded-For</code>.
@@ -53,7 +53,7 @@
<!-- 2 checks -->
<rect class="dg-box dg-box--tint" x="445" y="160" width="270" height="74" rx="3" />
<text class="dg-small" x="455" y="180">AuthMiddlewear → AdminMiddleware</text>
<text class="dg-small" x="455" y="180">AuthMiddleware → AdminMiddleware</text>
<text class="dg-small" x="455" y="198">exif.Decode → DateTime, else 400</text>
<text class="dg-small" x="455" y="216">≤ 10MB · jpeg / png / gif / webp only</text>