Skip to content

feat(v2.4.1): add OutputAssertion for non-zero and varies-from output checks - #2

Merged
anvlkv merged 1 commit into
mainfrom
copilot/v241-add-output-assertion-config
May 5, 2026
Merged

feat(v2.4.1): add OutputAssertion for non-zero and varies-from output checks#2
anvlkv merged 1 commit into
mainfrom
copilot/v241-add-output-assertion-config

Conversation

Copilot AI commented May 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new OutputAssertion enum to SnapshotConfig that applies a correctness assertion to output samples after audio unit processing.

New API

pub enum OutputAssertion {
    /// Assert that at least one output sample (across all channels) is not 0.0. (default)
    NonZero,
    /// Skip the output assertion entirely.
    Skip,
    /// Assert that at least one output sample differs from the given baseline value.
    VariesFrom(f32),
}

The field is set via the builder:

// Default — panics if all output is silence
let config = SnapshotConfigBuilder::default().build().unwrap();

// Opt out (e.g. for filter units driven by InputSource::None)
let config = SnapshotConfigBuilder::default()
    .output_assertion(OutputAssertion::Skip)
    .build().unwrap();

// Check output varies from an arbitrary baseline
let config = SnapshotConfigBuilder::default()
    .output_assertion(OutputAssertion::VariesFrom(0.5))
    .build().unwrap();

Changes

  • src/config.rs — new OutputAssertion enum + output_assertion field on SnapshotConfig / SnapshotConfigBuilder (default: NonZero)
  • src/snapshot.rs — applies the assertion after all samples are collected in capture_audio_unit_data
  • src/tests.rs — two existing tests that use silent filters opted out via Skip; five new tests cover all variants and panic cases
  • Cargo.toml — version bumped to 2.4.1

@anvlkv
anvlkv marked this pull request as ready for review May 5, 2026 10:48
@anvlkv
anvlkv merged commit 46ce4b1 into main May 5, 2026
1 check passed
@anvlkv
anvlkv deleted the copilot/v241-add-output-assertion-config branch May 5, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants