Files
wz-phone/vault/Reports/T5.7.1-report.md
Siavash Sameni ed8a7ae5aa docs: protocol audit 2026-05-25, update architecture + Obsidian vault
Audit:
- docs/AUDIT-2026-05-25.md: full protocol audit covering 8 findings
  (4 critical, 2 high, 5 medium, 4 low) with code references and fix
  effort estimates
- vault/Audit/Tasks.md: Obsidian Tasks plugin file tracking all audit
  items with priorities, due dates, and per-step checklists

Architecture docs updated for Wire format v2 and Wave 5/6 features:
- ARCHITECTURE.md: adds wzp-video to dependency graph and project
  structure; wire format updated to v2 (16B header, 5B MiniHeader);
  relay concurrency section corrected (DashMap+RwLock is current, not
  a future optimization); test count 571→702; Android note
- PROGRESS.md: Wave 5 and Wave 6 sections appended; test count 372→702;
  current status and open blockers as of 2026-05-25
- ROAD-TO-VIDEO.md: implementation status table inserted (/🟡/🔴/🔲
  per phase); 6-step critical path to first video call
- WZP-SPEC.md: MediaHeader updated to v2 (16B byte-aligned); MiniHeader
  updated to 5B with seq_delta; codec IDs 9-12 added (H.264/H.265/AV1);
  version negotiation section added

Obsidian vault (vault/):
- 114 files across Architecture/, PRDs/, Reports/, Android/,
  Reference/, Audit/ with YAML frontmatter
- 00 - Home.md index note with wiki links
- .obsidian/app.json config

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 06:00:17 +04:00

76 lines
2.5 KiB
Markdown

---
tags: [report, wzp]
type: report
status: Pending Review
---
# 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. Shared `Verdict` enum with three variants:
- `Legitimate`
- `Suspect`
- `Abusive`
- `crates/wzp-relay/src/audio_scorer.rs:10-37` — Removed local `Verdict` enum; added `use crate::verdict::Verdict;`.
- `crates/wzp-relay/src/response_policy.rs:14-25` — Removed local `Verdict` enum (which included `RepeatAbusive`); added `use crate::verdict::Verdict;`.
- `crates/wzp-relay/src/response_policy.rs:87` — Removed `Verdict::RepeatAbusive => Action::Block` match arm. `ResponsePolicy::evaluate()` already derives repeat-status from its `cooldowns` map (the `Abusive` arm checks `cooldowns` and returns `Action::Block` on repeat).
- `crates/wzp-relay/src/lib.rs` — Added `pub 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
```bash
$ 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
```
```bash
$ cargo fmt --all -- --check
# pass
```
```bash
$ 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`: pass
- `cargo 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