Skip to content

Latest commit

 

History

History
77 lines (58 loc) · 2.61 KB

File metadata and controls

77 lines (58 loc) · 2.61 KB
# CompareLoop Module Guide Composable loop harness for repeated LVCompare runs (stability/hot-loop scenarios). ## High-level features - Repeated comparisons with polling or FileSystemWatcher triggers. - Optional skip when inputs unchanged, fail-fast on diff or error. - Percentile latency stats (p50/p90/p99) and coarse histograms. - Adaptive interval option with min/max bounds. - Dependency injection for deterministic tests (mock executor). - Canonical LVCompare path enforcement helpers. ## Key functions | Function | Summary | | -------- | ------- | | Invoke-IntegrationCompareLoop | Runs the loop; accepts VI paths, loop controls, outputs metrics | | Test-CanonicalCli | Validates default LVCompare install path | | Format-LoopDuration | Formats durations (ms vs seconds) | ## Common parameters (Invoke-IntegrationCompareLoop) | Parameter | Default | Notes | | --------- | ------- | ----- | | Base / Head | (required) | VI paths; skip validation with -SkipValidation | | IntervalSeconds | 5 | Poll delay (supports fractional seconds) | | MaxIterations | 0 | → infinite until diff/stop | | SkipIfUnchanged | off | Skip iteration if timestamps unchanged | | LvCompareArgs | -nobdcosm -nofppos -noattr | Additional CLI flags | | FailOnDiff / FailOnUnexpectedError | off | Fail-fast behaviour | | AdaptiveInterval | off | Auto-backoff; uses MinIntervalSeconds / MaxIntervalSeconds | | JsonLog | null | Optional line-delimited JSON output | ## Typical usage ```powershell Import-Module ./scripts/CompareLoop.psm1 -Force Invoke-IntegrationCompareLoop -Base 'fixtures/VI1.vi' -Head 'fixtures/VI2.vi' -MaxIterations 10 -SkipIfUnchanged -AdaptiveInterval -MinIntervalSeconds 2 -MaxIntervalSeconds 30 ``` Outputs include: - Iteration records (timestamp, diff flag, latency, error text). - Aggregate totals (diff count, error count, runtime stats). - Percentiles: p50, p90, p99, max, min seconds. - Optional JSON log per iteration. ## HTML / Markdown summaries The loop can emit diff summaries in plain text, Markdown, or HTML. Use -SummaryPath to write a file (extension controls format). ```powershell Invoke-IntegrationCompareLoop -Base 'fixtures/VI1.vi' -Head 'fixtures/VI2.vi' -SummaryPath 'loop-summary.md' ``` ## Testing hooks - -CompareExecutor parameter accepts a script block for unit tests (bypass real LVCompare). - Test-CanonicalCli validates install paths; use -SkipCanonicalValidation to opt out (only for tests). ## References - [docs/USAGE_GUIDE.md](./USAGE_GUIDE.md) - [docs/FIXTURE_DRIFT.md](./FIXTURE_DRIFT.md) - [docs/INTEGRATION_RUNBOOK.md](./INTEGRATION_RUNBOOK.md)