steid

@jamesgill /

steid/plans/current.md
Markdown67.4 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
67- **`MAX_RAW_BYTES` is 10 MiB**, chosen rather than derived. It bounds what one raw
68 request can hold in memory, because `GitQuery` reads bytes rather than streaming them.
69 Raising it means a handful of concurrent requests can hold that much each.
70- **The profile has no links.** `Organization` carries a display name and a bio and
71 nothing else, so the design's links row is not backed by data and was left out rather
72 than faked. A `links` field plus a settings control is the small feature that fixes it.
73- ~~**`create_repo` and `serve_git` read the clock internally**~~ — **closed.** Both take
74 a `now`; the [`Clock`]../src/application/port.rs port covers the one case that cannot
75 (webhook delivery, which reads per attempt). **`import_repo` and `run_import` still
76 read the clock internally** — a background task that runs for minutes has no caller's
77 `now` worth taking, so it is the next `Clock` caller rather than a `now` one.
78- **A push touches `updated_at` twice** — once for the advertisement, once for the RPC.
79 Harmless, same second, but two writes per push.
80- **A licence.** A public portfolio repository probably wants one, and the README
81 deliberately says nothing about licensing rather than guessing.
82- ~~Blocked on a domain transfer~~ — **transferred 2026-08-29**, so Phases 1–6 of the
83 deployment runbook are unblocked.
84- **(historic) Blocked on a domain transfer** (noted 2026-08-29). `jpgill.dev` is the
85 intended host for both the instance and the release downloads; the transfer is in
86 flight. Phases 1–6 of the deployment runbook cannot start until DNS resolves, because
87 Caddy requests a certificate on startup. Nothing else is blocked by it — the artifact
88 is built and verified, and `install.sh` still needs its container dry-run.
89- **A domain.** Caddy needs a real hostname to obtain a certificate. This is the one
90 blocker that is DNS rather than code.
91
92### Open
93
94- **Whether an absent *public* repository can 404 while private ones still 401.** The
95 uniform 401 from [0007]decisions/0007-tokens-over-http-basic.md is what makes a
96 private repository indistinguishable from one that does not exist — but it also turns
97 every mistyped URL into "Authentication failed", which cost real time on the first
98 deployment. The leak being prevented concerns *private* names only, so answering 404 for
99 a repository that would be public if it existed may cost nothing. Needs thought about
100 whether that is actually true.
101- **Zero-downtime deploys — deferred, deliberately.** `deploy.sh` currently stops the
102 service, swaps the binary and starts it: about two seconds. The plan, when it is worth
103 building: a systemd **template unit** `steid@.service` where the instance name *is* the
104 port, with `/opt/steid/3000` and `/opt/steid/3001` as separate install directories.
105 Deploy alternates — install to the idle port, start it, health-check it **directly on
106 loopback**, rewrite Caddy's upstream and `caddy reload` (graceful; existing connections
107 finish), then stop and disable the old one and enable the new so a reboot brings back
108 the right one.
109
110 Two things make this more than a shell script, and they are the reason it is deferred
111 rather than half-built:
112
113 - **Both processes share one SQLite database during the overlap.** WAL allows that, and
114 Steid's writes are short, so the overlap itself is fine. **Migrations are not.** The
115 new binary migrates on boot while the old one is still serving, so any schema change
116 that the old binary cannot tolerate — a new `NOT NULL` column, a dropped column —
117 breaks the still-live version. That is a constraint on how migrations are written
118 (**expand, deploy, contract**), not something the deploy script can solve.
119 - **An in-flight `git push` is cut when the old process stops.** `topcoat::start`
120 already drains on SIGTERM, so the fix is to stop the old one *after* Caddy has
121 repointed and let it finish what it has.
122
123 Worth building when instances belong to other people. At two seconds on a personal site,
124 it buys nothing today.
125- **Scheduled backups** are now `install.sh --backups daily` (off by default) and `steid backup`; the control plane ships them offsite. Historic: `/var/lib/steid` is the whole of the state and copies of it
126 exist only because they were taken by hand. This is the largest gap now that the
127 instance is live.
128- ~~Releases are not served from the instance yet~~ — **served, 2026-09-08**; artefacts at `/srv/steid-dist`, published by `deploy.sh --publish`. What follows is historic: The Caddy blocks are written and
129 commented in `deploy/Caddyfile`, and `install.sh`'s `RELEASE_BASE_URL` points at
130 `/jamesgill/repos/steid/releases`, but nothing has been rsynced there — so the
131 one-command install a stranger would run does not work yet.
132
133### Opened by the section 1 wave
134
135- **Diffs, READMEs and markdown code fences are unhighlighted.** The README goes through
136 `web/markdown.rs`, which writes its own `<pre><code>`; wiring `highlight.rs` into it is
137 a small follow-up. Blame was the fourth of these and is now done, so the adapter is
138 reached from two pages and the pattern for a third is set: build the file's text in
139 line order, call `source_lines` **once**, render `Classed` through `Unescaped`.
140- ~~`.jsx` is plain~~ — **aliased onto JavaScript.** `highlight.rs` gained an `ALIASES`
141 table, consulted only after the syntax set's own answer, so an alias can never
142 overrule a real grammar. It has one entry and should stay small.
143- **`\r\n` files keep the `\r` inside highlighted markup.** Invisible under
144 `white-space: pre`; noted rather than fixed.
145- **The blob header does not name the detected language.** It is only visible as colour.
146
147- **No ahead/behind counts on the branches page**, by decision: a `rev-list` per branch
148 is twenty forks for twenty branches. Waits for a kept-alive git.
149- ~~Neither refs page is paginated~~ — **both page**, 100 rows each, sliced in the use
150 case rather than in the port: `for-each-ref` returns every ref in one process, so a
151 `limit` there would buy nothing and cost a second call for the count. The settings
152 form's default-branch `<select>` asks for `None` and still gets every branch — an
153 option missing from it would be a branch nobody could choose.
154- **A repository with tags but no branches** says "No branches"; real but exotic, not
155 fixture-tested.
156- **`web::browse::{encode, timestamp}` are now `pub(super)`**, and `repo_stats` takes
157 `handle` and `name` so the sidebar counts can link. `timed_out` has since moved to
158 `web::context`, as this said it should.
159
160- **`git grep` output is collected whole before it is capped.** A one-letter query on a
161 big repository allocates all of git's output to keep 200 hits. Bounded by the 20 s
162 timeout, not by anything deliberate.
163- ~~The archive endpoint has no rate limiting~~ — limited (10/client/min). It is outside the read timeout, on
164 purpose (a large repository legitimately takes longer to pack). It is the most
165 expensive anonymous request in Steid: a full pack per hit. First thing to look at under
166 load. A late `git archive` failure is a truncated download, logged like the protocol
167 server's.
168- ~~Search has no paging~~ — **results page**, ~200 matches a page, **cut at a file
169 boundary rather than a line**: a file's matches are one block under its path, so a
170 page that ended mid-file would print the heading twice and split what reads as one
171 thing. A page holding a 300-match file overshoots instead, which is the right way
172 round. A search collects at most `SEARCH_MAX_MATCHES` (1,000) across all its pages —
173 paging must not turn a one-letter query into unbounded work, since `git grep` output
174 is still collected whole — and past that the page says to narrow the search.
175 **Every page re-runs the grep**; there is no cursor a second page could resume from.
176 Search still `trim()`s the query, cuts matched lines at 500 characters (which can
177 remove the match on a minified line), and ignores `GrepHit::column` when marking.
178
179- **The commit page's timeout state has never been rendered**, like search's and the
180 refs pages'. The predicate itself is now `web::context::timed_out`, shared by `refs`,
181 `commit` and `blame`; each page still writes its own panel, and `search_repo` still
182 answers in the application layer.
183- **`Diff::files` is emptied wholesale when the patch is truncated**, falling back to the
184 numstat list, so a 10 MiB commit shows no lines rather than the first few files.
185 numstat itself could in principle be truncated at ~300,000 changed files.
186- **A merge commit is diffed against its first parent only**, and merge rendering was
187 compiled, not seen: no fixture contains one.
188- **`MAX_RAW_BYTES` now does a second job** as the diff cap; retune both together.
189- **`bg-surface` is nearly `bg-background` in light mode**, so a file header reads only
190 by its border there. Pre-existing, but the commit page has one per file.
191- ~~No paging anywhere in history~~ — **`/log` and a comparison's commit list page**,
192 `?page=N`, 50 and 100 a page, with the shared control from [ui.md]ui.md#paging.
193 Each costs its page a `rev-list --count`. **A comparison's diff does not page**: it is
194 what the whole range changes, so it is the same on page 2 as on page 1, and a range
195 wide enough to need paging still renders one diff capped by `MAX_RAW_BYTES`.
196- **The compare form's `<datalist>` costs a `list_refs`** rendered inline on every visit.
197- ~~Nothing links to a commit by its sha yet~~ — done.
198
199- ~~The blame page has no revision switcher~~ — **added**, and `Switch` in
200 `web/browse.rs` now has a `Blame` arm, so switching branch keeps you on blame at the
201 same path. It costs the page one `list_refs`, which is what the wave deferred.
202- **`BlameCommit::boundary` and `author_name` reach only the tooltip.** The row is sha,
203 summary, date and must stay one line. On a multi-user instance the author is the first
204 thing to revisit.
205- **Blame is the most expensive read in `GitQuery`** and the likeliest to meet the 20 s
206 timeout. Nothing but this page calls it. ~~It also pays a second existence check~~ —
207 the check is now a line to a running `cat-file`, so the page costs two processes
208 rather than five and the double check costs no fork at all.
209- ~~Cross-branch links were verified only after the merge~~ — **walked, 2026-09-05**,
210 see the integration pass below.
211
212#### The integration pass — 2026-09-05
213
214The five branches merged and run as one app, on a real instance holding Steid's own
215history: 9 branches, 2 annotated tags, one public repository and one private. Every
216link that crosses a feature boundary was followed in a browser, and **nothing was
217broken at a seam.** Landing sha → commit page; log sha → commit; commit's "Browse
218files" → tree at that sha and its parent sha → the parent's page; the counts and the
219sidebar → branches and tags; a branch row → tree, log and a compare with a real diff
220(a merged branch correctly says there is nothing to compare); a search hit's line
221number → `blob#L<n>` with the anchor present and landing; `Code · Blame · Raw` in both
222directions; blame's sha → the commit page and its line number → the blob anchor;
223`zip` and `tar.gz` for `main` and for a tag, both extracting under `steid-<rev>/`.
224**A private repository 404s on all eleven routes anonymously** — landing, log,
225branches, tags, commit, search, tree, blame, raw, archive, compare. Highlighting still
226renders after the blame toggle and the anchor edits landed on the same table: Rust and
227TOML coloured, a plain file not. Screenshots of the whole flow in dark and light are
228in `target/shots/`.
229
230Two things the pass found, neither a break:
231
232- **The sidebar's Download links can only ever offer the default branch.**
233 `clone_block` takes a revision and its doc says the links are "for the revision being
234 viewed", but the sidebar renders only on the landing page, which has no `{rev}` — and
235 the tree and blob pages, which do, are single-column by design. So a tag's tarball is
236 reachable only by typing `/archive/v0.2.0.zip`. Both formats work at both revisions;
237 it is the entry point that is missing, and putting it on the tree page means deciding
238 whether that page gets a sidebar, which [ui.md]ui.md#the-repository-page settled the
239 other way.
240- ~~Blame renders its lines unhighlighted while the blob highlights them~~ — **closed.**
241 Blame's code cell now goes through `source_lines`, the blob's own adapter, so the two
242 views share classes, caps and plain fallback. Both render the same file to an
243 identical set of `hl-` spans, and rows stay 19.5px — the only variance is at a run's
244 hairline, which is `border-collapse` splitting that 1px, not the markup.
245
246### Opened by wave 2
247
248Everything struck through here has moved to [progress.md]progress.md; what is left is
249what is still open.
250
251- **A rename can strand a directory** if the process dies between the move and the row
252 write; same class as create's orphan, and the reconciliation sweep now has two shapes
253 to handle. **A rename races**: two renames onto one name both pass the free check and
254 the loser gets "name taken" for the wrong reason.
255- **Renaming touches nothing that stores the old name outside the row**, which the
256 integration pass walked: hooks, their delivery log and issues all followed a rename, and
257 the next push's payload named the new repository and URL. A webhook *target* or an issue
258 reference would have to be renamed with it.
259- **Every use case that rebuilds through `Repository::new()` must carry the fields
260 `new()` resets** — `pinned`, `archived`, and now the import trio. `update_repo` was
261 missing the trio, which is how a visibility save during a real import ended the import
262 as far as Steid was concerned. The next field added to `Repository` outside the
263 constructor has the same trap waiting; a builder that took the whole existing row would
264 close it for good.
265- **The settings page costs a git process** (`branches()`, for the select) — except
266 during an import, when it is skipped.
267- **The profile's Repositories tab pages at 50**, sliced *after* the visibility filter
268 so page 2 is never short by however many private repositories page 1 counted. The
269 overview and `/api/…/repos` both ask for the whole list (`None`) and are unchanged.
270
271- **A rejected issue burns a number** (allocated before validation); a gap costs
272 nothing next to a reused number. ~~No paging on issue lists~~ — **they page**, 50 a
273 page, and the state and label filters travel with the page number (`filtered_url`
274 builds all three, with tests). **A label-filtered list is still read whole**: which
275 labels an issue wears lives in a second table the list already reads to render its
276 pills, so the filter is applied in the use case and the page cut after it — the
277 unfiltered path is the one `limit`/`offset` serves.
278- **Owner-only issue writes are the single-user assumption showing.** Milestone 7 wants
279 anyone to open an issue on a public repository: a change to `writable_repo` only,
280 `author_id` is already stored and rendered.
281- No labels, assignees, milestones, search, cross-links (`#3` is plain text) or edit
282 history. `closed_at` is cleared on reopen. Body cap 65,536 characters, chosen.
283
284- **Imports have no size cap and no concurrency limit.** A 10 GB source fills the disk;
285 N submissions are N concurrent clones — the pass ran four at once without trouble, which
286 is evidence about a laptop and not about a server. A semaphore in app context is the
287 small fix; a disk-space check or `--depth` the other. **No retry control** — the row
288 keeps its source, so a Retry button on the failed panel is small. **An import starts
289 public** and the settings form can make it private while it runs.
290- **DNS is resolved twice** for imports (check, then git); a TTL flip between the two is
291 the gap. `.local` (mDNS) is not refused by *import* — `WebhookUrl` does refuse it, and
292 the same suffix list would suit both. `is_public` is a denylist of IANA ranges, now
293 shared with webhooks in `domain/net.rs`.
294- **Search on an importing repository answers 200 with no matches**, where the archive
295 and blame routes answer 404 and the panel says what is happening. Nothing is wrong, but
296 "no matches in a repository that has no contents yet" is a sentence the page could say.
297 The refs pages answer 200 there too; what they render was not read closely.
298
299- **Webhook retries do not survive a restart**; the rows written so far stay. A durable
300 queue is a different feature. **DNS rebinding is not closed** for hooks or imports.
301- **`webhooks.active` is honoured everywhere but nothing toggles it** (one POST and one
302 button). ~~The deliveries page is capped at 50, unpaged~~ — **it pages**, 50 attempts
303 a page, and the port gained `count_by_webhook` for the numbers. **Redelivery now reads
304 a hook's whole delivery history**: the button can sit on any page, and the attempt
305 number it writes counts every attempt the *event* has had — which the old 50-row
306 window got wrong as soon as an event fell out of it. Correct, but unbounded on a hook
307 with a long history; a `find` by delivery id plus a per-event attempt count would
308 close it. `push_events` only grows and has no page: the obvious next use is an
309 activity feed.
310- ~~**`deliver_push` reads the clock internally**~~ — it takes a `Clock` now. It still
311 takes no `Actor`: authorization is settled once in `record_push`.
312- **Slow endpoints hold a task ~2.5 minutes per push**, bounded by hooks per repository,
313 which nothing caps.
314- **`STEID_ALLOW_PRIVATE_WEBHOOKS` is a real hole when it is on**, which is why it is off
315 by default, warned about at boot and documented in [runbook.md]runbook.md beside
316 `STEID_INSECURE_COOKIES`. A deployed instance with it set lets anyone who can add a hook
317 read its own network's responses off the deliveries page.
318
319#### The paging pass — 2026-09-06
320
321Walked on a real instance on port 3118 holding this repository's own history (182
322commits, three branches, two tags) and 62 issues opened through the form:
323
324- `/log` at 182 commits: pages 1, 2 and 4 each say `Showing 51–100 of 182 commits` and
325 the like, `?page=400` and `?page=banana` both render page 4 and page 1 rather than an
326 error, and a branch force-pushed from 182 commits down to 2 answers a bookmarked
327 `?page=4` with those two commits and no control.
328- Issues at 62: the state and label filters survive a page (`?label=bug&page=2` says
329 "Showing 51–59 of 59 open issues labelled bug"), and the Open/Closed links keep the
330 label while dropping the page.
331- A comparison of 180 commits pages at 100; search for `let` pages six times over 1,000
332 matches with uneven pages, which is the file-boundary cut doing its job; a hook with
333 60 seeded deliveries pages at 50. Branches, tags and the profile's one repository
334 render no control at all, which is the one-page case.
335- **Not walked**: a redelivery from page 2 (it would have sent a real request to the
336 hook's endpoint) — the widened read is covered by tests only; and the deliveries rows
337 were seeded into SQLite rather than earned by pushes.
338
339Screenshots in `target/shots/`, `paging-*`.
340
341#### The wave 2 integration pass — 2026-09-06
342
343The four branches merged and run as one app on port 3111, holding Steid's own history
344with two annotated tags, four imported repositories (ripgrep, cargo, clippy,
345rust-analyzer) and a private one. **Two things were broken at a seam, both in the same
346place: a use case that rebuilt a `Repository` and dropped a field.** See
347[progress.md]progress.md for the walk and the decisions; the ones that constrain future
348work:
349
350- **Issues stay open for writing on an archived repository**, and on an importing one.
351 Archiving says the *code* is finished, and an import is about the code arriving; a
352 tracker that closed itself because the code was done would be the wrong shape for the
353 conversation that follows a release.
354- **Rename and Archive are refused while an import is landing**, with the sentence the
355 transport gives a push. Both fight the clone for the directory. **Hooks may be added**
356 during an import, and the description, visibility and pin form still saves: none of
357 those touches the directory.
358- **Delete is deliberately outside the write guard.** Deleting is how a stuck import is
359 cleared, and the failed panel says so.
360- **An import can never land in an archived repository**: it creates a repository, so an
361 existing name is refused as taken before anything is cloned.
362- **An anonymous POST to a private repository's routes answers 400**, not 404 — the form
363 parser refuses a body before any use case runs. It is the same 400 an unknown repository
364 gives, so nothing leaks, but the reasoning is the form parser's rather than ours.
365
366### Opened by wave 3
367
368- **A reference is not styled by state** (closed vs open, existing vs not); that needs a
369 batch lookup per body, not a query per reference. Cross-repository references
370 (`ada/steid#12`) and full Steid URLs are plain text.
371- **Fences are highlighted on every render, uncached** — now paid by the README on the
372 landing page, the most-visited page, which is where the missing cache shows first.
373- ~~Diffs, READMEs and markdown code fences are unhighlighted~~ — READMEs and fences
374 done; diffs still plain.
375
376- **Nothing sweeps expired tokens and nothing warns before expiry** (no notification
377 channel exists). `GIT_PER_CLIENT = 60` is reasoned, not measured. The git limiter keys
378 on `X-Forwarded-For` like the login one, so `STEID_TRUSTED_PROXY` now guards two
379 endpoints' worth of question. `list_tokens` and `authenticate_token` take a `now`;
380 ~~`create_repo` and `serve_git` still read the clock~~ — all four closed.
381- ~~Tokens have no expiry and no last-used timestamp~~ — done.
382 ~~No rate limiting on token authentication~~ — done.
383
384- **Feeds**: `?rev=` naming a missing branch answers 200 and empty; issue feed content
385 carries Tailwind classes (harmless in a reader, which ignores classes it has no
386 stylesheet for); the issue feed orders by `created_at` while entries'
387 `<updated>` is `updated_at`; same-second events tie-break by id; no `ETag`,
388 `Last-Modified` or rate limit; an importing repository feeds an empty commit list.
389- ~~Feed content's cross-links were relative~~ — **absolute now**; `Crossref` carries an
390 optional `origin` the feed sets and every page leaves `None`.
391- **Steid has no per-page `<title>`**, and a page cannot contribute to `<head>`; see the
392 feeds entry in progress.md for the shape of the fix.
393
394- **Labels**: the delete confirm is a client-side `required` checkbox (a direct POST
395 bypasses it — a confirm for a person, not an authorization); the labels list is
396 unpaged; no bulk labelling, multi-label or "unlabelled" filter; renaming a label
397 breaks bookmarked `?label=` URLs; no `/api` surface. ~~The palette lives in both
398 `LabelColour::ALL` and `styles.css`~~ — it still does, but a test in `web/labels.rs`
399 now reads the stylesheet and asserts the two agree in both directions, so a ninth
400 colour cannot be half added.
401
402- **Polish leftovers**: ~~a redelivery beyond the last 50 attempts cannot be made~~ —
403 closed, `redeliver` reads the hook's whole history now;
404 ~~`redeliver` is the fourth internal clock read~~ — closed; the
405 concurrency limit is not a size cap; "Queued" is process-local; a row stuck at
406 `importing` because the recording failed cannot be retried until a restart; the
407 search switcher costs a `for-each-ref`; `language_of` re-runs `syntax_for`; ~~a handle
408 called `orphaned` is never reconciled~~ — it is a reserved handle now, pinned by a
409 test beside `QUARANTINE`; nothing
410 reconciles a row whose directory is missing.
411- ~~An orphaned repo directory is possible~~ — swept aside on boot now.
412- ~~The sidebar's Download links can only ever offer the default branch~~ — the tags
413 page carries each tag's archives, which closes the entry point.
414
415#### The wave 3 integration pass — 2026-09-06
416
417The six branches — tokens, labels, cross-links, feeds, the polish bundle and paging —
418merged and run as one app on port 3119, holding this repository's own history (190
419commits, two branches, four tags), 62 issues opened through the form, three labels with
42055 issues wearing `bug`, one public repository and one private. **One thing was broken
421at a seam, and it was two branches meeting rather than either being wrong**: markdown
422cross-links render a path with no host, which is right on a page and wrong in a feed,
423where the content is read somewhere else entirely. `Crossref` gained an `origin`; the
424page still passes `None`.
425
426What was walked, and held:
427
428- A `#12` and a bare sha in an issue body, and both again in the README on the landing
429 page, each landing on the issue and the commit they name.
430- Issues at 62 and 55 labelled: `?label=bug&page=2` says "Showing 51–55 of 55 open
431 issues labelled bug", the Open/Closed links keep the label and drop the page.
432- `/log` at 190 commits pages at 50; `?page=400` clamps to the last page and
433 `?page=banana` to the first. The log's Feed link keeps `?rev=`, on a revision and on
434 a paged revision, and `commits.atom?rev=older` is that branch's log.
435- A token with a 30-day expiry clones and pushes; the tokens page then reads
436 `Expires 2026-10-06 · Last used 4 minutes ago`.
437- The tags page's `tar.gz` for `v0.3.0` downloads and extracts under `steid-v0.3.0/`.
438- Search pages six times over 1,000 matches, the revision switcher carries the query and
439 drops the page, and the blob header names Rust and TOML and says nothing for a file
440 with no grammar.
441- A webhook fired by a real push, then redelivered from its deliveries page: identical
442 bytes, a fresh signature, recorded as `try 2` continuing the event's sequence.
443- **Anonymous on the private repository 404s on every route**, the new ones included:
444 landing, log, `log?page=2`, issues, `issues?label=bug&page=2`, labels, both feeds,
445 tags, branches, search and the hooks page. Its name appears nowhere in the owner's
446 public activity feed.
447
448Two things the pass found, neither a break:
449
450- **The Feed link on a filtered issue list offers the whole feed.** A feed has no
451 filter concept, so a reader who clicks it from `?label=bug` subscribes to everything.
452 Either the link should carry the filter or it should say "all issues".
453- **`latest_tag` breaks a same-second tie by refname**, so two tags created in the same
454 second show the alphabetically-first as "Latest tag". Only reachable from a fixture
455 that tags twice in one second; git's own ordering, not ours.
456
457Screenshots in `target/shots/`, `wave3-*`.
458
459### Opened by the kept-alive `cat-file`
460
461- **The pool holds memory nothing measures.** Two `git cat-file` processes per live
462 repository, up to 64 of them, each holding its repository's pack indexes open. The
463 caps are chosen rather than derived and there is no metric that says what one costs on
464 a real instance — the first thing to look at if an instance's resident size surprises
465 someone.
466- **The pool is unmeasured under concurrency.** Requests serialise per repository per
467 stream, which is right for one reader and untested for fifty: a second visitor's tree
468 page queues behind the first's. A pool of N processes per repository is the fix if it
469 ever shows, and it is a change to `cat_file.rs` alone.
470- **A desync is a 500 with no retry.** Deliberate — the stream has lost its place and
471 re-asking would answer from a process that is already gone — but it means one bad
472 reply fails one request rather than degrading. Nothing has ever produced one outside
473 the test that fakes it.
474- **The last-commit column re-walks history on every tree page.** One `git log
475 --name-only` capped at 500 commits, uncached, and a directory whose entries were all
476 last touched beyond that cap pays the cap in full to attribute nothing. Caching it per
477 (tree id, directory) would be exact — a directory's history cannot change while its
478 tree id does not — and is the obvious next step if a tree page ever feels slow.
479- **A merge attributes nothing.** `git log --name-only` prints no file list for a merge
480 commit, so a file whose most recent change arrived by merge is attributed to the
481 commit inside the branch rather than to the merge. git's answer, and the more useful
482 one, but it means the column can name a commit that is not on the branch's first-parent
483 line.
484- **The column is not on the branches, tags or compare pages**, and nothing else lists
485 files, so there is nowhere else it belongs yet. A pull request's file list would be the
486 first.
487- **`--batch-command` is left on the table** until Ubuntu 22.04 is out of support, at
488 which point the pair of processes becomes one. Recorded in the ADR, not urgent.
489
490### Opened by wave 4
491
492**Wave 4 is closed.** Its six seams are done and the whole of it has been walked as one
493app — see the pass below. What is left open is listed here.
494
495- **Diff highlighting does not go through the cache**, and a hunk opened inside a
496 multi-line string above it colours wrong (asserted, deliberate). **Nothing measures the
497 cache** — no hit rate, resident size or eviction count — and it now sits beside two
498 more unmeasured caps, the cat-file pool's and the merge cache's. The per-line 32-byte
499 overhead is a guess, and so is the merge cache's 128-byte one.
500- ~~Highlighting caches nothing~~ — done.
501
502- ~~A followed history count is an uncapped walk~~ — **capped at 500**, the last-commit
503 column's number, with `500+` on the page and the paging control offering only the pages
504 that were counted. **The cap has never been reached on a real repository**: Steid's own
505 longest file history is 52 commits, so only the tests exercise it.
506 A path's history still runs two walks per page. A submodule's own commit is never
507 resolved; nested `.gitmodules` are not read; the 100-link cap is chosen.
508 ~~Rendered markdown headings have no ids~~ — **they do**, slugified and deduplicated,
509 and the relative-link resolver now carries the `#fragment` across (found at a seam:
510 the ids landed first and the resolver was still dropping fragments). Raw-route images
511 are verified in Chrome only; Firefox and Safari may honour `nosniff` for images.
512- ~~Submodule rendering was never seen~~ — seen, linked, tested, and walked.
513
514- **Pull requests**: no assignees, reviews, milestones, `/api` or feed; owner-only
515 writes (merging must stay owner-only at Milestone 7); the Conversation tab asks git 2–4
516 questions per view — ~~and `merge_preview` writes unreferenced objects nothing gc's~~,
517 which is now **once per pair of commits** rather than once per view, though the objects
518 a first view writes are still unreferenced and still ungarbage-collected; the Commits
519 and Files tabs re-run the comparison; squash lists at most 50 subjects; the strategy
520 control is a native `<select>`; ~~"Closes #4" does nothing~~ — **it closes the issue and
521 comments on it**; ~~the delete-source checkbox defaults on even when the source is the
522 default branch~~ — **it opens unticked there**; `Unrelated` and the stale-ref refusal
523 are tested, not walked.
524- ~~Pull requests carry no labels~~ — **they do**, through a second join table; the
525 reasoning is in [progress.md]progress.md. No assignees or milestones still.
526- **A merged request's Commits and Files tabs go blank once its source branch is
527 deleted.** Both tabs resolve the branches live, so "spike adds no commits to main" is
528 what a merged-and-tidied request says about the change it landed. `merge_commit` is the
529 one thing stored, which is why the Conversation tab still says what happened. Storing
530 the source's head at merge time would fix it and is the same decision as storing a head
531 while open, which was deliberately refused — worth revisiting as one question.
532- **The last-commit column names the commit inside the branch, not the merge**, so a
533 file that arrived by merge attributes to the branch commit rather than to
534 "Merge pull request #3". That is `git log --name-only`'s own answer and the existing
535 decision (see the cat-file section above), but it is the one place the wave's features
536 meet and disagree about what a file's last change *was*. Changing it means walking
537 with `-m --first-parent`, which changes what the column means everywhere — a decision,
538 not a fix.
539
540#### The wave 4 integration pass — 2026-09-06
541
542The four branches merged, the six seams built, and the result run as one app on a real
543instance: this repository pushed with six branches and two tags, plus a purpose-built
544fixture repository (a rename, a submodule, a markdown file with headings, a conflicting
545pair of branches) and one private repository. Walked in a browser and with `curl`:
546
547- a pull request's **Files changed** shows highlighted diffs, Rust and markdown alike;
548- the compare page's **Create pull request** carries both branches into the form, which
549 prefills the title from a one-commit branch and opens a request that **merges**;
550- a merged request's sha **lands on the commit page**, and the fast-forward merge left
551 `main` alone because the box was unticked — which is seam 1, seen in a browser;
552- **`Closes #1`** in a merged request's body closed issue 1 and left a comment naming the
553 request and the branch it landed on; the `#3` in that comment points at `/issues/3`,
554 which 303s to `/pulls/3` — the cross-kind redirect doing its job;
555- a file's **History** follows the rename, and each row's sha reaches a commit page whose
556 diff is highlighted;
557- a rendered markdown file's headings carry ids and the README's
558 `docs/notes.md#the-second-section` **lands on the section** — after the fix below;
559- a **submodule row** links to `https://github.com/rust-lang/log.git` at its pinned sha;
560- a **labelled pull request filters**: `?label=bug` narrows the list and all three state
561 counts follow it, and the labels page counts issues and requests apart;
562- the tree page's **last-commit column survived `pkill -f 'cat-file --batch'`** — same
563 page, same 70 ms, two fresh processes;
564- a **conflicted request** costs one `merge-tree`: 43 ms on the first view, ~18 ms
565 after, and five more views wrote **no new loose objects**;
566- **anonymous on a private repository 404s on every route this wave touched** — fourteen
567 GETs and four POSTs, and the two POSTs that answer 400 answer it identically for a
568 repository that does not exist, so nothing is leaked.
569
570**One thing broke at a seam and was fixed**: heading ids landed in the renderer while
571both relative-link resolvers were still stripping `#fragment` from a rewritten link, so a
572README's link to a section of another file went to the top of that file. The fragment is
573now carried across.
574
575### Opened by the ops step
576
577- **The operator token has no rotation, expiry or hash at rest**; it lives in
578 `/etc/steid/steid.env` at mode 640 and is compared in constant time. Unlike a PAT, and
579 worth stating before anyone assumes symmetry.
580- **`POST /api/setup` shares `/auth/login`'s limiter**, so a flood of headless claim
581 attempts can lock the owner out of the form for a minute. Same secret under attack;
582 the right way round, but a coupling.
583- **`STEID_TRUSTED_PROXY` assumes one proxy hop**, and nothing checks the flag matches
584 reality; no boot warning, because it is correct in the shipped install.
585- **`/api/instance` reports no disk, memory or cache numbers**; the three unmeasured caps
586 would land there.
587- `web/instance.rs` holds both routes rather than `web/api.rs`, to keep five branches
588 off one file; if `/api` grows, move them.
589- ~~Whether to add `STEID_TRUSTED_PROXY`~~ — added.
590
591- **Metrics**: `active_imports` never observed above zero and `cat_file_respawns` only
592 unit-tested; no process-level metrics (RSS, fds) and no histograms yet — request
593 duration is the obvious next family, buckets need real traffic. **`classify()` is a
594 second statement of the URL layout**: a new top-level route shape needs a line there or
595 it counts as `page`; a new git subcommand needs a `GIT_COMMANDS` line or counts as `other`.
596
597- **`is_instance_owner` = the sole user**, so the backup download fails closed the day
598 Milestone 7 adds a second user. Deliberate; wants an instance-level role then.
599- **Nothing sweeps `<data_dir>/.backup`**: a process killed mid-backup leaves a full copy
600 of the database there, invisible and as large as the database. A boot sweep beside the
601 other three is the fix. **No test covers the backup web route** (404 for a stranger,
602 unlink-while-open, headers) — hand-verified only. **A directory destination that does
603 not exist is written as a file**, and a never-migrated database gives an ugly error.
604- **`--backups daily` was verified against a stubbed `systemctl`**, not real systemd;
605 cross-filesystem restore and multi-megabyte archives untested. Backups stay on the same
606 machine unless the operator ships them; the control plane will.
607
608- ~~**No password policy anywhere**~~ — **closed**. `domain::Password::new` is the one
609 rule: **at least 12 characters, no composition rule**, with a 512-byte ceiling to bound
610 Argon2's work. `claim_instance`, `reset_password` and `change_password` all go through
611 it, and the setup form, the reset page and the settings page print `Password::RULE`
612 itself rather than three paraphrases. **`POST /api/setup` deliberately does not** — a
613 short password gets the same opaque 404 as a wrong token, with the reason in the log,
614 because a response that named the password would tell a stranger guessing tokens that
615 they had guessed one. Existing passwords are never re-checked, so sign-in is unaffected.
616- **A forgot hit still costs an SMTP round trip a miss does not** — a send queue closes it.
617 **Nothing sweeps `password_resets`** (or `sessions`); one periodic sweep wants both.
618- **`/{handle}/settings` and its password POST answer 403, not the wave's 404** —
619 pre-existing; the one write-failure mapping from the review closes it.
620- **`/auth/login` and `/auth/setup` are still unstyled**, and the reset flow now ends on
621 the login page, so restyling them rose in priority.
622- TLS submission to a real relay was not exercised (plaintext to a local sink only).
623
624- **`InMemoryGitQuery` is re-exported from `infrastructure::git`** so a dozen use-case
625 test modules did not have to change during the wave. Repoint them at
626 `git_query::InMemoryGitQuery` and drop the re-export once nothing else is in flight.
627
628- **`labels::encode` is a fourth copy of `urls::encode(v, false)`**; one line to fold.
629 **`context.rs` now imports `repo_for` and `profile_for`** from two page modules;
630 review step 4 (`web/frame.rs`) should take `owned_repo` with the resolver. `owned_repo`
631 and `owned_profile` have no unit tests — they need a `Cx`; there is still no HTTP-level
632 test in the tree.
633- ~~`/{handle}/settings` and its password POST answer 403~~ — 404 now, with seven others.
634
635- **The forward migration check is untested**: nothing runs the previous release's
636 binary against the current schema. A release-script step downloading the last tarball
637 would close it; a wave slot, not a test.
638
639- **`claim::sole_owner_handle` still calls `users.sole_user()` directly** — a lookup
640 (where `/` redirects), not a predicate; revisit at M7 since both go `None` on a second
641 user. **No second-user test exists at the HTTP level** because no registration route
642 exists; the in-memory test covers it until the harness lands.
643
644- **`tests/http.rs` cannot render a view** (empty asset bundle), so 303-after-POST and the
645 `__Host-` cookie attributes are still hand-verified. Loading the real bundle in tests
646 needs `topcoat asset bundle` in the test gate or a checked-in manifest — decide.
647- ~~no test can build a `Cx` / no HTTP-level test~~ — `tests/http.rs` exists; four tests.
648
649- ~~`Limiter::Search` is not on the metrics enum~~ — added. **No page renders `TooLarge`**: the five
650 that guard on `context::timed_out` would 500 on it with a "took too long" copy that
651 would be a lie; extend the shared helper. Both post-merge.
652- ~~search page has no rate limit; `run` collects uncapped~~ — done.
653
654### Carried over — small, unblocked
655
656- **A client that disappears mid-request leaves the body-copy task waiting.** The copy
657 into git's stdin runs in its own task and nothing cancels it if the connection drops.
658 Bounded by the backend exiting and closing the pipe, but not by anything deliberate.
659- **No automated test asserts the security headers.** There is no HTTP-level test
660 harness, so losing the CSP would be silent. The likeliest regression is someone using
661 `insert()` instead of `or_insert()` and flattening the raw endpoint's stricter policy.
662- **`cargo audit` has never been run**, and the dependency tree has not been reviewed.
663- **A subprocess per git request.** Unlike Milestone 3's once-per-creation, this is on a
664 hot path and has not been measured. Milestone 5 is where that bill comes due.
665- **Streaming is by construction, not by measurement.** The response body is never
666 collected, but no clone large enough to prove it has been run.
667- **An orphaned repo directory is possible** if the process dies between the record
668 write and the filesystem write, and it then blocks re-creating that name. The durable
669 fix is a reconciliation sweep on boot
670 ([architecture.md]architecture.md#db-plus-filesystem-writes); clearing one is a
671 manual `rm` today, since repo deletion does not exist.
672- **The duplicate-name check races.** The loser is caught by `init_bare` or the unique
673 constraint, but surfaces as an opaque storage error rather than "name taken".
674- **Bare repos created on macOS carry `ignorecase = true`.** A migration gotcha if the
675 data directory ever moves to Linux.
676- ~~**Light mode is still untested**~~ — **looked at 2026-09-05** on the repository
677 landing page, a tree and a blob, by temporarily flipping the layout's `class="dark"`
678 and screenshotting. Nothing was wrong: every colour on these pages already comes from
679 a token. The profile, the settings pages and the log have still not been checked, and
680 **there is still no way for a visitor to choose** — the layout hardcodes `dark`.
681- **The `/log` page's switcher opens with nothing marked current** when no revision is
682 in the URL, because `repo_log` still does not report the revision it resolved. Now more
683 visible than before, since there is a switcher to look wrong.
684- **Task-list items keep their bullet** and footnotes render in place rather than
685 collected at the end. Both cosmetic.
686- ~~**The landing page now makes 15 `git` processes**~~ — **4 now**, and 115 ms of
687 latency has become 31 ms. The fix was 0006's kept-alive `cat-file --batch`, as that
688 entry said it would be; see the
689 [third amendment]decisions/0006-git-binary-behind-narrow-ports.md#amendment--20260906-stage-2-a-kept-alive-cat-file
690 for the whole before/after table.
691- **`count_commits` costs two processes, not one.** It resolves the revision before
692 running `rev-list --count`, because `rev-list` is fatal on an empty repository and on
693 an unknown branch, and this module's rule is that a non-zero exit from git is always a
694 real fault. `--ignore-missing` was tried: it covers a bad object id, not a bad
695 revision *name*.
696- **`bg-muted` is not a token and never was.** Three `<pre>` blocks used it, so they
697 have been rendering with no background at all — silently, exactly as `ui.md` warns
698 about classes Tailwind never ships. Fixed on the clone block, the empty-repository
699 push snippet and, last, `token.rs`'s new-token block. All three now use `bg-surface`,
700 and `bg-muted` appears nowhere in `src/` — only `bg-muted-foreground`, which is real.
701- **The licence sniffer reads 1 KiB, not the 200 bytes first sketched.** BSD-2 and
702 BSD-3 differ only by a third clause about 900 bytes in. `LICENSE-MIT` and other
703 suffixed spellings are not detected: the filename list is deliberately short, because
704 every extra candidate is another speculative blob read.
705- ~~**A per-file last-commit column is still absent**~~ — **shipped**, on the root and
706 on every subdirectory, once the kept-alive `cat-file --batch` it was waiting on
707 landed. One `git log --name-only` per listing, not one per entry.
708- **Fonts are not loaded.** The theme names Geist and IBM Plex Mono; both fall back
709 today. Topcoat's `font-fontsource` feature handles it.
710- **The auth pages are unstyled.** `/auth/setup` and `/auth/login` are still bare
711 milestone-1 HTML, and the styled top bar now sits right above them making it obvious.
712- **The top bar's wordmark says "steid"**, not the owner's identity — see the open
713 question at the end of [ui.md]ui.md#the-shell.
714- **Light mode is untested.** The palette defines it; nobody has looked at it.
715- **No rate limiting** on `/auth/login` or `/auth/setup`.
716- **`sweep_expired` is never called**, so expired session rows accumulate. Expiry is
717 enforced on read, so this is tidiness, not a hole.
718- ~~**CSRF.**~~ — **closed 2026-09-08**,
719 [0008]decisions/0008-csrf-double-submit-bound-to-the-session.md. Every form carries
720 an HMAC token bound to the session, and `web/csrf_scan.rs` fails the build when a POST
721 route forgets it. `SameSite=Lax` and Topcoat's own `OriginLayer` are still the first
722 two layers; this is the third. **Login CSRF is still open** — see below.
723
724### Opened by the security review (2026-09-10)
725
726Findings and evidence in [security-2026-09-10.md]security-2026-09-10.md. Seven
727findings, all fixed; four things it could not close in one sitting:
728
729- **The search page has no rate limit of its own.** The 4 MiB grep cap bounds the memory,
730 not the CPU: `?q=` is still a full `git grep` per request on a page nobody has to be
731 signed in to reach, and it is now the most expensive unauthenticated read after the
732 archive. A `SearchLimiter` beside `ArchiveLimiter` is mechanical; the numbers are not —
733 how many per window, and whether an empty query counts, are a decision rather than a
734 default.
735- **DNS rebinding is open on both outbound paths.** The webhook sender and the import
736 clone both resolve, check every address, and then let the library resolve again. A
737 record whose TTL expires in between still gets through. Closing it means pinning the
738 address and setting `Host`/SNI by hand, separately for `ureq` and for `git`. Both
739 modules say so in their headers.
740- **`run` still collects git's output without a byte cap** for everything that is not
741 grep or a diff — `log`, `for-each-ref`, `cat-file`. Each is bounded some other way
742 (`--max-count`, the ref count, an object size read from its header first), so none is
743 reachable in the shape grep was, but the property is incidental rather than enforced.
744 Worth a sweep the next time a page asks git something open-ended.
745- **An import of a renamed repository now fails rather than following the redirect.**
746 The price of `http.followRedirects=false`, taken deliberately. If it turns out to bite
747 often, the answer is to resolve the redirect ourselves and re-check the target, not to
748 turn it back on.
749
750### Opened by the CSRF work (2026-09-08)
751
752- **Login CSRF is open, knowingly.** `/auth/setup`, `/auth/login`, `/auth/forgot` and
753 `/auth/reset/{token}` are exempt because they are submitted signed out and there is no
754 session to bind a token to — a double-submit token an attacker can simply fetch
755 protects nothing. So an attacker can still force a victim's browser to sign in *as the
756 attacker*, which then attributes whatever they do next to the attacker's account.
757 `SameSite=Lax` and the `OriginLayer` cover it in any current browser. The real fix is a
758 pre-session CSRF cookie with its own lifetime, which is a bigger decision than this
759 was; the exemptions and their reasons are in `csrf::EXEMPT`.
760- **A restart 403s every form already open on screen**, because the secret is random per
761 boot. Deliberate ([0008]decisions/0008-csrf-double-submit-bound-to-the-session.md),
762 and worst in development: `topcoat dev` rebuilds on every edit, so a form left open
763 across one refuses on submit. If that becomes annoying, the answer is a persisted
764 secret, which is a thing to back up and rotate.
765- **`csrf_scan.rs` matches on text, so it can be fooled.** A handler that mentions
766 `csrf_verified` in a comment passes; one that spells the route across two lines is not
767 seen at all. It is a guard against forgetting, not against trying.
768- **The scan's 307 rule is coarse.** It fails a POST handler containing `redirect(`
769 anywhere, including in a doc comment. Nothing hits that today.
770- **Nothing tests the refusal page itself.** The 403 view was checked in a browser, and
771 there is still no HTTP-level harness that could assert it — the same gap item 7 of the
772 wave list already names.
773
774### Opened by the organisation review (2026-09-06)
775
776Full findings and an ordered, independently mergeable refactor list are in
777[review-2026-09-06-organisation.md]review-2026-09-06-organisation.md. The layer rules
778held — domain imports nothing outward, no page writes through a port — so what is open
779is shape, not correctness:
780
781- ~~**58 `#[allow(clippy::too_many_arguments)]`**~~ — **63 counted, 38 left.**
782 `application::Stores` bundles the `orgs`/`memberships`/`repos` triple that 56
783 signatures took, and every allow the change made unnecessary is gone. The 38 that
784 remain are genuinely wide signatures — `merge_pull` and `redeliver` at 17 parameters,
785 `back_up`, the two `password_reset` writes — not port-threading. Narrowing those is
786 review step 11's `GitQuery` split and `merge_pull`'s own shape, not this.
787- **Three `write_failure`s that disagree** (`labels.rs` maps `Forbidden` to 404,
788 `issues.rs` and `pulls.rs` to 403) and **eight copies of the same ownership guard**
789 across `web/`. Both want to live in `web::context`.
790- **`web/browse.rs` and `web/repo.rs` are imported by thirteen modules each** for
791 formatters, URL builders and the repo frame — none of which is browsing or the repo
792 page.
793- ~~**PR numbering reaches into `IssueRepository`**~~ — `next_number` is on
794 `RepoRepository` now, so `create_pull` no longer holds the issue port at all.
795 `merge_pull` still does, and should: `Closes #n` really is an issue write.
796- **`/api` has three routes** against 34 POST handlers. ROADMAP.md calls it a standing
797 practice; four waves shipped without it, which also cost the check on whether the
798 read/write line is in the right place.
799- **There is no event concept, only `PushEvent`** — so webhooks and the activity feed
800 can only report pushes. A `RepoEvent` log is the shared shape, and deserves an ADR
801 before anything consumes the payload.
802- **The web layer is the thin spot in testing**: `web/pulls.rs` is 1,870 lines of code
803 with 7 tests, `web/labels.rs` 892 with none, and what is untested there is exactly the
804 duplicated logic above.
805- **Two docs are now out of date.** `architecture.md` still says the reconciliation
806 sweep is unwritten (`application/reconcile.rs` writes it) and credits `#[memoize]`
807 with earning its keep (there are zero in the tree).
808
809### Opened by the second organisation review (2026-09-10)
810
811Full findings and a re-ranked, independently mergeable step list are in
812[review-2026-09-10-organisation.md]review-2026-09-10-organisation.md. Seven of the
813first review's thirteen steps landed and did what they promised; what is open is again
814shape, plus one trap:
815
816- ~~`csrf_scan` read `web/` non-recursively~~ — recursive since 2026-09-10, with a test.
817- **`repo::visible_repo` is a third copy of the visibility rule**, outside
818 `application/access.rs` and imported by seven modules. Milestone 7's third role would
819 otherwise land in three bodies rather than one.
820- **`GitQuery::diff` hands git's stdout across the layer boundary** as `RawDiff`, and
821 `application/diff.rs` parses it — the only port that does. One call site.
822- **URL builders re-scattered after step 3**: two `commit_url`s, two `compare_url`s, and
823 seventeen more `*_url` functions living in the page that first needed them.
824- **The composition root and three CLI commands live in `main.rs`**, which has no tests.
825 Extracting the builder into the library is the whole prerequisite for an HTTP-level
826 harness — `topcoat::serve_until` takes any `Listener` and `TcpListener` is one, checked
827 in the vendored crate.
828- **`architecture.md` has three stale claims**: `RegistrationPolicy` does not exist,
829 `access.rs` is not quite the only place deciding access (`is_instance_owner` in two
830 pages, `operator_authorized` in `web/`), and two files are now past the 1,500-line
831 test-file threshold with their tests still inline.
832
833### Opened by the access wave (steps 5 and 6)
834
835- **`&Stores::new(&orgs(cx), &memberships(cx), &repos(cx))` is written 60 times in
836 `web/`.** Each accessor builds a fresh adapter around the same pool, so it is cheap but
837 noisy. A `context::ports(cx)` returning an owned triple with a `.stores()` borrow would
838 collapse it; it needs a binding per handler, so it was left out of a mechanical change.
839- **`writable_repo` and `changeable_repo` are still two functions for one rule** — one
840 layered on `readable_repo`, one resolving directly — kept apart because their callers
841 want different things back. `access_tests.rs` pins that they agree on every actor, so
842 folding them is now a safe change rather than a risky one.
843- **Milestone 7's permission argument has a home but no name.** The predicates are in one
844 file and the signatures have room; what they still lack is the third role and the
845 permission enum. Nothing here decided its shape.
846- ~~**`POST /auth/login` still ends a failed sign-in with `redirect`**~~ — **fixed
847 2026-09-08**, along with a *third* instance nobody had spotted: `POST /auth/setup` on
848 an already-claimed instance answered `redirect("/")`. `csrf_scan.rs` now fails any POST
849 handler that names `redirect(`, so there cannot be a fourth.
850- **`Password::MAX_BYTES` is untested against Argon2 itself.** 512 bytes is a bound on
851 the work, not a measured one; nobody has timed a 512-byte hash on the deployed
852 machine.
853
854## Backlog
855
856Ordered. Pull from the top.
857
8580. ~~**The ops step the control plane needs**~~ — **done 2026-09-08**: all four capabilities plus password reset, the tidy-up refactors, the access module and CSRF are on main; the security review is the next step, then Milestone 7. Historic text follows. Decided in
859 [steid-control-plane ADR 0002]../../steid-control-plane/decisions/0002-machine-per-tenant.md
860 (2026-09-08): each managed tenant is its own machine, provisioned by cloud-init
861 running `install.sh`. Steid stays unmodified; it must become drivable headlessly.
862 Four things, one wave, disjoint files: a headless claim plus a `GET /api/instance`
863 reporting version and claimed state; `steid backup` / `steid restore` producing one
864 consistent archive (SQLite online backup plus the data directory), with an owner-only
865 "Download a backup" on the settings page and an opt-in `--backups daily` timer in
866 `install.sh`; a `/metrics` endpoint; releases served from the distribution host
867 (closes 5b). Then password reset with email, which Steid sends and the operator
868 configures. Self-hosters get the same mechanism as options; managed tenants get it
869 scheduled and shipped by the control plane.
870
8710. ~~**The boot-time owner, for the control plane**~~ — **done, 2026-09-13**.
872 `STEID_OWNER_EMAIL` + `STEID_OWNER_HANDLE` create the owner before the first request;
873 `install.sh --owner-email --owner-handle` writes them. The decisions are in
874 [progress.md]progress.md#the-boot-time-owner--done-2026-09-13. `Cargo.toml` and
875 `install.sh` say **0.6.0**, and **0.6.0 is now cut and published** — see below.
876 Carried forward: **the seeded owner's only way in is `steid reset-password` on the
877 box** — a bearer secret in whatever channel it is carried over — which closes at
878 Milestone 7's identity; and **nothing in the data says an account was seeded**, which
879 is deliberate (no sentinel) but leaves a "you have never set a password" prompt with
880 nothing to key on.
881
8820. ~~**Releases move off jpgill.dev**~~ — **done, 2026-09-20**. `install.sh` defaults to
883 `https://releases.steid.dev` (S3 behind CloudFront), `deploy.sh --publish` writes
884 that host *and* the jpgill.dev mirror, and `--publish-s3-only` cuts a release without
885 going near the live site. 0.6.0 is published there — the first version cloud-init can
886 install headlessly, which is what the control plane was blocked on. Reasoning in
887 [decision 0009]decisions/0009-releases-from-releases-steid-dev.md and
888 [progress.md]progress.md#releases-move-to-releasessteiddev--done-2026-09-20.
889 Carried forward: **the mirror is temporary** and goes when the control plane's
890 milestone 2 moves this instance onto the fleet — until then a publish writes two
891 hosts and can half-succeed; **the mirror for 0.6.0 has not been written yet**, because
892 it needs ssh to the author's live box and that is the author's to run
893 (`./deploy.sh --publish` or an scp by hand); and **artefacts are still unsigned** —
894 a `.sha256` served from the host that served the tarball proves transport, not
895 provenance, and that is more visible now the host is a CDN.
896
8971. **Milestone 6 — Writing.** Posts, markdown, `/{handle}/posts/{slug}`. Open when it
898 starts: which markdown crate, and whether raw HTML in markdown is trusted — safe for a
899 single author, a stored-XSS hole the moment Milestone 7 adds a second user. A
900 repository's README rendering on its page falls out of the same pipeline.
901
9022. **Milestone 7 — Identity, full — has a shape now**, set by the control plane's
903 [ADR 0005]../../steid-control-plane/decisions/0005-oidc-only-sign-in-and-organisations-own-instances.md
904 (2026-09-12): a company signs everyone into its instance with its identity
905 provider, and an individual's managed instance may do the same with a personal
906 Google account. What that asks of this milestone, beyond orgs, invites and a
907 registration policy: a `User` with linked **external identities** (issuer, subject,
908 verified email) beside an *optional* password hash; an **identity-provider
909 configuration** reachable headlessly (`STEID_OIDC_*` env, like every operator
910 setting, so self-hosters get the same mechanism by hand); a registration policy
911 that can say "anyone from this provider with this hosted domain"; `POST /api/setup`
912 able to bind the owner to an external identity rather than a password; and an
913 instance-level role, which `is_instance_owner` (= the sole user) already needs.
914 The OIDC relying party is a small crate **shared** with the control plane rather
915 than copied — the one exception to copy-not-share, because it is security code
916 (it exists: `steid-control-plane/crates/steid-oidc`, on `openidconnect`, to be
917 extracted when this milestone needs it). OIDC first; SAML is the control plane's
918 milestone 9 and lands here after.
919 **The registration policy is chosen per instance on the control plane** (its
920 domain.md, *Access policy*, 2026-09-13) and delivered headlessly, so it must be
921 data, not a compile-time choice: `Open` (password registration), `InviteOnly`,
922 `EmailDomain { provider, domain }`, `Provider { issuer, group/claim constraint }`,
923 later `Saml`. A self-hoster sets the same thing by env or a settings page.
924
925### Forge feature candidates (surveyed 2026-09-05)
926
927Not yet ordered against Milestone 6. Grouped by what they touch, because the plan is to
928run several agents at once and the grouping is what decides what can run together.
929**Sections 1 and 2–4 are done; 5–7 are what is left.** Shared hotspots: `GitQuery` in `port.rs` (every
930browsing feature appends a method), `git_query.rs`, the repo sub-nav, and `plans/`
931itself. New tables touch `sqlite.rs` + `in_memory.rs` and should merge one at a time.
932
933**Sections 1 and 2–4 have now had a wave each. Wave 2 is done** — rename, default
934branch, archived, issues, import from a URL, push events and webhooks, all merged and
935then walked together as one app; see the integration pass above. **Wave 3 is done too** —
936token expiry and last-used, a rate limit on token auth, issue labels, markdown
937cross-links and highlighted fences, Atom feeds, paging everywhere, and the wave 2
938follow-ups; merged and walked, see the wave 3 pass above.
939
940**Section 1 is done**, the per-file last-commit column included — it was the one thing
941left, and the kept-alive `cat-file --batch` it waited for
942([0006]decisions/0006-git-binary-behind-narrow-ports.md) shipped with it. Shipped: the two-column
943repository landing page, syntax highlighting, branches and tags pages, archive
944download, code search, the commit page, compare, and blame. All eight were merged and
945then walked together as one app; see the integration pass above. See
946[ui.md]ui.md#the-repository-page for the layout and the entry-point map, and
947[progress.md]progress.md for what each cost.
948
9491. ~~**Read-only browsing**~~ — **done**, the per-file last-commit column included. It
950 was the last thing outstanding and it arrived with the kept-alive `cat-file --batch`
951 that [0006]decisions/0006-git-binary-behind-narrow-ports.md said had to come first.
9522. **Repo model** — **done** except **topics and pinned repos on the profile** and the
953 **orphan-directory reconciliation sweep on boot**, which now has three shapes to
954 handle (a create that died, a rename that died, an import that died). Shipped: rename,
955 the default branch setting, the archived flag.
9563. **Collaboration**: **issues and labels done**; still open are **pull requests** (needs
957 the commit and compare pages, plus a merge on the bare repo) and **milestones** (8+).
9584. **Transport and git ops** — **done** for this wave: import from URL, post-receive
959 events and webhooks, `REMOTE_USER` passthrough. Still open: **LFS** (not yet) and
960 **SSH** (would reverse [0001]decisions/0001-git-over-http-not-ssh.md).
9615. **Identity and auth**: ~~token expiry and last-used~~ · ~~rate limiting on token
962 auth~~ · ~~CSRF~~ — CSRF done 2026-09-08, alone, as planned. Still open:
963 Milestone 7 multi-user (run alone) · nothing sweeps expired tokens and nothing warns
964 before one expires.
9656. **Portfolio**: posts (Milestone 6) · profile links · ~~Atom feeds for commits~~ —
966 done in wave 3 (commits, issues and push activity); posts will want one when they
967 exist.
9687. **Platform and quality**: scheduled backups and served releases (closes 5b) ·
969 HTTP-level test harness plus security-header tests and `cargo audit` · `/api`
970 coverage for existing use cases · styled auth pages, light mode, fonts.
971
972Process decisions, now answered by the wave rather than open: agents **do** get
973worktrees and short-lived branches, which is a deliberate bend in the commit-to-main
974rule and worth keeping for a wave; and agents do **not** edit `plans/` — each writes a
975handover the merging session folds in, because five agents appending to `current.md`
976conflict every time. The integration pass afterwards is not optional: it is the only
977place a cross-feature link is ever exercised.
978
979Wave 2 amends one of those: an agent working **alone** — the integration pass is one —
980edits `plans/` in the same commits as the code, as CLAUDE.md asks. The no-`plans/` rule is
981about concurrent agents, not about agents.
982
983## Open questions
984
985- **Topcoat is early** (v0.5.0, first released 2026-07-22, breaking changes expected
986 by its own authors). Expect churn that isn't feature work.
987- Topcoat ships Tailwind without Node, which reopens the design system attempt #1
988 dropped purely to avoid an npm build step — see [ui.md]ui.md.
989
990## Routing findings (Milestone 0)
991
992- **Topcoat 0.5 requires rustc ≥ 1.95.** On an older toolchain `cargo add topcoat`
993 silently resolves to an empty `topcoat v0.0.0` placeholder instead of failing. Local
994 stable is now 1.97.1.
995- `Router::builder().discover()` collects `#[page]`-annotated items **at link time**,
996 so pages can live in any module. Layering is our choice, not the framework's.
997- `module_router!` derives each URL from the module tree rather than a path string.
998 Still deferred. Application routes now group cleanly (`auth/login`, `api/me`), but
999 handles sit at the root ([0004]decisions/0004-root-handles-grouped-routes.md), so a
1000 parameterised root segment still has to coexist with static ones. Worth checking how
1001 `module_router!` handles that before committing to it.
1002- Path and query params are read from `Cx` via `path_param!` / `#[query_params]`, not
1003 injected as handler arguments. Parses are memoized per request.
1004- Layouts wrap by path prefix and nest outermost-first, and a layout can catch a page's
1005 `NotFoundError` to render a branded 404.
1006- `HOST` / `PORT` configure the bind address, so `STEID_LISTEN_ADDR` is gone.
1007- `Body` is a boxed `http_body::Body` used for both requests and responses, with
1008 `into_data_stream()` to read and `Body::new()` to wrap a stream — pack data can
1009 stream both directions without buffering. This is what makes Milestone 4 viable.