Description
The debug subcommand in simlin-cli and the print_tsv_comparison function in simlin-engine/src/results.rs use iter().zip() to compare simulation output against reference data. Rust's zip() stops at the shorter iterator, so when the reference dataset has fewer timesteps than the simulation (or vice versa), trailing steps are silently dropped from the comparison output with no warning.
This means a user debugging a model could miss divergence that only appears in later timesteps, or fail to notice that reference data is incomplete -- the tool gives no indication that the comparison is partial.
Why it matters
- Correctness: The comparison tool's purpose is to help users spot differences between expected and actual simulation results. Silently omitting data undermines that purpose.
- Developer experience: A user investigating a model discrepancy could waste time because the tool hides the very steps where behavior diverges.
- Debuggability: When reference files are generated from different tool versions or configurations, length mismatches are a meaningful signal that should be surfaced, not hidden.
Components affected
src/simlin-cli/src/main.rs -- the debug subcommand's result comparison logic
src/simlin-engine/src/results.rs -- print_tsv_comparison function
Possible approaches
- Warn on mismatch: Before the zip loop, compare lengths and emit a warning (e.g., via
eprintln!) if they differ, stating which side is shorter and by how many steps.
- Use
zip_longest: Switch to itertools::zip_longest (or equivalent) to iterate over all steps, printing placeholder values (e.g., N/A or ---) for the shorter side's missing entries.
- Error on mismatch: Treat a length mismatch as an error condition, printing the mismatch details and returning a non-zero exit code from the CLI.
Option 1 is the simplest and least disruptive. Option 2 gives the most complete output.
Context
Identified during review of PR #436 (systems format debug path). This is pre-existing behavior, not introduced by that PR.
Description
The
debugsubcommand insimlin-cliand theprint_tsv_comparisonfunction insimlin-engine/src/results.rsuseiter().zip()to compare simulation output against reference data. Rust'szip()stops at the shorter iterator, so when the reference dataset has fewer timesteps than the simulation (or vice versa), trailing steps are silently dropped from the comparison output with no warning.This means a user debugging a model could miss divergence that only appears in later timesteps, or fail to notice that reference data is incomplete -- the tool gives no indication that the comparison is partial.
Why it matters
Components affected
src/simlin-cli/src/main.rs-- thedebugsubcommand's result comparison logicsrc/simlin-engine/src/results.rs--print_tsv_comparisonfunctionPossible approaches
eprintln!) if they differ, stating which side is shorter and by how many steps.zip_longest: Switch toitertools::zip_longest(or equivalent) to iterate over all steps, printing placeholder values (e.g.,N/Aor---) for the shorter side's missing entries.Option 1 is the simplest and least disruptive. Option 2 gives the most complete output.
Context
Identified during review of PR #436 (systems format debug path). This is pre-existing behavior, not introduced by that PR.