Skip to content

pkgs/id: split the monolith crate into sub-crates along module seams (prioritized by Drew 2026-11-01) #3447

Open

Description

@dezren39

Order

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:

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.

Activity

  1. added
    priority/highImportant and time-sensitive
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    on Nov 1, 2026
  2. developing-today commented on Nov 1, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    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.

  4. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 1, 2026
  5. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  6. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 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):

    1. 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).
    2. 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).
    3. 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).
    4. 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).
    5. Phase 5 — id-web: web/ (19k lines, 1 in-reference — the cleanest big extraction) once its world/tags dependencies live in sub-crates.
    6. 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).

  7. added
    work/assignedQueue worker lifecycle state
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 1, 2026
  8. 155 remaining items

  9. added
    effort/lLarge: multi-day or open-ended; expect staged check-ins
    queue/queuedHas a queued task in the Supabase agent queue
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    queue/queuedHas a queued task in the Supabase agent queue
    status/triagedTriaged and routed (see agent note)
    on Nov 4, 2026
  10. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done (triage)

    • Agent: queue worker (repo-worker-code), lane code-q
    • Session / ID: task 9571
    • Found via: queue claim (direct execution lane)
    • Task: Triage of this crate-split umbrella at current main (2026-11-04).

    Findings — the split is underway, not unstarted:

    Routing: no new issues or tasks needed — the step issues are the fix path and are already queued. This issue stays OPEN as the umbrella until step 7 (#4411) lands. Per-phase acceptance evidence (sandbox fuel baselines identical; before/after cold check-build timings recorded here) remains owed by each step's PR, per the acceptance block on this issue.

  11. added
    status/triagedTriaged and routed (see agent note)
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/lLarge: multi-day or open-ended; expect staged check-insexpediteImportant - do this very soon, before anything not expeditedkind/enhancementpriority/highImportant and time-sensitivesource/creatorFiled by the new-issue-creator jobstatus/triagedTriaged and routed (see agent note)task/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions