Skip to main content

assert_stage_contract

Macro assert_stage_contract 

Source
macro_rules! assert_stage_contract {
    ($stage:expr) => { ... };
}
Expand description

Assert that a stage satisfies all seven universal contracts defined in the Normy white paper.

This macro is the single source of truth for stage correctness. Every stage must pass it. It is deliberately exhaustive and unforgiving — because production NLP pipelines demand it.

§The Seven Universal Contracts:

  1. zero_copy_when_no_changes → no allocation when input == output
  2. fused_path_equivalent_to_apply → static fused path produce identical results to apply()
  3. stage_is_idempotent → applying twice yields same result as once
  4. needs_apply_is_accurate → correctly predicts whether apply() would change text
  5. handles_empty_string_and_ascii → graceful on edge cases
  6. no_panic_on_mixed_scripts → survives pathological real-world input
  7. (Implicit) Send + Sync + 'static → required by trait bounds

Failure of any contract is a critical bug.