Skip to content

docs(plan): add Cargo workspace crate split & memory limit plan (WSM-01..05) - #1067

Open
fleeto wants to merge 1 commit into
libra-tools:mainfrom
fleeto:plan/workspace-crate-split-memory-limits
Open

fleeto wants to merge 1 commit into
libra-tools:mainfrom
fleeto:plan/workspace-crate-split-memory-limits

Conversation

@fleeto

@fleeto fleeto commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the follow-up architectural plan and task-card decomposition (WSM-01..WSM-05) in docs/development/plan/plan-20261122-workspace-crate-split.md to eliminate the remaining single-process rustc memory ceiling (9.845 GiB cgroup max anon / 9.640 GiB RssAnon) and reduce full-suite test artifact disk growth after PR #1066.

Evidence Grounding

  • 2×2 Compilation Attribution (--jobs 1, CPUQuota=400%, MemoryHigh=14G, MemoryMax=18G):
    • Production liblibra.rlib: 6.592 GiB RssAnon (Hybrid) / 6.448 GiB (debug=0)
    • Unit-test libra --lib --test: 9.640 GiB RssAnon (Hybrid) / 9.313 GiB (debug=0)
    • Pure inline #[cfg(test)] delta is +2.87–3.05 GiB RssAnon, while line-tables-only accounts for only 0.14–0.33 GiB.
  • Empirical Pilot Disproving Non-Workspace Test Migration:
    • Only 8 files (~1% of src/ test lines, 97 tests) are strict black-box tests without private use super::* / #[cfg(test)] fault-hook coupling; migrating them changed cgroup max anon by only -0.032 GiB (9.845 -> 9.813 GiB) while adding a 190 MiB binary.
    • Therefore, lowering the single-rustc peak without leaking private APIs requires a Cargo Workspace split where production domains move together with their private unit tests.
  • Cross-Domain crate:: Dependency Matrix (src/ 760,764 lines):
    • internal/db_model: 7,377 lines, only 1 back-edge to command/vcs (cleanest foundation crate).
    • gui: 7,396 lines, 14 outgoing refs, 0 incoming refs (cleanest leaf crate, isolates the heavy gpui/wgpu/ely-* dependency tree).
    • internal/ai: 307,634 lines (40.4% of src/, 51.4% of inline unit tests) — primary target to cut the monolithic rustc peak.

Proposed Task Cards (DAG: WSM-01 -> WSM-02 -> {WSM-03, WSM-04} -> WSM-05)

  • WSM-01: Read-only audit of cross-domain back-edges, SCC boundaries, and tests/compat/* src/ path hardcodings.
  • WSM-02: Cargo Workspace skeleton, crates/libra-db-model extraction, and workspace-aware upgrade of tests/compat/* guards.
  • WSM-03: Extract crates/libra-gui to isolate the gpui/wgpu/ely-* dependency graph.
  • WSM-04: Decouple back-edges and extract crates/libra-ai (keeping all 2,329 private unit tests and #[cfg(test)] hooks intact inside the crate with zero public API widening).
  • WSM-05: Selective domain aggregation of heavy integration test binaries (agent_bridge_*, agent_mcp_*, operation_* excluding *_span_test and feature-gated targets) + full-suite resource regression gate.

Note: This PR introduces the draft plan document only (pending / unverified). No production or test code is modified.

…01..05)

Signed-off-by: fleeto <dustise@live.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant