steid

@jamesgill /

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