refactor(core): split monolithic test and CLI modules into focused files#35
Merged
Conversation
Move each subcommand (convert, profile, monte_carlo, compare, sensitivity) into dedicated modules under commands/ and extract CliError into error.rs to reduce main.rs from ~900 lines to a thin dispatch layer.
Cover all classification branches: T-gate (odd π/4 multiples), Clifford (even π/4 multiples incl. zero), Rotation (arbitrary, irrational), non-finite inputs (NaN, ±Inf), and 1e-10 tolerance boundary (inside at 1e-12, outside at 1e-8).
…anup - Re-export PhysicalQubitEstimate directly from pirx_hw in lib.rs instead of routing through the analysis module (it's a pirx-hw type, not an analysis concern) - Remove unnecessary #[allow(dead_code)] on ManifestMeta::description - Fix formatting in classify_rz_angle test
Break monolithic 2300-line integration test file into 10 domain-specific modules (abort, basic, decoder, demand, error_budget, hooks, multi_pool, rz, timing, trace_ids). Extract shared HW model loading into test_support.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Split the monolithic
engine_integration.rs(2364 lines, 53 tests) into 10 focused test modules, extract CLI command handlersand error type into dedicated files, move
PhysicalQubitEstimatere-export to the correct crate-root location, and add unittests for
classify_rz_angle.Why
engine_integration.rshad grown into a single file covering 10 unrelated concerns (abort, decoder, demand, hooks,multi-pool, etc.), making it hard to locate tests and reason about coverage. The CLI
main.rs(742 lines) mixed argumentparsing with command execution logic, violating the thin-composition-root pattern.
PhysicalQubitEstimatewas re-exportedthrough
analysis/mod.rsdespite originating frompirx_hw— misleading for readers.classify_rz_anglehad zero unit testsdespite being the single source of truth for angle classification.
How
engine_{basic,abort,decoder,demand,error_budget,hooks,multi_pool,rz,timing,trace_ids}.rs. Shared TOML fixtures and helpers extracted totest_support/mod.rs. Zero test additions, zero test removals — verified by diffing function names.profile,monte-carlo,compare,convert,sensitivity) gets its own file undercommands/.CliErrormoves toerror.rs.main.rsreduced to argument parsing + dispatch.pub use pirx_hw::PhysicalQubitEstimatemoved fromanalysis/mod.rstolib.rs. Public API (pirx_core::PhysicalQubitEstimate) unchanged.classify_rz_anglecovering T-gate/Clifford/Rotation classification, edge cases (NaN, ±∞), and tolerance boundariesTesting
make cipasses locally (fmt + clippy + test + audit)Checklist
unwrap()/expect()in production code