3.8 KiB
id, name, status, depends_on, scope, risk, impact, level, tags
| id | name | status | depends_on | scope | risk | impact | level | tags | |||
|---|---|---|---|---|---|---|---|---|---|---|---|
| review-002-con18b-ws-polish | WS small fixes — pre-send cap check, close reasons, custom-route knobs, axum-flavor tests (WS-14/15/17/18/19) | completed |
|
moderate | low | component | implementation |
|
Description
Five review-002 minor WS findings that all live in the two WS files
(byte_adapter.rs, upgrade.rs) — batched because each is small and
they share the review-002-ws13-idle-progress refactor context
(sequence after it; do not parallelize on the same file):
- WS-14: the byte-cap check can trip only after
poll_writehas accepted into the channel (byte_adapter.rs:326-334, 585-586) — the mux committed the chunk, then the pump 1011s and truncates. Move the size check intopoll_writebeforetry_sendso the mux sees the write error instead of the wire. - WS-15:
WriteMsg::CloseWithhardcodes the reason "text messages not supported" for idle-timeout (1001), inbound-size (1011), and text (1002) closes (:316-324). Carry the reason in the variant; tests assert numeric codes today, keep them and add reason asserts where cheap. - WS-17: bare-registry WS routes get no knob surface
(
upgrade.rs:104-111hardcodes 60 s idle + private 64-session semaphore). Add aWsIdleTimeout-style request extension mirroringChannelsPolicy(or document the fixed values in the module doc — implementer's choice, butupgrade.rsdocs must match reality). - WS-18: write-side stall is unbounded (peer stops reading → write
pump parks in
ws_sink.send, 64×16 MiB bounded but time-unbounded). Add a write-progress timeout to the write pump (same knob family as the read side — share the config surface WS-17 touches). - WS-19: axum-flavor
AxumFramingarms have no direct unit test (cap-trip closes + idle-1001 are asserted on tungstenite only, via shared generic code). Mirror one text→1002 and one cap-trip test overAxumFraming.
Acceptance Criteria
- WS-14: over-cap write rejected in
poll_writepre-try_send; test asserts the stream error, not a wire-level 1011 - WS-15: close reasons distinct per cause (idle / oversized / text); existing close-frame tests updated with reason asserts
- WS-17: knob surface exists (extension or documented-fixed) and
upgrade.rsmodule docs match the implementation - WS-18: write-progress timeout lands with the same config family; test: a peer that stops reading (clog the sink) is evicted within the knob (scaled test, tungstenite path)
- WS-19: two
AxumFramingunit tests (text→1002, cap-trip) pass cargo test,cargo clippy --all-targets -- -D warnings,cargo fmt --checkpass
References
- docs/reviews/002-post-remediation-review.md (Part B', WS-14/15/17/18/19)
- src/websocket/byte_adapter.rs:326-334 (WS-14), :316-324 (WS-15), :584-597 (WS-18), :782-1206 (WS-19 test target)
- src/websocket/upgrade.rs:104-111 (WS-17), :308-317 (the ChannelsPolicy extension pattern to mirror)
- tasks/websocket/review-001-ws-pump-consolidation.md (the generic pump these extend)
Notes
Slice suggestion (per the review-001 lesson on WS agents): one slice per finding with its own commit, in the order above (WS-14 is the only behavior-correctness one; WS-18 is the only new mechanism). If WS-13 (chief-risk task) changed the read-loop shape, rebase-verify the cap accounting comments before this task's slices — they cite pre/post-extend order explicitly.
Summary
WS-14 pre-send cap check in poll_write; WS-15 per-cause close reasons (close_reason module, absorbs the text-message reason bug); WS-18 60s write-progress timeout (close-less teardown on clogged socket); WS-17 WsTimeouts request extension (replaces-state precedence); WS-19 axum-flavor tests. One commit per item.