T1.2.1: Add rustdoc on MediaType variants and methods

This commit is contained in:
Siavash Sameni
2026-05-11 11:33:42 +04:00
parent 6eb94f079d
commit 6385b93391
3 changed files with 79 additions and 4 deletions

View File

@@ -1,20 +1,26 @@
use serde::{Deserialize, Serialize};
/// Media stream type carried in a v2 [`MediaHeader`](crate::MediaHeaderV2).
/// Media stream type carried in a v2 [`MediaHeaderV2`](crate::MediaHeaderV2).
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u8)]
pub enum MediaType {
/// Encoded speech / music (Opus, Codec2, ComfortNoise).
Audio = 0,
/// Encoded video access unit (H.264, H.265, AV1; PRD-video-multicodec).
Video = 1,
/// Opaque payload not interpreted by the relay (reserved).
Data = 2,
/// In-band control message carried on the media plane (reserved).
Control = 3,
}
impl MediaType {
/// Encode to the wire byte representation (`self as u8`).
pub const fn to_wire(self) -> u8 {
self as u8
}
/// Decode from a wire byte. Returns `None` for values outside 0..=3.
pub const fn from_wire(v: u8) -> Option<Self> {
match v {
0 => Some(Self::Audio),

View File

@@ -1235,10 +1235,10 @@ Statuses (in order of progression):
| Task | Status | Agent | Started (UTC) | Completed (UTC) | Report | Reviewer notes |
|---|---|---|---|---|---|---|
| T1.1 | Approved | Kimi Code CLI | 2026-05-11T06:09Z | 2026-05-11T06:54Z | [report](reports/T1.1-report.md) | Approved 2026-05-11. Spawned T1.1.1 (field rustdoc) and T1.1.2 (refresh stale test-count). |
| T1.1.1 | Pending Review | Kimi Code CLI | 2026-05-11T07:17Z | 2026-05-11T07:22Z | [report](reports/T1.1.1-report.md) | Rework submitted: added rustdoc on 6 consts + 6 methods in impl MediaHeaderV2. Re-ran both Verify commands. |
| T1.1.2 | Pending Review | Kimi Code CLI | 2026-05-11T07:19Z | 2026-05-11T07:21Z | reports/T1.1.2-report.md | |
| T1.1.1 | Approved | Kimi Code CLI | 2026-05-11T07:17Z | 2026-05-11T07:22Z | [report](reports/T1.1.1-report.md) | Approved after rework. Both Verify commands clean. |
| T1.1.2 | Changes Requested | Kimi Code CLI | 2026-05-11T07:19Z | — | [report](reports/T1.1.2-report.md) | 3 stale "272 audio tests" refs still live in PRD-wire-format-v2.md (×2) and ROAD-TO-VIDEO.md. Grep was too narrow. See report. |
| T1.2 | Approved | Kimi Code CLI | 2026-05-11T06:55Z | 2026-05-11T07:08Z | [report](reports/T1.2-report.md) | Approved 2026-05-11. Spawned T1.2.1 (rustdoc on MediaType variants/methods). Agent also resolved the T1.2 TODO inside MediaHeaderV2 — good call. |
| T1.2.1 | Open | — | — | — | — | Spawned from T1.2 review; non-blocking |
| T1.2.1 | Pending Review | Kimi Code CLI | 2026-05-11T07:23Z | 2026-05-11T07:24Z | reports/T1.2.1-report.md | — |
| T1.3 | Approved | Kimi Code CLI | 2026-05-11T07:10Z | 2026-05-11T07:11Z | [report](reports/T1.3-report.md) | Approved 2026-05-11. No follow-ups; docs-and-test-only change. |
| T1.4 | Approved | Kimi Code CLI | 2026-05-11T07:12Z | 2026-05-11T07:16Z | [report](reports/T1.4-report.md) | Approved 2026-05-11. Spawned T1.4.1 (rustdoc on v2 mini types). The two-step expand test catches the W4 desync scenario nicely. |
| T1.4.1 | Open | — | — | — | — | Spawned from T1.4 review; non-blocking |

View File

@@ -0,0 +1,69 @@
# T1.2.1 — Add rustdoc on `MediaType` variants and methods
**Status:** Pending Review
**Agent:** Kimi Code CLI
**Started:** 2026-05-11T07:23Z
**Completed:** 2026-05-11T07:24Z
**Commit:** see git log
**PRD:** ../PRD-wire-format-v2.md
## What I changed
- `crates/wzp-proto/src/media_type.rs:7-10` — added `///` doc comments to all 4 variants (`Audio`, `Video`, `Data`, `Control`)
- `crates/wzp-proto/src/media_type.rs:14` — added `///` doc on `to_wire`
- `crates/wzp-proto/src/media_type.rs:18` — added `///` doc on `from_wire`
## Why these choices
Follow-up from T1.2 review: coding standard #9 requires `///` on all public items. Added concise one-line docs matching the examples from the task spec.
## Deviations from the task spec
None.
## Verification output
```bash
$ cargo doc -p wzp-proto --no-deps 2>&1 | grep -i "missing" || echo "no missing-doc warnings"
no missing-doc warnings
```
```bash
$ cargo clippy -p wzp-proto --all-targets -- -D warnings -W missing_docs 2>&1 | grep "media_type.rs:" | head -10
# (no output — no missing-docs in media_type.rs)
```
```bash
$ cargo build -p wzp-proto
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.49s
```
```bash
$ cargo test -p wzp-proto --no-fail-fast
running 112 tests
test result: ok. 112 passed; 0 failed; ...
```
```bash
$ cargo fmt --all -- --check
# (clean)
```
## Test summary
- Tests added: 0
- Tests modified: 0
- `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)
- [ ] No backward-incompat surprises
- [ ] Tests cover the new behavior
- [ ] Approved