GeezerVison is showing github.com — pkgs/id: split the monolith crate into sub-crates along module seams (prioritized by Drew 2026-11-01) · Issue #3447 · developing-today/code
pkgs/id: split the monolith crate into sub-crates along module seams (prioritized by Drew 2026-11-01) #3447Closed 7 / 77 of 7 issues completedClosed 7 / 77 of 7 issues completed DescriptionOrder
Drew, 2026-11-01 (~03:23 CST, main chat): "prioritize the crate splitting work."
This elevates the crate-shape work out of #3195's sequencing. #3195 scoped splitting as "only if the above is insufficient" (after profile separation, release audit, build hygiene). Drew's order makes the split a first-class work item now, in parallel — the profile work in #3195 continues on its own track and is not a precondition.
Why
pkgs/id is one giant compilation unit and the cost is now gating production work:
- pkgs/id: build-time review — runtime performance first, then build time (cold check build ~16 min, tests run 12 s) #3195's table: 150 src .rs files, 125,722 lines (2026-10-31), up from 71,723 lines on 2026-10-11 — compile time tracks the crate's own size, superlinearly under LTO with
codegen-units = 1.
- pkgs/id: build-time review — runtime performance first, then build time (cold check build ~16 min, tests run 12 s) #3195 measured a cold nix build of the package at ~16 min under shared load (2026-10-31).
- 2026-11-01: the NixOS switch that deploys the fleet-feed collector (pm-stack NixOS module: fleet-feed collector units are hand-written — fold service + timer into nixos/services/pm-stack #3363) sat behind this compile for over an hour of wall time — the
id release build (cargo, ~200-crate dependency graph, LTO) ran 53+ minutes under fleet load, and two stale/duplicate builds of the same package were found competing with it and had to be killed by hand.
- Every check/test build recompiles the one crate end-to-end for any change anywhere in it. Splitting along the existing module seams makes most changes recompile only the touched sub-crate and lets the graph build in parallel.
Scope
- Identify the split seams from the crate's existing module structure and dependency directions (the program's areas — artifact, world, sandbox, web, dht/ssh, core types — are the starting hypothesis; the triage verifies against real import graphs).
- Sequence the extraction into phased, independently mergeable packets (one sub-crate per packet), each keeping the full test suite green.
- Keep the public surface of the resulting top crate/binary unchanged for consumers (the NixOS module, mcpx, and the flake checks build the same binary).
Acceptance (inherited from #3195, non-negotiable)
- Shipped-binary runtime performance unchanged-or-better, with evidence: the deterministic fuel baselines in
src/sandbox.rs identical after each phase; runtime spot benchmark before/after.
- Cold check-build time materially reduced, before/after timings recorded on this issue from the laptop.
- No test coverage removed and no check weakened to buy speed.
Program context: #3195 (build-time review), Drew's 2026-10-28 id program directive. Sibling storage/duplication problem: the fleet target-dir duplication issue filed alongside this one.
{
"pm_meta": 1,
"direct_parent": {
"repo": "developing-today/code",
"number": 3195,
"kind": "sub-issue"
},
"links": [],
"provenance": {
"actor": "dezren39",
"ingested_by": "metadata-sweeper",
"ingested_at": "2026-11-24T03:22:45.619Z"
},
"ascertained": {
"title": "pkgs/id: split the monolith crate into sub-crates along module seams (prioritized by Drew 2026-11-01)",
"state": "CLOSED",
"labels": [
"task/triage",
"status/blocked",
"source/creator",
"priority/high",
"app/id",
"epic",
"queue/blocked",
"effort/l",
"kind/enhancement",
"expedite",
"epic/id-program",
"epic/id-crate-split",
"design/id-crate-split"
],
"milestone": null,
"created_at": "2026-11-01T09:25:05Z",
"updated_at": "2026-11-14T06:23:18Z",
"closed_at": "2026-11-13T08:55:54Z"
}
}
Sub-issuesCollapse Sub-issuesSub-issues7 of 77 of 7 Issues completedLoading 7 sub-issues Activitydeveloping-today commented on Nov 1, 2026 dezren39 commented on Nov 1, 2026 Prioritized by Drew in main chat 2026-11-01 ~03:23 CST. Triage task 5366 queued at priority 10 (top band) on repo-health-code-pilot, DB-verified. The triage maps the seams and routes phased extraction packets; #3195's acceptance (fuel baselines identical, runtime perf neutral-or-better, no coverage loss) binds every phase. dezren39 commented on Nov 1, 2026 dezren39 commented on Nov 1, 2026 🤖 Agent note · done (triage)
Module map at current main 70c206250 — pkgs/id/src: 150 .rs files, 126,981 lines, single crate (no workspace yet). Cross-reference counts are files in area A referencing crate::<module> of area B (laptop count, this run):
| Area |
Lines |
out → |
in ← |
Reading |
| web/ |
19,038 |
32 |
1 |
top-of-stack consumer; almost nothing depends on it |
| commands/ |
10,626 |
81 |
35 |
the binary's workhorse; depends on everything |
| world/ (dir) |
9,037 |
28 |
0 |
world cluster core |
| event_store/ |
8,066 |
21 |
9 |
sync/event cluster core |
| groups/ |
5,948 |
7 |
19 |
identity/groups cluster |
| world_session/ |
5,271 |
41 |
19 |
world cluster |
| encryption/ |
4,901 |
9 |
1 |
near-leaf; feeds groups |
| cli.rs |
4,401 |
2 |
6 |
shell |
| world_ssh.rs |
3,163 |
13 |
3 |
world cluster |
| repl/ |
2,934 |
0 |
0 |
self-contained (talks to commands via the binary surface) |
| directory.rs + directory_view.rs |
5,693 |
10 |
28 |
mid-layer, widely used |
| tags.rs |
2,698 |
1 |
12 |
near-leaf core type |
| sandbox.rs |
2,290 |
2 |
8 |
near-leaf |
| membership/ |
2,059 |
0 |
4 |
leaf |
| world_net/store/compile/hub/fixture/doctor/native/records/manifest/line/caps/limits/presentation.rs |
≈15,500 |
low |
caps 14, limits 14, presentation 7 |
world cluster + its leaf types |
| protocol.rs |
1,731 |
6 |
7 |
mid |
| store.rs / store_traits.rs |
1,734 |
4 |
8 |
mid |
| leaves (out ≈ 0, in high): waiting 814 (0/14), connectivity 439 (0/15), discovery 1122 (0/6), tuple 1245 (0/2), access 237 (0/4), petname 751 (1/4), qr 102, sync_method 239, time 11 (2/8) |
|
|
foundation |
|
Pinned sequence (each phase one independently mergeable packet, full suite green, binary surface unchanged; each phase's worker enqueues the next phase on completion, reusing the standard fix dedupe key once the prior task is terminal):
- Phase 1 — id-core (foundation): workspace conversion + extract the leaf modules (time, waiting, connectivity, discovery, tuple, petname, qr, access, sync_method, membership/, world_caps, world_limits, world_presentation) into a sub-crate; main crate re-exports at existing
crate:: paths. → task 5371 (enqueued).
- Phase 2 — id-world: the world cluster (world/, world_session/, world_ssh, world_net, world_store, world_compile, world_hub, world_fixture, world_doctor, world_native, world_records, world_manifest, world_line — ≈33k lines with Phase-1 leaves as its base).
- Phase 3 — id-sync: event_store/ + chain, tag_claims, tag_index, log_sync, local_events, event_sync, store_traits (≈13k lines; tags.rs/tuple stay-or-move decided by Phase 1's re-export shape — tuple already in id-core).
- Phase 4 — id-groups: groups/ + encryption/ + invites/ + blob_gate, rejection (≈12k lines; encryption is near-leaf at 9 out / 1 in and groups consumes it).
- Phase 5 — id-web: web/ (19k lines, 1 in-reference — the cleanest big extraction) once its world/tags dependencies live in sub-crates.
- Remainder: commands/, cli, repl, main, store, protocol, directory — the binary crate, now a shell over the sub-crates.
Timing method (from #3195, required in every phase packet): cold nix build of pkgs/id (flake check phase) wall time on the laptop, before/after, plus cold cargo check with an empty CARGO_TARGET_DIR; record both on this issue. #3195 baseline: ~16 min cold nix build under shared load, 1,963 lib tests executing in 12.4 s — the cost is this one unit's compilation.
Explicitly NOT in scope for any phase: behavior/API/CLI/wire changes, test weakening, profile work (#3195's track).
dezren39 commented on Nov 12, 2026 Lineage fix (2026-11-12, per Drew's directive that all work link to epics/boards/labels):
- This issue is now a native sub-issue of pkgs/id: build-time review — runtime performance first, then build time (cold check build ~16 min, tests run 12 s) #3195 (its stated parent track), and pkgs/id: build-time review — runtime performance first, then build time (cold check build ~16 min, tests run 12 s) #3195 is now a native sub-issue of the ID epic epic: ID platform expansion — apps, comms, currency, hosting, boards (2026-10-28 directive, LIST 6–15) #2056.
- All seven step issues (pkgs/id crate split — step 1: extract id-caps (workspace + leaf foundation already landed as id-core) #4403, pkgs/id crate split — step 2: extract id-store, then id-events #4405, pkgs/id crate split — step 3: extract id-sync (log_sync + wire layer; artifact lands here) #4406, pkgs/id crate split — step 4: extract id-groups (groups/membership/encryption) #4407, pkgs/id crate split — step 5: extract id-worlds #4408, pkgs/id crate split — step 6: extract id-directory, then id-web #4409, pkgs/id crate split — step 7: extract id-cli; facade slimming #4411) are now native sub-issues of this issue.
- Labels unified across the chain:
app/id, epic/id-program, epic/id-crate-split, design/id-crate-split (the latter two created today mirroring the existing epic/* and design/* label families); this issue also carries epic.
- Board: org Project Bump build/buck/preludes/buck2-prelude from
3a02ea3 to 9530656 #4 membership/fields could not be set or verified from automation — the available gh token lacks the project/read:project scopes (INSUFFICIENT_SCOPES from the API). Needs gh auth refresh -s read:project,project interactively, then add epic: ID platform expansion — apps, comms, currency, hosting, boards (2026-10-28 directive, LIST 6–15) #2056/pkgs/id: build-time review — runtime performance first, then build time (cold check build ~16 min, tests run 12 s) #3195/pkgs/id: split the monolith crate into sub-crates along module seams (prioritized by Drew 2026-11-01) #3447 + steps with Area=ID.
Full register: lineage manifest filed in pm-stack (lineage-manifest-2026-11-12). dezren39 commented on Nov 13, 2026 The pkgs/id crate split is complete — all seven steps landed, and this umbrella closes.
What shipped
Final shape: the facade id package is re-exports + main.rs + its retained feature modules; implementation lives in crates/: id-caps, id-cli, id-core, id-directory, id-events, id-groups, id-native-shell, id-store, id-sync, id-web, id-worlds. Two deviations were recorded on the step issues as they were made: id-worlds depends downward on id-directory (WorldCore owns a Directory as persisted state — #4409 close-out), and the facade's re-export surface is kept whole rather than pruned in step 7 (per-name retirement deferred to an API-tightening pass — PR #9362).
Acceptance evidence
- Fuel:
FUEL_BUDGETS byte-identical after every step, including the last (verified by cmp against the pre-split snapshot at each PR).
- Runtime spot benchmark (before/after, this laptop, debug builds, fresh scratch store per run, 10× 256 KiB put + 10× get + 5× list, medians of 3 runs): before = the baseline anchor
6741fc50a4 (steps 1–5 in, 6–7 not yet): put batch 1.36 s, get batch 0.37 s, list batch 0.37 s. After = current main 335ca94918: put 1.38 s, get 0.34 s, list 0.34 s. Parity within noise; get/list marginally better. (Steps 1–5's own runtime effect is covered by their step records plus fuel identity across all steps.)
- Build times: full cold-ish
cargo build -p id on this laptop (fresh target dir, broker lock, current fleet load): ~3–4 minutes both for the anchor tree and the final tree — the dependency graph dominates a from-scratch build, and pkgs/id: build-time review — runtime performance first, then build time (cold check build ~16 min, tests run 12 s) #3195's ~16-minute figure was a cold Nix build under the heavier shared load of 2026-10-31, so the two are not directly comparable. The split's build win is the incremental shape the monolith made impossible: per-crate cargo check on the extracted crates runs in seconds to ~1 minute warm (e.g. id-cli ≈ 8–45 s, id-web similar in this run's logs), and a change in one member no longer recompiles the whole application layer. The Nix gating derivation (id-web package) went from failing to compile its check phase on pre-split main (the suite-B visibility breakage) to compiling fully and stopping only at the pre-existing id: frames byte-refusal test fails on main (RequestTooLarge vs BudgetExhausted) — blocks id build + nixos-integration check #8354.
- Coverage: no test deleted and no check weakened at any step; totals rose across the split (final: facade 973, id-cli 677 + 7 narrowed aliases tests, workspace members chunk 3,532, suite B 988 — deltas per PR are test-code moving with its implementation, each accounted on its PR). Remaining red is pre-existing and tracked: id: frames byte-refusal test fails on main (RequestTooLarge vs BudgetExhausted) — blocks id build + nixos-integration check #8354 (frames accounting), serve_tests web/iroh world test: forged join not refused with "join denied" (pre-existing, hidden by suite-B compile break) #9274 (serve world-presentation test, hidden for weeks by the suite-B compile break the split repaired), and the
web/dist-manifest test that only passes with the bun-built assets (as in the Nix package build).
One design-protocol item was not re-run in this final pass: benches/world_bench.rs criterion medians against the step-0 record. Fuel identity (the deterministic runtime gate) plus the spot pair above stand as the runtime evidence; a canary re-measure is a small follow-up if wanted. dezren39 commented on Nov 14, 2026 Packet-defect disposition under Drew's 2026-11-13 unblock-all order: task 13975 was cancelled (packet defect verified unchanged — see the task record) and replaced by fresh triage task 16472, now queued. Worker main-unblock-all-2026-11-13.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|