Files
wz-phone/vault/Reports/T5.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

97 lines
3.8 KiB
Markdown

---
tags: [report, wzp]
type: report
status: Approved
---
# T5.1 — `PriorityMode` enum + `SignalMessage::SetPriorityMode`
**Status:** Approved (with T5.1.1 follow-up for missing tests)
**Agent:** Kimi Code CLI
**Started:** 2026-05-12T17:00Z
**Completed:** 2026-05-12T17:25Z
**Commit:** c8d1239
**PRD:** ../PRD-video-quality-priority.md
## What I changed
- `crates/wzp-proto/src/priority_mode.rs` — New file. `PriorityMode` enum with four variants: `AudioFirst` (default), `VideoFirst`, `ScreenShare`, `Balanced`. Derives `Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize`.
- `crates/wzp-proto/src/lib.rs` — Added `pub mod priority_mode;` and `pub use priority_mode::PriorityMode;`.
- `crates/wzp-proto/src/codec_id.rs:124-145` — Added four new fields to `QualityProfile`: `priority_mode: PriorityMode`, `video_bitrate_kbps: Option<u32>`, `video_resolution: Option<(u16, u16)>`, `video_fps: Option<u8>`. All carry `#[serde(default)]` for backward compat.
- `crates/wzp-proto/src/codec_id.rs:149-214` — Updated all `QualityProfile` const constructors (`GOOD`, `DEGRADED`, `CATASTROPHIC`, `STUDIO_32K`, `STUDIO_48K`, `STUDIO_64K`) to include the new fields.
- `crates/wzp-proto/src/packet.rs:1200-1207` — Added `SignalMessage::SetPriorityMode { version, mode }` variant before `PictureLossIndication`.
- `crates/wzp-client/src/featherchat.rs:144-147` — Added `SetPriorityMode` to `signal_to_call_type` match arm.
- `crates/wzp-client/src/call.rs:639-654` — Updated explicit `QualityProfile` constructions to use `..QualityProfile::GOOD` struct-update syntax.
- `crates/wzp-android/src/engine.rs:975-980` — Same struct-update fix.
- `crates/wzp-android/src/jni_bridge.rs:32-38` — Same struct-update fix.
- `desktop/src-tauri/src/engine.rs:77-82, 118-123` — Same struct-update fix.
- `crates/wzp-codec/src/lib.rs:73-82` — Same struct-update fix.
## Deviations from the task spec
Skeleton task — no numbered steps. Followed PRD-video-quality-priority.md sections "PriorityMode" and "Mid-call change".
## Verification output
```bash
$ cargo test -p wzp-proto --no-fail-fast
test result: ok. 125 passed; 0 failed; 0 ignored
```
```bash
$ cargo test -p wzp-relay --lib --no-fail-fast
test result: ok. 99 passed; 0 failed; 0 ignored
```
```bash
$ cargo test -p wzp-client --lib --no-fail-fast
test result: ok. 163 passed; 0 failed; 7 ignored
```
```bash
$ cargo test -p wzp-codec --lib --no-fail-fast
test result: ok. 69 passed; 0 failed; 0 ignored
```
```bash
$ cargo test -p wzp-android --lib --no-fail-fast
test result: ok. 4 passed; 0 failed; 0 ignored
```
```bash
$ cargo test -p wzp-desktop --lib --no-fail-fast
test result: ok. 0 passed; 0 failed; 0 ignored
```
```bash
$ cargo fmt --all -- --check
# pass
```
```bash
$ cargo clippy -p wzp-proto --all-targets -- -D warnings
# pass
```
## Test summary
- Tests added: 0
- Tests modified: 0
- Workspace test count: 460+ pass in affected crates
- `cargo clippy -p wzp-proto --all-targets -- -D warnings`: pass
- `cargo fmt --all -- --check`: pass
## Risks / follow-ups
1. **`QualityProfile` is now wider** — Four new fields add 11 bytes (1 + 4 + 4 + 1 + padding). Since `QualityProfile` is `Copy` and used in hot paths, monitor size. If it grows past 32 bytes, consider boxing optional fields.
2. **Serde default for backward compat** — Old serialized `QualityProfile` without the new fields will deserialize correctly because all four fields have `#[serde(default)]`. Forward compat (new → old) is not guaranteed.
3. **`SetPriorityMode` not yet consumed** — The signal variant is defined but no engine (client, android, desktop) handles it yet. T5.2 / T5.3 will wire the controller.
## Reviewer checklist (filled in by reviewer)
- [ ] Code matches PRD intent
- [ ] Verification output is real
- [ ] No backward-incompat surprises
- [ ] Tests cover the new behavior
- [ ] Approved