Skip to content

Drop size limits and consolidate workshop modules - #42

Merged
vinniefalco merged 1 commit into
cppalliance:masterfrom
vinniefalco:master
Dec 1, 2026
Merged

vinniefalco merged 1 commit into
cppalliance:masterfrom
vinniefalco:master

Conversation

@vinniefalco

Copy link
Copy Markdown
Member

Summary

Removes numeric function/type size limits (type_size.rs, too-many-lines-threshold, too-many-arguments-threshold) while keeping all binary architectural guards intact, recombines split production files, types, and single-caller helpers across 13 shipping crates under crates/workshop/, removes borrow-evading clones and avoidable allocations, and consolidates duplicated test fixtures and unrolled unit tests into shared #![cfg(test)] support modules and labeled const tables.

All 17 shipping crate facades (lib.rs/main.rs), public exports, wire formats (agent-frames.json, workshop-frames.json), and desktop CLI contracts remain unchanged.

Measured Before-and-After (17 Shipping Crates)

Metric Before After Delta
Production .rs files 154 100 -54 (-35.1%)
Typeless production files 45 16 -29 (-64.4%)
Total production lines 22,985 20,497 -2,488 (-10.8%)
Production code lines (non-comment) 14,456 13,051 -1,405 (-9.7%)
Production fn / methods 973 786 -187 (-19.2%)
Production struct / enum 220 203 -17
Total test lines 32,338 30,149 -2,189 (-6.8%)
Test code lines (non-comment) 26,904 25,734 -1,170 (-4.3%)

Key Changes

  • Numeric ratchets dropped: Removed crates/build-xtask/src/type_size.rs and unwired it from crates/build-xtask/src/{main,tidy}.rs; dropped too-many-lines-threshold and too-many-arguments-threshold from clippy.toml; added too_many_lines = "allow" and too_many_arguments = "allow" to [workspace.lints.clippy] in root Cargo.toml; updated AGENTS.md to 1 file holds 1 domain concept with no length limit.
  • Module & type recombination: Consolidated fragmented subtrees and legacy hyphenated cap-split files (conversation-run.rs, workshop_socket-menu.rs, realtime-origin.rs, backing-ui-state-memory.rs, catalog-chat.rs, progress-wire.rs, desktop/src/gateway/, gateway/src/client/, protocol frames, server routes/agents, workspace backing/pointer/handlers/workspace_file, run-log read/schema) into single concept files; dissolved single-use wrapper/state/latch types (SessionsState, EmbeddedAssets, AssetManifest, OpenRequest, Settled, SwitchFailure, RefreshState, BindingState, LastWorkspacePointer, StopSignal, duplicate sidecar ownership enums) and inlined single-caller helpers.
  • Ownership & allocations: Borrowed fields in Serialize-only wire DTOs (AgentEvent, ContractResponse, PackDto, ModelDto), avoided Channels cloning and unsubscribed SessionEvent clones in workshop-agents, avoided 1 MiB text and Value/PathBuf clones in workshop-workspace, switched normalize_dropped_path to Cow<'_, str>, and trimmed SSE/HTTP/config allocations.
  • Tests: Extracted shared #![cfg(test)] test_support.rs modules (gateway-discovery, gateway, workspace, desktop, run-log/tests/it/support.rs), unified mock servers/recorders, and collapsed repetitive single-case tests into labeled const tables with expanded symmetric edge-case coverage.

Verification

All workspace gates passed:

  • cargo fmt --all --check
  • CARGO_BUILD_WARNINGS=deny cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo nextest run --locked --workspace --all-features (844 passed, 10 skipped)
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --all-features --document-private-items
  • cargo test -p build-xtask (75 passed), cargo xtask tidy (no violations), cargo dylint --all, cargo deny check, cargo audit, and node --test crates/workshop/ui/test/docs-claims.mjs

This change removes function and type size limits from the workspace and consolidates split modules into single domain files across 13 crates under `crates/workshop/`. `AGENTS.md` drops the size-limit rule, `Cargo.toml` allows `too_many_lines` and `too_many_arguments`, `clippy.toml` removes both thresholds, and `crates/build-xtask/src/tidy.rs` drops `type_size_violations` along with `crates/build-xtask/src/type_size.rs`. Across the touched workshop crates, child modules and single-use helpers merge into their owning files, repeated test fixtures move into shared support modules, and repeated unit tests collapse into table-driven cases.

- Internal module trees collapse while crate `lib.rs` re-exports stay intact: `frames.rs` in `crates/workshop/protocol/src/`, `log.rs` in `crates/workshop/run-log/src/`, `http.rs` in `crates/workshop/support/src/`, `gateway.rs` and `quit.rs` in `crates/workshop/desktop/src/`, `app.rs`, `agents.rs`, `assets.rs`, `cross_site.rs`, and `workshop_socket.rs` in `crates/workshop/server/src/`, and `workspace.rs`, `workspace_file.rs`, and `handlers.rs` in `crates/workshop/workspace/src/` absorb their split siblings. In `crates/workshop/desktop/src/gateway.rs`, `SidecarIdentity` replaces both `GatewayAttachment` and `RecoveryOwnership`; in `crates/workshop/server/src/app.rs`, `AppState` wraps `Registrations` in one `Arc` instead of wrapping each `Registration`.
- Several internal projections avoid cloning: `AgentEvent` in `crates/workshop/server/src/agents/wire.rs` and `ContractResponse`, `PackDto`, and `ModelDto` in `crates/workshop/server/src/routes/prompts.rs` borrow their string and JSON fields, and `normalize_dropped_path` in `crates/workshop/desktop/src/drops.rs` returns `Cow<'_, str>`. Shared test helpers move into new `test_support.rs` modules in `crates/workshop/desktop/src/`, `crates/workshop/gateway/src/`, and `crates/workshop/gateway-discovery/src/`, `crates/workshop/run-log/tests/it/support.rs`, and `recv_frames_until` in `crates/workshop/server/tests/common/mod.rs`.
- In `crates/workshop/agents/src/conversation.rs` and `crates/workshop/agents/src/transcript.rs`, `push` on `Transcript` serializes the `Event` payload before taking the lock and runs an `on_push` callback under the lock so `ConversationRecorder` broadcasts only when `channels.events.receiver_count() > 0` without cloning `Channels`.
- Inlining `stop_supervisor_then_request_shutdown` into `quit_everything` drops `quit_stops_the_supervisor_before_requesting_the_gateway_shutdown` from `crates/workshop/desktop/src/quit-tests.rs`, and removing `continue_teardown` in `crates/workshop/desktop/src/main.rs` narrows `every_supervisor_outcome_reports_without_stopping_teardown` to calling `report_supervisor_shutdown` without verifying continuation.
@vinniefalco
vinniefalco merged commit 96208ee into cppalliance:master Dec 1, 2026
18 checks passed
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