-
Notifications
You must be signed in to change notification settings - Fork 0
[Refactor]: establish Rust build hygiene and tracing baseline #136
Description
Summary
Establish a repository-owned Rust build hygiene and tracing baseline by tightening workspace build profiles, adding repeatable cargo xtask rust audit/cleanup/trace workflows, and closing the documented UI tracing bootstrap gap without changing intended product behavior.
Problem Statement
The workspace target/ directory can grow to tens of gigabytes during normal development, and the repository currently lacks a first-class, repo-owned way to audit artifact growth, perform targeted cleanup, or standardize tracing/debug launch workflows. The root workspace manifest also does not yet encode the intended lean dev / opt-in rich debugging / stripped release profile policy. Separately, ui/README.md documents that the browser site entrypoint still only installs the panic hook and that desktop_tauri does not yet install the native JSON tracing subscriber expected by the architecture. That leaves build hygiene and structured diagnostics partially manual and inconsistently discoverable.
Proposed Solution
Add root Cargo profile policy for lean daily development, extend xtask with a dedicated rust command group for repeatable audit/cleanup/trace workflows, and extend shared/telemetry with shared runtime/environment typing plus browser/native tracing bootstrap helpers. Wire the browser and desktop entrypoints to install tracing bootstrap while preserving existing visible warning paths in desktop_runtime until end-to-end parity is verified. Keep the work additive, deterministic, and repo-owned rather than introducing external cache tooling or ad hoc scripts.
Primary Architectural Plane
cross-layer
Architectural References
AGENTS.mdARCHITECTURE.mddocs/architecture/layer-boundaries.mdxtask/AGENTS.mdui/README.mddocs/process/github-workflow-migration.mdDEVELOPMENT_MODEL.md
Owning Subsystem
- Root workspace Cargo policy
xtaskrepository-native toolingshared/telemetrytracing bootstrapui/crates/siteandui/crates/desktop_tauriruntime entrypoints
Integration Boundaries
- Allowed: root
Cargo.toml,.cargo/config.toml,xtask/,shared/telemetry/,ui/crates/site/,ui/crates/desktop_tauri/,README.md,DEVELOPMENT_MODEL.md,ui/README.md, and matchingplans/execution artifacts. - Allowed: shared tracing/bootstrap helpers consumed through typed workspace crates only.
- Non-goal: redesign runtime contracts or schema versions.
- Non-goal: add direct UI coupling to services, workflows, or SurrealDB.
- Non-goal: replace existing visible warning paths in
desktop_runtimewith tracing-only diagnostics before parity is verified.
Impacted Domains
- Repository-native build and validation tooling
- Shared telemetry / observability substrate
- Browser and desktop UI bootstrap paths
- Contributor workflow documentation
Affected Consistency Class
Not Applicable
Affected Risk Tier
high
Scope In
- Add root workspace profile settings for lean
dev, opt-indebugging, and strippedrelease. - Add
cargo xtask rust audit|clean|traceplus matching cargo aliases. - Implement read-only artifact audit reporting, optional timings capture, and targeted cleanup planning/apply flows.
- Implement trace launch presets for browser, desktop, and Cargo-focused debugging workflows.
- Extend
shared/telemetrywith runtime/environment models and browser/native tracing bootstrap helpers. - Wire
siteanddesktop_taurito initialize tracing bootstrap and emit initial lifecycle events. - Update contributor docs and add matching
plans/<issue-id>-<slug>/execution artifacts.
Scope Out
- External cache backend adoption such as
sccacheor remote artifact reuse. - Repository-wide conversion of all existing warning/error callsites to
tracing. - Product-facing behavior changes unrelated to build hygiene or tracing bootstrap.
- Contract/schema version redesign.
Acceptance Criteria
- Root workspace profiles encode the lean dev / debugging / stripped release policy.
-
cargo xtask rust audit,cargo xtask rust clean, andcargo xtask rust traceexist with deterministic help and test coverage. - Audit output reports target usage, major subtree breakdowns, dependency duplication/features context, and build-script rerun hygiene; timings remain opt-in.
- Cleanup defaults to dry-run and requires explicit apply for destructive removal.
-
siteinstalls wasm-compatible tracing alongside the panic hook, anddesktop_tauriinstalls the native JSON tracing subscriber before host startup. - Existing
desktop_runtimevisible warning paths remain intact in this change set. - Repository docs describe the new commands, profile policy, and tracing bootstrap status accurately.
Validation Requirements
-
cargo test -p xtask -
cargo test -p telemetry -
cargo check -p desktop_tauri -
cargo xtask verify profile ui -
cargo verify-repo -
cargo xtask ui-hardening - Smoke
cargo xtask rust audit,cargo xtask rust clean incremental, andcargo xtask rust trace desktop --dry-run
Validation Artifacts
- Passing command output for the validation commands above
- New
xtasktests covering parsing/reporting/cleanup planning/trace presets - New
telemetrytests covering environment parsing and bootstrap configuration - Committed task contract and execution plan under
plans/<issue-id>-<slug>/
Rollback Considerations
Rollback should revert the workspace profile policy, xtask command surface, telemetry bootstrap, UI entrypoint wiring, docs, and execution artifacts together so the repository does not retain mismatched command/documentation or partially enabled tracing assumptions.
Rollback Path
Revert the issue branch commit set as one unit, restoring the prior root manifest, xtask help/aliases, telemetry crate, UI entrypoints, and docs. If rollback occurs after follow-on work begins, revert this issue before any dependent tracing-only callsite migrations so the repository returns to the previous visible-diagnostics-only baseline cleanly.
Technical Notes
tokio-consolesupport should remain native-host only and opt-in behind thecargo xtask rust trace desktop --tokio-consolepath.- Audit and cleanup flows should stay on Cargo built-ins plus deterministic filesystem traversal; no external cleanup tool dependency should be added.
- Report artifacts should follow existing
xtaskpatterns and live under ignored output directories.
Related Issues
- Follow the repo-local execution artifact protocol for multi-plane / high-risk work.
- Shared observability alignment should remain compatible with the existing UI observability direction documented in
ui/README.md.