steid

@jamesgill /

steid/plans/current.md
Markdown48.8 KBRendered·Source·Blame·History·Raw
1# Current
2
3> Keep this file short. One active step, one ordered backlog. Completed work moves to
4> [progress.md]progress.md. If this file starts reading like a changelog, it has
5> drifted — that's exactly what went wrong last time.
6
7## Active: Milestone 5b — Deployable by anyone
8
9**Goal:** a stranger can install Steid on a fresh Linux box in one command and reach it
10over HTTPS, and the author can publish an instance and push Steid's own source to it.
11Distributed as **a binary plus its assets**, not a container.
12
13**Out of scope:** push-to-release and any CI/CD (8+ — see
14[ROADMAP.md]ROADMAP.md#milestone-ladder), multi-user registration (7), and hosting
15release artefacts on Steid itself, which it has no feature for.
16
17### Steps
18
19- [x] Release build producing `steid-<version>-<target>.tar.gz` — binary, `assets/`,
20 README — and verified to boot from a clean extraction
21- [x] `install.sh` — download, systemd unit, Caddy with automatic HTTPS, idempotent
22- [x] `README.md` — the repo has none, and it is the front door of a portfolio project
23- [x] Operability: `/healthz`, graceful shutdown on SIGTERM
24- [x] `STEID_SETUP_TOKEN` as an optional override, so claiming is not a race with
25 `journalctl`
26- [x] Rate limiting on `/auth/login` and `/auth/setup`
27- [x] Backup and restore, documented — two paths, rsync is enough
28
29### Done when
30
31`curl … | sh -s -- --domain git.example.com` on a fresh VPS yields a working HTTPS
32instance, and Steid's own source is pushed to it and browsable there.
33
34### Settled
35
36- **A binary plus `assets/`, not a container.** Topcoat can embed the asset *manifest*
37 (`Manifest::parse` + `include_str!`, for WASM) but not the asset *bytes* — that path
38 pairs with `AssetConfig::hosted_at`, which expects a CDN. A single self-contained file
39 would mean fighting the framework, so the artifact is a directory. The Dockerfile stays
40 as a secondary path.
41- **A TLS proxy is mandatory, not conventional.** Topcoat 0.5 has no TLS: no rustls, no
42 ACME, no HTTPS listener — checked, not assumed. Since git authenticates over HTTP
43 Basic, without TLS a personal access token crosses the network in cleartext on every
44 push. Caddy is chosen because automatic certificates are its headline feature and the
45 config is two lines.
46- **glibc, built on Debian bullseye — not static musl.** Two reasons, the second
47 decisive. musl failed on `ring` (Debian's `musl-gcc` wrapper rejects `-m64`) and would
48 need a real cross toolchain. But **musl's whole point is a binary with no runtime
49 dependencies, and Steid hard-requires `git` on `PATH`** — anyone installing it already
50 has a package manager, so the portability musl buys cannot be used. Building on
51 bullseye pins the glibc floor at 2.31, covering Debian 11+ and Ubuntu 20.04+; building
52 on bookworm would need 2.36 and silently exclude Ubuntu 22.04, which is still
53 everywhere. Verified: a release build in `rust:1.97-slim-bullseye` succeeds, 11.5 MB.
54- **The runtime binary links a TLS stack it never uses.** `ring` ← `rustls` ← `ureq` ←
55 Topcoat's `icon-iconify`/`tailwind` features, whose `ureq` exists to download the
56 Tailwind CLI *at build time*. Those features are enabled on the normal dependency as
57 well as the build one, so the crypto comes along for the ride. Moving them to
58 build-dependencies only would shrink the binary and drop an unused dependency from the
59 attack surface — worth trying, not yet attempted, and it is what made the musl attempt
60 fail where it did.
61- **Rsync is the deployment mechanism for now**, and that is enough while the artifact is
62 two paths. Push-to-release is the eventual answer and is parked at 8+.
63
64### Open
65
66- **Whether to add `STEID_TRUSTED_PROXY`.** The rate limiter keys on `X-Forwarded-For`
67 because **Topcoat 0.5 discards the peer address at accept time and never exposes it** —
68 a handler sees headers and nothing else. Behind a proxy that is fine. Exposed directly,
69 a caller can vary the header for a fresh budget, leaving only the global cap. An
70 explicit "trust forwarded headers" flag defaulting to off would close it, at the cost
71 of one more thing an operator must get right. Not picked.
72- **`MAX_RAW_BYTES` is 10 MiB**, chosen rather than derived. It bounds what one raw
73 request can hold in memory, because `GitQuery` reads bytes rather than streaming them.
74 Raising it means a handful of concurrent requests can hold that much each.
75- **The profile has no links.** `Organization` carries a display name and a bio and
76 nothing else, so the design's links row is not backed by data and was left out rather
77 than faked. A `links` field plus a settings control is the small feature that fixes it.
78- ~~**`create_repo` and `serve_git` read the clock internally**~~ — **closed.** Both take
79 a `now`; the [`Clock`]../src/application/port.rs port covers the one case that cannot
80 (webhook delivery, which reads per attempt). **`import_repo` and `run_import` still
81 read the clock internally** — a background task that runs for minutes has no caller's
82 `now` worth taking, so it is the next `Clock` caller rather than a `now` one.
83- **A push touches `updated_at` twice** — once for the advertisement, once for the RPC.
84 Harmless, same second, but two writes per push.
85- **A licence.** A public portfolio repository probably wants one, and the README
86 deliberately says nothing about licensing rather than guessing.
87- ~~Blocked on a domain transfer~~ — **transferred 2026-08-29**, so Phases 1–6 of the
88 deployment runbook are unblocked.
89- **(historic) Blocked on a domain transfer** (noted 2026-08-29). `jpgill.dev` is the
90 intended host for both the instance and the release downloads; the transfer is in
91 flight. Phases 1–6 of the deployment runbook cannot start until DNS resolves, because
92 Caddy requests a certificate on startup. Nothing else is blocked by it — the artifact
93 is built and verified, and `install.sh` still needs its container dry-run.
94- **A domain.** Caddy needs a real hostname to obtain a certificate. This is the one
95 blocker that is DNS rather than code.
96
97### Open
98
99- **Whether an absent *public* repository can 404 while private ones still 401.** The
100 uniform 401 from [0007]decisions/0007-tokens-over-http-basic.md is what makes a
101 private repository indistinguishable from one that does not exist — but it also turns
102 every mistyped URL into "Authentication failed", which cost real time on the first
103 deployment. The leak being prevented concerns *private* names only, so answering 404 for
104 a repository that would be public if it existed may cost nothing. Needs thought about
105 whether that is actually true.
106- **Zero-downtime deploys — deferred, deliberately.** `deploy.sh` currently stops the
107 service, swaps the binary and starts it: about two seconds. The plan, when it is worth
108 building: a systemd **template unit** `steid@.service` where the instance name *is* the
109 port, with `/opt/steid/3000` and `/opt/steid/3001` as separate install directories.
110 Deploy alternates — install to the idle port, start it, health-check it **directly on
111 loopback**, rewrite Caddy's upstream and `caddy reload` (graceful; existing connections
112 finish), then stop and disable the old one and enable the new so a reboot brings back
113 the right one.
114
115 Two things make this more than a shell script, and they are the reason it is deferred
116 rather than half-built:
117
118 - **Both processes share one SQLite database during the overlap.** WAL allows that, and
119 Steid's writes are short, so the overlap itself is fine. **Migrations are not.** The
120 new binary migrates on boot while the old one is still serving, so any schema change
121 that the old binary cannot tolerate — a new `NOT NULL` column, a dropped column —
122 breaks the still-live version. That is a constraint on how migrations are written
123 (**expand, deploy, contract**), not something the deploy script can solve.
124 - **An in-flight `git push` is cut when the old process stops.** `topcoat::start`
125 already drains on SIGTERM, so the fix is to stop the old one *after* Caddy has
126 repointed and let it finish what it has.
127
128 Worth building when instances belong to other people. At two seconds on a personal site,
129 it buys nothing today.
130- **No scheduled backups.** `/var/lib/steid` is the whole of the state and copies of it
131 exist only because they were taken by hand. This is the largest gap now that the
132 instance is live.
133- **Releases are not served from the instance yet.** The Caddy blocks are written and
134 commented in `deploy/Caddyfile`, and `install.sh`'s `RELEASE_BASE_URL` points at
135 `/jamesgill/repos/steid/releases`, but nothing has been rsynced there — so the
136 one-command install a stranger would run does not work yet.
137
138### Opened by the section 1 wave
139
140- **Diffs, READMEs and markdown code fences are unhighlighted.** The README goes through
141 `web/markdown.rs`, which writes its own `<pre><code>`; wiring `highlight.rs` into it is
142 a small follow-up. Blame was the fourth of these and is now done, so the adapter is
143 reached from two pages and the pattern for a third is set: build the file's text in
144 line order, call `source_lines` **once**, render `Classed` through `Unescaped`.
145- ~~`.jsx` is plain~~ — **aliased onto JavaScript.** `highlight.rs` gained an `ALIASES`
146 table, consulted only after the syntax set's own answer, so an alias can never
147 overrule a real grammar. It has one entry and should stay small.
148- **`\r\n` files keep the `\r` inside highlighted markup.** Invisible under
149 `white-space: pre`; noted rather than fixed.
150- **The blob header does not name the detected language.** It is only visible as colour.
151
152- **No ahead/behind counts on the branches page**, by decision: a `rev-list` per branch
153 is twenty forks for twenty branches. Waits for a kept-alive git.
154- ~~Neither refs page is paginated~~ — **both page**, 100 rows each, sliced in the use
155 case rather than in the port: `for-each-ref` returns every ref in one process, so a
156 `limit` there would buy nothing and cost a second call for the count. The settings
157 form's default-branch `<select>` asks for `None` and still gets every branch — an
158 option missing from it would be a branch nobody could choose.
159- **A repository with tags but no branches** says "No branches"; real but exotic, not
160 fixture-tested.
161- **`web::browse::{encode, timestamp}` are now `pub(super)`**, and `repo_stats` takes
162 `handle` and `name` so the sidebar counts can link. `timed_out` has since moved to
163 `web::context`, as this said it should.
164
165- **`git grep` output is collected whole before it is capped.** A one-letter query on a
166 big repository allocates all of git's output to keep 200 hits. Bounded by the 20 s
167 timeout, not by anything deliberate.
168- ~~The archive endpoint has no rate limiting~~ — limited (10/client/min). It is outside the read timeout, on
169 purpose (a large repository legitimately takes longer to pack). It is the most
170 expensive anonymous request in Steid: a full pack per hit. First thing to look at under
171 load. A late `git archive` failure is a truncated download, logged like the protocol
172 server's.
173- ~~Search has no paging~~ — **results page**, ~200 matches a page, **cut at a file
174 boundary rather than a line**: a file's matches are one block under its path, so a
175 page that ended mid-file would print the heading twice and split what reads as one
176 thing. A page holding a 300-match file overshoots instead, which is the right way
177 round. A search collects at most `SEARCH_MAX_MATCHES` (1,000) across all its pages —
178 paging must not turn a one-letter query into unbounded work, since `git grep` output
179 is still collected whole — and past that the page says to narrow the search.
180 **Every page re-runs the grep**; there is no cursor a second page could resume from.
181 Search still `trim()`s the query, cuts matched lines at 500 characters (which can
182 remove the match on a minified line), and ignores `GrepHit::column` when marking.
183
184- **The commit page's timeout state has never been rendered**, like search's and the
185 refs pages'. The predicate itself is now `web::context::timed_out`, shared by `refs`,
186 `commit` and `blame`; each page still writes its own panel, and `search_repo` still
187 answers in the application layer.
188- **`Diff::files` is emptied wholesale when the patch is truncated**, falling back to the
189 numstat list, so a 10 MiB commit shows no lines rather than the first few files.
190 numstat itself could in principle be truncated at ~300,000 changed files.
191- **A merge commit is diffed against its first parent only**, and merge rendering was
192 compiled, not seen: no fixture contains one.
193- **`MAX_RAW_BYTES` now does a second job** as the diff cap; retune both together.
194- **`bg-surface` is nearly `bg-background` in light mode**, so a file header reads only
195 by its border there. Pre-existing, but the commit page has one per file.
196- ~~No paging anywhere in history~~ — **`/log` and a comparison's commit list page**,
197 `?page=N`, 50 and 100 a page, with the shared control from [ui.md]ui.md#paging.
198 Each costs its page a `rev-list --count`. **A comparison's diff does not page**: it is
199 what the whole range changes, so it is the same on page 2 as on page 1, and a range
200 wide enough to need paging still renders one diff capped by `MAX_RAW_BYTES`.
201- **The compare form's `<datalist>` costs a `list_refs`** rendered inline on every visit.
202- ~~Nothing links to a commit by its sha yet~~ — done.
203
204- ~~The blame page has no revision switcher~~ — **added**, and `Switch` in
205 `web/browse.rs` now has a `Blame` arm, so switching branch keeps you on blame at the
206 same path. It costs the page one `list_refs`, which is what the wave deferred.
207- **`BlameCommit::boundary` and `author_name` reach only the tooltip.** The row is sha,
208 summary, date and must stay one line. On a multi-user instance the author is the first
209 thing to revisit.
210- **Blame is the most expensive read in `GitQuery`** and the likeliest to meet the 20 s
211 timeout. Nothing but this page calls it. ~~It also pays a second existence check~~ —
212 the check is now a line to a running `cat-file`, so the page costs two processes
213 rather than five and the double check costs no fork at all.
214- ~~Cross-branch links were verified only after the merge~~ — **walked, 2026-09-05**,
215 see the integration pass below.
216
217#### The integration pass — 2026-09-05
218
219The five branches merged and run as one app, on a real instance holding Steid's own
220history: 9 branches, 2 annotated tags, one public repository and one private. Every
221link that crosses a feature boundary was followed in a browser, and **nothing was
222broken at a seam.** Landing sha → commit page; log sha → commit; commit's "Browse
223files" → tree at that sha and its parent sha → the parent's page; the counts and the
224sidebar → branches and tags; a branch row → tree, log and a compare with a real diff
225(a merged branch correctly says there is nothing to compare); a search hit's line
226number → `blob#L<n>` with the anchor present and landing; `Code · Blame · Raw` in both
227directions; blame's sha → the commit page and its line number → the blob anchor;
228`zip` and `tar.gz` for `main` and for a tag, both extracting under `steid-<rev>/`.
229**A private repository 404s on all eleven routes anonymously** — landing, log,
230branches, tags, commit, search, tree, blame, raw, archive, compare. Highlighting still
231renders after the blame toggle and the anchor edits landed on the same table: Rust and
232TOML coloured, a plain file not. Screenshots of the whole flow in dark and light are
233in `target/shots/`.
234
235Two things the pass found, neither a break:
236
237- **The sidebar's Download links can only ever offer the default branch.**
238 `clone_block` takes a revision and its doc says the links are "for the revision being
239 viewed", but the sidebar renders only on the landing page, which has no `{rev}` — and
240 the tree and blob pages, which do, are single-column by design. So a tag's tarball is
241 reachable only by typing `/archive/v0.2.0.zip`. Both formats work at both revisions;
242 it is the entry point that is missing, and putting it on the tree page means deciding
243 whether that page gets a sidebar, which [ui.md]ui.md#the-repository-page settled the
244 other way.
245- ~~Blame renders its lines unhighlighted while the blob highlights them~~ — **closed.**
246 Blame's code cell now goes through `source_lines`, the blob's own adapter, so the two
247 views share classes, caps and plain fallback. Both render the same file to an
248 identical set of `hl-` spans, and rows stay 19.5px — the only variance is at a run's
249 hairline, which is `border-collapse` splitting that 1px, not the markup.
250
251### Opened by wave 2
252
253Everything struck through here has moved to [progress.md]progress.md; what is left is
254what is still open.
255
256- **A rename can strand a directory** if the process dies between the move and the row
257 write; same class as create's orphan, and the reconciliation sweep now has two shapes
258 to handle. **A rename races**: two renames onto one name both pass the free check and
259 the loser gets "name taken" for the wrong reason.
260- **Renaming touches nothing that stores the old name outside the row**, which the
261 integration pass walked: hooks, their delivery log and issues all followed a rename, and
262 the next push's payload named the new repository and URL. A webhook *target* or an issue
263 reference would have to be renamed with it.
264- **Every use case that rebuilds through `Repository::new()` must carry the fields
265 `new()` resets** — `pinned`, `archived`, and now the import trio. `update_repo` was
266 missing the trio, which is how a visibility save during a real import ended the import
267 as far as Steid was concerned. The next field added to `Repository` outside the
268 constructor has the same trap waiting; a builder that took the whole existing row would
269 close it for good.
270- **The settings page costs a git process** (`branches()`, for the select) — except
271 during an import, when it is skipped.
272- **The profile's Repositories tab pages at 50**, sliced *after* the visibility filter
273 so page 2 is never short by however many private repositories page 1 counted. The
274 overview and `/api/…/repos` both ask for the whole list (`None`) and are unchanged.
275
276- **A rejected issue burns a number** (allocated before validation); a gap costs
277 nothing next to a reused number. ~~No paging on issue lists~~ — **they page**, 50 a
278 page, and the state and label filters travel with the page number (`filtered_url`
279 builds all three, with tests). **A label-filtered list is still read whole**: which
280 labels an issue wears lives in a second table the list already reads to render its
281 pills, so the filter is applied in the use case and the page cut after it — the
282 unfiltered path is the one `limit`/`offset` serves.
283- **Owner-only issue writes are the single-user assumption showing.** Milestone 7 wants
284 anyone to open an issue on a public repository: a change to `writable_repo` only,
285 `author_id` is already stored and rendered.
286- No labels, assignees, milestones, search, cross-links (`#3` is plain text) or edit
287 history. `closed_at` is cleared on reopen. Body cap 65,536 characters, chosen.
288
289- **Imports have no size cap and no concurrency limit.** A 10 GB source fills the disk;
290 N submissions are N concurrent clones — the pass ran four at once without trouble, which
291 is evidence about a laptop and not about a server. A semaphore in app context is the
292 small fix; a disk-space check or `--depth` the other. **No retry control** — the row
293 keeps its source, so a Retry button on the failed panel is small. **An import starts
294 public** and the settings form can make it private while it runs.
295- **DNS is resolved twice** for imports (check, then git); a TTL flip between the two is
296 the gap. `.local` (mDNS) is not refused by *import* — `WebhookUrl` does refuse it, and
297 the same suffix list would suit both. `is_public` is a denylist of IANA ranges, now
298 shared with webhooks in `domain/net.rs`.
299- **Search on an importing repository answers 200 with no matches**, where the archive
300 and blame routes answer 404 and the panel says what is happening. Nothing is wrong, but
301 "no matches in a repository that has no contents yet" is a sentence the page could say.
302 The refs pages answer 200 there too; what they render was not read closely.
303
304- **Webhook retries do not survive a restart**; the rows written so far stay. A durable
305 queue is a different feature. **DNS rebinding is not closed** for hooks or imports.
306- **`webhooks.active` is honoured everywhere but nothing toggles it** (one POST and one
307 button). ~~The deliveries page is capped at 50, unpaged~~ — **it pages**, 50 attempts
308 a page, and the port gained `count_by_webhook` for the numbers. **Redelivery now reads
309 a hook's whole delivery history**: the button can sit on any page, and the attempt
310 number it writes counts every attempt the *event* has had — which the old 50-row
311 window got wrong as soon as an event fell out of it. Correct, but unbounded on a hook
312 with a long history; a `find` by delivery id plus a per-event attempt count would
313 close it. `push_events` only grows and has no page: the obvious next use is an
314 activity feed.
315- ~~**`deliver_push` reads the clock internally**~~ — it takes a `Clock` now. It still
316 takes no `Actor`: authorization is settled once in `record_push`.
317- **Slow endpoints hold a task ~2.5 minutes per push**, bounded by hooks per repository,
318 which nothing caps.
319- **`STEID_ALLOW_PRIVATE_WEBHOOKS` is a real hole when it is on**, which is why it is off
320 by default, warned about at boot and documented in [runbook.md]runbook.md beside
321 `STEID_INSECURE_COOKIES`. A deployed instance with it set lets anyone who can add a hook
322 read its own network's responses off the deliveries page.
323
324#### The paging pass — 2026-09-06
325
326Walked on a real instance on port 3118 holding this repository's own history (182
327commits, three branches, two tags) and 62 issues opened through the form:
328
329- `/log` at 182 commits: pages 1, 2 and 4 each say `Showing 51–100 of 182 commits` and
330 the like, `?page=400` and `?page=banana` both render page 4 and page 1 rather than an
331 error, and a branch force-pushed from 182 commits down to 2 answers a bookmarked
332 `?page=4` with those two commits and no control.
333- Issues at 62: the state and label filters survive a page (`?label=bug&page=2` says
334 "Showing 51–59 of 59 open issues labelled bug"), and the Open/Closed links keep the
335 label while dropping the page.
336- A comparison of 180 commits pages at 100; search for `let` pages six times over 1,000
337 matches with uneven pages, which is the file-boundary cut doing its job; a hook with
338 60 seeded deliveries pages at 50. Branches, tags and the profile's one repository
339 render no control at all, which is the one-page case.
340- **Not walked**: a redelivery from page 2 (it would have sent a real request to the
341 hook's endpoint) — the widened read is covered by tests only; and the deliveries rows
342 were seeded into SQLite rather than earned by pushes.
343
344Screenshots in `target/shots/`, `paging-*`.
345
346#### The wave 2 integration pass — 2026-09-06
347
348The four branches merged and run as one app on port 3111, holding Steid's own history
349with two annotated tags, four imported repositories (ripgrep, cargo, clippy,
350rust-analyzer) and a private one. **Two things were broken at a seam, both in the same
351place: a use case that rebuilt a `Repository` and dropped a field.** See
352[progress.md]progress.md for the walk and the decisions; the ones that constrain future
353work:
354
355- **Issues stay open for writing on an archived repository**, and on an importing one.
356 Archiving says the *code* is finished, and an import is about the code arriving; a
357 tracker that closed itself because the code was done would be the wrong shape for the
358 conversation that follows a release.
359- **Rename and Archive are refused while an import is landing**, with the sentence the
360 transport gives a push. Both fight the clone for the directory. **Hooks may be added**
361 during an import, and the description, visibility and pin form still saves: none of
362 those touches the directory.
363- **Delete is deliberately outside the write guard.** Deleting is how a stuck import is
364 cleared, and the failed panel says so.
365- **An import can never land in an archived repository**: it creates a repository, so an
366 existing name is refused as taken before anything is cloned.
367- **An anonymous POST to a private repository's routes answers 400**, not 404 — the form
368 parser refuses a body before any use case runs. It is the same 400 an unknown repository
369 gives, so nothing leaks, but the reasoning is the form parser's rather than ours.
370
371### Opened by wave 3
372
373- **A reference is not styled by state** (closed vs open, existing vs not); that needs a
374 batch lookup per body, not a query per reference. Cross-repository references
375 (`ada/steid#12`) and full Steid URLs are plain text.
376- **Fences are highlighted on every render, uncached** — now paid by the README on the
377 landing page, the most-visited page, which is where the missing cache shows first.
378- ~~Diffs, READMEs and markdown code fences are unhighlighted~~ — READMEs and fences
379 done; diffs still plain.
380
381- **Nothing sweeps expired tokens and nothing warns before expiry** (no notification
382 channel exists). `GIT_PER_CLIENT = 60` is reasoned, not measured. The git limiter keys
383 on `X-Forwarded-For` like the login one, so `STEID_TRUSTED_PROXY` now guards two
384 endpoints' worth of question. `list_tokens` and `authenticate_token` take a `now`;
385 ~~`create_repo` and `serve_git` still read the clock~~ — all four closed.
386- ~~Tokens have no expiry and no last-used timestamp~~ — done.
387 ~~No rate limiting on token authentication~~ — done.
388
389- **Feeds**: `?rev=` naming a missing branch answers 200 and empty; issue feed content
390 carries Tailwind classes (harmless in a reader, which ignores classes it has no
391 stylesheet for); the issue feed orders by `created_at` while entries'
392 `<updated>` is `updated_at`; same-second events tie-break by id; no `ETag`,
393 `Last-Modified` or rate limit; an importing repository feeds an empty commit list.
394- ~~Feed content's cross-links were relative~~ — **absolute now**; `Crossref` carries an
395 optional `origin` the feed sets and every page leaves `None`.
396- **Steid has no per-page `<title>`**, and a page cannot contribute to `<head>`; see the
397 feeds entry in progress.md for the shape of the fix.
398
399- **Labels**: the delete confirm is a client-side `required` checkbox (a direct POST
400 bypasses it — a confirm for a person, not an authorization); the labels list is
401 unpaged; no bulk labelling, multi-label or "unlabelled" filter; renaming a label
402 breaks bookmarked `?label=` URLs; no `/api` surface. ~~The palette lives in both
403 `LabelColour::ALL` and `styles.css`~~ — it still does, but a test in `web/labels.rs`
404 now reads the stylesheet and asserts the two agree in both directions, so a ninth
405 colour cannot be half added.
406
407- **Polish leftovers**: ~~a redelivery beyond the last 50 attempts cannot be made~~ —
408 closed, `redeliver` reads the hook's whole history now;
409 ~~`redeliver` is the fourth internal clock read~~ — closed; the
410 concurrency limit is not a size cap; "Queued" is process-local; a row stuck at
411 `importing` because the recording failed cannot be retried until a restart; the
412 search switcher costs a `for-each-ref`; `language_of` re-runs `syntax_for`; ~~a handle
413 called `orphaned` is never reconciled~~ — it is a reserved handle now, pinned by a
414 test beside `QUARANTINE`; nothing
415 reconciles a row whose directory is missing.
416- ~~An orphaned repo directory is possible~~ — swept aside on boot now.
417- ~~The sidebar's Download links can only ever offer the default branch~~ — the tags
418 page carries each tag's archives, which closes the entry point.
419
420#### The wave 3 integration pass — 2026-09-06
421
422The six branches — tokens, labels, cross-links, feeds, the polish bundle and paging —
423merged and run as one app on port 3119, holding this repository's own history (190
424commits, two branches, four tags), 62 issues opened through the form, three labels with
42555 issues wearing `bug`, one public repository and one private. **One thing was broken
426at a seam, and it was two branches meeting rather than either being wrong**: markdown
427cross-links render a path with no host, which is right on a page and wrong in a feed,
428where the content is read somewhere else entirely. `Crossref` gained an `origin`; the
429page still passes `None`.
430
431What was walked, and held:
432
433- A `#12` and a bare sha in an issue body, and both again in the README on the landing
434 page, each landing on the issue and the commit they name.
435- Issues at 62 and 55 labelled: `?label=bug&page=2` says "Showing 51–55 of 55 open
436 issues labelled bug", the Open/Closed links keep the label and drop the page.
437- `/log` at 190 commits pages at 50; `?page=400` clamps to the last page and
438 `?page=banana` to the first. The log's Feed link keeps `?rev=`, on a revision and on
439 a paged revision, and `commits.atom?rev=older` is that branch's log.
440- A token with a 30-day expiry clones and pushes; the tokens page then reads
441 `Expires 2026-10-06 · Last used 4 minutes ago`.
442- The tags page's `tar.gz` for `v0.3.0` downloads and extracts under `steid-v0.3.0/`.
443- Search pages six times over 1,000 matches, the revision switcher carries the query and
444 drops the page, and the blob header names Rust and TOML and says nothing for a file
445 with no grammar.
446- A webhook fired by a real push, then redelivered from its deliveries page: identical
447 bytes, a fresh signature, recorded as `try 2` continuing the event's sequence.
448- **Anonymous on the private repository 404s on every route**, the new ones included:
449 landing, log, `log?page=2`, issues, `issues?label=bug&page=2`, labels, both feeds,
450 tags, branches, search and the hooks page. Its name appears nowhere in the owner's
451 public activity feed.
452
453Two things the pass found, neither a break:
454
455- **The Feed link on a filtered issue list offers the whole feed.** A feed has no
456 filter concept, so a reader who clicks it from `?label=bug` subscribes to everything.
457 Either the link should carry the filter or it should say "all issues".
458- **`latest_tag` breaks a same-second tie by refname**, so two tags created in the same
459 second show the alphabetically-first as "Latest tag". Only reachable from a fixture
460 that tags twice in one second; git's own ordering, not ours.
461
462Screenshots in `target/shots/`, `wave3-*`.
463
464### Opened by the kept-alive `cat-file`
465
466- **The pool holds memory nothing measures.** Two `git cat-file` processes per live
467 repository, up to 64 of them, each holding its repository's pack indexes open. The
468 caps are chosen rather than derived and there is no metric that says what one costs on
469 a real instance — the first thing to look at if an instance's resident size surprises
470 someone.
471- **The pool is unmeasured under concurrency.** Requests serialise per repository per
472 stream, which is right for one reader and untested for fifty: a second visitor's tree
473 page queues behind the first's. A pool of N processes per repository is the fix if it
474 ever shows, and it is a change to `cat_file.rs` alone.
475- **A desync is a 500 with no retry.** Deliberate — the stream has lost its place and
476 re-asking would answer from a process that is already gone — but it means one bad
477 reply fails one request rather than degrading. Nothing has ever produced one outside
478 the test that fakes it.
479- **The last-commit column re-walks history on every tree page.** One `git log
480 --name-only` capped at 500 commits, uncached, and a directory whose entries were all
481 last touched beyond that cap pays the cap in full to attribute nothing. Caching it per
482 (tree id, directory) would be exact — a directory's history cannot change while its
483 tree id does not — and is the obvious next step if a tree page ever feels slow.
484- **A merge attributes nothing.** `git log --name-only` prints no file list for a merge
485 commit, so a file whose most recent change arrived by merge is attributed to the
486 commit inside the branch rather than to the merge. git's answer, and the more useful
487 one, but it means the column can name a commit that is not on the branch's first-parent
488 line.
489- **The column is not on the branches, tags or compare pages**, and nothing else lists
490 files, so there is nowhere else it belongs yet. A pull request's file list would be the
491 first.
492- **`--batch-command` is left on the table** until Ubuntu 22.04 is out of support, at
493 which point the pair of processes becomes one. Recorded in the ADR, not urgent.
494
495### Opened by wave 4
496
497**Wave 4 is closed.** Its six seams are done and the whole of it has been walked as one
498app — see the pass below. What is left open is listed here.
499
500- **Diff highlighting does not go through the cache**, and a hunk opened inside a
501 multi-line string above it colours wrong (asserted, deliberate). **Nothing measures the
502 cache** — no hit rate, resident size or eviction count — and it now sits beside two
503 more unmeasured caps, the cat-file pool's and the merge cache's. The per-line 32-byte
504 overhead is a guess, and so is the merge cache's 128-byte one.
505- ~~Highlighting caches nothing~~ — done.
506
507- ~~A followed history count is an uncapped walk~~ — **capped at 500**, the last-commit
508 column's number, with `500+` on the page and the paging control offering only the pages
509 that were counted. **The cap has never been reached on a real repository**: Steid's own
510 longest file history is 52 commits, so only the tests exercise it.
511 A path's history still runs two walks per page. A submodule's own commit is never
512 resolved; nested `.gitmodules` are not read; the 100-link cap is chosen.
513 ~~Rendered markdown headings have no ids~~ — **they do**, slugified and deduplicated,
514 and the relative-link resolver now carries the `#fragment` across (found at a seam:
515 the ids landed first and the resolver was still dropping fragments). Raw-route images
516 are verified in Chrome only; Firefox and Safari may honour `nosniff` for images.
517- ~~Submodule rendering was never seen~~ — seen, linked, tested, and walked.
518
519- **Pull requests**: no assignees, reviews, milestones, `/api` or feed; owner-only
520 writes (merging must stay owner-only at Milestone 7); the Conversation tab asks git 2–4
521 questions per view — ~~and `merge_preview` writes unreferenced objects nothing gc's~~,
522 which is now **once per pair of commits** rather than once per view, though the objects
523 a first view writes are still unreferenced and still ungarbage-collected; the Commits
524 and Files tabs re-run the comparison; squash lists at most 50 subjects; the strategy
525 control is a native `<select>`; ~~"Closes #4" does nothing~~ — **it closes the issue and
526 comments on it**; ~~the delete-source checkbox defaults on even when the source is the
527 default branch~~ — **it opens unticked there**; `Unrelated` and the stale-ref refusal
528 are tested, not walked.
529- ~~Pull requests carry no labels~~ — **they do**, through a second join table; the
530 reasoning is in [progress.md]progress.md. No assignees or milestones still.
531- **A merged request's Commits and Files tabs go blank once its source branch is
532 deleted.** Both tabs resolve the branches live, so "spike adds no commits to main" is
533 what a merged-and-tidied request says about the change it landed. `merge_commit` is the
534 one thing stored, which is why the Conversation tab still says what happened. Storing
535 the source's head at merge time would fix it and is the same decision as storing a head
536 while open, which was deliberately refused — worth revisiting as one question.
537- **The last-commit column names the commit inside the branch, not the merge**, so a
538 file that arrived by merge attributes to the branch commit rather than to
539 "Merge pull request #3". That is `git log --name-only`'s own answer and the existing
540 decision (see the cat-file section above), but it is the one place the wave's features
541 meet and disagree about what a file's last change *was*. Changing it means walking
542 with `-m --first-parent`, which changes what the column means everywhere — a decision,
543 not a fix.
544
545#### The wave 4 integration pass — 2026-09-06
546
547The four branches merged, the six seams built, and the result run as one app on a real
548instance: this repository pushed with six branches and two tags, plus a purpose-built
549fixture repository (a rename, a submodule, a markdown file with headings, a conflicting
550pair of branches) and one private repository. Walked in a browser and with `curl`:
551
552- a pull request's **Files changed** shows highlighted diffs, Rust and markdown alike;
553- the compare page's **Create pull request** carries both branches into the form, which
554 prefills the title from a one-commit branch and opens a request that **merges**;
555- a merged request's sha **lands on the commit page**, and the fast-forward merge left
556 `main` alone because the box was unticked — which is seam 1, seen in a browser;
557- **`Closes #1`** in a merged request's body closed issue 1 and left a comment naming the
558 request and the branch it landed on; the `#3` in that comment points at `/issues/3`,
559 which 303s to `/pulls/3` — the cross-kind redirect doing its job;
560- a file's **History** follows the rename, and each row's sha reaches a commit page whose
561 diff is highlighted;
562- a rendered markdown file's headings carry ids and the README's
563 `docs/notes.md#the-second-section` **lands on the section** — after the fix below;
564- a **submodule row** links to `https://github.com/rust-lang/log.git` at its pinned sha;
565- a **labelled pull request filters**: `?label=bug` narrows the list and all three state
566 counts follow it, and the labels page counts issues and requests apart;
567- the tree page's **last-commit column survived `pkill -f 'cat-file --batch'`** — same
568 page, same 70 ms, two fresh processes;
569- a **conflicted request** costs one `merge-tree`: 43 ms on the first view, ~18 ms
570 after, and five more views wrote **no new loose objects**;
571- **anonymous on a private repository 404s on every route this wave touched** — fourteen
572 GETs and four POSTs, and the two POSTs that answer 400 answer it identically for a
573 repository that does not exist, so nothing is leaked.
574
575**One thing broke at a seam and was fixed**: heading ids landed in the renderer while
576both relative-link resolvers were still stripping `#fragment` from a rewritten link, so a
577README's link to a section of another file went to the top of that file. The fragment is
578now carried across.
579
580### Carried over — small, unblocked
581
582- **A client that disappears mid-request leaves the body-copy task waiting.** The copy
583 into git's stdin runs in its own task and nothing cancels it if the connection drops.
584 Bounded by the backend exiting and closing the pipe, but not by anything deliberate.
585- **No automated test asserts the security headers.** There is no HTTP-level test
586 harness, so losing the CSP would be silent. The likeliest regression is someone using
587 `insert()` instead of `or_insert()` and flattening the raw endpoint's stricter policy.
588- **`cargo audit` has never been run**, and the dependency tree has not been reviewed.
589- **A subprocess per git request.** Unlike Milestone 3's once-per-creation, this is on a
590 hot path and has not been measured. Milestone 5 is where that bill comes due.
591- **Streaming is by construction, not by measurement.** The response body is never
592 collected, but no clone large enough to prove it has been run.
593- **An orphaned repo directory is possible** if the process dies between the record
594 write and the filesystem write, and it then blocks re-creating that name. The durable
595 fix is a reconciliation sweep on boot
596 ([architecture.md]architecture.md#db-plus-filesystem-writes); clearing one is a
597 manual `rm` today, since repo deletion does not exist.
598- **The duplicate-name check races.** The loser is caught by `init_bare` or the unique
599 constraint, but surfaces as an opaque storage error rather than "name taken".
600- **Bare repos created on macOS carry `ignorecase = true`.** A migration gotcha if the
601 data directory ever moves to Linux.
602- ~~**Light mode is still untested**~~ — **looked at 2026-09-05** on the repository
603 landing page, a tree and a blob, by temporarily flipping the layout's `class="dark"`
604 and screenshotting. Nothing was wrong: every colour on these pages already comes from
605 a token. The profile, the settings pages and the log have still not been checked, and
606 **there is still no way for a visitor to choose** — the layout hardcodes `dark`.
607- **The `/log` page's switcher opens with nothing marked current** when no revision is
608 in the URL, because `repo_log` still does not report the revision it resolved. Now more
609 visible than before, since there is a switcher to look wrong.
610- **Task-list items keep their bullet** and footnotes render in place rather than
611 collected at the end. Both cosmetic.
612- ~~**The landing page now makes 15 `git` processes**~~ — **4 now**, and 115 ms of
613 latency has become 31 ms. The fix was 0006's kept-alive `cat-file --batch`, as that
614 entry said it would be; see the
615 [third amendment]decisions/0006-git-binary-behind-narrow-ports.md#amendment--20260906-stage-2-a-kept-alive-cat-file
616 for the whole before/after table.
617- **`count_commits` costs two processes, not one.** It resolves the revision before
618 running `rev-list --count`, because `rev-list` is fatal on an empty repository and on
619 an unknown branch, and this module's rule is that a non-zero exit from git is always a
620 real fault. `--ignore-missing` was tried: it covers a bad object id, not a bad
621 revision *name*.
622- **`bg-muted` is not a token and never was.** Three `<pre>` blocks used it, so they
623 have been rendering with no background at all — silently, exactly as `ui.md` warns
624 about classes Tailwind never ships. Fixed on the clone block, the empty-repository
625 push snippet and, last, `token.rs`'s new-token block. All three now use `bg-surface`,
626 and `bg-muted` appears nowhere in `src/` — only `bg-muted-foreground`, which is real.
627- **The licence sniffer reads 1 KiB, not the 200 bytes first sketched.** BSD-2 and
628 BSD-3 differ only by a third clause about 900 bytes in. `LICENSE-MIT` and other
629 suffixed spellings are not detected: the filename list is deliberately short, because
630 every extra candidate is another speculative blob read.
631- ~~**A per-file last-commit column is still absent**~~ — **shipped**, on the root and
632 on every subdirectory, once the kept-alive `cat-file --batch` it was waiting on
633 landed. One `git log --name-only` per listing, not one per entry.
634- **Fonts are not loaded.** The theme names Geist and IBM Plex Mono; both fall back
635 today. Topcoat's `font-fontsource` feature handles it.
636- **The auth pages are unstyled.** `/auth/setup` and `/auth/login` are still bare
637 milestone-1 HTML, and the styled top bar now sits right above them making it obvious.
638- **The top bar's wordmark says "steid"**, not the owner's identity — see the open
639 question at the end of [ui.md]ui.md#the-shell.
640- **Light mode is untested.** The palette defines it; nobody has looked at it.
641- **No rate limiting** on `/auth/login` or `/auth/setup`.
642- **`sweep_expired` is never called**, so expired session rows accumulate. Expiry is
643 enforced on read, so this is tidiness, not a hole.
644- **CSRF.** `SameSite=Lax` covers the common case. Forms now exist, so this is decidable
645 rather than hypothetical.
646
647## Backlog
648
649Ordered. Pull from the top.
650
6511. **Milestone 6 — Writing.** Posts, markdown, `/{handle}/posts/{slug}`. Open when it
652 starts: which markdown crate, and whether raw HTML in markdown is trusted — safe for a
653 single author, a stored-XSS hole the moment Milestone 7 adds a second user. A
654 repository's README rendering on its page falls out of the same pipeline.
655
656### Forge feature candidates (surveyed 2026-09-05)
657
658Not yet ordered against Milestone 6. Grouped by what they touch, because the plan is to
659run several agents at once and the grouping is what decides what can run together.
660**Sections 1 and 2–4 are done; 5–7 are what is left.** Shared hotspots: `GitQuery` in `port.rs` (every
661browsing feature appends a method), `git_query.rs`, the repo sub-nav, and `plans/`
662itself. New tables touch `sqlite.rs` + `in_memory.rs` and should merge one at a time.
663
664**Sections 1 and 2–4 have now had a wave each. Wave 2 is done** — rename, default
665branch, archived, issues, import from a URL, push events and webhooks, all merged and
666then walked together as one app; see the integration pass above. **Wave 3 is done too** —
667token expiry and last-used, a rate limit on token auth, issue labels, markdown
668cross-links and highlighted fences, Atom feeds, paging everywhere, and the wave 2
669follow-ups; merged and walked, see the wave 3 pass above.
670
671**Section 1 is done**, the per-file last-commit column included — it was the one thing
672left, and the kept-alive `cat-file --batch` it waited for
673([0006]decisions/0006-git-binary-behind-narrow-ports.md) shipped with it. Shipped: the two-column
674repository landing page, syntax highlighting, branches and tags pages, archive
675download, code search, the commit page, compare, and blame. All eight were merged and
676then walked together as one app; see the integration pass above. See
677[ui.md]ui.md#the-repository-page for the layout and the entry-point map, and
678[progress.md]progress.md for what each cost.
679
6801. ~~**Read-only browsing**~~ — **done**, the per-file last-commit column included. It
681 was the last thing outstanding and it arrived with the kept-alive `cat-file --batch`
682 that [0006]decisions/0006-git-binary-behind-narrow-ports.md said had to come first.
6832. **Repo model** — **done** except **topics and pinned repos on the profile** and the
684 **orphan-directory reconciliation sweep on boot**, which now has three shapes to
685 handle (a create that died, a rename that died, an import that died). Shipped: rename,
686 the default branch setting, the archived flag.
6873. **Collaboration**: **issues and labels done**; still open are **pull requests** (needs
688 the commit and compare pages, plus a merge on the bare repo) and **milestones** (8+).
6894. **Transport and git ops** — **done** for this wave: import from URL, post-receive
690 events and webhooks, `REMOTE_USER` passthrough. Still open: **LFS** (not yet) and
691 **SSH** (would reverse [0001]decisions/0001-git-over-http-not-ssh.md).
6925. **Identity and auth**: ~~token expiry and last-used~~ · ~~rate limiting on token
693 auth~~ — both done in wave 3. Still open: CSRF (touches every form — run alone) ·
694 Milestone 7 multi-user (run alone) · nothing sweeps expired tokens and nothing warns
695 before one expires.
6966. **Portfolio**: posts (Milestone 6) · profile links · ~~Atom feeds for commits~~ —
697 done in wave 3 (commits, issues and push activity); posts will want one when they
698 exist.
6997. **Platform and quality**: scheduled backups and served releases (closes 5b) ·
700 HTTP-level test harness plus security-header tests and `cargo audit` · `/api`
701 coverage for existing use cases · styled auth pages, light mode, fonts.
702
703Process decisions, now answered by the wave rather than open: agents **do** get
704worktrees and short-lived branches, which is a deliberate bend in the commit-to-main
705rule and worth keeping for a wave; and agents do **not** edit `plans/` — each writes a
706handover the merging session folds in, because five agents appending to `current.md`
707conflict every time. The integration pass afterwards is not optional: it is the only
708place a cross-feature link is ever exercised.
709
710Wave 2 amends one of those: an agent working **alone** — the integration pass is one —
711edits `plans/` in the same commits as the code, as CLAUDE.md asks. The no-`plans/` rule is
712about concurrent agents, not about agents.
713
714## Open questions
715
716- **Topcoat is early** (v0.5.0, first released 2026-07-22, breaking changes expected
717 by its own authors). Expect churn that isn't feature work.
718- Topcoat ships Tailwind without Node, which reopens the design system attempt #1
719 dropped purely to avoid an npm build step — see [ui.md]ui.md.
720
721## Routing findings (Milestone 0)
722
723- **Topcoat 0.5 requires rustc ≥ 1.95.** On an older toolchain `cargo add topcoat`
724 silently resolves to an empty `topcoat v0.0.0` placeholder instead of failing. Local
725 stable is now 1.97.1.
726- `Router::builder().discover()` collects `#[page]`-annotated items **at link time**,
727 so pages can live in any module. Layering is our choice, not the framework's.
728- `module_router!` derives each URL from the module tree rather than a path string.
729 Still deferred. Application routes now group cleanly (`auth/login`, `api/me`), but
730 handles sit at the root ([0004]decisions/0004-root-handles-grouped-routes.md), so a
731 parameterised root segment still has to coexist with static ones. Worth checking how
732 `module_router!` handles that before committing to it.
733- Path and query params are read from `Cx` via `path_param!` / `#[query_params]`, not
734 injected as handler arguments. Parses are memoized per request.
735- Layouts wrap by path prefix and nest outermost-first, and a layout can catch a page's
736 `NotFoundError` to render a branded 404.
737- `HOST` / `PORT` configure the bind address, so `STEID_LISTEN_ADDR` is gone.
738- `Body` is a boxed `http_body::Body` used for both requests and responses, with
739 `into_data_stream()` to read and `Body::new()` to wrap a stream — pack data can
740 stream both directions without buffering. This is what makes Milestone 4 viable.