Progress
This attempt (#3, Topcoat)
1,350 tests. Active milestone in current.md.
Control plane asks · 0.7.0
Three capabilities the control plane's phase D0 asked for. Nothing here tells Steid it is managed; each is a mechanism a self-hoster gets identically.
steid restore --replace (2026-09-26). The refusal — "restore only into an unclaimed
instance" — stays the default, because for a self-hoster it is the one thing standing
between a mistyped hostname and somebody's site being replaced. A managed instance boots
claimed (the boot-time owner), so it always holds a user, and without a way past the
refusal the console's restore could never succeed at all.
- A typed choice, not a
bool.RestoreMode::{OnlyIfEmpty, Replace}, withOnlyIfEmptytheDefault.restore(.., true, ..)at a call site says nothing about what is true, and these two answers are "refuse" and "destroy everything" — the pair least worth guessing at. It is enforced in the application layer, where the refusal already lived, rather than in the command that parses the flag. --replaceconsents to the first two checks only. The version check still stands: an archive from a newer Steid may hold a schema this binary cannot read, and no amount of consent makes that work.- Unpack beside, then swap. The archive extracts into
<workspace>/incomingfirst, so a corrupt or truncated archive fails having touched nothing live. Only once the whole extraction has succeeded does the adapter move the data directory's current contents into<data_dir>/.replaced-<stamp>/and the staged tree into their place — renames, so no bare repository can be half-copied, and both ends are on one filesystem by construction (the workspace is inside the data directory). - Moved, never deleted, for the reason
GitStorage::quarantineexists: the directory may hold the only copy of somebody's objects. A consistent copy of the database that is about to be thrown away is taken into the same directory, so the aside holds a whole previous instance rather than half of one. The cost is real and is stated where it will be read —Restored::replacedcarries the path out andsteid restoreprints it with therm -rf— because the instance now occupies roughly twice what it did. - The dot on
.replaced-is load-bearing three times: a handle can never start with one, so the backup packer skips it,list_repo_dirsfinds no repository under it (its contents are a level deeper than the sweep looks), and the swap itself skips every top-level dot entry — which is what leaves the.backupworkspace it is running out of, and any earlier replacement, where they are. - The window that is not atomic is between the swap and installing the database: the repositories are the archive's and the database is still the old one. Recovery is the aside directory plus the archive, both still on disk. Narrowing it further would need the two halves to share a transaction, which they cannot.
- A restore into a running process is the operator's problem and is said so in the doc comment. The console stops the service, restores, starts it; nothing in Steid checks, because there is nothing portable to check with.
- The flag parses on either side of the path — the control plane renders
restore --replace "$ARCHIVE"; a person types it wherever it falls — andsteid restore --replac a.tar.gzis a usage error rather than a restore of a file called--replac, which needed a guard on the one-argument arm.
install.sh --operator-token <token> (2026-09-26). Until now cloud-init fetched the
token from Parameter Store after the install, rewrote steid.env and restarted Steid —
so the box served for a few seconds with the operator surface off, and anything asking
/api/instance in that window got the public shape and read it as "no version".
- The one exception to "written once and left alone". Every other setting in
steid.envis written on the first install and never touched again, so an upgrade cannot revert somebody's edit. The operator token is not somebody's edit: it is a machine credential held by whatever provisioned the box, it gets rotated, and a box with the surface off is a box a control plane cannot see. Only a run that passes the flag rewrites it; an upgrade without it leaves the line alone. set_env_secretwrites the line, not a here-doc: the replacement goes tosteid.env.newunderumask 077and is moved into place, so the token is never briefly world-readable and an interrupted run cannot truncate the env file. The value is emitted withprintf '%s\n'rather than a here-doc, because a here-doc expands$…and backticks and the value is a token somebody else generated.- The value never reaches the terminal, a log or
ps. Noecho, nosay, nodiecarries it;saynames the key only.set -xis off, and turning it on would print this like anything else. - The rewrite strips the previous line and the marker comment above it, or a rotation would stack a fresh comment every run.
- It runs after the first-write/keep-existing branch and before the unit is written and Steid restarted, which is the whole point of the change.
- Verified against a temporary directory, not a real box: the variable defaults, the
argument parser and the whole configuration section were extracted from
install.shand run withCONF_DIR/STATE_DIR/INSTALL_DIRpointed at a temp tree andchownstubbed — the same stubbed-command approach--backups dailywas verified with. Six cases: a first install with and without the flag; an upgrade with no flag leaving the file byte-identical; a later run with the flag adding the line and preserving a hand-made edit; a rotation replacing the line rather than stacking one (one key line, one comment, the old value gone, mode 640, no leftover.new); and a token full of$, backticks, quotes and%swritten back byte-for-byte and absent from the output.sh -n install.shpasses.
Disk usage on /api/instance (2026-09-26). The operator shape gains disk, an
object of three u64 byte counts: data_dir_bytes, filesystem_total_bytes,
filesystem_free_bytes. It closes the "reports no disk, memory or cache numbers" bullet
for the first of the three.
- A nested object, not three flat
disk_*keys, so the group is present or absent together and a consumer tests one thing. Bytes only — formatting "12 GB of 20 used" is the console's, and a number it can do arithmetic on is what it cannot get back from a formatted string. - Never on the public shape, and there is a test that serialises the anonymous answer
and asserts the string does not contain
disk. It says how big somebody's machine is. - A seventh narrow port,
DiskUsage. A use case may not ask the filesystem anything, and a test must not depend on the size of the disk it runs on.InMemoryDiskUsagebeside it, including anunmeasurable()for the case the report has to survive. describe_instanceswallows a disk error intoNone, deliberately and for the reasongit_versiondoes: that same response carriesclaimedand the version, which are what a control plane is polling for, and a data directory that cannot be stat'd must not take them down. The reason goes to standard error.rustix, notlibcornix, forstatvfs.std::fscannot answer it at all.libc::statvfsneedsunsafe, and this codebase has none;nixis not in the tree.rustixalready is —tempfileandtar'sxattrboth pull it with thefsfeature — so the direct dependency added one line toCargo.lockand no crate to the build, and it is a safe wrapper.default-features = false, featuresfsandstd.f_frsize, notf_bsize: POSIX says the block counts are in fragments, andf_bsizeis the preferred I/O size, which is not the same number on every filesystem.f_bavail, notf_bfree: the difference is the reserve kept for root, and Steid does not run as root, sof_bfreewould promise space it cannot have. Stat'd against the data directory, not/, because state is routinely its own volume.- The walk is the expensive half and is cached for a minute. Timed on the author's
laptop against a synthetic tree of the shape a forge really has — 20 repositories ×
1,000 loose objects, 20,000 files, 78 MB — at 115–160 ms, and a real 4,150-file
.gitat 13 ms warm (the first cold pass was 148 ms). Uncached, an operator poll every few seconds would be the most expensive thing the instance does. OneWalkingDiskUsagein app context, or the cache remembers nothing — the same composition-root decisionCatFilePooland the highlight cache needed. - The walk counts everything under the data directory, quarantined and
.replaced-…directories included. It is what the instance is costing, not what it is usefully holding, and the gap between the two is exactly what somebody looking at a full volume needs to see. - Apparent size (
len()), not blocks used — it matches what a backup of the directory would weigh, which is the comparison somebody sizing a volume makes. Never follows a symlink (DirEntry::metadatadoes not traverse), never fails (an unreadable directory contributes nothing and the walk carries on), and is iterative so a pathological tree cannot overflow the stack of a thread that is only counting bytes. how_long_the_walk_takesis an#[ignore]d benchmark in the module, driven bySTEID_WALK_BENCH=<dir> cargo test --lib -- --ignored --nocapture, so the measurement above can be repeated rather than believed.- No
/metricsgauge. The consumer is a console showing one instance's storage; putting it on the scrape would mean a walk on the collector's schedule too.
Releases move to releases.steid.dev · done (2026-09-20)
0.6.0 is published from https://releases.steid.dev — the steid-releases bucket
behind CloudFront — instead of from jpgill.dev, which keeps serving the same files as
a mirror. The reasoning is decision 0009;
what is worth not rediscovering:
- The version was not bumped.
Cargo.tomlandinstall.shhad said 0.6.0 since the boot-time owner landed, and no artefact was ever cut for it —jpgill.devstill served 0.5.0 as the newest. So 0.6.0 is published as-is. Bumping to 0.6.1 would have burned a number to record a change of URL that nobody had downloaded. --publish-s3-onlyexists because the mirror needs ssh to a live website. Cutting a release and touching the author's box are separate decisions, and before this they were one flag.--no-mirroris the same separation on a deploy that is also publishing.- Content types are set explicitly on upload (
--no-guess-mime-typeplus--content-type). The CLI's guess labels a.tar.gzwithContent-Encoding: gzip; a browser then decompresses it on download and the.sha256beside it no longer matches — a failure that reads as tampering rather than as a header. - The invalidation is waited for, not fired. CachingOptimized holds objects up to 24
hours,
install.shis overwritten at a path that already exists, and the script's own HTTPS verification would otherwise happily pass against the previous publish. - The distribution id is looked up by its alias. An id written into a public repository is a fact about one AWS estate that goes stale silently, and the symptom is a publish that reports success while the host serves the old script.
- No credential is in the repository. The publish uses
--profile ${STEID_AWS_PROFILE:-steid}by name; no key, no account id, no role ARN. This matters more than it used to: the repository is about to be public.
The boot-time owner · done (2026-09-13)
STEID_OWNER_EMAIL + STEID_OWNER_HANDLE create the owner before the first request, so
a scripted install comes up already claimed and there is never a window in which a
stranger could claim the box. Asked for by the control plane's
ADR 0008, but
Steid knows nothing about a control plane: this is a capability for any operator who
wants an unattended install, and a self-hoster gets the same thing by hand. Absent the
variables, nothing changed.
- No usable password, and no sentinel type. The seeded owner's stored hash is a real
Argon2 hash of 32 random bytes generated at boot and dropped — the same shape as
login.rs'sABSENT_USER_HASH.verifytherefore answersOk(false)through the normal path, in the time any wrong password takes. The alternative, a sentinel value thatloginrecognises, would be a second code path through the one function that must not grow one, and the first thing a future change forgets. The cost is that nothing in the database says "this account was seeded"; the benefit is that nothing has to. - Both variables or neither. One without the other refuses to start (exit 4,
beside the mail check) with a line naming the missing one. Coming up unclaimed is the
exact state this feature exists to prevent, so it cannot also be the fallback for a
typo. Likewise a reserved or malformed handle, or a bad email: the refusal is the
domain rule's own message, at the one moment an operator is reading the output.
adminis the case ADR 0008 calls out, and it is a reserved handle. - Inert once claimed, silently. The variables live in
steid.envfor the life of the instance and are re-read on every boot; a claimed instance says nothing, the way the setup token is already absent once an owner exists. The check isapp::seed_owner_on_boot's — the boot policy — whileseed_ownerrefuses a claimed instance itself, which is the invariant behind it. claim_instanceandseed_ownersharecreate_owner. The three saves have to happen in org → user → membership order or the foreign keys trip, which attempt #2 already had to fix once; a second copy would be a second place to get it wrong. What differs is only what may run it: a token and a claimed check, or a claimed check.AppConfig::owner_seedrather than a check inmain.mainis the one place in the tree nothing can assert against, and the both-or-neither rule is a decision worth a test. It returnsResult<Option<OwnerSeed>, DomainError>;mainonly prints and exits.tests/http.rsboots a seeded instance throughapp::seed_owner_on_boot, which is the functionmaincalls, so the boot order — seed first, then decide whether there is a setup token — is exercised rather than re-implemented in the test.- A page cannot be rendered in
tests/http.rs. The empty asset bundle those tests use panics inside Topcoat's catalog the moment aview!is built, so the assertions about a claimed instance go through the routes that redirect or answer JSON —/api/setup,POST /auth/setup,POST /auth/login,POST /auth/reset/{token}— and neverGET /auth/setup. That is a standing limit of that harness, not of this feature. The end-to-end proof is the reset flow: mint a link, spend it, sign in with the new password, all over HTTP. install.sh --owner-email/--owner-handlewrites them, refuses one without the other, and — like every other setting there — writes them only whensteid.envis first created; a re-run with them says they were ignored rather than implying a re-seed. The closing message forks: an owned instance is told how to mint a reset link instead of how to find a setup token.
A security review of the whole surface · done (2026-09-10)
Every #[page] and #[route], the git transport, the CLI, the outbound paths and the
dependency tree. The table, the evidence and the deferred items are in
security-2026-09-10.md; what follows is what the next session
would otherwise rediscover.
- The boundary work held. No enumeration hole, no authorization gap, no injection.
The two 404 bodies for a private repository and an absent one are byte-identical, the
git transport gives one 401 for private, absent and mistyped alike, and every
gitargument that could come from a URL is either a resolved object id or sits after--. That is worth writing down because six of the seven findings were about something else entirely, and a future reader should not read "seven findings" as "the model was wrong." - Every finding was a resource limit or a library default, not a rule anyone got
wrong. The two that matter: Topcoat's
FormandJsonread the body withusize::MAXand there is no knob for it, andureqfollows ten redirects by default. Both were assumptions nobody had reason to check, and both are the sort of thing to check first in a framework this new. - One 200 MB POST to
/auth/logintook the process from 20 MB resident to 811 MB. Measured, not reasoned.web::body_limitcaps it at a mebibyte in the one layer at/— which is now doing three jobs, for the same.discover()reason the request counting is there. The git RPC routes are exempt and the exemption matches the whole four-segment route:RepoNamereserves neithergit-upload-packnorgit-receive-pack, so a repository may be called that, and matching on the last segment alone would have exempted its page. The test in the module is what caught it. - A path parameter arrives percent-decoded, and
see_otherpanics on a badLocation.POST /auth/reset/a%0d%0abdropped the connection and wrote a panic to the log. The fix is to encode the value on its way into the header rather than to validate its shape — a real token comes back fromencodeunchanged, so there is no second copy ofResetSecret's rules to drift. Anything from a URL that reaches a redirect wants the same treatment; the rest of the call sites take a literal or a validated handle. - The SSRF rule was two checks and needed a third. Resolving a host says nothing
about where a
302sends the next request, and the webhook path made that worse by storing the response body and rendering it on the deliveries page.max_redirects(0)forureq,-c http.followRedirects=falsefor the clone. The import cost is real: a repository renamed on its host no longer imports from its old URL. git grepwas the last uncapped read on an anonymous page.?q=eover Steid's own source is 5.3 MB of output, all collected before all but a thousand hits were thrown away.run_cappedalready existed for diffs and only had to learnrun_allowing's exception — grep's exit 1 means "matched nothing".Secrethad one hole and the layer had one gap:operator_tokenwas a bareStringon aDebug-deriving struct, and nothing setCache-Controlon anything. Both one line.private, no-cacherather thanno-store, because a response the browser was told not to store cannot answer the archive'sIf-None-Match.cargo auditis clean — zero vulnerabilities, the same three standing warnings (bincode,yaml-rust,chacha20), all transitive and none an upgrade Steid can make on its own.
CSRF on every form · done (2026-09-08)
The item current.md had carried since the forms first existed, run alone because it
touches every one of them. The decision and its alternatives are
0008; what follows is what
the next session would otherwise rediscover.
- Topcoat already ships an origin check, and nothing said so.
sessions()installs anOriginLayerthat refuses any non-safe method whoseSec-Fetch-Siteis notsame-origin/none, falling back toOriginvsHost— read intopcoat-session-0.5.0/src/origin.rs. So Steid was not unprotected before this; it had two defences sharing one deliberate gap, which is that a request carrying neither header passes. That is the gap the token closes, and knowing the layer exists is what turns "we have no CSRF protection" into "we have two and want a third." - The token is
HMAC-SHA-256(per-boot secret, session token hash), so nothing new is stored.csrf_field()renders it,csrf_verified(cx, &form.csrf_token)checks it in constant time, both inweb/csrf.rs. A restart invalidates every open form — the price of a per-boot secret, and it shows up in development as a 403 on the first submit after atopcoat devrebuild rather than as anything obviously wrong. - A
#[page]handler cannot return both a status and a view from an error, because the router only renders its own error types and anything else becomes a 500. SoCsrfRefusedis caught by name in the root layout, which renders the 403 page — and that is whylayout.rsnow has ashellcomponent the layout renders twice. A#[route]handler never reaches a layout, so the two that need the check (/auth/logout,/{handle}/settings/password) usecsrf_verified_response, in theif let Some(response) = …shapethrottledalready established. #[serde(default)]on everycsrf_tokenfield is load-bearing. Without it a submission that omits the field entirely fails deserialization and answers a bare 400 instead of the 403 with a sentence. Found by walking the forms with curl; every unit test passed either way.- The two label-assignment forms deserialize as
Vec<(String, String)>— a checkbox list has one repeated field name — solabels::presented_tokenpicks the token out of the pairs. Any future form of that shape needs the same. csrf_scan.rsreads this directory's source and fails when a POST route neither calls the check nor is named incsrf::EXEMPTwith a reason. Textual on purpose: what is being guaranteed is that somebody wrote the line, and a runtime check would need every handler's fixtures. It also enforces the 307 rule, and found a third instance of it:POST /auth/setupon an already-claimed instance answeredredirect("/").- Six handlers had no form body at all — bare buttons submitting an empty POST:
token revoke, import retry, hook delete and redeliver, label delete, and sign out.
They take
Form<CsrfGuard>now. None of them was a link that POSTs; HTML cannot do that, so there was nothing to convert. - Ordering: the check runs before the ownership guard, so an anonymous POST to an owner-only route answers 403 rather than the guard's 404. Nothing leaks — the answer is the same for every URL, existing or not, because it does not consult the target.
- Verified in the running app on :3134, not only in tests: claimed, signed in, and walked every form through both curl and a real browser — repository create, the five repository settings writes, issues (create, comment, state, edit, labels), labels (add, edit, delete), tokens (issue, revoke), hooks (add, toggle, delete), the profile form, the password change, import, sign-out, and the pull request handlers. Each succeeds with its token and answers 403 without one, and a token tampered with in the browser renders the refusal page inside the normal chrome.
One access module, one bundle, one sequence, one password rule · done (2026-09-08)
Review steps 5 and 6, plus the password policy current.md had been carrying since the
ops wave. No behaviour change except the password rule, which is named below.
application/access.rsis now the only place that answers "who may do what."readable_repoandwritable_repocame out ofissue.rs,changeable_repoout ofrepo.rs,is_instance_ownerout ofbackup.rs, andauthz.rs's two organisation predicates were folded in and the file deleted. The point is milestone 7: graded permissions are a change to six predicate bodies and their signatures, provided no use case ever decides authorization inline. The module header says so, in the file someone would have to edit to break it.writable_repoandchangeable_repoenforce the same rule from opposite ends — one layered onreadable_repo, one resolving directly — and nothing checked that they agreed.access_tests.rsnow walks every actor against a public, a private and a missing repository and asserts both give the same verdict and the same kind of refusal. They do. Folding them together is now a safe change rather than a hopeful one.application::Storesreplaced theorgs/memberships/repostriple on 56 signatures, and took#[allow(clippy::too_many_arguments)]from 63 to 38. Every remaining allow is a genuinely wide signature rather than port-threading. It is one commit, not one per module: a use case's signature and its callers have to move together.- The transform was scripted, and the one thing a regex got wrong was inside a string
literal —
format!("{origin}/{handle}/repos/{name}")becamestores.repos, which compiled fine and was caught by a webhook payload test. Worth knowing before the next mechanical sweep: exclude string bodies, and lean on a test that asserts a rendered URL. Storesis three references andCopy, with hand-writtenClone/Copyimpls becausederivewould demandO: Copyof the adapters.
- The transform was scripted, and the one thing a regex got wrong was inside a string
literal —
next_numbermoved fromIssueRepositorytoRepoRepository. The sequence inrepo_sequencesis the repository's — issues and pull requests both draw from it so#4means one thing — but it sat on the issue port, socreate_pullheldIssueRepositoryfor one line. It no longer does. The in-memory sequence is a map onInMemoryRepoRepounder its own lock; the SQLite upsert-returning statement is unchanged, only relocated.- The password rule, and the one behaviour change in the wave.
domain::Password::newrequires 12 characters and nothing else — length is the property that measurably helps, and composition rules mostly producePassword1!or a sticky note. A 512-byte ceiling bounds Argon2's work for one unauthenticated request.claim_instance,reset_passwordandchange_passwordall ask it, which closes the actual hole: before, setup had no rule at all, so a password could be set at claim time that could never be changed to.- Existing passwords are never re-checked.
logindoes not construct aPassword, so an account made before the rule keeps signing in and meets the rule the next time its owner changes it. Password::RULEis a constant, printed verbatim by the setup form, the reset page and the settings page — three surfaces that would otherwise drift into three accounts of one rule.POST /api/setupdeliberately says nothing. A short password gets the same opaque 404 as a wrong token, with the reason in the log. Naming the password there would tell a stranger guessing setup tokens that they had guessed one, which is a worse trade than an unhelpful error for a caller that is a script.- The mismatch check runs before the length check: "those two are different" is the more useful answer when someone has mistyped, and the pages' refusal codes depend on that order. There is a test for the order, not just for the two refusals.
- Existing passwords are never re-checked.
The per-file last-commit column — section 1's last gap
Every file and directory in a listing now says what last changed it and when, linking to that commit. It is the column 0006 deferred twice, and it is on the landing page and on every subdirectory.
- One
git log --name-onlyper listing, not one per entry. At one fork per entry a twenty-file directory was the ~230ms that made 0006 defer it in the first place. The walk is--format=%H%x00%ct%x00%s --name-only -z, narrowed to the directory by a pathspec, capped at 500 commits — 500 that touched this directory, which is deep enough that a real listing is attributed long before it. - Newest first, first mention wins, and a path under a child attributes to the child:
src/web/page.rsin a listing ofsrcisweb's row. The walk stops as soon as every entry has an answer, so the cap is a worst case rather than the usual cost. - An entry the walk never reached shows nothing. A blank is honest; the oldest commit read is not the answer and would look like one.
-zoutput has no record boundary — git writes one flat NUL-separated sequence of fields and paths — so a record is recognised by shape: forty hex digits followed by a field that parses as a time. That also survives a merge, which--name-onlyprints with no file list at all.
A kept-alive git cat-file — stage 2 of 0006
Object reads no longer fork. infrastructure/cat_file.rs keeps two git cat-file
processes per repository — --batch-check and --batch — in a pool in app context, and
DiskGitQuery writes lines to them instead of spawning. The port is unchanged and its
whole test suite passed unmodified, which is what "an adapter change behind an unchanged
contract" was supposed to mean.
The landing page went from 15 processes and 115 ms to 4 and 31 ms; a tree page from 3 and 35 ms to 1 and 13 ms. The full table, the reasoning, and what stayed a process are in the third amendment to 0006. What is worth not rediscovering:
--batch-commandwas rejected on the git version floor, not on shape. It is the better shape — one process, each line naming its verb — and it needs git 2.36. Ubuntu 22.04 ships 2.34 andinstall.shsupports it deliberately.-zfor NUL-delimited input is 2.31 and is used, so a path containing a newline is one spec rather than two requests.- A batch stream is positional, so a misread reply is silent corruption, not an
error: every answer after it shifts by one, and the visible symptom is the wrong file's
bytes under the right filename. Hence the desync guard — the
--batchrequest carries the id, type and size--batch-checkalready gave, the reply header is checked rather than parsed, and any mismatch kills the process. A process that merely died is a different case and is respawned once per request. - The shim technique paid off a second time. A
gitonPATHlogging its arguments gave every number in the table in about ten minutes, and it is how the "15 processes" claim was checkable at all. ls-tree --longbecame two questions. A tree object carries no sizes, so the listing is the tree object parsed here plus one bulk--batch-checkfor the blob and symlink entries — chunked to 256 specs or 8 KiB, because writing more than a pipe holds without reading deadlocks both ends.- A one-commit log is not a log.
log(rev, 0, 1)— the landing page's latest-commit bar — is the revision's own commit object, so it costs no walk and no process. Anything wider still runsgit log, which is what walking history is. - git's
%sis the first paragraph, folded onto one line, not the first line. The commit parser reproduces that, and agpgsig's continuation lines each begin with a space — so the blank-looking ones inside a signature must not be read as the end of the headers.
Section 1 wave — read-only browsing · done
Every read-side git process is now bounded at 20 s (GIT_TIMEOUT in
git_query.rs), and the child is kill_on_drop so a cancelled request takes git with
it. Added before blame and grep arrived, because those are the first reads that can
run long on a big repository, and five agents each adding their own bound would have
produced five. GitQueryError::is_timeout() is how a page tells "asked too much"
(render a state, offer less) from "git failed" (a 500). Tokio's time feature was
enabled for it.
Syntax highlighting (merged 2026-09-05). syntect with the pure-Rust default-fancy
engine plus two-face (syntect-fancy feature) for the grammars the default set lacks —
TOML, Dockerfile, TypeScript — at +0.59 MiB on the binary. Decisions worth keeping:
- Classes, never inline colours. Output is
ClassStyle::SpacedPrefixed { prefix: "hl-" }and every colour is a--syntax-*token instyles.css, so the palette follows the theme.ClassedHTMLGeneratorcannot be used because its spans cross line boundaries and the blob view is one table row per line;highlight.rsdrivesParseState+ScopeStackitself, carrying parse state across lines but closing and reopening the markup at each line end. hl-classes are scope atoms, not positional, so.hl-functionalone would colour everymeta.functionbody. Single-atom selectors only for an atom that leads its scope; the rest are compounds. Rule order instyles.cssis load-bearing:.hl-stringis written after.hl-punctuationso a quote reads as its string, and the comment rule is last.- The trailing newline is dropped by character, not
trim_end— the_newlinessyntaxes need it fed in, and it comes back escaped inside the output, sometimes before a closing span. Left in, every row renders double-spaced. - Caps are 512 KiB and 10,000 lines, both, because cost is per byte and per line.
Plain text is returned as
Plainlines, not wrapped in colourless spans. - ~87 ms per 1,255-line file in release, uncached, paid on every view; debug is ~8× slower and not the number to plan against. If it matters: cache per blob object id.
Branches and tags pages (merged 2026-09-05). /branches and /tags, one
for-each-ref each, and the counts beside the switcher and in the sidebar are links.
%(HEAD)is why the page is one process:for-each-refmarks the default branch, so nothing callssymbolic-refon the happy path, and the compare link's base is read from the pinned row.- Keep empty fields when splitting
for-each-refoutput. A lightweight tag's%(*objectname)is empty; filtering empties shifts its date into the id slot. There is a test for exactly this. - Ordering is git's (
--sort=-committerdate), pinning is the use case's. The default branch is a display decision, a stable partition inlist_branches. - A lightweight tag's
%(contents:subject)is the commit's subject, so it is read only when%(objecttype)istag.annotatedis its own field because an annotated tag may carry an empty message. The row shows the peeled%(*objectname)so the sha is browsable. - "No tags yet" and "nothing pushed yet" are different sentences; telling them apart
costs one
default_branchcall, only when the list is empty. refs.rs::timed_outis the first web-layer place that renders a timeout as a state rather than a 500. When a second page wants it, move it toweb::context.
Archive download and code search (merged 2026-09-05). /archive/{rev}.tar.gz
and .zip streamed from git archive; /search?q=&rev= over git grep -F.
GitArchiveis a fourth narrow port, not aGitQuerymethod.GitQuery's contract is capped bytes, collected; an archive is as large as the repository. It lives ininfrastructure/git.rsbeside the protocol server and reusesweb::git::GitBody, so "one subprocess's stdout becomes a response body" is written once and used twice.- The archive use case is two steps, which is what makes the
ETagcheap.archive_repoauthorizes and resolves into anArchiveTargetnothing else can construct;open_archiveruns git. A conditional request is answered from step one, so re-downloading a tag costs onecat-file. TheETagis the resolved commit. git grepis the one command whose exit status is an answer (1 = no matches).run_within_allowingtakes an allowed-exit list andNO_MATCHESnames the exception at the call site, so the module's rule stays visible where it is broken.git grep -zis not optional: a path may contain colons, so the colon-separated form has no unambiguous reading. The parser walks NULs.RepoPathrefuses a colon, soa:b.rsis unsearchable as well as unbrowsable; the parser drops those hits rather than link to a 404. Pinned by a test.- A search timeout is a page state (
Searched::TimedOut), the first real consumer ofGitQueryError::is_timeout. - Archive and search 404 a private repository for a stranger, matching every other read page rather than 0007's uniform 401, which exists so a git client can offer a credential; a browser link gets no benefit from it.
topcoat devin a worktree exited rather than restarting after some source edits and had to be relaunched by hand. Possibly two instances sharing atarget/. Watch it.
Commit page and compare view (merged 2026-09-05). /commits/{sha}, /compare
(form) and /compare/{base}...{head}, three-dot. Every sha in the log and the
latest-commit bar links to the commit page.
- The counts and the patch come from one
gitprocess:diff-tree --numstat -pwrites numstat first, so a patch too large to draw still lists every file with real+a −b. A second--numstatcall would be paid on every page for the rare oversized one. run_cappedreads through a pipe and kills the child atmax_bytes + 1; the exit status is checked only when the cap was not hit, since a killed process says so.run_allowingbends the "non-zero exit is a fault" rule for exactly two commands whose codes git's manual promises as answers:grep(1 = matched nothing) andmerge-base(1 = no common ancestor, 128 = broken). Both arrived in the same wave with their own copy; the merge kept one. A third caller needs the same scrutiny.- Compare is three-dot (merge-base to head): two-dot undoes everything base gained
since the branch left, a wall of deletions nobody made, and three-dot is what a pull
request needs.
...is unambiguous becauseRefNamerefuses... - The patch parser tracks hunk line counts, never matching
diff --git/+++/---prefixes anywhere: a patch of a patch contains those as content. - Paths come from
---/+++/rename from, not thediff --githeader, whosea/<old> b/<new>has no defined split when names contain spaces. C-quoted names are unquoted. - The compare form GETs to
/compare?base=&head=and 307s to the path form, so the shareable URL is always the path one and no JavaScript is needed. - The file header is
sticky, which is why the diff panel is notoverflow-hidden: a hidden overflow makes an ancestor a scroll container and sticky sticks to nothing.
Blame (merged 2026-09-05). /blame/{rev}/-/{path}, with Code · Blame · Raw in the
file header of both views.
- The porcelain parser is pure, in
application/blame.rs.git blame --porcelainwrites a commit's header block only the first time the commit appears; later runs are a bare sha line looked up from an accumulated map. A code line can look exactly like a header line, and the leading tab is the only thing that tells them apart. Both are pinned by tests.parse_blamenever fails: an unrecognised record is skipped. filenameis per commit, not per hunk, carried onBlameCommit; that is what makes the "moved from" marker work.- The use case reads the blob before blaming, so binary, too-large and not-there are
decided by the blob page's rules from the same cap. Blame's own output cannot tell: a
binary file blames into garbage rather than reporting itself. Costs one
cat-file. - The commit cell is one line tall, on purpose: two lines and blame and blob disagree about where line 400 is. Row height measured at 19.5px in both.
- The age tint is linear in time, not rank, five steps between the file's oldest and
newest commit, as
color-mixof the primary in plain CSS. A file whose history is bunched shows only the end steps; rank quintiles would always look richer and lie about the gaps. A file written in one commit takes the top step. - Blame is 4 processes (two
batch-checks asking the same existence question, one from the use case and one inside the adapter). A kept-alivecat-file --batchcollapses both — the same upgrade 0006 defers. - Headless Chrome writes screenshots to files; the puppeteer MCP tool does not.
--headless --hide-scrollbars --window-size=W,H --screenshot=path URL. Andtopcoat devsometimes keeps printing "no changes; application up to date" while serving the previous binary;pkill -f "topcoat dev", wait for the port, restart.
The integration pass (2026-09-05). The five branches merged, run as one app against
Steid's own history — 9 branches, 2 annotated tags, a public repository and a private
one — and every link crossing a feature boundary followed in a browser, in dark and in
light. Nothing was broken at a seam, which is the finding: five agents that could
not see each other agreed on URL shapes because the shapes were written down in
ui.md and in each other's handovers before the code was.
- A private repository 404s on all eleven read routes anonymously — landing, log,
branches, tags, commit, search, tree, blame, raw, archive, compare. Every use case
takes an
Actorand answersOk(None), and each page turns that intonot_found(); the uniformity is the architecture rule paying off rather than eleven separate decisions. - Two gaps found, both entry points rather than breaks. The About sidebar's Download
links can only ever offer the default branch, because the sidebar renders on the one
repository page that has no
{rev}. And blame renders its lines unhighlighted while the blob highlights them,highlight.rsandblame.rshaving shipped on separate branches. Both are in current.md. - A wave needs a divergent branch to test compare with. Every feature branch was an
ancestor of
mainafter merging, so every branch row's Compare link correctly said there was nothing to compare and exercised none of the diff.git commit-treemakes one without a working tree. - Follow-ups the handovers named, done here: blame's revision switcher (
Switchgained aBlamearm),web::context::timed_outshared by three pages,.jsxaliased onto JavaScript,token.rs's phantombg-muted, and the two exit-status comments that each claimed to be the only one.
Released as 0.3.0 (2026-09-06) — the first version carrying the section 1 wave.
No migrations between 0.2.0 and 0.3.0, so the two binaries share a database and
deploy.sh's rollback is a real one. First Linux release build with syntect and
two-face; both are pure Rust behind the fancy-regex features — the bullseye container
build took ~2 minutes and needed no changes. Deployed 2026-09-06 12:07 UTC+1, health
check passed first time. Probed live afterwards: landing, branches, tags, search, log,
commit and compare all under 0.25 s; the 113 KB git_query.rs blob and its blame both
~0.65 s (highlighting, uncached, on the Lightsail box); archive/main.tar.gz answers with
the sha as ETag; an unknown repository 404s.
Wave 2 — git features · done
Rename, default branch, archived (merged 2026-09-06). All on the settings page, which now reads as five sections.
- A rename moves the directory first, then writes the row, compensating with a move
back if the save fails — the opposite order from delete, because a move is reversible
where a delete is not.
GitStorage::renamerefuses an occupied destination: with no row naming it, whatever is there is an orphan, and adopting it hands someone else's objects to this repository.fs::renamesilently replaces an empty directory on Unix, hence the explicit exists check. - No redirect from an old name, single tenant; the form names
git remote set-url. Revisit at Milestone 7. - The default branch has no column. git holds it in
HEAD; a SQLite copy would be a second answer that drifts. The write isGitStorage::set_default_branch(on the storage port, sinceGitQuery's contract is reading).symbolic-refaccepts a branch that does not exist, which would make every page say "nothing pushed yet", so the use case checks the name againstbranches()first — the same call that renders the select, so one process for both. - Archived is a column and not a third visibility. It says "finished", not "hidden":
clone, browse, search and download keep working, and an archived private repository is
a real, tested state. The push refusal sits in
serve_gitafter theRole::Ownercheck, so only someone who could otherwise push ever learns a repository is archived.DomainError::Archivedis its own variant: the owner is refused too, and it is the one refusal the person hitting it can lift. The 403 carries atext/plainbody sogit pushshows the sentence behindremote:. update_repoandrename_repocarryarchivedacross explicitly, because both rebuild throughnew(), which resets it.- The
repositoriescolumn-migration test insqlite.rsapplies a list of migrations; every future column on that table belongs in it.
Issues (merged 2026-09-06). Per-repository issues with comments, an Issues tab, and a number sequence pull requests will share.
- The sequence is its own table,
repo_sequences (repo_id, next_number), not a column onrepositories: pull requests draw from it too, and allocating a number must not write the row a push is contending for. Allocation is one statement (insert … on conflict do update … returning), so SQLite's writer serialisation is the whole concurrency story;unique (repo_id, number)makes it load-bearing. - Comments sit behind the issue's port, one trait for the aggregate, two tables — a deliberate departure from a literal "every table gets a trait". Same-second comments tie-break on insertion order, not id: ids are random UUIDs and an id tiebreak made a conversation read backwards, caught by a flaky test.
markdown.rsneeded no change: it writes every tag itself and never passes source HTML through, so a<script>in an issue is inert text. That property is why user-written markdown can render on the session cookie's origin at all. Do not reintroduce HTML passthrough.- Third instance of the page-name shadowing trap:
#[page] async fn commentwould have shadowed a loop variable; the handler isadd_comment. - Author handles are resolved once per request (
Handles); a deleted author renders as "someone" rather than failing the page.
Import from a URL (merged 2026-09-06). A second block on the new-repository page
mirrors a public https:// source in the background; the row exists immediately in an
importing state. Verified against a real GitHub repository: 3,293 commits, 112 tags,
HEAD following the source, an ordinary repository afterwards.
import_stateis nullable andNULLis an ordinary repository, so a page that forgets about importing gets the behaviour it had.import_sourceoutlives the state: provenance stays true and a retry needs it. State attaches viawith_import(...)after construction, likepinned, rather than wideningfrom_trusted.- The SSRF check is two halves and both are needed:
ImportSource::newrefuses the scheme, userinfo and literal non-public addresses;DiskGitImportresolves the host and checks every address immediately before spawning git, because a public name can resolve to loopback. A host with one public and one private answer is refused. GitImportis a fifth narrow port, not aGitStoragemethod: a ten-minute network transfer that only runs in the background,kill_on_drop,GIT_TERMINAL_PROMPT=0— which is load-bearing, since without it a private or mistyped source hangs git on a username prompt forever. With it, GitHub's 401 for a missing path reads as "could not read Username", whichimport::explaintranslates.import_repodoes not touch disk;git clone --mirrorcreates the directory, so the two-writes problem moves intorun_import, which re-reads the row after the clone because minutes have passed and the repository may have been deleted. The boot sweep marks stuckimportingrows failed; it is safe because it runs before anything is spawned.- A push during an import is
DomainError::Unavailable→ 409, after the permission check so a stranger learns nothing. Clones during an import are still served: git either finds refs or it does not. The 409 sentence reaches the terminal as aremote:line. tokiogainednetforlookup_host. No new crate.
Push events and webhooks (merged 2026-09-06). One push_event per ref an
authorized push moved; webhooks at /settings/hooks deliver a signed JSON POST with
retries and a delivery log; REMOTE_USER reaches the reflog.
- Events are recorded from the application, not a
post-receivescript: refs are snapshotted before and after the receive-pack RPC and diffed. A hook script would need installing on creation and on boot, syncing with the binary, and a channel back; it is the right answer if per-push cost ever matters, and the only way to apre-receiverefusal. The recording hangs off the response body's EOF (GitBody::on_end), becauseserve_gitreturns while receive-pack still streams; a client that vanishes mid-transfer records nothing. REMOTE_USERwas inert untilcore.logAllRefUpdateswas turned on —git init --bareleaves bare repos with no reflog.init_barenow sets it; repositories created before this keep no reflog and there is no migration (git config core.logAllRefUpdates truein each bare repo). The(none)in the reflog identity isREMOTE_ADDR, which Topcoat 0.5 discards.- A hook's secret is stored in the clear, unlike a token: an HMAC needs the value, and a leak forges a payload at one endpoint rather than acting as the owner.
- SSRF in two halves:
WebhookUrl::newrefuses schemes, credentials, private and link-local ranges and packed address spellings (127.1,2130706433); the sender resolves and checks every answer before dialling.from_trusteddoes not re-run the rule, so a tightened rule cannot hide a stored hook from the page where it is deleted.— one copy, inimportandwebhookeach carry their ownis_publicdomain/net.rs, and it is the union of the two: each knew a range the other did not. ureq, notreqwest: already in the tree via Topcoat with rustls, so a feature flag rather than a second TLS stack; blocking, hencespawn_blocking.http_status_as_error(false)because a 4xx is what the delivery row records. New direct depshmac,serde_json,ureqwere all already compiled transitively.X-Steid-Deliverycarries the push event's id, the same on every attempt, since deduplicating on it is the only reason a receiver reads it. Hooks are delivered to concurrently, events sequentially per hook. The retry schedule is a parameter so tests prove four attempts without waiting 2.5 minutes.GitQuery::ref_snapshotcovers all ofrefs/and reports an annotated tag's own object.
The wave 2 integration pass (2026-09-06). The four branches merged and run as one app on port 3111, against Steid's own history with two annotated tags, four repositories imported from GitHub — ripgrep, cargo, clippy, rust-analyzer — and a private one. Unlike section 1's pass, this one found real breaks, and both were the same mistake in the same shape.
- A settings save during an import ended the import.
update_reporebuilds throughRepository::new()so the description rule lives in one place, andnew()resets the import trio; it carriedarchivedacross for exactly that reason and nobody noticed the trio. The consequence was not cosmetic: the row said "ordinary repository" whilegit clone --mirrorwas still writing into the directory, so the page read as an empty repository,refuse_writesstopped refusing pushes into it, and the provenance was gone for good. Two imports in the pass's own fixture lost their source before it was spotted.rename_repohad the same shape with a smaller consequence — an imported repository stops saying where it came from. The general rule, now in current.md: every use case that rebuilds throughnew()has to carry whatnew()resets. - An imported repository had no reflog.
git cloneleavescore.logAllRefUpdatesoff exactly asgit init --baredoes, and an import never goes throughinit_bare. Found by the new boot sweep reporting six repositories on an instance where every repository had been created by current code — the six were the imports.finish_mirrorsets it now, beside the other two things that turn a mirror into an ordinary repository.
What the pass walked, all in a browser or with git against a live instance: an import
of a real repository while its landing panel, profile badge, issues, settings and hooks
pages were read; git push into it refused with 409 and the sentence reaching the
terminal behind remote:, while git clone was served; after it landed, branches, tags,
a commit, blame, search, compare and both archive formats over 227 tags of imported
history. Then archiving: the push refusal in words, reads all still working, an issue
opened and commented after archiving, and nothing delivered to the hook because no push
can happen. Then a rename with a hook, a delivery log and an issue attached: all three
followed, and the next push's payload named the new repository and URL. A private
repository 404s anonymously on every route the wave added — issues, a single issue, new
issue, settings, hooks, one hook's deliveries — including while it is importing.
- The end-to-end webhook check is why
STEID_ALLOW_PRIVATE_WEBHOOKSexists. A real push to a real receiver on127.0.0.1:9099delivered a signed JSON body withX-Steid-Delivery,X-Steid-EventandX-Steid-Signature-256, accepted on the first try in 1 ms, and the deliveries page shows both attempts green. The wave had settled for a temporary source patch; a flag that warns at boot and is documented besideSTEID_INSECURE_COOKIESis the better shape, because a patch is invisible. - Decisions the pass settled, all in current.md: issues stay writable on an archived and on an importing repository; rename and archive are refused while an import lands and the page renders both buttons disabled with one sentence; hooks may be added during an import; delete stays outside the write guard because it is how a stuck import is cleared; an import can never land in an archived repository, because a taken name is refused before anything is cloned.
- The settings page 500'd on an importing repository before the pass, and not because
of the guard:
branches_ofasks git for the branch list, and against a directory that is not there yet that is a failed process rather than an empty list. It is skipped during an import now. - Screenshots of the whole walk are in
target/shots/underintegrate2-.
The seams closed in the same pass, each its own commit:
Repository::refuse_writes(RepoWrite)is the one place a repository says it is closed for writing. TheRepoWriteparameter is not decoration: an archived repository must stay renameable — archived is finished, not frozen — so archiving cannot be a blanket refusal.Contentsrefuses archived and importing;Settingsrefuses only importing.- One
is_public, indomain/net.rs, and it is the union of the two copies: each knew a range the other did not (import had0.0.0.0/8and the benchmarking range, webhooks had IETF protocol assignments, documentation and the reserved top of IPv4 space). The url-text rules stayed where they were, because only one type wants each. - The Issues tab counts on every repository page. It was an optional parameter three
pages passed, so the number appeared and vanished as you moved around. It is now a field
on
RepoView, which needed the read path split:visible_repoanswers "may this be seen" for browsing, blame, search, the commit page, the archive endpoint and the summary read — all of which discarded the view anyway — andview_repoadds the frame's onecount(*). Five issue pages stopped running a whole issue list purely for that number. Zero renders as nothing: a mono0beside a tab reads as a measurement somebody took. - An issue's Comment and Close/Reopen share a row, the Comment button reaching its
form by
form=id rather than by containment — which is what keeps the textarea out of the row.token.rs's Revoke is ghost and small, like a hook row's Delete.
Wave 3 — the simpler features · done
Paging, everywhere at once (merged 2026-09-06). Every list that said "this list is not paged" now pages, through one pattern and one control — the whole decision is in ui.md; what is worth not rediscovering:
- Offset (
?page=N), not a keyset cursor — including for the git lists. The cursor is the textbook answer for a log and is wrong here:git logwalks a date-interleaved history rather than a chain, so "the commits before<sha>" (git log <sha>^) is not the same set as "the rest of this log" once a merge is in it, and the other parent's line would silently vanish from page 2.--skipis git's own answer, is exact, and is what makes one control serve both the git and the SQLite lists. It costs a count per page —rev-list --count,count(*)— which is also what buys "3 of 7". - Clamp, never refuse.
?page=400on a four-page list,?page=banana, a link into a branch that has been force-pushed since: all are the nearest page that exists.application::paging::clampis the one rule, so/apicannot answer differently. Walked in a browser: a bookmarked page 4 of a branch, force-pushed down to two commits, renders those two commits and no control rather than a 500. - Two shapes of "page this", and the difference is not the storage. A list that
arrives whole anyway is sliced in the use case (
Paged::slice): branches and tags are onefor-each-refwhatever the page asks for, and a profile's repositories must be cut after the visibility filter or page 2 would be short by however many private repositories page 1 counted. A list a query can narrow getslimit/offsetat the port (issues, webhook deliveries), with a test per implementation that the second page starts where the first ended. Option<usize>where a list has a second caller that wants all of it.list_branches(None)is the settings form's default-branch<select>— an option missing from it is a branch nobody can choose — andlist_repos(None)is the profile overview and/api. A page number would have silently truncated both.- The label-filtered issue list cannot be paged in SQL. Which labels an issue wears
is a second table
list_issuesalready reads whole to render the pills, so the filter is applied in the use case and the page cut after it; the port'slimit/offsetserve the unfiltered path, which is the one a thousand-issue repository lives in. - Search pages by file, not by line. A file's matches are one block under its path,
so a page ends with the last file that fits and may overshoot 200 rather than print
the same heading twice.
SEARCH_LIMIT(200) became the page andSEARCH_MAX_MATCHES(1,000) the bound on a whole search:git grepoutput is still collected whole, so a deeper page must not be able to raise what one query costs. Every page re-runs the grep — there is nothing to resume from. - Redelivery stopped being a 50-row window. The button can sit on any page now, and the attempt number it writes counts every attempt the event has had — which the window got wrong as soon as an event aged out of it. The read is unbounded for one hook; noted in current.md.
- The control renders nothing at all on a one-page list, and so does the sentence above it. That is why most of these pages look untouched on a small instance.
Markdown cross-links and highlighted fences (merged 2026-09-06). #12 and a bare
lowercase 7–40 hex word link to the issue and commit pages; fences with an info string
render through highlight::fenced_lines.
- References are matched by shape, never checked. Existence would cost a query or a
cat-fileper reference per render; the target pages already 404.deadbeeflinks, deliberately. Uppercase hex does not. - The boundary rule is the whole trick: the character before may not be
alphanumeric,
-,_,.or/(sosrc/deadbeef1,v1.0-abcdef1and URL fragments stay text); after, only alphanumeric,_and-disqualify, so#12,ends cleanly. - Fences are buffered, not streamed, because a string can span lines;
Writerholds aFenceand writes the<pre>atTagEnd::CodeBlock.fenced_linesissource_lines' sibling: an info string is a token, not a filename, and an empty line inside<pre>must stay genuinely empty. - The "raw HTML never reaches the page" guarantee is intact: the only unescaped
output shaped by the source is markup
highlightwrote around text syntect escaped. markdown::rendergainedOption<Crossref>;Nonerenders as before, which is what posts will want until they have a repository to refer to.
Token expiry, last use, and a rate limit on git auth (merged 2026-09-06). Three of ADR 0007's deliberate omissions closed.
- Expiry is a closed set (
TokenLifetime: 30 days, 90, a year, never; 90 the default), not a date picker; days are 86,400 s with no calendar. An expired token authenticates exactly like an unknown one — 0007's uniform 401 — and the list is where a person finds out. Both new columns are null for pre-existing tokens: retroactively expiring a pasted credential would break a clone with nothing connecting it to an upgrade. last_used_atis written at most once a minute, the comparison in the domain (should_record_use), and a future timestamp never writes, so a clock that went backwards cannot make every request a write.touch_last_usedis its own port method andsave's upsert does not touch the column — one writer per column, or a stale save walks the last use backwards. Pinned by a SQLite test.- The git transport has its own limiter,
GitAuthLimiter, 60 per client per minute (global 600): a clone authenticates two or three times, so sharing the 10/min login budget would spend a sign-in allowance on one command. Only requests presenting a credential count; an anonymous clone of a public repository is never throttled. The 429 carries atext/plainbody git shows behindremote:. git_actorreturnsResult<Result<Actor, Response>>: the outer error is a fault, the inner is the 429 to send.
Atom feeds (merged 2026-09-06). commits.atom and issues.atom per repository,
/{handle}/feed.atom for push activity, autodiscovery links in the head, muted "Feed"
links on the log, issues toolbar and profile.
/{handle}/feed.atom, not/{handle}.atom: Topcoat matches whole segments only, so{handle}.atomis refused at registration; the extension must be its own segment.- Autodiscovery is derived from the request path in
atom::discovered, not contributed by the page:extensions(cx)is immutable, only a#[layer]may insert, and.discover()forbids a second layer at/besidesecurity_headers. If a page ever needs to contribute to<head>(a per-page<title>, which Steid still lacks), the fix is one shared#[layer("/")]owning a request-scoped page-metadata cell withsecurity_headersfolded in. - The activity feed counts no commits: N would be a git process per entry on an
unauthenticated polled endpoint. Entries say what moved with
before → afterand link to the compare page. The feed costs zero subprocesses. log_entriesis a secondGitQuerymethod (subject plus body) with its own parser, becauseparse_logdropped empty fields — safe only while every field is non-empty; a one-line message has an empty body.parse_loghas since been fixed the same way, so both parsers keep empty fields and drop only the-zterminator.- One escaper, and C0 controls are dropped, not escaped: there is no escape for a
NUL and one byte would break the whole document. A feed's
updatedis the newest entry's own time, nevernow. Entry ids are the alternate URL for commits and issues andurn:uuid:for push events, since two pushes can share a compare URL. PushEventRepository::list_recenttakes repository ids so the port answers no authorization question; SQLite buildsin (?, …)from the count.
Issue labels (merged 2026-09-06). /labels per repository, pills on issues and
list rows, a Labels control on an issue, ?label= filtering.
- A colour is one of eight palette names, never a hex value, parsed with
FromStrreturningResult; the eight are--label-*token pairs instyles.cssfor both schemes. The pill CSS is plain CSS because the class is built at render time and Tailwind never sees it. Adding a ninth is one variant and one token. - Assignments live behind the labels port (no fields of their own) and are posted
as the whole ticked set via
Form<Vec<(String, String)>>— a checkbox list posts one key many times, which no struct field can hold, and replacing makes a double submit idempotent. A foreign label id isNotFound, not dropped. ?label=narrows the toolbar's open and closed counts too; a name matching no label filters everything out rather than widening. Labelling does not move an issue'supdated_at: that clock marks when what the issue says changed.- Gotchas:
#[path_param] struct Label(str)cannot exist inweb/labels.rs— the name snake-cased is the URL parameter and it would shadow the domain type; the route uses{id}, and getting it wrong panics at request time. A list row's disclosure must not be<details class="contents">: the panel becomes a flex sibling and lands beside the row. The row is the<summary>(links inside still navigate).
Wave 2 follow-ups (merged 2026-09-06). Webhook on/off and Redeliver; import Retry
and a two-clone concurrency limit; zip · tar.gz on tag rows; a revision switcher on
search results; the detected language in the blob header; an orphan-directory sweep.
- A redelivery rebuilds the payload, it does not replay a stored body (a delivery row keeps what came back, not what went out); verified byte-identical with the same signature on a real push. It is awaited in the request — one attempt, no backoff — and its attempt number continues the event's sequence, taken from the page already read, so only an attempt within the last 50 can be redelivered. The toggle takes the wanted state, not "the other one", so a double click is idempotent.
MAX_CONCURRENT_IMPORTS = 2, chosen: one serialises a small import behind a slow one; many peak together duringindex-packon a small box. The permit is taken inside the spawned task so the form answers at once; the queue records who holds a permit, keyed{handle}/{name}, because a semaphore cannot say.ImportSlotis aDropguard: two leaked permits would silently stop every future import.retry_importmutates the loaded row rather than rebuilding throughnew()— the wave 2 trap — and does not re-validate the stored source.- Two adjacent bare text nodes are one flex item: the language label rendered as
Rust7.3 KBbecausegap-3separates elements, not text. Same class of silent failure asbg-muted. - Orphan directories are moved aside, never deleted, to
<data_dir>/orphaned/<seconds>-<name>; the sweep skips that directory, runs after the import sweep (an interrupted import still has a row), and its decision is a pure function over strings, not typed names — a directory that does not parse is exactly what a sweep exists to notice.GitStoragegainedlist_repo_dirsandquarantine.
The wave 3 integration pass (2026-09-06). The six branches merged and run as one app on port 3119 against this repository's own history — 190 commits, two branches, four tags, 62 issues opened through the form, 55 of them labelled, one public repository and one private. One thing was broken at a seam, and like wave 2's it was two branches meeting rather than either being wrong on its own.
- A feed's cross-links were relative.
markdown::Crossrefbuilds/{handle}/repos/…for#12and a bare sha, which is right on a page — a relative link survives a hostname change — and wrong inissues.atom, whose content is read in somebody's reader where a bare path resolves against whatever they last fetched, if at all. The entry's ownalternatelink, three lines away, was already absolute.Crossrefgained anoriginthe feed sets frompublic_originand every page leavesNone. Neither branch could have found this: cross-links shipped before feeds, and feeds reused the page's renderer, which is exactly the shape a pass exists to catch. - The rest held. A
#12and a sha in an issue body and in the README both land;?label=bug&page=2keeps the filter and the Open/Closed links keep the label while dropping the page;/logclamps?page=400and?page=banana; the log's Feed link keeps?rev=on a paged revision; a 30-day token clones and pushes and the tokens page then shows its last use; a tag'star.gzextracts understeid-<tag>/; search's switcher carries the query and drops the page; the blob header names Rust and TOML; a webhook fired by a real push redelivered byte-identically astry 2. Anonymous on the private repository 404s on all twelve routes, feeds and paged URLs included. - Four seams closed with the pass rather than found by it: a
Clockport, so no use case reads the wall clock out of thin air;orphanedreserved as a handle, since the boot sweep is written never to look inside a directory by that name; a test that readsstyles.cssand pins it againstLabelColour::ALLin both directions; andparse_logkeeping empty fields, the latent bug the feeds branch named while writing the second parser. - Two findings, neither a break. The Feed link on a filtered issue list offers the
unfiltered feed, and
latest_tagbreaks a same-second tie by refname — only reachable from a fixture that tags twice in one second. Both in current.md. - The README was rewritten in the same pass: it still told a visitor that issues,
webhooks and search did not exist. The install path had drifted too — the published
target is
-gnu, not the-muslthe manual steps named.
Wave 3 merge note. The feeds branch rebased cleanly onto the links branch and did not
compile: markdown::render had gained a parameter. A clean rebase is not a passing
build; every merge now runs the tests on main before the docs commit.
Wave 4 — the deeper git features · done
The wave 4 integration pass (2026-09-06). Six seams between the wave's features, then the whole thing walked as one app. The walk is in current.md; what is worth not rediscovering:
- One thing broke at a seam. Rendered headings gained ids, and both relative-link
resolvers were still stripping
#fragmentfrom a link they rewrote — each with a comment saying the fragment had nothing to find, which had been true an hour earlier. A feature and the thing that links to it landed in different commits, which is exactly where an integration pass earns its keep. - A merge preview is cached per pair of commit ids, in the adapter rather than the
use case: the port's contract is unchanged, and
merge_previewis both the expensive call and the one that writes. Content addressing is what makes the key safe — two commit ids determine their merge completely, so a remembered answer cannot go stale. Measured on a conflicted request: 43 ms then ~18 ms, and no new loose objects per view. Closes #nis a domain parser and reads shape alone. A bare#4stays a cross-reference; the keyword must start a word and be followed by spaces and then the reference, socloses. #4is two sentences. It runs after the branch has moved: a failure there leaves an issue open, where the reverse would close issues for a merge that never landed. ACloses #nnaming a pull request closes nothing.- A followed count is capped at 500, the last-commit column's number and for the same
reason —
--followreads a tree per commit.CommitCountcarriescappedbeside the total because "500" and "at least 500" are different statements, and the paging control offers only the pages that were counted. - The delete-source checkbox needed the default branch, which the page did not have. It is asked for only when the merge box will draw a button at all, so a closed or merged request costs no extra process.
- Two seam expectations were not met, by prior decision rather than by breakage: the
last-commit column still names the commit inside a merged branch rather than the merge
(git's own
--name-onlyanswer), and a merged request's Commits and Files tabs go blank once the source branch is deleted, because both resolve refs live. Both are recorded as open incurrent.mdwith what changing them would cost.
Pull requests carry labels (2026-09-06). The same labels the issues wear, from the
same repository-wide set: pills on the list rows and on the request, a Labels control
for the owner, and ?label= on /pulls with all three state counts obeying it.
- A second join table,
pull_request_labels, not one polymorphic table. Alabelled (kind, subject_id, label_id)would read tidily and would have to give up bothon delete cascades: SQLite cannot point a foreign key at whichever table akindcolumn names, so deleting a pull request would leave rows behind for the application to sweep by hand.IssueIdandPullRequestIdare different types for the same reason, and akindcolumn erases that at the boundary. The cost is a parallel set of four port methods, which is mechanical. - The labels page stays one page. Labels are the repository's, not a tracker's, so there is one place to manage them — and the row now carries two counts, because one total covering both would make "it comes off 3 issues" wrong for whichever kind it was not counting. The pull request count is drawn only when it is non-zero.
- A pill's destination is a parameter with a default (
Filtering::Issues), so the existing call sites are unchanged and a pill on a pull request leads to the other requests like it rather than to the issues. - The filtered list is narrowed in memory, the issue list's shape and for its reason: the pairs are already read whole to draw the pills. Filtering costs the other two states' listings, and only when a filter is applied.
Highlighted diffs and one highlight cache (merged 2026-09-06). The commit, compare and pull-request diffs are coloured by the file's syntax; blob, blame and README fences share a bounded cache. A 150 KB blob went from 327 ms to 15 ms on second view.
- The cache is keyed by content, so nothing can be stale: a blob passes its object
id (free), blame and fences a SHA-256 digest. Blame must not use the blob's id —
its body is reassembled without a trailing newline and is not byte-identical.
fencedis in the key so a fence and a blob cannot collide. - Bounded by bytes (64 MiB), not entries; the
lrucrate with default features off carries the recency half. The lock is not held across the highlight: two concurrent misses both compute and the second insert replaces the first — a wasted parse, never a wrong answer. highlight::cache()is a static that main also puts in app context — the sameArc, becausemarkdown.rsrenders with noCxin reach and threading a parameter through four call sites said nothing the static does not.- Diff hunks are highlighted twice, old side and new side, never interleaved: an
unterminated string on a removed line would otherwise bleed over the added line
below. A hunk is parsed as if the file began at its first line; the limitation is
asserted by a test. The tints at 12%/20% were already legible under every token;
styles.cssis unchanged.
File history, rendered markdown, submodules and symlinks (merged 2026-09-06).
/log/{rev}/-/{path} follows a file through renames; a .md blob is a document by
default with ?view=source; submodule rows link to an https:// upstream from
.gitmodules; symlink rows show and follow their target.
- A file is followed, a directory is not: git refuses
--followfor a directory with a fatal exit, so the use case asks what is at the path first —list_tree, thenread_blobwith a 0-byte cap, which resolves and sizes without reading, so deciding costs no process.rev-listhas no--follow, so a followed count is a wholegit log --followwalk, bounded only by the timeout. The count uses the samefollowas the listing or the total is smaller than its pages. - A path not there at the revision is a 404, not an empty list: those are different answers.
.gitmodulesis read once per listing and only when a submodule is present; onlyhttps://becomes a link (ssh://, scp-style and relative URLs stay text with the pinned sha). Symlink targets are read in bulk through the kept-alive cat-file, capped at 100 per listing — past the cap none is read, since a half-filled column says something false about the blanks.resolve_relativeis shared by symlinks and markdown and refuses absolute targets and walks out of the tree.render_with_linksdeclines images on purpose (a README's images sit at the root and rewriting trades a 404 for a broken image); the file view usesrender_with_targetswithRelative::{Link, Image}. Resolution happens before the scheme check, so a resolver cannot hand backjavascript:.#[component]drops outer attributes, so#[allow(clippy::too_many_arguments)]on one does nothing and an inner allow is a parse error: fold parameters into a struct (Listing<'a>). The shadowing trap bit a fourth time (let history = …).
Pull requests (merged 2026-09-06). Branch to branch within a repository, a Pull requests tab, three sub-tabs, a merge box with merge-commit, fast-forward and squash, source deletion, and a push event on merge so webhooks fire.
- A pull request is an issue with two branches and a merge attached: it shares
IssueNumberand therepo_sequencesallocator, so#7names one thing;/issues/{n}and/pulls/{n}303 to each other. Three states, and merged is terminal:mergerefuses a second call, which is what makes a double-submitted form land one commit. - Nothing about the branches is stored while open — every page resolves both refs
live, so a force-push is simply the new proposal;
merge_commitis the one exception because both branches may be gone afterwards. A branch resolves throughrefs/heads/, never by bare name (rev-parse spikewould happily answer with a tag). git merge-tree --write-treecomputes the merge in the object database — the third exit-status exception ingit_query.rs(1 = conflicts), and it writes unreferenced objects on every preview.GitMergeis its own port (commit_tree,update_ref,delete_ref), not moreGitStoragemethods: that port's subject is a repository's lifecycle, and these write inside one. Two verbs and nomerge, so fast-forward and squash compose in the use case.- Every ref move is a compare-and-swap (
update-ref <ref> <new> <old>); git's exit code cannot distinguish a stale old value from a fault, so stderr's "but expected" is matched. The six steps' order is the design: authorize and guard, recompute mergeability, write the commit (safe to fail, unreachable), move the target guarded, delete the source guarded, record events and mark merged. - A merge reaches webhooks through
record_pushwith synthesised snapshots, so a merge and a push produce the same events. Merging meets the shared write guard (RepoWrite::Contents); opening and commenting stay open on an archived repository. - git 2.38 detected once at boot (
GitFeatures); older git'smerge-treesucceeds at the wrong thing (a three-way diff), so the box says so and draws no button. The install floor is unchanged; README notes the merge requirement. - Gotchas:
commit-treeneeds git's@<seconds> +0000date form or it refuses0; abg-mergedpassed throughattrsonto a Primary badge lost tobg-primaryby stylesheet order — hence aMergedbadge variant.--mergedis the theme's sixth semantic colour, purple, git's convention.
Before deploying 0.4.0 (2026-09-06). A robots.txt disallowing the paths that spawn
git or pack the repository (archive, search, blame, compare, log, commits) — browsing,
issues and feeds stay crawlable, they are the portfolio — and an ArchiveLimiter at
10 per client and 60 global per minute, its own budget for the reason the git-auth one
is. Chosen over a Caddy rate limit because stock Caddy has none without a plugin, and
the limiter already existed. Nobody but the owner can write anything: there is no
registration, every write use case requires Role::Owner, and the exposure of a public
instance is git work on public repositories, not data.
Released as 0.4.0 (2026-09-06) — waves 2, 3 and 4: import, issues, labels, webhooks,
pull requests, feeds, paging, token lifecycle, the kept-alive cat-file, file history,
rendered markdown, highlighted diffs and the caches. Thirteen additive migrations since
0.3.0, so deploy.sh's rollback still restores a database the old binary reads.
Merging pull requests needs git 2.38 on the server; the Lightsail box has 2.47.
The ops step · in progress (2026-09-08)
Prep before the wave: src/cli.rs (steid serves; steid backup|restore|reset-password
are subcommands, stubs until their steps land — exit 3, distinct from a usage error's
2; no argument-parsing crate for three commands), STEID_OPERATOR_TOKEN on AppConfig,
and web::operator::operator_authorized(cx): a constant-time bearer check that is
false both when no token is configured and when the wrong one is presented, so an
instance never given a token advertises no operator surface (404, not 401).
The operator surface (merged 2026-09-08). GET /api/instance and POST /api/setup
in web/instance.rs, JSON only, no layout, no cookie, no session.
- One response struct with optional fields, not two: anonymous callers get exactly
{"claimed":false}(a unit test pins the bytes) and the operator bearer adds version, git version, merge support, counts and uptime. A wrong operator token gets the public answer, not a 401 — a 401 would confirm a token exists to guess. POST /api/setuprefuses identically for every reason — wrong token, already claimed, bad handle — with the same 404 body from one helper, and both interesting refusals return before Argon2 runs so timing matches. It issues no session: a control plane holding a cookie would be a browser.STEID_TRUSTED_PROXY, off by default, closes the wave-1 question. Off, the rate limiters read no header and every caller shares one key (global caps only); on, the rightmostX-Forwarded-Foras before.install.shsets it true because it installs Caddy.client_keywas split into a testablekey_from(trusted, headers).cargo auditis part of done. First run foundh20.4.15 (RUSTSEC-2026-0258, reachable through hyper on every request); fixed by a lock-only bump to 0.4.19. Three advisories stand with no fix to take:bincodeandyaml-rustunmaintained (via syntect) and a yankedchacha20(via topcoat-session).UserRepository::countandRepoRepository::countare instance-wide sizes, not listings; the repository count includes private ones on purpose.GitFeaturesnow keeps the version it parsed;StartedAtlives in app context as anInstant.
A metrics endpoint (merged 2026-09-08). /metrics, operator-bearer only (404
otherwise), hand-written Prometheus exposition, one counting line at each site.
- No metrics crate: counters and four gauges over a closed label set. Every label
is a slot in a fixed array indexed by an enum or a
consttable, so cardinality is a property of the type — a path or handle as a label would make a scrape an unbounded map an anonymous caller controls. Nothing on the page names a repository. Every series is emitted from boot including zeroes, orrate()reads the first error as a reset. - Counting lives in infrastructure only. Webhook outcomes in the sender, import
outcomes in
DiskGitImport::mirror— becauserun_importanswersOk(())for a failed import (the failure is data on the row).git::count_spawn(&Command)derives the subcommand from the built command past-C/--git-dir/-c, so a call site adds one line with no label to get wrong. - Requests are counted in the security-headers layer, and that is not optional:
.discover()allows one layer per path. A behaviour change came with it, and it is a fix: a handler'sErrwas converted to a 404/500 above every layer, so until now every 404 went out with no CSP, noX-Frame-Options, noReferrer-Policy, and the error half of the site was uncountable. The layer now converts the error itself. /metricsis rate limited only on the unauthorized path (30/client/min, 300 global): an authorized scrape never touches the limiter, so guessing from elsewhere cannot starve a collector — the opposite order from/auth/login, where the expensive work is the hash and must be gated first. Gauges are sampled from their real owners at scrape time, never mirrored. Two escapers, because help text is not quoted.
Releases served from the instance (merged 2026-09-08) — Milestone 5b's last item.
https://jpgill.dev/install.sh and …/repos/steid/releases/v0.4.0/<artefact> serve;
the stranger's one-liner has now actually run, in clean Debian 12 containers on both
architectures, from the real URL. No Rust changed.
- Artefacts live at
/srv/steid-dist, not/var/lib/steid/distas the runbook anddeploy/Caddyfilesaid: that directory is the instance's state and its backup surface (deploy.shtars it on every deploy), and it is750 steid:steidwhile Caddy runs ascaddy. The URL is unchanged. handle_path, nothandle, for the releases block —handlekeeps the prefix, sofile_serverlooked under the full URL path and every download 404ed whilecaddy validatesaid fine. The trailinghandle { reverse_proxy }is load-bearing: a barereverse_proxyruns for every request including the static ones.deploy.sh --publish, off by default: a publish changes what strangers get under a version number that can never be re-cut, and would publish only the architecture that deploy built. It verifies over HTTPS, not on the filesystem. Norsyncon the box (Debian 13 minimal):scpto the login home thensudo install -m 644.- 0.4.0's
aarch64artefact did not exist and was built from the release commit withgit archive, so nothing later leaked into a tarball wearing that version. - Found by running the download path: a first install kept Caddy's placeholder
Caddyfile, so the domain served Caddy's welcome page silently. Fixed in
install.sh.
Backup and restore (merged 2026-09-08). steid backup <dest> writes one tar.gz
(manifest, steid.db via VACUUM INTO, the data directory); steid restore <archive>
refuses a non-empty instance or a newer archive; an owner-only download on the settings
page at 2 per hour; install.sh --backups daily, off by default.
VACUUM INTO, not a file copy, and it is a port (DatabaseSnapshot): SQLite writes through a-walsibling, so copyingsteid.dbon a serving instance restores a database that never existed.back_uptakes noActor,back_up_fordoes. Whoever runssteid backupis root on the box and already holds the files; anActor::Systemvariant would be a value meaning "skip the check". Onlyback_up_foris reachable from the network.- "The owner" is the sole user (
is_instance_owner), because a backup is every row and every private repository; it answersfalsefor everybody once a second user exists — Milestone 7 needs an instance-level role. - Scratch lives at
<data_dir>/.backup, never/tmp: the dot is load-bearing, since a handle cannot start with one and the packer skips top-level dot-directories, which is what keeps a backup from containing the copy it is built from. Verified live. - The web download unlinks the archive while it is open, so a client that disconnects mid-download leaves no copy of the database on disk. The ownership check runs before the limiter, the reverse of every other limited route: a stranger must not be able to spend the owner's two-an-hour budget.
- Backup opens the database without migrating (
database::open), so a control plane snapshotting a database an older binary still serves applies no schema change; restore migrates because a fresh install has no file at all.replacecloses the pool: after that line the process may only finish restoring and exit. - New deps:
tar,flate2, andtempfilepromoted from dev.
Password reset with email, change password, and the CLI fallback (merged
2026-09-08). /auth/forgot, /auth/reset/{token}, a password section on settings,
steid reset-password <handle>, STEID_SMTP_URL + STEID_MAIL_FROM + STEID_PUBLIC_URL.
- The forgot path leaked which way it was faster. Copying login's dummy-hash trick onto the miss branch made the hit the quick one (7 ms vs 234 ms). The verification is now unconditional, before the branch; measured ~230 ms either way. No test — a timing assertion is a flaky test — so the guard is the comment. The residual signal is a hit's SMTP round trip; closing it needs a send queue.
- The reset page has its own limiter (30/client/min): it is a page a person reloads,
and on the sign-in budget six loads locked them out of
/auth/login./auth/forgotstays on the sign-in budget because it is an address probe. - dotenvy needs quotes and fails the rest of the file silently: an unquoted
STEID_MAIL_FROM=Steid <x@y>makesdotenv()error, whichmaindiscards, dropping every later variable. Quote values with spaces or angle brackets. - lettre:
default-features = falseplusbuilder,smtp-transport,tokio1,tokio1-rustls,ring;rustls-native-certsso an internal relay with a private CA works — which makes the Dockerfile'sca-certificatesline load-bearing. Mail is built at boot and exits 4 on bad config, so per-request construction cannot fail. steid reset-passworddeliberately says whether the handle exists: whoever runs it has the SQLite file in front of them, and the one tool a locked-out owner has must be distinguishable from a typo. It takes noActor, likeclaim_instance.- A reset ends every session including the asker's; a change ends every other one
and retires outstanding reset links.
delete_by_user(user, except)is one statement. Reset rows are marked used, not deleted, so a replayed link can say "already used".
The tidy-up wave · in progress (2026-09-08)
Review steps 1 and 8 (merged). The six biggest mod tests blocks moved to sibling
<module>_tests.rs files via #[path] — no module-tree change, no widening, not one
test touched; repo.rs 3,127 → 739, git_query.rs 4,958 → 1,293, sqlite.rs 4,158 →
1,791. git_query's parsers now live in git_query/parse_{refs,log,tree,diff}.rs, each
pure; a --format const lives with the parser that reads it, not the call site, so
the two cannot drift. #[path] on a module declared in a non-inline module resolves
relative to the declaring file's directory. The convention is in architecture.md.
Review step 7 (merged). infrastructure/git.rs (3,746 lines, six ports) is a
directory with one file per port — git/{storage,protocol,archive,import,merge}.rs —
and InMemoryGitQuery sits beside DiskGitQuery in git_query/in_memory.rs. No call
site or signature changed; git_command, count_spawn and run_git stay in git/mod.rs
where every file can see them. Shared test fixtures are a #[cfg(test)] pub(crate) mod fixture (sibling test modules cannot see a pub(super) item of git). Checked by
diffing every fn name and the sorted bodies before and after. architecture.md now
names application/reconcile.rs as the sweep it said nobody had written and stops
crediting #[memoize], which nothing uses.
Review steps 2 and 3 (merged). One context::owned_repo, one owned_profile (the
review's three "inline copies" were profile guards, a different read), and one
context::write_failure; eight guards and four mappings deleted. pulls.rs keeps a
mapping of its own for its three genuine arms (archived, unavailable, a raced merge)
and delegates the rest — the shape any page with something extra to say should copy.
The one behaviour change: nine owner-only routes that answered 403 to a stranger now
answer 404, wave 5's rule everywhere. Two 403s remain on purpose: the git transport's
"authenticated but may not push", and a merge whose session outlived its user.
web/format.rs and web/urls.rs took the formatters and URL builders out of
browse.rs (1,654 → 1,357; importers 16 → 7); urls.rs's doc carries the one encoding
rule — a revision is encoded whole, a path keeps its slashes.
The pre-control-plane wave · in progress (2026-09-10)
Expand, deploy, contract (merged). The rule is in architecture.md → "Migrations"
and enforced by database_compat_tests.rs: a lexical guard over the real migrations/
directory rejects drop column, drop table, rename, and add column … not null
without a default; a replay test applies 0.4.0's migration set and runs today's reads
against it — the reverse direction, proven because database::open (backup) opens
without migrating. The forward direction (old binary, new schema) is not tested; it
needs the old tarball and is a CI job. Comments must be stripped before matching —
every migration's prose says "drop" and "rename" while doing neither — and string
literals kept for execution. RELEASED_0_4_0 in the test is the authoritative last
release set; plans/releases.md is the human record, reconstructed from the four
release commits; a prefix test keeps them honest and catches a back-dated migration.
Every existing migration already complied.
Access, second pass (merged). visible_repo is the bottom of the predicate stack in
access.rs; readable_repo and changeable_repo are written in terms of it, so the
visibility rule has one body — a read rule and a write rule that disagree fail open, which
is why this preceded milestone 7. is_instance_owner became access::instance_owner
and context::instance_owner(cx): the name is stable and the body is what
milestone 7 replaces. It takes users, not Stores, because instance ownership needs
none of the triple. operator_authorized stays a machine credential in the web layer;
architecture.md now says two kinds of caller, two predicates. The milestone 7 shape
lives in access.rs's module doc, cited by function name.
The composition root, and the first HTTP tests (merged). infrastructure::app::build( config, pool, assets, setup) -> RouterBuilder holds every app_context call and layer;
sweep_on_boot holds the three sweeps; main.rs went 523 → 173 lines with no decision a
test would assert. build returns the builder so a test can append a fake; takes the
AssetBundle rather than calling load(), which walks up from the executable and would
make tests depend on topcoat asset bundle; clears setup_token itself so the running
app holds the claim secret only in SetupState; prints nothing. The chain is
append-only, written at the top of the module. src/cli/{backup,restore,reset_password}.rs
are library functions with eleven tests on real SQLite in a tempdir — the operator's
recovery path had none because it lived in a binary. tests/http.rs boots build on
127.0.0.1:0 with serve_until and a oneshot, ureq in spawn_blocking as the
client, 0.3 s: security headers on a 200, a 307 and a 404; CSRF 403 with the sentence;
/metrics 404 byte-identical to an unrouted path; claim through /api/setup. It serves
an empty asset bundle, so it must never render a view — the asset renderer panics on a
catalogue miss; the signed-in assertions (303-after-POST, __Host- cookie) need the real
bundle and a signed-in helper.
Search rate limit, and the plain git read capped (merged). SearchLimiter, 20 per
client per minute and 120 globally, its own budget so a crawler walking ?q= cannot lock
the owner out of sign-in; an empty query is free (it never reaches grep); the refusal is
a page with the form still filled and Retry-After on the response. run now goes
through the capped reader at MAX_RUN_BYTES = 32 MiB and over it is
GitQueryErrorKind::TooLarge, an error rather than a truncation because the reads
through run are parsed whole — half a ref list is a wrong answer, not a smaller one.
Unreachable today (every caller is bounded by its own arguments), which is the point.
Released as 0.5.0 (2026-09-10) — the ops step, the tidy-up and access refactors,
CSRF, both reviews and their fixes, and the pre-control-plane wave. Two additive
migrations since 0.4.0. The first release the control plane can provision from:
/api/instance, /api/setup, steid backup/restore, /metrics, password reset.
Deploying it breaks every open form once (per-boot CSRF secret) and needs
STEID_OPERATOR_TOKEN in the box's env for the operator surface.
Milestone 0 — Skeleton · done
Topcoat 0.5 app serving pages, AppConfig from STEID_* env, SQLite pool in app
context. Split into a library plus a thin binary — the domain layer had no consumers
yet and read as ~30 dead-code warnings in a bare binary, and it unlocks tests/.
Topcoat's link-time page discovery works from a library; that was checked, not assumed.
Requires rustc ≥ 1.95. On older toolchains cargo add topcoat silently resolves to
an empty topcoat v0.0.0 placeholder instead of failing.
Milestone 1 — Identity, thin · done
Domain. Typed IDs, Email, PasswordHash, OrgName, Organization, User,
Membership, Role, Actor, Session, SetupToken, DomainError. Value objects
pair new() (validates) with from_trusted() (skips, for rows already validated).
Application. claim_instance, login, resolve_actor, record_session,
end_session, sweep_expired. PasswordHasher port with Argon2 and a stub.
Infrastructure. Migrations for orgs, users, memberships, sessions. In-memory and
SQLite implementations of every port. Root layout, /setup, /login, /logout, home,
and /api/me.
describe_identity is the first use case with two consumers — the home page and
/api/me both read through it. Until that existed, "the application layer is
transport-neutral" was an assertion with one caller behind it.
Verified in a browser and by curl: wrong token refused with nothing written; correct token creates org + user + owner membership and signs the owner in; session authenticates; logout clears cookie and row; wrong password bounces; right one signs in; re-claiming a claimed instance is refused.
Decisions worth remembering
Actoris an enum with an explicitAnonymous, notOption<UserId>. Attempt #2 used a placeholderUserId("ssh-anonymous")and it became a security hole. A variant can't be forgotten the way a sentinel can.loginverifies a dummy hash when no user matched. Returning early on the unknown-email path makes it measurably faster and leaks which addresses have accounts. A test pins that the dummy stays parseable — if it stops being,verifybails early and the defence dies silently.SetupTokencompares in constant time. An early-return comparison leaks how much of the token is right, which recovers it a character at a time.- The setup token is only in app context while unclaimed, so a claimed instance has nothing for a claim attempt to match.
- SQLite ignores foreign keys unless asked, per connection.
foreign_keys(true)plus a test that a user pointing at a missing org is refused. sqlx migrate addstamps versions to the second — three calls in one second collide, leaving apply order ambiguous between tables that reference each other.- An unparseable role surfaces as an error, never as "no membership". The latter silently downgrades an owner to no access.
Securesession cookies over plain-HTTP localhost fail silently. See runbook.md. This one actually bit, and it looked exactly like broken auth logic.
Milestone 2 — Profile page · done
/{handle} is the real profile page: label, handle, bio, and the section frame for
repositories, writing, and projects. Public, renders signed out, 404s on an unknown
handle, and resolves regardless of casing. / forwards a signed-in owner to their own
profile. /api/users/{handle} serves the same read model as JSON.
URLs settled as root handles with grouped application routes
(0004), superseding
0003 the same day. A twenty-word reserved list in
OrgName::new keeps handles from shadowing routes.
Decisions worth remembering
PublicProfilehas no email field, deliberately.Identitydoes, and/api/mereturns it, because that endpoint describes the caller to themselves. Giving the type that reaches the page nowhere to put an email makes the leak impossible rather than merely avoided.viewer_is_owneris decided in the use case, so the web form and/apicannot disagree about who may edit. Tested for a signed-in stranger and a non-owner member — "signed in" quietly becoming "allowed" is the usual failure.Organization::update_profileclears on blank input rather than storing whitespace, so cleared and never-set are one state and the page renders one case. A rejected edit applies nothing.- Bio length counts characters, not bytes. A byte check would reject a bio of accented text well under the limit.
path_paramis an attribute macro in 0.5, not function-like. The vendored crate is the authority for the pinned version, not the docs onmain.- Components are invoked bare inside
view!, andif/match/for/letare native to the macro. #[query_params]needserror = …to work with?; otherwise the error borrows fromcxand escapes the handler.- Forms re-render on failure and redirect on success. Redirecting after a validation error throws away what was typed and hides the reason.
- Styling is Tailwind via Topcoat's build script, with registry components copied in rather than depended on (0005). Components reference theme tokens, never raw colours.
Milestone 3 — Repo model · done
Repositories exist as records and as bare repos on disk, and they appear on the
profile. Domain, both persistence adapters, GitStorage with DiskGitStorage behind
it, create_repo / view_repo / list_repos, the /{handle}/repos/new form and
/{handle}/repos/{name} page, the profile's Repositories section, and
/api/users/{handle}/repos. How git is invoked is recorded in
0006.
Verified in a browser and by curl: the owner creates a repo through the form, a
bare repo appears at {data_dir}/{handle}/{name}.git, and it lists on the profile; a
private repo is absent for a signed-out visitor on both the page and /api; an unknown
handle 404s rather than answering []. git clone does not work yet — Milestone 4.
Decisions worth remembering
git initon an existing repository exits 0 and re-initialises in silence. Measured, not assumed. SoAlreadyExistshas to be our ownpath.exists()check — there is no exit code to key off. Refusing rather than adopting matters because a directory with no matching row is an orphan from a crashed create, and re-initialising it would resurface a private repository's objects under a fresh record.git initcreates missing parent directories itself, so there is nocreate_dir_allbefore it. This was in the plan and the probe removed it.--template=takes a new bare repo from 18 files to 2. The default seeds sixteen.samplehooks. Timed at 15.2ms against 13.1ms across 20 runs — so the ~2ms is not the reason; Steid installs its own hooks later and the samples would be noise to work around.--initial-branch=mainis explicit so the host'sinit.defaultBranchcannot decide it. This machine's git already saysmain, which is precisely why a drift would go unnoticed — hence the test.GIT_CONFIG_GLOBALandGIT_CONFIG_SYSTEMare pointed at/dev/null, and the fiveGIT_*variables that redirect object storage are removed from the child environment.GIT_DIRwas checked and does not override an explicit path argument, butGIT_OBJECT_DIRECTORYdoes redirect where objects land, and the failure is silent — the repository just looks empty.- One
run_gitowns the invocation. With a single caller this looks premature; it is a private function rather than a public abstraction for that reason. The point is that Milestone 4'shttp-backendspawn cannot quietly disagree about isolation. tokio::processandtokio::fs, never thestdequivalents.init_bareis not hot — ~13ms, once per repository — butremove_dir_allon a repo with real history walks every loose object and would stall a runtime worker. The performance that matters is Milestone 4's per-request spawn, not this.tempfilefor test fixtures, nottarget/. Parallel-safe by construction and self-cleaning on panic. Debris undertarget/would be actively harmful here, sinceinit_barerefuses a path that already exists.- Membership is resolved once per listing, not once per row. Obvious in hindsight;
the shape that invites the mistake is filtering inside a loop that can
await. - One empty state serves "no repositories" and "none you may see". A distinct message for the second — or any count — leaks that private repositories exist and how many. Tested, because it is the kind of thing a later "helpful" tweak would undo.
redirect()is a 307, and 307 preserves the method. Post/redirect/get needs a 303, or the browser re-POSTs the form to its redirect target. Milestone 2's settings form shipped with this and nothing caught it — every test passed, because the tests are on the use case and the bug is in the reply. Found by following the redirect with curl. The fix is aStatusCode::SEE_OTHERplus aLocationpair insideview!, wrapped asweb::context::location, becausesee_other()is a response type and#[page]must return a view for the layout to wrap the failure re-render.RedirectError::newis private, so a 303 cannot be built as an error, and the error-to-response path only downcasts topcoat's own error types — a custom one becomes a 500.#[page]returns a view;#[route]returns a response. That is the whole reason the redirect is spelled awkwardly: a form handler needs both a redirect and a full-page re-render, and only the view path gets the layout.- Boolean HTML attributes take an explicit value in
view!—required=(true), not barerequired, which fails to parse.falseomits the attribute entirely, soselected=(bool)on an<option>is correct rather than renderingselected="false". topcoat ui add selectneeds theicon-iconifyfeature and a staged icon set. The chevron comes fromfeather, staged inbuild.rs. No new crates, but the build fails with a clear message until the set is staged.is_org_ownermoved toapplication/authz.rson its second caller. Owner-ness gates the profile edit, repo creation, and later PATs and push; two copies of an authorization predicate drift, and the direction they drift is open.- The compensating transaction is safe to do by path.
removeafter a failed save can only ever delete whatinit_barejust created, because the loser of a concurrent create never gets pastinit_bare. Non-obvious enough that it is commented in the code as well as here. - Compensation is best-effort. If the removal also fails, the caller still gets the error that started it — an orphaned directory is the documented failure mode, and replacing the real error with the cleanup's error would hide the cause.
InMemoryGitStorageenforcesAlreadyExiststoo. A permissive fake would letcreate_repopass while the real adapter refused. The fake mirroring the rule is the point of having two implementations./apiresolves the handle without loading a profile.handle_paramsplit out ofprofile_forso the repo listing route 404s onlist_repos' ownNone. Routing it through the profile would have made thatNoneunreachable and left the page and/apidisagreeing about what an empty portfolio means — the exact duplicationarchitecture.mdsays to watch for.- The
/apilisting is a bare array, not an envelope. Matches/api/users/{handle}returning a bare object. Pagination later means a wrapper and a breaking change; taken knowingly, since personal-first means a handful of repositories and there are no consumers yet. Repository::descriptionstays. Added unrequested and flagged; kept on review because this milestone's own "Done when" puts repositories on the profile, which makes it a consumer inside the milestone rather than speculation. Worth noting the window that closed: the repositories migration had not yet been applied to the dev database, so removing the column would have been a free in-place edit rather than a second migration.
Milestone 4a — Clone over HTTP · done
git clone works against a public repository, for anyone, with no credentials.
GitProtocolServer (CGI-shaped) with GitHttpBackend behind it, the serve_git use
case, and three routes under /{handle}/repos/{name}.git/. Bodies stream both
directions.
Verified against a real client, not only by unit test: an anonymous git clone of a
201-ref repository returns 201 commits and 203 refs with HEAD matching the origin, on
protocol v2 and on v0; a private repository answers 404 to an anonymous clone but 200 to
its owner's browser session; git push is refused with 403; and unknown repo, unknown
handle, missing service, an unknown service, a missing .git suffix, and a
dumb-protocol object path all answer 404 while the repository page still answers 200.
git http-backend's contract, probed against git 2.50.1 by driving the CGI from a
throwaway server and cloning through it. Everything below is measured, not read.
The contract
HTTP_CONTENT_ENCODING, notCONTENT_ENCODING. CGI gives onlyContent-TypeandContent-Lengthunprefixed names; every other request header isHTTP_-prefixed, andhttp-backendlooks for the prefixed one. This is the finding that would have cost a day. With the wrong name,http-backendhands the still-compressed body toupload-pack, which dies withbad line length characterand the client reportsfatal: expected 'packfile'— nothing names gzip, or the environment, anywhere in the failure. And it only happens once a repository has enough refs for the client to bother compressing: a one-ref test repo passes.HTTP_GIT_PROTOCOLcarriesversion=2through toupload-pack. Clones verified on v2 and onprotocol.version=0, both 201 commits, both gzipped.GIT_PROJECT_ROOTplusPATH_INFO, wherePATH_INFOis the on-disk path relative to the root. Steid's URL and its storage layout differ —/{handle}/repos/{name}.git/…against{data_dir}/{handle}/{name}.git— so the adapter rewrites the middle segment out.GIT_PROJECT_ROOTis the data directory.GIT_HTTP_EXPORT_ALL=1is required. Without it every repository answersStatus: 404 Not FoundandRepository not exported, unless agit-daemon-export-okmarker file sits in the bare repo (confirmed: dropping that file in re-enables it).- Headers are CRLF-terminated and end at
\r\n\r\n. No bare-LF variant was observed, but the adapter should accept one rather than hang. Status:appears only on failure. Its absence means 200, and it must be translated, not forwarded as a header.http-backendsets its ownContent-Typeand cache headers —Expires: Fri, 01 Jan 1980,Pragma: no-cache,Cache-Control: no-cache, max-age=0, must-revalidate. Steid forwards them rather than inventing its own.
Decisions worth remembering
GIT_HTTP_EXPORT_ALL, nevergit-daemon-export-ok. The marker file is git's own visibility mechanism and it looks tempting, but visibility lives in therepositoriestable and the use case is what enforces it. A marker file would be a second source of truth for the same question, free to drift from the first, and the drift direction is "private repository still clonable". Steid decides; git is told to stop asking.receive-packis refused by default —Status: 403 Forbidden,Service not enabled: 'receive-pack', without any configuration. Convenient for 4a, but the routes still refuse writes explicitly rather than leaning on it: a default that helpfully changes is not an authorization decision.- A non-zero exit can arrive after the headers are already out. The gzip failure exited 1 having emitted a complete, successful-looking header block. So the exit code cannot gate the response — by the time it is known, the status is sent. It belongs in the log.
- A missing repository is
Status: 404with exit 0. Failure is reported in the CGI stream, not the exit code, and the two disagree in both directions. - The router is the allowlist. Only
info/refs,git-upload-packandgit-receive-packare routed. Handed any other path,http-backendserves dumb-protocol object files straight off disk — a read of a repository nothing authorized. Verified:/….git/objects/info/packsanswers 404. - The endpoint is named by the route, not parsed from the path. Three routes, three
literal
GitEndpointvalues, andserve_gitrebuildspath_infofrom the validated handle and name. The string that decides authorization and the string handed to git are therefore the same string. - Existence is settled before permission. A push to a repository the actor cannot see answers 404, not 403 — a 403 would confirm a private repository by that name exists. Costs nothing to get right at the start and is invisible to test later.
BufReaderis what makes the header/body split safe. The reader keeps whatever it read past the blank line, so handing the reader itself back as the response body carries the already-buffered first bytes of the pack with it. Parsing headers into a separate buffer and then streaming the rest would silently drop them.- The child's exit code cannot gate the response. A protocol failure exits non-zero after a complete, successful-looking header block has been written. By the time the status is known it has been sent, so the exit code goes to the log and nowhere else.
- Stderr must be drained, not merely piped. An unread pipe fills and blocks the backend mid-transfer. It is read in the same task that reaps the child.
body_limitdoes not exist intopcoat-router0.5.0 — the warning carried from 0001 is stale. Bodies are read by the handler with a caller-chosen limit viato_bytes, and the git routes takeBodyunbuffered so no limit applies at all.impl<B> IntoResponse for http::Response<B>means a handler can return its ownhttp_body::Bodyand Topcoat re-bodies it. That is what lets the pack stream without a framework-specific body type.
Milestone 4b — Push and tokens · done
git push works over HTTP for the owner, and a private repository is clonable by
someone holding a token for it. PersonalAccessToken with both storage adapters,
issue_token / list_tokens / revoke_token / authenticate_token, HTTP Basic on the
git routes, and token management at /{handle}/settings/tokens. Decisions recorded in
0007.
Verified end to end, issuing the token through the UI rather than seeding one:
push of 201 refs to a public repo and to a private one; clone of the private repo
returning 201 commits; anonymous clone of the public repo still open with no prompt;
401 with WWW-Authenticate: Basic for a private repo, a nonexistent repo, an
unknown handle and a push advertisement alike; a wrong token challenged rather than
accepted; and after revoking, both clone and push answer 401 while the public repo stays
open. The token is shown once and never again on reload, the revoke button disappears
from the list, and the page is 403 for anyone else.
Decisions worth remembering
http-backendrefusesreceive-packby default, and Steid authorizing the push is not enough. The symptom is a 403 that looks like Steid's own refusal but is git's:Service not enabled: 'receive-pack'. It needs-c http.receivepack=truebefore the subcommand. That flag is set from aGitRequestfield the use case turns on only after the authorization check passes, so git remains a second refusal behind Steid's rather than being switched on wholesale — if the rules are ever wrong, git still says no.- The uniform 401 is what makes authenticated cloning possible at all. A git client offers a credential only after a 401, so the 4a behaviour of answering 404 for a private repository made an authenticated private clone unreachable. Extending the 401 to repositories that do not exist is what keeps it from leaking which private names are real.
- A bad credential falls through to anonymous rather than failing. The caller then gets the same challenge as someone who presented nothing and can try again, which is also how a stale session cookie behaves.
- Basic accepts the token in the password field, or in the username with no password. Git puts it in the password; people paste it into the username. The alternative is an authentication failure with nothing to explain it.
- Issuing a token deliberately does not redirect, unlike every other form here. The secret exists only in that response, and surviving a redirect would mean putting a live credential in a URL — browser history, logs, referrers. Reloading issues a second token, which is harmless and visible in the list.
- Revoking someone else's token is
NotFound, notForbidden. That a token id exists but belongs to another user is not a fact worth confirming. - Tokens do not expire. A credential pasted into a machine and forgotten is worth less if it stops working silently; revocation is the control that matters.
in_memory.rskeepsmod testsin the middle of the file, likesqlite.rs. Appending an implementation to the end lands it inside a later impl block.
Measured, for Milestone 5
Taken at the end of 4b, on a 201-commit repository, 50 runs averaged per command:
| Command | Per call |
|---|---|
git rev-parse HEAD | 11.2 ms |
git ls-tree -l HEAD | 11.7 ms |
git cat-file -p HEAD: | 11.6 ms |
git log -20 --format=… | 11.8 ms |
git for-each-ref | 14.4 ms |
The cost is starting git, not the query — every command lands in the same band
regardless of the work it does, matching the ~13ms git init --bare from Milestone 3.
A three-call page is therefore ~35ms of pure overhead, and a per-file last-commit column
at one call per entry would be ~230ms for twenty files. This is the input
0006 asked for before reconsidering
gix on the read path.
Milestone 5 — Repo browsing · done
A repository is readable on the web: the file tree at a revision, a file's contents with
line numbers, and the commit log. ObjectId / RefName / RepoPath / EntryKind /
TreeEntry / CommitSummary in the domain, a GitQuery port with DiskGitQuery and an
in-memory fake behind it, browse_repo and repo_log read models, and pages at
/{handle}/repos/{name}, /tree/{rev}, /tree/{rev}/-/{path}, /log and /log/{rev}.
The read-path decision and its upgrade ladder are in
0006.
Verified against Steid's own repository, hosted on Steid. A freshly created repo
shows push instructions; after pushing 57 commits the page lists the tree; directories
descend and breadcrumb back; src/domain/session.rs renders with line numbers and
correct HTML escaping; the log shows 50 commits with author and relative time. Unknown
revision, unknown path, ../etc/passwd, unknown repo and unknown handle all 404, clone
still works, and a private repository answers 404 to an anonymous visitor on every
browse route while its owner sees it.
Decisions worth remembering
cat-file --batch-checkwith the spec on stdin is the lookup primitive. It exits 0 and prints<spec> missingfor anything unresolvable, which is what makes "not found" a value read off stdout rather than an exit code to interpret. The rule the adapter follows: a non-zero exit is always an error; absence is a marker in the output (missing,ambiguous,dangling,notdir). The obvious alternatives are worse —rev-parse --verify --quietreturns 1 for an unknown ref but 128 for a missing repository, andls-treepointed at a blob is afatal:for what is, to a visitor, a 404. Passing the spec on stdin also means no revision or path can ever be read as a flag, whatever validation upstream does or stops doing.git login a repository with no commits is a fatal error, not empty output, hence resolving the revision first. An extra fork, in exchange for not reading meaning out of a localised stderr string.%sis git's subject, not the first line — with no blank line in the message it joins the whole first paragraph with spaces. The adapter takes.lines().next()rather than trusting that.- Negative
%ctexists in imported histories and would panicUNIX_EPOCH + Duration. - A symlink is indistinguishable from a file in the object store — both are blobs — so
read_blobreturns a symlink's target path as its content. Deliberate; making itOk(None)would cost an extrals-treeof the parent. - The empty repository is a first-class state, not an error. Steid creates
repositories empty and Milestone 4 made it easy to have one never pushed to, so
default_branchreturningNonemeans "no commits" and the page offers the three commands to push rather than a broken listing. %2Fin a revision segment survives routing. Topcoat matches on the raw path and percent-decodes after, so a slashed branch works as a single segment — which is what makes the/-/separator sufficient without a ref lookup.- Three agents worked in parallel on disjoint files, with the port, the fake and a
non-panicking stub adapter written first so neither branch could break the other's
build. The stub answering "nothing there" rather than
todo!()is what let the pages be developed and run before the adapter existed.
Milestone 5b — Deployable by anyone · in progress
Distributed as a binary plus its assets/ directory, installed by one command, behind
Caddy for automatic HTTPS. release.sh, install.sh, deploy/, a README.md, and the
operability the service needs: /healthz, STEID_SETUP_TOKEN, and rate limiting.
Topcoat findings, both load-bearing
topcoat::start()already handles SIGTERM.serve()callsserve_until(…, shutdown_signal()), and that selects on Ctrl+C and SIGTERM on Unix: it stops accepting, drops the listener so a replacement process can bind the port, and drains in-flight requests up toshutdown_timeout. So systemd stop/restart does not cut a clone mid-pack, and no wiring was needed — the work was finding this out rather than building it.- The peer socket address is not reachable from a handler.
internal_servediscards it at accept time (let (stream, _remote) = accepted?;) and never puts it on the request extensions; the context exposes only parts, method, uri, headers and extensions. Any IP-based decision in Steid is therefore header-based by necessity, not by choice, and closing that would take an upstream change.
Decisions worth remembering
- The rate limiter keys on the rightmost
X-Forwarded-Forentry. A proxy appends the address it accepted from, so the last entry is the one the nearest proxy wrote and the only one a client cannot forge. The leftmost — what "the real client IP" usually means — is exactly the attacker-controlled one. Two proxy hops collapse clients onto the inner proxy's address, which is stricter, so being wrong that way is safe. - A global cap backs the per-key one, because without a peer address a forged key cannot be disproved. It turns key forgery from a total bypass into a modest speed-up. The cost is that a flood can lock the login form for a minute — a recoverable denial against an unrecoverable guessed password.
- The limiter's map is bounded. An unbounded map keyed by attacker-controlled values is itself the denial of service; at the cap it sweeps expired entries and otherwise falls through to the global window, which is stricter rather than permissive.
- glibc on bullseye, not static musl. musl failed on
ring(Debian'smusl-gccrejects-m64), but the decisive argument is that musl buys a dependency-free binary and Steid hard-requiresgiton PATH — the portability is unusable. Bullseye pins the glibc floor at 2.31, covering Debian 11+ and Ubuntu 20.04+; bookworm would need 2.36 and silently exclude Ubuntu 22.04. - The runtime binary links a TLS stack it never uses.
ring←rustls←ureq← Topcoat'sicon-iconify/tailwind, whoseureqdownloads the Tailwind CLI at build time. Those features are on the normal dependency as well as the build one, so the crypto ships too. Moving them would shrink the binary and drop an unused dependency from the attack surface. Not attempted; it is also what made the musl build fail where it did. STEID_SETUP_TOKENdoes not undermine 0002. What that ADR refused to put in configuration was the owner's password — long-lived, goes stale, ends up in a repository. This is the one-time claim secret the operator was already copying out of a log line. It is validated for strength, never printed, and ignored entirely once claimed.
Gap-filling while 5b was blocked on DNS · done
Built while the domain transfer was in flight, so none of it belongs to a milestone. Three things: repository settings, browse usability, and README rendering — the last of which is Milestone 6's markdown pipeline arriving early because a repository page needed it.
Repository settings — a hole, not a feature
Repositories were create-only. No edit, no delete, and therefore no way to un-publish something published by accident. Now: description and visibility are editable, and a repository can be deleted behind a type-the-name confirmation.
- Delete writes the row first, then the directory best-effort. An orphaned directory
only blocks reusing that name and is already
create_repo's documented failure mode; an orphaned row is a repository that lists on the profile and 404s when clicked. The visible failure is the worse one, so the ordering avoids it. - Two different refusals, deliberately. A repository the actor may not see is
NotFound(a 403 would confirm a private repo by that name exists); one they can see but do not own isForbidden, matchingcreate_repo, because the resource is public anyway. The page collapses both to 404. - Renaming is still impossible, now with a comment saying why. The bare repo lives at
{data_dir}/{handle}/{name}.git, so a rename is a directory move that breaks every existing clone — and doing the row half only breaks them silently.
Markdown — raw HTML is structurally impossible, not merely disabled
pulldown-cmarkdoes not sanitise URLs. Itsescape_hrefonly percent-escapes, sojavascript:would have survived into a rendered README. The renderer uses a scheme allowlist (http,https,mailto,ftp,ftps,tel) and strips ASCII control characters before the check as well as on output, because browsers strip them too andjava	script:is otherwise a live bypass.- Adding the crate with
default-features = falseturned off itshtmlfeature, sopush_htmldoes not exist in this build. The renderer therefore walks the event stream and writes every tag itself. Forced rather than chosen, and better: the emittable tag set is exactly what the writer spells out, so raw HTML cannot pass through by construction.Event::Htmlis written as text, so<script>is visible and inert rather than silently vanishing. - Escaping goes through
topcoat::view::HtmlContext, the same escaperview!uses — not a hand-rolled one. - Smart punctuation is off: it rewrites
--flagto an en dash, quietly corrupting CLI flags in README prose. - Relative links are rewritten into tree URLs; relative images are deliberately left
alone, because a tree URL serves a page and rewriting would swap a 404 for a broken
image. Pointing them at
/raw/is the obvious follow-up now that route exists.
Browse — the switcher and raw files
for-each-refasks only for%(refname).%(objecttype)iscommitfor both a branch and a lightweight tag, so the namespace is the only thing that answers branch-versus-tag.- Raw files are served as
application/octet-stream, always — never the file's own type and never guessed from an extension — withnosniff,Content-Disposition: attachmentanddefault-src 'none'; sandbox. A repository-supplied.htmlor.svgserved as its real type on this origin is stored XSS against the viewer's session.text/plainwas rejected because browsers render it and have been talked into sniffing it as HTML. The filename is repository content arriving in a header, so it is reduced to[A-Za-z0-9._-]against header injection. - The switcher costs one more fork (~13ms) on tree and log pages, measured
interleaved against
ls-treeto cancel out load — same band, confirming again that the fork is the cost. It is not called on the repository page or an empty repository.
Verified
Against a running instance with a deliberately hostile README: zero real <script> or
<img> tags in the output, the markup present once as escaped inert text, the
javascript: link stripped of its href while https://example.com survived, the table
rendered, raw bytes SHA-256 identical with the headers above, the switcher listing a
branch and a tag, and the Settings link visible to the owner and absent for anonymous.
The profile page, rebuilt · done
Flat navigation, per ui.md. Tabs instead of stacked sections,
one lead item distinguished by weight and space rather than size, hairlines instead of
boxes, and a /{handle}/repos index for the tab to point at.
Decisions worth remembering
- Existing rows were stamped with the migration time, not left at 0. A repository pushed to for months would otherwise read "updated 56 years ago" on the very page the column exists to order. Wrong by a bounded amount and self-correcting on the first push, against wrong forever and looking broken.
- The single-pin invariant lives in the use case, not in a constraint. The rule is "pinning this unpins that", and a unique index can only refuse, never unpin. The two writes are not one transaction; a crash between them leaves nothing pinned, which is the harmless direction.
updated_atis touched on the authorized write path, before the protocol is reached — so a clone never moves it and neither does a refused push. It records that a push was authorized, not that it succeeded; waiting for the subprocess would be a much larger change for a small gain. A failed touch is logged and does not fail the push.- The lead is picked out of the listing, not fetched separately, so the lead and the list cannot disagree about which repository is pinned.
- Ordering changed from name to recency, and two existing tests had been passing by accident: everything created inside one second tied and fell back to the alphabet.
Two Topcoat traps, both silent
let profile = …in a module with#[page] async fn profileis a unit-struct pattern, not a binding. The page's name is a unit struct in module scope. The error points at neither the page nor the shadowing.- Forgetting
topcoat asset bundleaftercargo buildproduces a broken-looking page, not an error. New utility classes are simply absent, so gaps collapse and type falls back to browser defaults — it reads as a design mistake. Cost one confused screenshot.
Security review before going public · done
Attempted with three blind reviewer agents; all three died to the machine sleeping, so the review was done directly instead. Findings were verified by attacking a running instance, not by reading comments — the codebase argues confidently for its own safety and those arguments are exactly what needed testing.
What held, demonstrated rather than assumed
| Probe | Result |
|---|---|
Private repo: page, tree, log, settings, raw, /api | 404 on every surface; /api does not leak the name |
rev=--upload-pack=touch /tmp/pwned and five other injections | 404, no execution |
Four path-traversal spellings incl. %2e%2e and ....// | 404 |
| Login brute force | 10 attempts then 429 |
| Error bodies | bare "not found", nothing internal |
Raw .html and .svg from a repo | octet-stream + nosniff + attachment + sandbox CSP |
Filename ev"il; drop.txt in a header | sanitised to ev_il__drop.txt, no header injection |
<script> in a viewed file | escaped, zero live tags |
The production cookie is __Host-session; HttpOnly; Secure; SameSite=Lax; Path=/ —
the strictest cookie form available, and it forbids a Domain attribute so a
compromised subdomain cannot inject one.
A near-miss worth recording: the first check appeared to show production serving
steid-dev-session with no Secure. It was a testing error — dotenvy reads .env
from the working directory, and running the binary from the repo root picked up the
gitignored dev .env. Verify from a neutral directory, and note the same trap applies
to the deployment: the systemd unit's WorkingDirectory=/opt/steid means a stray .env
there would silently override the environment file.
The one real finding: no security headers on HTML
Fixed with a layer, deliberately a layer rather than a per-handler concern — a page added without them would simply not have them and nothing would fail.
- Steid renders no JavaScript at all, not a script tag on any page, so
default-src 'none'is a policy the product can genuinely keep. That is far stricter than a typical CSP and worth defending: if a feature ever needs script, weakening it should be a deliberate decision. 'unsafe-inline'is granted for styles only, and only because Topcoat's icon macro emitsstyle="vertical-align: -0.125em". A framework constraint, not a choice.Referrer-Policy: no-referrer, not the usualstrict-origin-when-cross-origin: a private repository's URL contains its name, and a README may link anywhere, so a referrer would hand that name to whatever the visitor clicked.- Headers are set with
entry().or_insert(), neverinsert()— the raw endpoint's own stricterdefault-src 'none'; sandboxmust not be relaxed by a blanket overwrite. Verified that it survives.
Not covered, and why
- The member-but-not-owner path could not be demonstrated. There is no registration, so a second account cannot exist until Milestone 7. It is covered by use-case tests and nothing else — re-verify for real the moment a second account is possible.
- No automated test asserts the headers. There is no HTTP-level test harness in this project, so a regression here would be silent. That is a gap, not a decision.
- No dependency audit (
cargo auditwas not run), and no review of the deployment scripts beyond the earlier container dry-run.
Deployed · jpgill.dev, 2026-09-04
Steid runs on the public internet at https://jpgill.dev, on AWS Lightsail (Debian 13,
x86_64, 1 GB), behind Caddy with a Let's Encrypt certificate, hosting its own source.
Installed with install.sh --tarball, since the instance that will serve the releases is
the one being installed.
What the first real deployment taught
- A domain transfer moves the registrar, not the nameservers. The transfer to Amazon
Registrar completed, the Route 53 zone held the right records, and every public resolver
returned nothing — because the
.devregistry still delegated to the old provider's nameservers. Diagnosed withdig +trace, which shows the delegation the world actually follows rather than the zone you are looking at. - The domain was
jpgill.dev, notjpgilldev.com. Inferred from an email address and never confirmed, and by then it was baked intoinstall.sh's release URL and the systemd unit. Ask what the domain is. .devis HSTS-preloaded. Browsers refuse plain HTTP with no click-through, so the certificate is not optional — until Caddy has one the site is simply unreachable.- The uniform 401 cost real time. Pushing to a mistyped handle answered
Authentication failedrather than "no such repository", because 0007 deliberately makes an absent repository indistinguishable from a private one. That trade was recorded as costing "a prompt on a typo"; in practice it cost ten minutes and a confident wrong diagnosis, with someone watching who knew the design. A stranger has nobody to ask. - An upgrade silently discarded the operator's Caddyfile.
install.shkeptsteid.envacross a re-run but rewrote the Caddyfile unconditionally, so a hand-addedwwwredirect vanished on the next upgrade and took the hostname with it. Now written on first install only, with--force-caddyfileand--www. Found by testing the upgrade path rather than waiting for it to happen. - The upgrade path works and is verified: claim, database, repositories,
steid.envand Caddyfile all surviveinstall.shre-run against a newer tarball.
Renaming a handle, done by hand
current.md recorded a rename as "a directory move, not a row update". That was exercised
for real, renaming jpgilldev to jamesgill on the live instance: one UPDATE orgs SET name and one mv of {data_dir}/{handle}/. Everything else — users, repositories,
tokens, sessions — keys off ids, so nothing else moved, and the account, password and
access token all survived.
So a rename feature is genuinely two writes. What makes it more than that is the consequence: every existing clone URL breaks, and there is no redirect from the old handle. That is the part to design, not the mechanics.
The shell: top bar and per-page widths · done (2026-09-05)
The root layout gained a slim global top bar — wordmark to /, and either "Sign in"
or @handle / Settings / Sign out — and stopped imposing a width. Pages now choose
their own column via two components in layout.rs: narrow (48rem — profile, forms,
settings) and wide (80rem — tree, blob, log, the repo page). Verified in the
browser across visitor and owner states, including sign-out.
Decisions worth remembering
- A slim bar plus contextual tabs, deliberately not an app shell. The reasoning lives in ui.md; the short form is that Steid's first audience is an anonymous reader of someone's site, and GitLab-style rail chrome tells that visitor they've landed in an admin tool.
- A
#[layout]may takecx: &Cxalongsideslot— both recognized by name, no other parameters. Documented in the vendoredtopcoat-router-macrodocs, not obvious from the README example. - The layout imposes no width; pages wrap themselves. Same philosophy as request helpers being functions: a page that forgets a container renders full-bleed, which is immediately visible, rather than silently inheriting a wrong one.
- The top bar costs an identity lookup on every page render (session hash plus a user row). Fine over local SQLite; worth remembering if page queries are ever counted.
The repository landing page · done (2026-09-05)
/{handle}/repos/{name} became two columns — the file list and README on the left, an
About sidebar on the right — and every repository page (tree, blob, log) picked up the
same header and Code / Commits tab strip. New: a toolbar row carrying the revision
switcher and branch/tag counts, a latest-commit bar, an About block with the
description and detected licence, a facts list (commits, branches, tags, latest tag,
pushed), and the clone URL moved into the sidebar.
The layout and the map of where the next features slot in are in ui.md. What is here is what the next session should not have to rediscover.
Verified with the app running from a worktree on port 3100: this repository's own
history pushed into it with two annotated tags and three branches, plus an empty
repository and one with no README and no licence. Screenshots taken headless at 1280px
and 800px, in both colour schemes, of the landing page, the empty and sparse states, a
tree subpath, a blob and the log; the owner's view (with the Settings button) checked
signed in. cargo test 467 passing, clippy clean.
Decisions worth remembering
- The subprocess count was measured, not estimated. A
gitshim onPATHlogging every invocation: 15 processes for a repository with a README and a licence, 10 without them, 1 for an empty one — up from 7. Worth repeating the trick; it took two minutes and contradicted a careful hand-count. - The description has exactly one home, and it is the sidebar. Putting it in the header too makes the header tallest on the repositories with the most to say, which pushes the code below the fold on exactly the pages that deserve it least.
repo_summarytakes the revision and the root listing the page already read. A self-contained use case would have spent two more processes re-reading what the caller had in hand. The five calls it does make run under onetokio::try_join!.organise_refswas split out oflist_refsso the landing page gets the counts and the switcher's list from onefor-each-ref. Two places deciding ref order is two places to change it.- A
#[component]'s name is a unit struct in module scope, and the copied-in components are in that scope too. A parameter namedlabelinsiderepo.rsdoes not bind — it parses as thelabelcomponent's unit struct, and the error says "expectedstr, foundlabel" without naming the component. The fix was renaming the parameter toterm. This is the same trapCLAUDE.mdrecords for pages; registry components widen it to every file that imports one. bg-mutedis not a token. Three<pre>blocks have been rendering with no background since they were written, silently — the exact failureui.mddescribes for Tailwind classes the build never ships.bg-surfaceis the token. Two were fixed here;token.rsstill has one.- The clone URL wraps rather than scrolls. In an 18rem column an
overflow-x-autoURL looks like a truncated one, and the part hidden is the repository's own name. - Light mode was checked by flipping the layout's
class="dark"and rebuilding, because there is no toggle. Nothing was wrong on these pages. That is the cheapest way to check it until a toggle exists, and it is worth doing before each UI step rather than after several.
Reference: what attempt #2 proved
Not this repo's progress. This is a catalogue of what was built and verified working
in steid-backup-2026-07-31, so the rebuild can crib rather than rediscover.
Final state: single crate, ~4,200 LOC, 60 passing tests, five milestones.
Identity
Domain model (User, Organization, Membership, Actor, Role), Email and
PasswordHash value objects, typed IDs, DomainError, four repository ports with
in-memory and SQLite implementations each. RegistrationPolicy (Personal / Invite /
Open) driving which routes exist. Argon2 hashing behind a PasswordHasher port with a
stub for tests. Use cases: bootstrap_owner, register_user, login, create_invite.
Signed-cookie sessions via an AuthUser extractor.
Gotcha: organizations must be saved before users — the FK runs that direction.
Both bootstrap_owner and register_user had to be fixed for this.
Repo model
Repository entity, RepoId, Visibility (Public/Private), RepoRepository port,
migration 006_create_repositories.sql. create_repo use case validates the name,
rejects duplicates, and initialises the bare repo on disk in the same call. Bare repos
live at {data_dir}/{org}/{repo}.git, data_dir defaulting to ./data. Repos are
created empty, no initial commit, like GitHub.
Git over SSH
GitStorage port (init_bare, repo_path) with DiskGitStorage shelling out to
git init --bare. GitProtocolServer port (upload_pack, receive_pack) with
GitBinary spawning git upload-pack / git receive-pack via
tokio::process::Command and pumping stdio with tokio::io::copy.
serve_clone and serve_push use cases enforce visibility and actor checks before
any protocol byte flows — that ordering is the whole point of putting them in the
application layer.
SSH channel bridging
The fiddly part, and worth re-reading if SSH ever returns as a transport (milestone 8+ — 0001 chose HTTP):
- Store
Channel<Msg>perChannelIdin the handler's map onchannel_open_session - On
exec_request, take the channel, split it withinto_stream()+tokio::io::split - Take stderr via
make_writer_ext(Some(1))beforeinto_stream()— that call consumes the channel, so the order is not optional - No
data()orchannel_eof()handlers needed once the streams are split
An earlier iteration used mpsc channels, custom ChannelReader/ChannelWriter, and a
spawn_blocking thread. All of it was deleted and the result was simpler.
SSH key auth and authorization
SshKey { id, user_id, name, fingerprint, openssh } + port, migration
007_create_ssh_keys.sql (fingerprint UNIQUE). Fingerprints are SHA256 via
russh::keys::ssh_key::PublicKey::fingerprint(HashAlg::Sha256), stored as SHA256:….
add_ssh_key parses the openssh blob, dedupes on fingerprint, and re-encodes to a
canonical form before storing.
auth_none rejects. auth_publickey fingerprints the offered key, looks it up, and
on a match stores user_id on the handler; exec_request builds the real Actor
from it.
Authorization rules as shipped:
| Operation | Requirement |
|---|---|
| Clone, public repo | open |
| Clone, private repo | any membership in the repo's org |
| Push | Role::Owner membership in the repo's org |
Web UI at /{owner}/keys — owner-only, lists fingerprints, accepts openssh via
textarea, revokes per-row.
Verified end-to-end: clone with an unregistered key → Permission denied (exit
128); register via web UI → clone and push both succeed; second unregistered key →
rejected at auth; revoke via web UI → subsequent clone rejected at auth.
Security notes
Attempt #2 ran with a named, deliberate backdoor between milestones: SSH accepted
any connection and passed a placeholder Actor (UserId("ssh-anonymous")), leaving
push open to anyone who could reach the port. It was recorded with an explicit
tightening point (ssh.rs::exec_request) and a closing milestone, and it did close.
That practice is worth keeping. When this attempt opens a hole to make progress, name it, name the line that closes it, and name the milestone.
Never built
Repo browsing (tree/blob/log), HTTP smart protocol, personal access tokens, flash messages, issues, PRs, blogs, pages, project showcases. Milestones 5–8 in ROADMAP.md are all greenfield.