Skip to content

Code and architecture revision#50

Merged
ericodx merged 8 commits into
mainfrom
code-and-architecture-revision
Apr 1, 2026
Merged

Code and architecture revision#50
ericodx merged 8 commits into
mainfrom
code-and-architecture-revision

Conversation

@ericodx
Copy link
Copy Markdown
Owner

@ericodx ericodx commented Apr 1, 2026

Summary

Three distinct bugs were fixed and an architectural refactor consolidated execution dependencies.

Fixes:

  • SPM build output was being suppressed — BuildStage now uses launchCapturing instead of launch, making compilation errors visible on stderr
  • swift build --build-tests --target X are mutually exclusive in SPM; the correct flag is now chosen based on the presence of --target
  • BuildError.compilationFailed was not caught in the SPM path of buildArtifact, crashing the CLI; it is now intercepted and triggers the incremental retry-with-exclusion flow

Performance:

  • Incompatible SPM mutants were creating a fresh sandbox per mutant, recompiling SwiftSyntax and all dependencies from scratch up to 30×. The new strategy uses a shared sandbox: 1 full initial build + N incremental builds (only the mutated file recompiles) + swift test --skip-build per mutant

Refactor:

  • ExecutionDeps groups ProcessLaunching, CacheStore, ProgressReporter and MutationCounter — eliminates long parameter lists in TestExecutionStage, IncompatibleMutantExecutor and FallbackExecutor
  • Discovery pipeline decomposed: MutantIndexingStage (assigns indices and determines schematizability), IncompatibleRewritingStage (rewrites incompatible mutants), SchematizationStage (schematizable mutants only)
  • SchematizationResult removed; pipeline stages return values directly

Type of Change

  • feat: A new feature has been added.
  • fix: A bug has been fixed.
  • perf: A code change that improves performance.
  • refactor: A code change that neither fixes a bug nor adds a feature.
  • test: Addition or correction of tests.
  • docs: Changes only to the documentation.
  • ci: Changes related to continuous integration and deployment scripts.
  • build: Changes that affect the build system or external dependencies.
  • deps: Dependency version upgrades with no logic changes.
  • chore: Other changes that do not fit into the previous categories.
  • revert: Reverts a previous commit.

Invariants Checklist

  • Original project is never modified — all mutations happen inside an isolated sandbox
  • xcodebuild build-for-testing runs exactly once for all schematizable mutants
  • No mutant results are lost or duplicated
  • Mutant positions (file, line, column) are accurate in all reported results
  • A cancelled task never leaves a simulator slot permanently acquired from the pool
  • schematizedContent never contains the __swiftMutationTestingID global declaration
  • Swift 6 Strict Concurrency compatible
  • Pipeline stages remain stateless pure transformations

Pipeline Impact

Which stages are affected?

  • SandboxFactory
  • BuildStage
  • SimulatorPool
  • TestExecutionStage
  • IncompatibleMutantExecutor
  • PerFileBuildFallback
  • CacheStore
  • Reporters (Text / JSON / HTML / Sonar)
  • CLI / Configuration
  • Models / RunnerInput contract
  • None

Testing

  • Unit tests added or updated
  • Tests use mock ProcessLaunching — no real xcodebuild, xcrun simctl, or xcresulttool
  • Tests use FileHelpers for any filesystem interaction (temp directories only)
  • Snapshot tests added or updated (if reporter output format changed)
  • Integration tests added or updated and tagged separately (if pipeline or CLI behavior changed)
  • All tests pass locally (swift test)

@ericodx ericodx self-assigned this Apr 1, 2026
@ericodx ericodx added fix Something wasn't working performance Changes that improve execution speed or resource usage refactor Code change that neither fixes a bug nor adds a feature labels Apr 1, 2026
@ericodx ericodx merged commit 37e8dfe into main Apr 1, 2026
1 check passed
@ericodx ericodx deleted the code-and-architecture-revision branch April 1, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Something wasn't working performance Changes that improve execution speed or resource usage refactor Code change that neither fixes a bug nor adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant