Skip to content

Reduce repeated Swift warnings and measure focused test build cost #519

Description

@morluto

Problem

A cold focused test produced approximately 11,000 warning emissions from about
451 distinct warning locations. The warnings contributed to a 97,209-line,
6.9 MB build log before nine selected tests ran.

The issue is both warning debt and missing measurement. We need to know which
warnings are unique, which are repeated, and how much focused build cost changes
after repository-owned warnings are fixed.

Observed run

Command:

./conductor test --filter WorkspaceSaveCoordinatorTests

Measured results:

  • SwiftPM build: 315.49 seconds
  • selected XCTest execution: 2.515 seconds
  • build steps: 2,552
  • root test target: 348 Swift files / approximately 201,000 lines
  • build log: 6,880,015 bytes / 97,209 lines
  • distinct warning locations: approximately 451
  • raw warning emissions: approximately 11,000
  • sampled swift-package physical-footprint peak: approximately 1.4 GB
  • subsequent xctest RSS: approximately 794 MiB
  • resulting worktree .build: approximately 8.1 GB

Some warning locations appeared about 25 times.

What is confirmed

  • swift test --filter limited XCTest execution to nine tests but did not avoid
    building the root test target and its dependencies.
  • The root test target depends on RepoPromptApp, RepoPromptMCP, and
    RepoPromptShared.
  • The log contained far more warning emissions than distinct warning locations.
  • Several warnings were Swift concurrency diagnostics in repository-owned code.
  • Build time dominated the observed focused run: 315.49 seconds of build versus
    2.515 seconds of XCTest execution.

SwiftPM defines a target as a module or test suite; a test filter selects tests
to execute rather than creating a smaller compilation unit:

What is not known

This sample does not show how much of the 315-second build or 1.4 GB peak was
caused by warnings. Cold dependency work and compilation of the broad target
graph were also present. The exact reason individual warnings were repeated has
not been isolated.

Required work

Add a read-only focused-build diagnostic that reports:

  • total output bytes and lines;
  • distinct warning locations and raw warning emissions;
  • top repeated warnings and owning source files;
  • build, link, and XCTest timing;
  • peak child process-tree RSS;
  • compiler job count;
  • cold or warm cache state.

Use that report to classify repository-owned warnings and fix genuine Swift
concurrency/correctness warnings. Suppress a warning only when the toolchain or
dependency owns it and a source fix is not available.

After cleanup, repeat the same cold focused run and compare warning counts,
output size, time, and peak RSS. Keep target modularization (#416) as a separate
measurement so warning cleanup is not credited for unrelated cache or target
changes.

Expected behavior

Focused build output identifies each actionable warning without thousands of
unexplained repeats. Repository-owned concurrency warnings remain visible until
fixed.

Acceptance criteria

  • A reproducible diagnostic separates distinct warnings from raw emissions.
  • The diagnostic records output size, build/XCTest time, cache state, and peak child RSS.
  • Repository-owned warnings are classified and fixed or tracked.
  • Any suppression is narrow and documented.
  • A comparable cold run records the before/after warning and resource measurements.
  • Test behavior and contract-ledger IDs remain unchanged unless separately reviewed.

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions