Skip to content

APR-POKA-001: Poka-yoke validation for AprWriter #123

@noahgift

Description

@noahgift

Summary

Implement Toyota Way / Poka-yoke validation in AprWriter to prevent malformed models from being written.

Background

During WAPR-TRANS-001, a missing Slaney-normalized filterbank caused 89.4% mel divergence (sign flip). The model was created without embedded filterbank, falling back to broken computation.

Requirements

Gate Checks (Jidoka - stop the line)

  1. Filterbank Required: If model uses mel spectrogram, filterbank MUST be embedded
  2. Filterbank Scale Check: filterbank.max() < 0.1 (Slaney-normalized range)
  3. Smoke Test: Silence input must produce negative mel mean

API

impl AprWriter {
    /// Validate model before write. Returns error if gates fail.
    pub fn validate(&self) -> Result<(), ValidationError>;
    
    /// Write with mandatory validation (Jidoka)
    pub fn write_validated(&self) -> Result<Vec<u8>, WhisperError>;
}

Acceptance Criteria

  • AprWriter::write() calls validate() by default
  • Clear error messages pointing to fix
  • Unit tests for each gate
  • Documentation in spec

References

  • APR-VERIFY-001 Case Study (Section 11)
  • Toyota Production System: Poka-yoke (mistake-proofing)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions