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

3.7 KiB

tags, type, status
tags type status
report
wzp
report Approved

T1.2 — Add MediaType enum

Status: Approved Agent: Kimi Code CLI Started: 2026-05-11T06:55Z Completed: 2026-05-11T07:08Z Commit: see git log PRD: ../PRD-wire-format-v2.md

What I changed

  • crates/wzp-proto/src/media_type.rs:1-55 — created new module with MediaType enum (Audio=0, Video=1, Data=2, Control=3), to_wire(), from_wire(), and two unit tests
  • crates/wzp-proto/src/lib.rs:18 — added pub mod media_type;
  • crates/wzp-proto/src/lib.rs:28 — added pub use media_type::MediaType;
  • crates/wzp-proto/src/packet.rs:4 — added use crate::MediaType;
  • crates/wzp-proto/src/packet.rs:168 — changed MediaHeaderV2.media_type from u8 to MediaType, resolving the TODO(T1.2)
  • crates/wzp-proto/src/packet.rs:184write_to now calls self.media_type.to_wire()
  • crates/wzp-proto/src/packet.rs:202read_from now uses MediaType::from_wire(buf.get_u8())?
  • crates/wzp-proto/src/packet.rs:1292 — updated media_header_v2_roundtrip test to use MediaType::Audio

Why these choices

Followed steps T1.2.1 through T1.2.2 without deviation. Since MediaType now exists, I also resolved the TODO(T1.2) placeholder left in MediaHeaderV2 during T1.1 so the v2 header is internally consistent before moving on.

Deviations from the task spec

None.

Verification output

$ cargo test -p wzp-proto media_type
running 2 tests
test media_type::tests::media_type_roundtrip ... ok
test media_type::tests::media_type_unknown_rejected ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 106 filtered out; finished in 0.00s
$ cargo test -p wzp-proto media_header_v2_roundtrip
running 1 test
test packet::tests::media_header_v2_roundtrip ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 107 filtered out; finished in 0.00s
$ cargo build -p wzp-proto -p wzp-codec -p wzp-fec -p wzp-crypto -p wzp-transport -p wzp-relay -p wzp-client -p wzp-web -p wzp-native
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 15.31s
$ cargo test -p wzp-proto -p wzp-codec -p wzp-fec -p wzp-crypto -p wzp-transport -p wzp-relay -p wzp-client -p wzp-web -p wzp-native --no-fail-fast
...
test result: ok. 567 passed; 0 failed; ...
$ cargo clippy -p wzp-proto --all-targets -- -D warnings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.57s
$ cargo fmt --all -- --check
# (clean)

Test summary

  • Tests added: 2 (media_type_roundtrip, media_type_unknown_rejected)
  • Tests modified: 1 (media_header_v2_roundtrip — now uses MediaType::Audio)
  • Workspace test count before: 565 pass / 0 fail (non-Android subset)
  • Workspace test count after: 567 pass / 0 fail (non-Android subset)
  • cargo clippy -p wzp-proto --all-targets -- -D warnings: pass
  • cargo fmt --all -- --check: pass

Risks / follow-ups

None.

Reviewer checklist (filled in by reviewer)

  • Code matches PRD intent
  • Verification output is real (re-run if suspicious) — re-ran cargo test -p wzp-proto (112 passed across 2 suites), clippy + fmt clean.
  • No backward-incompat surprises
  • Tests cover the new behavior
  • Approved

Reviewer notes (2026-05-11)

Approved. Bonus that the agent resolved the TODO(T1.2) placeholder inside MediaHeaderV2.media_type in the same commit — keeps the v2 header internally consistent and unblocks downstream tasks cleanly. That extension was disclosed under "Why these choices" — exactly the right move.

One small follow-up:

  1. T1.2.1 — Add rustdoc on MediaType variants and methods. Same rustdoc-coverage concern as T1.1.1 — coding standard #9. Non-blocking.