steid

@jamesgill /

steid/plans/current.md
Markdown23.2 KBRendered·Source·Blame·History·Raw

Current

Keep this file short: the active work, what it leaves open, and the known gaps. Completed work moves to progress.md. If this file starts reading like a changelog, it has drifted — that's exactly what went wrong last time.

Active: launch readiness

Since 2026-10-01 the order of work is the workspace launch plan, ../../plans/launch.md. These are Steid's items in it; the number is the plan's, and the plan holds the detail and the order.

  • 1.1 Source off the laptop, Steid's half: the only remote is the author's own box, unpushed since 2026-09-10.
  • 1.2 A rollback must boot. Half done: the fix and 0.8.1 are cut; the publish and the real upgrade-and-rollback proof are still to come.
    • migrate() ignores applied migrations it does not know and still refuses an edited one; tested in process (database_compat_tests.rs).
    • Every released migration set from 0.5.0 to 0.8.0 is pinned by digest. 0.5.0's published bytes are proved only for the copies in dist/ (releases.md).
    • 0.8.1 cut (2026-10-02): Cargo.toml, install.sh's default, README and the releases.md row. Not built, not published.
    • Publish 0.8.1 — the author's: ./release.sh --all, then ./deploy.sh --publish-s3-only.
    • The upgrade-and-rollback proof, with the console: provision a tenant while 0.8.1 is the newest release, publish the next one, upgrade, force a failure, and watch the box come back. Until a release after 0.8.1 exists there is nothing to roll back from, and that release must add a migration for the proof to exercise the fix: across no migration, 0.8.0 would have rolled back just as well.
  • 2.13 Commands run by hand read the installed config.
  • 2.14 A half-failed seed is refused on the next boot.
  • 2.15 A backup cannot hold refs to missing objects.
  • 2.16 A merge that fails partway finishes or says so.
  • 2.17 Reset links come from STEID_PUBLIC_URL, not Host.
  • 2.18 Login CSRF and DNS rebinding (see Security below).
  • 2.19 A new security review once 2.13–2.18 land (the 2026-09-10 review is the standard).
  • 2.20 The smaller batch (WAL, transactions, the stranded rename, reserved handles, merge edges, run_allowing's cap, installer flags).
  • 2.21 Measure clone, push and browse on the smallest tier.
  • 3.2 The forgot-password copy for managed instances, which cannot run steid reset-password.
  • 4.1 / 4.2 The milestone 7 members slice, closing the single-owner shortcuts inside it.
  • 5.2 Immutable releases: a version is never re-cut.
  • 5.3 Provenance and tags: build from a clean, tagged commit, and record it.
  • 5.4 A pinned, checksummed, signed installer and signed artefacts.
  • 5.5 CI (after 1.1).
  • 5.6 Contract tests against a real Steid binary. Steid's share includes the check launch 1.2 asks for: boot the previous release's binary against the current schema. Release binaries are Linux and the laptop is macOS, so it cannot be a cargo test; the in-process stand-in is a_database_one_migration_ahead_still_boots.

Held, the author's (since 2026-09-28): re-publishing the root install.sh so it defaults to 0.8.0. Since the 0.8.1 cut the repository's pin says 0.8.1, so this is now part of publishing 0.8.1, which uploads install.sh with the artefacts. Do not re-publish install.sh on its own before then: it would send fresh installs to a 0.8.1 that does not exist.

Open from 0.8.0

0.8.0 (organisations and home) is in progress.md.

  • No way to unset home, only to move it. An instance with none falls back to its sole owner, a state a fresh instance is in rather than one anybody chooses, so the button says "make this the home page" and there is no "stop being it".
  • Nothing lists the organisations you belong to. /orgs/new is reachable only by typing it. Launch 4.2's minimum slice has the list; until then a second organisation is easy to create and hard to find.
  • /api says nothing about home. InstanceReport had no natural place for it.
  • /auth/setup and /auth/login are unstyled (the new wizard screens are styled). The look is launch phase 7, last.

Known gaps

Still open, condensed; the reasoning behind each is in progress.md under the work that opened it. Open shape work from the reviews is under Code shape.

Security

  • Login CSRF is open, knowingly (launch 2.18). /auth/setup, /auth/login, /auth/forgot and /auth/reset/{token} are exempt — signed out, there is no session to bind a token to — so an attacker can sign a victim in as the attacker. SameSite=Lax and the OriginLayer cover current browsers; the fix is a pre-session CSRF cookie. Reasons in csrf::EXEMPT.
  • DNS rebinding is open on webhooks and imports (launch 2.18): both resolve, check every address, then let the library resolve again. Closing it means pinning the address and setting Host/SNI by hand, separately for ureq and git. Import does not refuse .local (mDNS); WebhookUrl does, and the same suffix list would suit both.
  • STEID_ALLOW_PRIVATE_WEBHOOKS is a real hole when on: off by default, warned at boot, documented in runbook.md.
  • The operator token has no rotation, expiry or hash at rest (steid.env, mode 640, compared in constant time). install.sh --operator-token writes it unquoted — hex from openssl rand -hex 32 is the only shape exercised — and was verified against a temp directory, not a real box.
  • POST /api/setup shares /auth/login's limiter, so a flood of headless claims can lock the owner out of the form for a minute.
  • STEID_TRUSTED_PROXY assumes one proxy hop, and nothing checks it matches reality; it now guards the git limiter as well as the login one, both keyed on X-Forwarded-For.
  • The seeded owner's only way in is steid reset-password on the box — a bearer secret in whatever channel carries it — until milestone 7's identity. Nothing in the data says an account was seeded (deliberate: no sentinel).
  • CSRF edges: a restart 403s every open form (per-boot secret, by 0008; a persisted secret is the fix if it grates); csrf_scan.rs matches text, so a comment naming csrf_verified fools it and a route spelled across two lines escapes it, and its 307 rule fails any POST handler containing redirect(, doc comments included.
  • A forgot hit costs an SMTP round trip a miss does not; a send queue closes it.
  • Password::MAX_BYTES (512) has never been timed against Argon2 on the deployed machine.
  • Tokens: nothing sweeps expired ones or warns before expiry; GIT_PER_CLIENT = 60 is reasoned, not measured.
  • An import of a renamed repository fails rather than following the redirect — the price of http.followRedirects=false. If it bites, resolve the redirect ourselves and re-check the target.

Git and data

  • Rename: a rename that dies midway strands the row (launch 2.20) — the boot sweep quarantines the moved directory, but nothing reconciles any row whose directory is missing. Two renames onto one name race, and the loser gets "name taken" for the wrong reason; create's duplicate-name check races too and surfaces as an opaque storage error. A rename touches nothing stored outside the row (a webhook target, an issue reference).
  • Every use case that rebuilds through Repository::new() must carry what new() resets — pinned, archived, the import trio. A builder taking the whole existing row would close the trap for good.
  • Imports: no size cap (a 10 GB source fills the disk); the two-clone limit is not a size cap; an import starts public; "Queued" is process-local; a row stuck at importing because the recording failed cannot be retried until a restart; DNS is resolved twice. import_repo and run_import still read the clock — the next Clock caller.
  • Webhooks: retries do not survive a restart; a slow endpoint holds a task ~2.5 minutes per push, bounded by hooks per repository, which nothing caps; push_events only grows; redelivery reads a hook's whole delivery history — unbounded on a long-lived hook, closed by a find by delivery id plus a per-event attempt count.
  • Pull requests: objects a first merge preview writes are unreferenced and never gc'd (once per pair of commits now). A merged request's Commits and Files tabs go blank once its source branch is deleted — storing heads was refused while open; revisit as one question.
  • The last-commit column names the commit inside a merged branch, not the merge — -m --first-parent would change it everywhere, a decision. It re-walks up to 500 commits per tree page, uncached (caching per tree id and directory would be exact), and appears only on tree listings — a pull request's file list would be the next place.
  • Diffs: a merge commit is diffed against its first parent only, and merge rendering has never been seen; Diff::files empties wholesale when the patch is truncated. MAX_RAW_BYTES (10 MiB, chosen) is also the diff cap — retune both together; raising it lets concurrent requests each hold that much.
  • Search: git grep output is collected whole before the cap; every page re-runs the grep; the query is trimmed, lines cut at 500 characters, GrepHit::column ignored; an importing repository answers 200 with no matches (the refs pages answer 200 there too, and what they render was not read closely).
  • The cat-file pool holds memory nothing measures (two processes per live repository, up to 64), is unmeasured under concurrency (requests serialise per repository per stream), and a desync is a 500 with no retry. --batch-command waits for Ubuntu 22.04 to leave support.
  • History: the followed-count cap of 500 has never been reached on a real repository; a path's history runs two walks per page; a submodule's commit is never resolved, nested .gitmodules are not read, and the 100-link cap is chosen.
  • Costs noted, not fixed: blame is the most expensive read; count_commits is two processes (rev-list is fatal on an empty repository or unknown branch, and --ignore-missing covers a bad object id, not a bad name); a push touches updated_at twice; the settings page costs a branches(); the compare form's <datalist> and the search switcher each cost a ref listing per visit; language_of re-runs syntax_for; no ahead/behind counts on branches (by decision: a rev-list per branch, until git is kept alive); a subprocess per git request and streaming are unmeasured (launch 2.21).
  • Sweeps missing: sweep_expired is never called and nothing sweeps password_resets (one periodic sweep wants both; expiry is enforced on read); nothing sweeps <data_dir>/.backup, where a killed backup leaves a full database copy.
  • The forward migration check runs in process only. a_database_one_migration_ahead_still_boots boots this binary against a database one migration ahead, which is the failure launch 1.2 found. Nothing yet runs the previous release's binary against the current schema, which is the test that would have caught it. It cannot be a cargo test (release binaries are Linux), so it is launch 5.6's.
  • The replay test stands at 0.5.0's schema, not the last released one (0.8.0's): its set was not moved on when 0.8.0 was cut, and it reads neither password_resets (0.5.0) nor instance_settings (0.8.0). Moving it on is the replay set plus two reads.
  • Smaller: a client that vanishes mid-request leaves the body-copy task waiting until git exits; bare repositories made on macOS carry ignorecase = true; \r\n files keep the \r inside highlighted markup; a repository with tags and no branches says "No branches"; latest_tag breaks a same-second tie by refname.

Web and UI

The look is redone last (launch phase 7); these are gaps in behaviour.

  • The profile has no links — Organization carries a name and a bio only; a links field plus a settings control is the fix.
  • Steid has no per-page <title>, and a page cannot contribute to <head> (the shape of the fix is in progress.md's feeds entry).
  • No page renders TooLarge: the five that guard on context::timed_out would 500 with a "took too long" copy that would be a lie; extend the shared helper. The commit page's timeout state has never been rendered.
  • The /log switcher opens with nothing marked current when the URL names no revision, because repo_log does not report what it resolved.
  • Issues: a rejected issue burns a number; no assignees, milestones, search or edit history; closed_at clears on reopen; the body cap of 65,536 characters is chosen; a label-filtered list is read whole. Owner-only writes are the single-user assumption (milestone 7: a change to writable_repo).
  • Pull requests: no assignees, reviews, milestones, /api or feed; merging stays owner-only at milestone 7; the Conversation tab asks git 2–4 questions per view; the Commits and Files tabs re-run the comparison; squash lists at most 50 subjects; the strategy control is a native <select>; Unrelated and the stale-ref refusal are tested, not walked.
  • Labels: the delete confirm is a client-side required checkbox (a direct POST bypasses it — a confirm, not an authorization); the list is unpaged; no bulk, multi-label or "unlabelled" filter; a rename breaks bookmarked ?label=; no /api.
  • Cross-links are not styled by state, and cross-repository references and full URLs stay plain text.
  • Feeds: a missing ?rev= answers 200 and empty; issue content carries Tailwind classes; the issue feed orders by created_at while <updated> is updated_at; same-second events tie-break by id; an importing repository feeds an empty commit list; no ETag, Last-Modified or rate limit; the Feed link on a filtered issue list offers the whole feed.
  • Highlighting: diffs do not go through the cache; a hunk inside a multi-line string colours wrong (asserted); nothing measures the cache, and its per-line and merge-cache overheads are guesses.
  • Blame shows BlameCommit::boundary and author_name only in the tooltip — the row is sha, summary and date, and must stay one line. On a multi-user instance the author is the first thing to revisit.
  • Smaller: raw-route images are checked in Chrome only; task-list items keep their bullet and footnotes render in place; bg-surface is nearly bg-background in light mode; light mode is unchecked on the profile, settings and log, and a visitor cannot choose it; fonts are not loaded; the wordmark says "steid" (ui.md).

Operations

  • Releases: the jpgill.dev mirror is temporary — until the control plane moves this instance onto the fleet a publish writes two hosts and can half-succeed — and the 0.6.0 mirror had not been written, since it needs ssh to the author's box (not rechecked since 2026-09-20). Signing is launch 5.4.
  • /api/instance reports no memory or cache numbers. The disk walk is cached for a minute, so a console that has just grown a volume sees the old number for up to that long, and counts .replaced-… and orphaned/, so a replaced instance reads as twice its size until the aside directory goes. Both routes live in web/instance.rs; move them if /api grows.
  • Metrics: active_imports never observed above zero; cat_file_respawns only unit-tested; no process metrics or histograms. classify() restates the URL layout, so a new route shape or git subcommand needs a line there.
  • The instance owner is the sole user (instance_owner), so the backup download fails closed the day a second user exists; claim::sole_owner_handle is the same lookup. Launch 4.2's instance-level role replaces both. No second-user test exists at the HTTP level, because no registration route exists.
  • Backups: no test covers the web route; a missing directory destination is written as a file; a never-migrated database errors badly; --backups daily was verified against a stubbed systemctl; cross-filesystem restore and large archives are untested. A self-hoster's backups stay on the machine unless they ship them.
  • Mail: TLS submission to a real relay has never been exercised.
  • The archive endpoint is the most expensive anonymous request (a full pack per hit, limited to 10 a minute per client) and the first thing to look at under load; a late git archive failure is a truncated download.

Code shape

The open steps of review-2026-09-10-organisation.md, which stays as their reference:

  • Step 4: URL builders re-scattered (two commit_urls, two compare_urls, seventeen more in pages); labels::encode is a fourth copy of urls::encode(v, false).
  • Step 6: web/frame.rs — web/repo.rs is imported by thirteen modules, and context.rs imports repo_for and profile_for upward from page modules.
  • Step 7: split web/pulls.rs (1,975 lines, 7 tests); the web layer is the thin spot in testing. owned_repo and owned_profile have no unit tests.
  • Step 8: GitQuery::diff hands git's stdout (RawDiff) across the layer boundary.
  • Step 9: application/refs.rs out of browse.rs; repoint the test modules and drop infrastructure::git's InMemoryGitQuery re-export.
  • Step 10: tests/http.rs exists but cannot render a view (empty asset bundle), so 303-after-POST, the __Host- cookie and the CSRF refusal page are hand-verified. The real bundle needs topcoat asset bundle in the test gate or a checked-in manifest — decide.
  • Step 11: split GitQuery (an amendment to 0006). Step 12: a RepoEvent log, so webhooks and feeds can report more than pushes (needs an ADR). Step 13: /api — five routes against 87; the standing practice in ROADMAP.md has lapsed.

Also open:

  • 38 too_many_arguments allows remain, all genuinely wide signatures (merge_pull, redeliver); narrowing them is step 11 and merge_pull's own shape.
  • &Stores::new(&orgs(cx), &memberships(cx), &repos(cx)) is written 60 times in web/; a context::ports(cx) would collapse it.
  • writable_repo and changeable_repo are two functions for one rule; access_tests.rs pins their agreement, so folding them is safe.
  • Milestone 7's permission argument has a home but no name: the third role, the permission enum and the collaborator model (an ADR) are undecided.
  • From the 2026-09-06 review, not rechecked since: sqlite.rs's tests use claim_instance as a fixture, and view_repo pays two count(*) and a membership lookup even on routes that draw no tab strip.

Backlog

Forward plans outside the launch order. Milestone 6 comes after launch by the plan's own list; milestone 7's first slice is launch 4.1 / 4.2, and the rest follows it.

  1. Milestone 6 — Writing. Posts, markdown, /{handle}/posts/{slug}. Open when it starts: which markdown crate, and whether raw HTML in markdown is trusted — safe for a single author, a stored-XSS hole the moment milestone 7 adds a second user.
  2. Milestone 7 — Identity, full — has a shape, set by the control plane's ADR 0005 (2026-09-12): a company signs everyone into its instance with its identity provider, and an individual's managed instance may do the same with a personal Google account. Beyond organisations (shipped in 0.8.0), invites and a registration policy, it asks for: a User with linked external identities (issuer, subject, verified email) beside an optional password hash; an identity-provider configuration reachable headlessly (STEID_OIDC_*); POST /api/setup able to bind the owner to an external identity; and an instance-level role. The OIDC relying party is a small crate shared with the control plane (steid-control-plane/crates/steid-oidc, on openidconnect, to be extracted when this milestone needs it) — the one exception to copy-not-share, because it is security code. Run it alone, as CSRF was. OIDC first; SAML is the control plane's milestone 9. The registration policy is chosen per instance on the control plane and delivered headlessly, so it is data: Open, InviteOnly, EmailDomain { provider, domain }, Provider { issuer, group/claim constraint }, later Saml. A self-hoster sets the same by env or a settings page. Launch 4.2 is its first slice.
  3. Forge feature candidates still open (surveyed 2026-09-05; the waves that built the rest are in progress.md): topics, and pinned repositories on the profile; milestones (8+); LFS; SSH (would reverse 0001); profile links; an Atom feed for posts once they exist; /api coverage for existing use cases.
  4. Zero-downtime deploys — deferred, deliberately. deploy.sh stops, swaps and starts: about two seconds. The plan: a systemd template unit steid@.service whose instance name is the port (/opt/steid/3000, /opt/steid/3001); install to the idle port, health-check it on loopback, repoint Caddy and caddy reload, then stop the old one and swap which is enabled. Two things make it more than a script: both processes share one SQLite file during the overlap, which wants WAL (launch 2.20: Steid is in rollback-journal mode today) and migrations written expand, deploy, contract; and an in-flight git push is cut unless the old process stops after Caddy has repointed (topcoat::start already drains on SIGTERM). Worth building when instances belong to other people.

Open questions

  • Whether an absent public repository can 404 while private ones still 401. The uniform 401 from 0007 hides private names, and also turns every mistyped URL into "Authentication failed", which cost real time on the first deployment. The leak concerns private names only, so a 404 for a name that would be public may cost nothing — needs thought about whether that is true.
  • Topcoat is early (v0.5.0, first released 2026-07-22, breaking changes expected by its own authors). Expect churn that isn't feature work.