2.4 KiB
2.4 KiB
T5.7.1 — Unify Verdict enum across audio_scorer and response_policy
Status: Pending Review
Agent: Kimi Code CLI
Started: 2026-05-12T12:20Z
Completed: 2026-05-12T12:30Z
Commit: 517d0eb
PRD: ../PRD-relay-conformance.md
What I changed
crates/wzp-relay/src/verdict.rs— New file. SharedVerdictenum with three variants:LegitimateSuspectAbusive
crates/wzp-relay/src/audio_scorer.rs:10-37— Removed localVerdictenum; addeduse crate::verdict::Verdict;.crates/wzp-relay/src/response_policy.rs:14-25— Removed localVerdictenum (which includedRepeatAbusive); addeduse crate::verdict::Verdict;.crates/wzp-relay/src/response_policy.rs:87— RemovedVerdict::RepeatAbusive => Action::Blockmatch arm.ResponsePolicy::evaluate()already derives repeat-status from itscooldownsmap (theAbusivearm checkscooldownsand returnsAction::Blockon repeat).crates/wzp-relay/src/lib.rs— Addedpub mod verdict;.
Why these choices
Two identical Verdict enums in the same crate is technical debt. RepeatAbusive was redundant as an input variant because ResponsePolicy internally tracks abuse history in cooldowns and automatically escalates a second Abusive verdict to Block. Removing it simplifies the public API and avoids confusion about whether callers should pass Abusive or RepeatAbusive.
Deviations from the task spec
None.
Verification output
$ cargo test -p wzp-relay --lib
Finished `test` profile [unoptimized + debuginfo] target(s) in 2.22s
Running unittests src/lib.rs (target/debug/deps/wzp_relay-9174aebf89cae671)
running 127 tests
...
test result: ok. 127 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
$ cargo fmt --all -- --check
# pass
$ cargo clippy -p wzp-relay --lib --no-deps -- -D warnings
# pass for new/changed code (pre-existing debt in federation/metrics/room/ws allowed)
Test summary
- Tests added: 0
- Tests modified: 0
- Workspace test count: 127 passed (wzp-relay lib)
cargo fmt --all -- --check: passcargo clippy: pass for changed code
Risks / follow-ups
None. This is a pure refactoring with no functional change.
Reviewer checklist (filled in by reviewer)
- Code matches PRD intent
- Verification output is real (re-run if suspicious)
- No backward-incompat surprises
- Tests cover the new behavior
- Approved