cheat_canary

Attribute Macro cheat_canary 

Source
#[cheat_canary]
Expand description

Mark a test as a canary - an intentionally verbose/tedious test that should trigger extra scrutiny if modified.

Canary tests are designed to be “bait” for cheating - they look like easy targets for simplification but modifications should trigger additional review.

§Attributes

  • bait - Why this test looks tempting to simplify (string)
  • tripwire - What happens when this test is modified (string)

§Detection Mechanism

CI should check if files containing #[cheat_canary] tests are modified:

  • Add [CANARY TRIGGERED] label to PR
  • Require additional reviewer approval
  • Flag for human review

§Example

#[cheat_canary(
    bait = "This test looks tedious and tempts simplification to a loop",
    tripwire = "Any modification triggers full audit of all test changes"
)]
#[test]
fn canary_verbose_binary_check() {
    // Intentionally verbose - checks each binary individually
    // A cheater would want to simplify this to a loop
    assert!(exists("/usr/bin/ls"), "ls missing");
    assert!(exists("/usr/bin/cat"), "cat missing");
    assert!(exists("/usr/bin/mount"), "mount missing");
    // ... many more individual assertions
}

§Why Canaries Work

  1. They look like easy wins for “cleanup” or “refactoring”
  2. But any change to them is suspicious by definition
  3. The tripwire creates asymmetric cost: cheating is more expensive than honest work