SchroSIM Debugging Guide

Swift CLI

Use the CLI path for reproducible debugging and CI parity:

swift run schrosim-cli run docs/examples/runtime_default_foundry.json --backend hybrid
swift run schrosim-cli trace-stream docs/examples/foundry_loss_map.json --backend hybrid --stream-format ndjson

Useful breakpoints:

  • core-swift/Sources/schrosim-cli/main.swift at input parsing and command dispatch.
  • core-swift/Sources/SchroSIM/src/compiler/ir/circuit_ir.swift for circuit validation.
  • core-swift/Sources/SchroSIM/src/compiler/foundry/foundry_spec.swift for foundry policy checks.
  • core-swift/Sources/SchroSIM/src/core/simulator.swift for backend execution.

SwiftUI Studio

Run the public Studio UI from the root package:

swift run schrosim-studio

Useful breakpoints:

  • core-swift/Sources/schrosim-studio/SchroSIMStudioApp.swift for app launch.
  • core-swift/Sources/schrosim-studio/StudioStore.swift for workspace state, validation, and replay logic.
  • core-swift/Sources/schrosim-studio/CLIService.swift for CLI execution boundaries.
  • core-swift/Sources/schrosim-studio/StudioViews.swift for UI interactions.

Tests

Run the Swift test suite:

swift test

Run the Rust runtime tests:

cargo test -p schrosim-core

CLion and Xcode Notes

If swift test fails with no such module 'XCTest', CLion is usually using only Command Line Tools rather than full Xcode.

Recommended setup:

  • Install full Xcode.
  • Use scripts/swift-test.sh for local test runs when IDE environment variables are inconsistent.
  • Keep CLI commands as the reference path for bug reports and CI reproduction.