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.swiftat input parsing and command dispatch.core-swift/Sources/SchroSIM/src/compiler/ir/circuit_ir.swiftfor circuit validation.core-swift/Sources/SchroSIM/src/compiler/foundry/foundry_spec.swiftfor foundry policy checks.core-swift/Sources/SchroSIM/src/core/simulator.swiftfor 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.swiftfor app launch.core-swift/Sources/schrosim-studio/StudioStore.swiftfor workspace state, validation, and replay logic.core-swift/Sources/schrosim-studio/CLIService.swiftfor CLI execution boundaries.core-swift/Sources/schrosim-studio/StudioViews.swiftfor 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.shfor local test runs when IDE environment variables are inconsistent. - Keep CLI commands as the reference path for bug reports and CI reproduction.