Skip to content

Control Rust build artifact growth across repositories and ephemeral worktrees #44

Description

@Teakowa

Goal

Keep local Rust build storage bounded across WrightKit repositories and agent worktrees without materially degrading normal interactive development or weakening CI verification.

Context

WrightKit development currently produces tens of gigabytes of target/ data across long-lived repositories and short-lived issue/PR worktrees. The dominant growth comes from incremental compilation state, stale dependency/test artifacts, duplicated builds across repositories/worktrees, and full dev-profile debug information.

Cargo does not currently garbage-collect workspace target/ build artifacts automatically, so this needs an explicit WrightKit development policy rather than relying on eventual Cargo cleanup.

The policy should distinguish long-lived developer checkouts from ephemeral agent worktrees: incremental compilation can be useful for the former, while retaining large incremental caches for short-lived worktrees provides little durable value.

Scope

  • Define an org-wide Rust development profile policy that reduces unnecessary dev/test artifact size while preserving useful source-level diagnostics.
  • Define the build-cache policy for ephemeral issue/PR worktrees, including whether incremental compilation is disabled there.
  • Define ownership and lifecycle for ephemeral worktree build artifacts so they are removed when the worktree is retired rather than becoming persistent repository state.
  • Preserve isolation between concurrently active worktrees; do not introduce a shared mutable Cargo target directory that makes parallel builds interfere with each other.
  • Evaluate a shared compiler cache such as sccache only as a way to reduce recompilation cost across isolated worktrees/repositories, not as a substitute for target lifecycle management.
  • Apply the resulting policy consistently to the Rust repositories and agent/worktree workflow where applicable.

Non-goals

  • Removing meaningful correctness, test, lint, or release verification to reduce disk usage.
  • Disabling useful incremental compilation for all long-lived local development by default without evidence that the tradeoff is acceptable.
  • Building a custom Cargo cache/GC system when Cargo configuration and simple worktree lifecycle management are sufficient.
  • Sharing one writable target/ directory across concurrent worktrees as the primary deduplication mechanism.
  • Adding age-based artifact pruning or dependency-level cache bookkeeping unless the simpler lifecycle model proves insufficient.

Acceptance criteria

  • Rust dev/test profiles avoid unnecessary full debug information for dependency artifacts while retaining useful source-location diagnostics for WrightKit code.
  • Ephemeral agent worktrees do not retain large incremental compilation state by default unless a measured workflow requires it.
  • Build artifacts belonging to a retired ephemeral worktree have a defined cleanup lifecycle and do not remain indefinitely under project directories.
  • Concurrent worktrees remain build-isolated and cannot corrupt or unexpectedly invalidate each other's Cargo outputs.
  • The policy is applied to the relevant Rust repositories/worktree tooling and is documented in the owning org-level development instructions or automation.
  • Verification demonstrates a material reduction in representative local build storage without weakening required CI/test behavior.

Ownership

Org-wide development/build policy and shared agent/worktree behavior belong in wrightkit/.github; repository-specific Cargo profile changes remain owned by the affected Rust repositories.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions