steid

@jamesgill /

steid/plans/current.md
Markdown23.2 KBRendered·Source·Blame·History·Raw
1# Current
2
3> Keep this file short: the active work, what it leaves open, and the known gaps.
4> Completed work moves to [progress.md]progress.md. If this file starts reading like a
5> changelog, it has drifted — that's exactly what went wrong last time.
6
7## Active: launch readiness
8
9Since 2026-10-01 the order of work is the workspace launch plan,
10[`../../plans/launch.md`]../../plans/launch.md. These are Steid's items in it; the number
11is the plan's, and the plan holds the detail and the order.
12
13- [ ] [1.1](../../plans/launch.md#phase-1-before-anything-else) Source off the laptop,
14 Steid's half: the only remote is the author's own box, unpushed since 2026-09-10.
15- [ ] [1.2](../../plans/launch.md#phase-1-before-anything-else) A rollback must boot.
16 **Half done:** the fix and 0.8.1 are cut; the publish and the real
17 upgrade-and-rollback proof are still to come.
18 - [x] `migrate()` ignores applied migrations it does not know and still refuses an
19 edited one; tested in process (`database_compat_tests.rs`).
20 - [x] Every released migration set from 0.5.0 to 0.8.0 is pinned by digest. 0.5.0's
21 published bytes are proved only for the copies in `dist/`
22 ([releases.md]releases.md#which-bytes-each-release-shipped).
23 - [x] **0.8.1 cut** (2026-10-02): `Cargo.toml`, `install.sh`'s default, README and
24 the `releases.md` row. Not built, not published.
25 - [ ] **Publish 0.8.1** — the author's: `./release.sh --all`, then
26 `./deploy.sh --publish-s3-only`.
27 - [ ] **The upgrade-and-rollback proof**, with the console: provision a tenant while
28 0.8.1 is the newest release, publish the next one, upgrade, force a failure, and
29 watch the box come back. Until a release after 0.8.1 exists there is nothing to roll
30 back *from*, and **that release must add a migration** for the proof to exercise the
31 fix: across no migration, 0.8.0 would have rolled back just as well.
32- [ ] [2.13](../../plans/launch.md#steid) Commands run by hand read the installed config.
33- [ ] [2.14](../../plans/launch.md#steid) A half-failed seed is refused on the next boot.
34- [ ] [2.15](../../plans/launch.md#steid) A backup cannot hold refs to missing objects.
35- [ ] [2.16](../../plans/launch.md#steid) A merge that fails partway finishes or says so.
36- [ ] [2.17](../../plans/launch.md#steid) Reset links come from `STEID_PUBLIC_URL`, not `Host`.
37- [ ] [2.18](../../plans/launch.md#steid) Login CSRF and DNS rebinding (see Security below).
38- [ ] [2.19](../../plans/launch.md#steid) A new security review once 2.13–2.18 land
39 ([the 2026-09-10 review]security-2026-09-10.md is the standard).
40- [ ] [2.20](../../plans/launch.md#steid) The smaller batch (WAL, transactions, the
41 stranded rename, reserved handles, merge edges, `run_allowing`'s cap, installer flags).
42- [ ] [2.21](../../plans/launch.md#both) Measure clone, push and browse on the smallest tier.
43- [ ] [3.2](../../plans/launch.md#phase-3-the-customer-journey) The forgot-password copy
44 for managed instances, which cannot run `steid reset-password`.
45- [ ] [4.1 / 4.2](../../plans/launch.md#phase-4-decisions-only-the-author-can-take) The
46 milestone 7 members slice, closing the single-owner shortcuts inside it.
47- [ ] [5.2](../../plans/launch.md#phase-5-release-engineering) Immutable releases: a
48 version is never re-cut.
49- [ ] [5.3](../../plans/launch.md#phase-5-release-engineering) Provenance and tags: build
50 from a clean, tagged commit, and record it.
51- [ ] [5.4](../../plans/launch.md#phase-5-release-engineering) A pinned, checksummed,
52 signed installer and signed artefacts.
53- [ ] [5.5](../../plans/launch.md#phase-5-release-engineering) CI (after 1.1).
54- [ ] [5.6](../../plans/launch.md#phase-5-release-engineering) Contract tests against a
55 real Steid binary. Steid's share includes the check launch 1.2 asks for: boot the
56 **previous release's** binary against the current schema. Release binaries are Linux
57 and the laptop is macOS, so it cannot be a `cargo test`; the in-process stand-in is
58 `a_database_one_migration_ahead_still_boots`.
59
60**Held, the author's (since 2026-09-28):** re-publishing the root `install.sh` so it
61defaults to 0.8.0. Since the 0.8.1 cut the repository's pin says **0.8.1**, so this is
62now part of publishing 0.8.1, which uploads `install.sh` with the artefacts. Do not
63re-publish `install.sh` on its own before then: it would send fresh installs to a 0.8.1
64that does not exist.
65
66### Open from 0.8.0
67
680.8.0 (organisations and home) is in [progress.md]progress.md#organisations-and-home--080.
69
70- **No way to unset home**, only to move it. An instance with none falls back to its
71 sole owner, a state a fresh instance is in rather than one anybody chooses, so the
72 button says "make this the home page" and there is no "stop being it".
73- **Nothing lists the organisations you belong to.** `/orgs/new` is reachable only by
74 typing it. Launch 4.2's minimum slice has the list; until then a second organisation is
75 easy to create and hard to find.
76- **`/api` says nothing about home.** `InstanceReport` had no natural place for it.
77- **`/auth/setup` and `/auth/login` are unstyled** (the new wizard screens are styled).
78 The look is [launch phase 7]../../plans/launch.md#phase-7-the-aesthetic, last.
79
80## Known gaps
81
82Still open, condensed; the reasoning behind each is in [progress.md]progress.md under
83the work that opened it. Open shape work from the reviews is under *Code shape*.
84
85### Security
86
87- **Login CSRF is open, knowingly** (launch 2.18). `/auth/setup`, `/auth/login`,
88 `/auth/forgot` and `/auth/reset/{token}` are exempt — signed out, there is no session to
89 bind a token to — so an attacker can sign a victim in *as the attacker*. `SameSite=Lax`
90 and the `OriginLayer` cover current browsers; the fix is a pre-session CSRF cookie.
91 Reasons in `csrf::EXEMPT`.
92- **DNS rebinding is open on webhooks and imports** (launch 2.18): both resolve, check
93 every address, then let the library resolve again. Closing it means pinning the address
94 and setting `Host`/SNI by hand, separately for `ureq` and `git`. Import does not refuse
95 `.local` (mDNS); `WebhookUrl` does, and the same suffix list would suit both.
96- **`STEID_ALLOW_PRIVATE_WEBHOOKS` is a real hole when on**: off by default, warned at
97 boot, documented in [runbook.md]runbook.md.
98- **The operator token** has no rotation, expiry or hash at rest (`steid.env`, mode 640,
99 compared in constant time). `install.sh --operator-token` writes it unquoted — hex from
100 `openssl rand -hex 32` is the only shape exercised — and was verified against a temp
101 directory, not a real box.
102- **`POST /api/setup` shares `/auth/login`'s limiter**, so a flood of headless claims can
103 lock the owner out of the form for a minute.
104- **`STEID_TRUSTED_PROXY` assumes one proxy hop**, and nothing checks it matches reality;
105 it now guards the git limiter as well as the login one, both keyed on
106 `X-Forwarded-For`.
107- **The seeded owner's only way in is `steid reset-password` on the box** — a bearer
108 secret in whatever channel carries it — until milestone 7's identity. Nothing in the
109 data says an account was seeded (deliberate: no sentinel).
110- **CSRF edges:** a restart 403s every open form (per-boot secret, by 0008; a persisted
111 secret is the fix if it grates); `csrf_scan.rs` matches text, so a comment naming
112 `csrf_verified` fools it and a route spelled across two lines escapes it, and its 307
113 rule fails any POST handler containing `redirect(`, doc comments included.
114- **A forgot hit costs an SMTP round trip a miss does not**; a send queue closes it.
115- **`Password::MAX_BYTES` (512)** has never been timed against Argon2 on the deployed
116 machine.
117- **Tokens:** nothing sweeps expired ones or warns before expiry; `GIT_PER_CLIENT = 60` is
118 reasoned, not measured.
119- **An import of a renamed repository fails** rather than following the redirect — the
120 price of `http.followRedirects=false`. If it bites, resolve the redirect ourselves and
121 re-check the target.
122
123### Git and data
124
125- **Rename:** a rename that dies midway strands the row (launch 2.20) — the boot sweep
126 quarantines the moved directory, but nothing reconciles any row whose directory is
127 missing. Two renames onto one name race, and the loser gets "name taken" for the wrong
128 reason; create's duplicate-name check races too and surfaces as an opaque storage
129 error. A rename touches nothing stored outside the row (a webhook target, an issue
130 reference).
131- **Every use case that rebuilds through `Repository::new()` must carry what `new()`
132 resets** — `pinned`, `archived`, the import trio. A builder taking the whole existing
133 row would close the trap for good.
134- **Imports:** no size cap (a 10 GB source fills the disk); the two-clone limit is not a
135 size cap; an import starts public; "Queued" is process-local; a row stuck at
136 `importing` because the recording failed cannot be retried until a restart; DNS is
137 resolved twice. `import_repo` and `run_import` still read the clock — the next `Clock`
138 caller.
139- **Webhooks:** retries do not survive a restart; a slow endpoint holds a task ~2.5
140 minutes per push, bounded by hooks per repository, which nothing caps; `push_events`
141 only grows; redelivery reads a hook's whole delivery history — unbounded on a
142 long-lived hook, closed by a `find` by delivery id plus a per-event attempt count.
143- **Pull requests:** objects a first merge preview writes are unreferenced and never
144 gc'd (once per pair of commits now). A merged request's Commits and Files tabs go
145 blank once its source branch is deleted — storing heads was refused while open; revisit
146 as one question.
147- **The last-commit column** names the commit inside a merged branch, not the merge —
148 `-m --first-parent` would change it everywhere, a decision. It re-walks up to 500
149 commits per tree page, uncached (caching per tree id and directory would be exact), and
150 appears only on tree listings — a pull request's file list would be the next place.
151- **Diffs:** a merge commit is diffed against its first parent only, and merge rendering
152 has never been seen; `Diff::files` empties wholesale when the patch is truncated.
153 `MAX_RAW_BYTES` (10 MiB, chosen) is also the diff cap — retune both together; raising
154 it lets concurrent requests each hold that much.
155- **Search:** `git grep` output is collected whole before the cap; every page re-runs the
156 grep; the query is trimmed, lines cut at 500 characters, `GrepHit::column` ignored; an
157 importing repository answers 200 with no matches (the refs pages answer 200 there too,
158 and what they render was not read closely).
159- **The cat-file pool** holds memory nothing measures (two processes per live repository,
160 up to 64), is unmeasured under concurrency (requests serialise per repository per
161 stream), and a desync is a 500 with no retry. `--batch-command` waits for Ubuntu 22.04
162 to leave support.
163- **History:** the followed-count cap of 500 has never been reached on a real repository;
164 a path's history runs two walks per page; a submodule's commit is never resolved,
165 nested `.gitmodules` are not read, and the 100-link cap is chosen.
166- **Costs noted, not fixed:** blame is the most expensive read; `count_commits` is two
167 processes (`rev-list` is fatal on an empty repository or unknown branch, and
168 `--ignore-missing` covers a bad object id, not a bad name); a push touches `updated_at`
169 twice; the settings page costs a `branches()`; the compare form's `<datalist>` and the
170 search switcher each cost a ref listing per visit; `language_of` re-runs `syntax_for`;
171 no ahead/behind counts on branches (by decision: a `rev-list` per branch, until git is
172 kept alive); a subprocess per git request and streaming are unmeasured (launch 2.21).
173- **Sweeps missing:** `sweep_expired` is never called and nothing sweeps
174 `password_resets` (one periodic sweep wants both; expiry is enforced on read); nothing
175 sweeps `<data_dir>/.backup`, where a killed backup leaves a full database copy.
176- **The forward migration check runs in process only.**
177 `a_database_one_migration_ahead_still_boots` boots *this* binary against a database
178 one migration ahead, which is the failure launch 1.2 found. Nothing yet runs the
179 **previous release's** binary against the current schema, which is the test that would
180 have caught it. It cannot be a `cargo test` (release binaries are Linux), so it is
181 launch 5.6's.
182- **The replay test stands at 0.5.0's schema**, not the last released one (0.8.0's): its
183 set was not moved on when 0.8.0 was cut, and it reads neither `password_resets` (0.5.0)
184 nor `instance_settings` (0.8.0). Moving it on is the replay set plus two reads.
185- **Smaller:** a client that vanishes mid-request leaves the body-copy task waiting until
186 git exits; bare repositories made on macOS carry `ignorecase = true`; `\r\n` files keep
187 the `\r` inside highlighted markup; a repository with tags and no branches says "No
188 branches"; `latest_tag` breaks a same-second tie by refname.
189
190### Web and UI
191
192The look is redone last ([launch phase 7]../../plans/launch.md#phase-7-the-aesthetic);
193these are gaps in behaviour.
194
195- **The profile has no links** — `Organization` carries a name and a bio only; a `links`
196 field plus a settings control is the fix.
197- **Steid has no per-page `<title>`**, and a page cannot contribute to `<head>` (the shape
198 of the fix is in progress.md's feeds entry).
199- **No page renders `TooLarge`**: the five that guard on `context::timed_out` would 500
200 with a "took too long" copy that would be a lie; extend the shared helper. The commit
201 page's timeout state has never been rendered.
202- **The `/log` switcher opens with nothing marked current** when the URL names no
203 revision, because `repo_log` does not report what it resolved.
204- **Issues:** a rejected issue burns a number; no assignees, milestones, search or edit
205 history; `closed_at` clears on reopen; the body cap of 65,536 characters is chosen; a
206 label-filtered list is read whole. Owner-only writes are the single-user assumption
207 (milestone 7: a change to `writable_repo`).
208- **Pull requests:** no assignees, reviews, milestones, `/api` or feed; merging stays
209 owner-only at milestone 7; the Conversation tab asks git 2–4 questions per view; the
210 Commits and Files tabs re-run the comparison; squash lists at most 50 subjects; the
211 strategy control is a native `<select>`; `Unrelated` and the stale-ref refusal are
212 tested, not walked.
213- **Labels:** the delete confirm is a client-side `required` checkbox (a direct POST
214 bypasses it — a confirm, not an authorization); the list is unpaged; no bulk,
215 multi-label or "unlabelled" filter; a rename breaks bookmarked `?label=`; no `/api`.
216- **Cross-links** are not styled by state, and cross-repository references and full URLs
217 stay plain text.
218- **Feeds:** a missing `?rev=` answers 200 and empty; issue content carries Tailwind
219 classes; the issue feed orders by `created_at` while `<updated>` is `updated_at`;
220 same-second events tie-break by id; an importing repository feeds an empty commit list;
221 no `ETag`, `Last-Modified` or rate limit; the Feed link on a filtered issue list offers
222 the whole feed.
223- **Highlighting:** diffs do not go through the cache; a hunk inside a multi-line string
224 colours wrong (asserted); nothing measures the cache, and its per-line and merge-cache
225 overheads are guesses.
226- **Blame** shows `BlameCommit::boundary` and `author_name` only in the tooltip — the row
227 is sha, summary and date, and must stay one line. On a multi-user instance the author
228 is the first thing to revisit.
229- **Smaller:** raw-route images are checked in Chrome only; task-list items keep their
230 bullet and footnotes render in place; `bg-surface` is nearly `bg-background` in light
231 mode; light mode is unchecked on the profile, settings and log, and a visitor cannot
232 choose it; fonts are not loaded; the wordmark says "steid" ([ui.md]ui.md#the-shell).
233
234### Operations
235
236- **Releases:** the `jpgill.dev` mirror is temporary — until the control plane moves this
237 instance onto the fleet a publish writes two hosts and can half-succeed — and the 0.6.0
238 mirror had not been written, since it needs ssh to the author's box (not rechecked
239 since 2026-09-20). Signing is launch 5.4.
240- **`/api/instance`** reports no memory or cache numbers. The disk walk is cached for a
241 minute, so a console that has just grown a volume sees the old number for up to that
242 long, and counts `.replaced-…` and `orphaned/`, so a replaced instance reads as twice
243 its size until the aside directory goes. Both routes live in `web/instance.rs`;
244 move them if `/api` grows.
245- **Metrics:** `active_imports` never observed above zero; `cat_file_respawns` only
246 unit-tested; no process metrics or histograms. `classify()` restates the URL layout, so
247 a new route shape or git subcommand needs a line there.
248- **The instance owner is the sole user** (`instance_owner`), so the backup download
249 fails closed the day a second user exists; `claim::sole_owner_handle` is the same
250 lookup. Launch 4.2's instance-level role replaces both. No second-user test exists at
251 the HTTP level, because no registration route exists.
252- **Backups:** no test covers the web route; a missing directory destination is written
253 as a file; a never-migrated database errors badly; `--backups daily` was verified
254 against a stubbed `systemctl`; cross-filesystem restore and large archives are
255 untested. A self-hoster's backups stay on the machine unless they ship them.
256- **Mail:** TLS submission to a real relay has never been exercised.
257- **The archive endpoint** is the most expensive anonymous request (a full pack per hit,
258 limited to 10 a minute per client) and the first thing to look at under load; a late
259 `git archive` failure is a truncated download.
260
261### Code shape
262
263The open steps of [review-2026-09-10-organisation.md]review-2026-09-10-organisation.md,
264which stays as their reference:
265
266- **Step 4:** URL builders re-scattered (two `commit_url`s, two `compare_url`s, seventeen
267 more in pages); `labels::encode` is a fourth copy of `urls::encode(v, false)`.
268- **Step 6:** `web/frame.rs` — `web/repo.rs` is imported by thirteen modules, and
269 `context.rs` imports `repo_for` and `profile_for` upward from page modules.
270- **Step 7:** split `web/pulls.rs` (1,975 lines, 7 tests); the web layer is the thin spot
271 in testing. `owned_repo` and `owned_profile` have no unit tests.
272- **Step 8:** `GitQuery::diff` hands git's stdout (`RawDiff`) across the layer boundary.
273- **Step 9:** `application/refs.rs` out of `browse.rs`; repoint the test modules and drop
274 `infrastructure::git`'s `InMemoryGitQuery` re-export.
275- **Step 10:** `tests/http.rs` exists but cannot render a view (empty asset bundle), so
276 303-after-POST, the `__Host-` cookie and the CSRF refusal page are hand-verified. The
277 real bundle needs `topcoat asset bundle` in the test gate or a checked-in manifest —
278 decide.
279- **Step 11:** split `GitQuery` (an amendment to 0006). **Step 12:** a `RepoEvent` log, so
280 webhooks and feeds can report more than pushes (needs an ADR). **Step 13:** `/api` —
281 five routes against 87; the standing practice in ROADMAP.md has lapsed.
282
283Also open:
284
285- **38 `too_many_arguments` allows** remain, all genuinely wide signatures (`merge_pull`,
286 `redeliver`); narrowing them is step 11 and `merge_pull`'s own shape.
287- **`&Stores::new(&orgs(cx), &memberships(cx), &repos(cx))` is written 60 times** in
288 `web/`; a `context::ports(cx)` would collapse it.
289- **`writable_repo` and `changeable_repo` are two functions for one rule**;
290 `access_tests.rs` pins their agreement, so folding them is safe.
291- **Milestone 7's permission argument has a home but no name**: the third role, the
292 permission enum and the collaborator model (an ADR) are undecided.
293- From the [2026-09-06 review]archive/review-2026-09-06-organisation.md, not rechecked
294 since: `sqlite.rs`'s tests use `claim_instance` as a fixture, and `view_repo` pays two
295 `count(*)` and a membership lookup even on routes that draw no tab strip.
296
297## Backlog
298
299Forward plans outside the launch order. Milestone 6 comes after launch by the plan's own
300list; milestone 7's first slice is launch 4.1 / 4.2, and the rest follows it.
301
3021. **Milestone 6 — Writing.** Posts, markdown, `/{handle}/posts/{slug}`. Open when it
303 starts: which markdown crate, and whether raw HTML in markdown is trusted — safe for a
304 single author, a stored-XSS hole the moment milestone 7 adds a second user.
3052. **Milestone 7 — Identity, full — has a shape**, set by the control plane's
306 [ADR 0005]../../steid-control-plane/decisions/0005-oidc-only-sign-in-and-organisations-own-instances.md
307 (2026-09-12): a company signs everyone into its instance with its identity provider,
308 and an individual's managed instance may do the same with a personal Google account.
309 Beyond organisations (shipped in 0.8.0), invites and a registration policy, it asks
310 for: a `User` with linked **external identities** (issuer, subject, verified email)
311 beside an *optional* password hash; an **identity-provider configuration** reachable
312 headlessly (`STEID_OIDC_*`); `POST /api/setup` able to bind the owner to an external
313 identity; and an instance-level role. The OIDC relying party is a small crate
314 **shared** with the control plane (`steid-control-plane/crates/steid-oidc`, on
315 `openidconnect`, to be extracted when this milestone needs it) — the one exception to
316 copy-not-share, because it is security code. Run it alone, as CSRF was.
317 OIDC first; SAML is the control plane's milestone 9. **The registration policy is
318 chosen per instance on the control plane** and delivered headlessly, so it is data:
319 `Open`, `InviteOnly`, `EmailDomain { provider, domain }`,
320 `Provider { issuer, group/claim constraint }`, later `Saml`. A self-hoster sets the
321 same by env or a settings page. Launch 4.2 is its first slice.
3223. **Forge feature candidates still open** (surveyed 2026-09-05; the waves that built the
323 rest are in [progress.md]progress.md#how-the-waves-were-run): topics, and pinned
324 repositories on the profile; milestones (8+); LFS; SSH (would reverse
325 [0001]decisions/0001-git-over-http-not-ssh.md); profile links; an Atom feed for
326 posts once they exist; `/api` coverage for existing use cases.
3274. **Zero-downtime deploys — deferred, deliberately.** `deploy.sh` stops, swaps and
328 starts: about two seconds. The plan: a systemd template unit `steid@.service` whose
329 instance name is the port (`/opt/steid/3000`, `/opt/steid/3001`); install to the idle
330 port, health-check it on loopback, repoint Caddy and `caddy reload`, then stop the old
331 one and swap which is enabled. Two things make it more than a script: both processes
332 share one SQLite file during the overlap, which wants WAL (launch 2.20: Steid is in
333 rollback-journal mode today) and migrations written expand, deploy, contract; and an
334 in-flight `git push` is cut unless the old process stops *after* Caddy has repointed
335 (`topcoat::start` already drains on SIGTERM). Worth building when instances belong to
336 other people.
337
338## Open questions
339
340- **Whether an absent *public* repository can 404 while private ones still 401.** The
341 uniform 401 from [0007]decisions/0007-tokens-over-http-basic.md hides private names,
342 and also turns every mistyped URL into "Authentication failed", which cost real time on
343 the first deployment. The leak concerns private names only, so a 404 for a name that
344 would be public may cost nothing — needs thought about whether that is true.
345- **Topcoat is early** (v0.5.0, first released 2026-07-22, breaking changes expected by
346 its own authors). Expect churn that isn't feature work.