Decomposition of docs/reviews/002-post-remediation-review.md per its 5-unit remediation plan: - Unit 1 (security-critical): gw15-publish-body-cap, prj16-schema-via-call (CF-004 filed alkcall-side), fwd13-dot-segments, fwd16-missing-capability, oai11-ref-memoization - Unit 2 (timeout/terminality): ws13-idle-progress, fwd15-stream-timeout, cli01-retry-after-budget, con17-mcp-pagination, con18-wss-sweep-exit - Unit 3 (projection/docs): projection-truthfulness, mcp-batch-cap, gw16-status-drift - Unit 4 (spec-import): yaml-normalization, oai13-path-item-wildcards, import-loudness-cluster, js01-placeholder-check, fwd17-19-contract-decisions - Unit 5 (WS polish + tests): con18b-ws-polish, client-policy-wire-tests, cov-deployment-knobs, cov13-dead-code, srv11-srv12-router-ordering - review-002-bracketed-followup: tentatively planned post-bulk pass (stale-check, OQA-18 enforcement decision, CON-08/09 close() lever, cross-crate re-checks) — deliberately not serialized against the bulk Also: review-002 numbering repair (CON-14 was double-booked; MCP pagination now CON-14, from_wss monitor renumbered CON-18, missing CON-14 section added). taskgraph: 66 valid, no cycles; 24 pending (all review-002); gen-1/gen-2 parallel waves identified; workflow-cost hotspots are prj16 (12.8) and ws13 (11.1), both carrying the reviewed slicing guidance in their Notes.
59 lines
2.6 KiB
Markdown
59 lines
2.6 KiB
Markdown
---
|
|
id: review-002-con18-wss-sweep-exit
|
|
name: Dead-connection fast-fail + bounded from_wss sweep exit (CON-18)
|
|
status: pending
|
|
depends_on: []
|
|
scope: narrow
|
|
risk: low
|
|
impact: component
|
|
level: implementation
|
|
tags: [adapters, review-002, from-wss]
|
|
---
|
|
|
|
## Description
|
|
|
|
Review 002 CON-18 [minor]. The review-001 CON-02 fix added a 1 s
|
|
pending-map sweep to `from_wss`'s drop monitor — but it never exits:
|
|
once `eof_observed` holds, the sweep branch runs `fail_all` every
|
|
second **forever** (`from_wss.rs:254-272`). Each fire-and-forget
|
|
`import()` whose peer dies leaves a spawned task + pending map + watch
|
|
receiver alive for the process lifetime (a true task/allocator leak
|
|
scaling with import count). Note the naive fix is wrong: the sweep
|
|
test proves post-EOF registrations race `fail_all` and hang without
|
|
the sweep — so exit requires making post-EOF registration fail fast
|
|
*first*.
|
|
|
|
## Acceptance Criteria
|
|
|
|
- [ ] Post-EOF (dead connection) registration fails fast: calls
|
|
registered after the observed EOF resolve immediately with
|
|
`CONNECTION_CLOSED` (retryable, matching the established
|
|
mapping) instead of relying on the next sweep tick
|
|
- [ ] The sweep then exits after a bounded grace period following EOF
|
|
(long enough that the fast-fail path is exercised; not forever)
|
|
— no per-dead-session permanent task remains
|
|
- [ ] Re-verify the existing race tests still pass (pre-drop,
|
|
forgotten/held drop-during-registration, post-EOF sweep —
|
|
from_wss.rs:809-1001) and tighten assertions where the fast-fail
|
|
makes timing deterministic
|
|
- [ ] A task-lifecycle test (or task-count assertion) proving the
|
|
monitor ends after teardown
|
|
- [ ] `cargo test --features wss`, `cargo clippy --features wss --all-targets -- -D warnings`,
|
|
`cargo fmt --check` pass
|
|
|
|
## References
|
|
|
|
- docs/reviews/002-post-remediation-review.md (Part B', CON-18 / CON-16-withdrawn merge note)
|
|
- src/adapters/from_wss.rs:244-273 (the monitor loop), :75 (interval), :305 (fire-and-forget import)
|
|
- tasks/adapters/review-001-ws-eof-signal.md (the WS-02/CON-02 fix this bounds)
|
|
- alkcall/docs/reviews/consumer-findings-ledger.md CF-001 (the retryability classification — keep consistent)
|
|
|
|
## Notes
|
|
|
|
Implementation shape suggestion: an `AtomicBool`/watch-dead flag on
|
|
the call connection consulted in the registration path (fail-fast)
|
|
plus a sweep-generation counter (exit after N idle sweeps post-EOF).
|
|
The alkcall-side CF-001 note matters: if/when the dead-mux write
|
|
mapping changes, the fail-fast class here should match. Keep the
|
|
WS-02 losslessness invariant intact — fast-fail is an *additional*
|
|
resolution path, not a replacement for the watch signal. |