Reading copy of lichen.page.review: one PR per unit, product changes only

HUB-AND-STORAGE-CHECK (whole) #83

targeting base/hub-and-storage-check-whole from view/hub-and-storage-check-whole
Open opened by and assigned to notplants-bot.bsky.social
targeting base/hub-and-storage-check-whole from view/hub-and-storage-check-whole

The storage limit and the hub each get one implementation.

Storage limit. Every limit check is one synchronous read of one number, the owner's storage left, held in one shared value (an atomic) in each site process; nothing waits on a directory walk. The front alone measures each site, its folder and its hub, keeps each figure in memory, re-measures only the site that told it, and waits for a measurement only on an import. Each of the owner's running sites is sent the bytes left, in its launch and then in an allowance frame on the control channel, and its admin thread sets the shared value; a site with no figure counts nothing. A site process measures nothing: after each save, each build that ran scripts, a render, git's three commits and each change to the hub, it tells the front (request_storage_recount), passed from the site's main thread to its admin thread and from there to the front. A create reads the front's figures with no walk; an import measures first. Single-site and desktop have no allowance, so their check passes and their tell does nothing. The allowance files, the hand-down and the weight thread are gone. The front server's create and import check keeps its own walk, renamed owner_storage_limit_check.

The hub. Twelve files in three folders become one module, git/hub/, each file one side and one job (the refs and call vocabulary, the exchange halves, merge and reset on the main side, and folder, receive, HTTP, full push, rewrite and files on the admin side). There is one git on the hub, with its hooks off and its environment cleared, used by the receive, the upload, the ref reads, the file reads, the publish's mktree and the peers' pack-objects. The hub's refs are named once. A push's and a fetch's advertisement share one pipeline, a refused push has one answer, the hub tells the front to recount after each write into it, and the backup's config, the pack tuning and the receive-pack answer are each written in one place. Comments and docs name git/hub's files and lines, and the hub's tests mount from git/tests.

Revert and routes. The revert is the site's own history view's: POST /cms/api/git/revert is one of git's site routes beside GET /cms/api/history, a write served in every mode and refused over the owner's storage limit as a save is. The dashboard's revert, the front's refusal on the site's host, the IPC revert and the test-only single-site router go. The dashboard's auto-save goes, with its route, its IPC route and its switch. The site's IPC routes are written once: each is mounted from its ask (IpcRoutes::mount), and the asks are read off the routes. iroh's peers and collaborators move into iroh, registered through the assembly, and every registered route is behind the dashboard's host role.

The rewrite's lock. The tree transaction a rewrite holds the site under moves from core onto git's part of the site, as RewriteSiteLock on git::listeners::Git, and the hold's names become the lock's (LOCK_FOR, lock_within, unlock, LockState). Behaviour is unchanged.

Smaller removals. Assembly::commit_now is gone: iroh commits its collaborators' edits by git directly. The two spawn doors are named for where they spawn, spawn_on_admin and spawn_on_main.


HUB-AND-STORAGE-CHECK, the whole phase in one reading PR. Plan: https://tangled.org/notplants-bot.bsky.social/lichen-orchestrator/blob/main/machine-docs/plans/HUB-AND-STORAGE-CHECK-2026-11-01.md

Only the phase's Rust product code is here: every .rs file under crates/<crate>/src/ (no tests folder in its path), which is what e2e/ci/count_product_code_lines.py counts as product. The head is the base plus commits that each set those files to their content at a tip (added, changed, deleted and renamed files alike). Tests, docs, scripts and non-Rust files (including Cargo.toml and Cargo.lock) are not in it, so the crates here are not meant to build on their own. Reading copy; nothing here is to be merged.

Source PRs on lichen.page.review (product), in order #

  • #3714 one storage limit check, the fast one (HUB-AND-STORAGE-CHECK unit 1)
  • #3716 one hub module, one git on the hub, its refs once (HUB-AND-STORAGE-CHECK 2a and 2b)
  • #3718 receive and HTTP once, the hub weighed once (HUB-AND-STORAGE-CHECK 2c)
  • #3720 the hub's small copies made one (HUB-AND-STORAGE-CHECK 2d)
  • #3722 the front measures and the site reads one number, the owner's storage left (HUB-AND-STORAGE-CHECK 2e)
  • #3724 the hub named where it is, commit_now gone, the spawn doors renamed (HUB-AND-STORAGE-CHECK 3, the close)
  • #3726 the revert in the site's history view, the dashboard's auto-save gone, the IPC routes written once (HUB-AND-STORAGE-CHECK 2f)
  • #3728 the rewrite's lock of the site is git's (HUB-AND-STORAGE-CHECK 2g)

Base, end tip, count #

Base 6cc622ced4f5d221865256910d9cb21eed2bed7e. End tip 3a5f2d0bb1708e1745bff3bfe3ac409f2ad4a9c0. Head 6f7649db12c2f5140f4ef091c17ff1b6026e3821 (93 files changed against the base).

Counter, base to end tip (the phase as lichen.page.review has it):

count-product-code-lines 6cc622ced4f5..3a5f2d0bb170: NET -498 · counted +4016 -4533 · moved out of the counted set +19 · comment-only deletions flagged 175 · macros flagged 0 · tests-folder code flagged 0

Counter, base to head (this PR):

count-product-code-lines 6cc622ced4f5..6f7649db12c2: NET -416 · counted +4015 -4431 · moved out of the counted set +0 · comment-only deletions flagged 175 · macros flagged 0 · tests-folder code flagged 0

The two are equal in every Rust line. They differ only by lines outside the Rust files: the front-end JS and TS the counter reads as moved out of the counted set (+19), the included frontends/builtin/ssr/app-ssr.js (+1 -1) and the included contract/dashboard-api.json (-101). Those files are not in this PR.

Check #

git diff base head lists only counter-product Rust files, and the head's content equals the end tip's for each of them. For the counter, the head's counted and NET lines equal the end tip's once those non-Rust lines are taken out.

Record #

HUB-AND-STORAGE-CHECK is COMPLETE at stack 3a5f2d0bb1708e1745bff3bfe3ac409f2ad4a9c0 (coordination record 3a5f2d0b). Earlier tips on this branch: units 1 to 2d at 21109d5e9, 2e and the close at 68d563cfe, 2f and 2g at 4f18a21d0. The final tip changes no Rust product file (its one change since 4f18a21d0 is a test), so the head 6f7649db1 already holds every counter-product Rust file at its final content, and no commit was added for it.

Commits 0