21 review-001 tasks across server/adapters/client/gateway/websocket/infra, chunked from the 7-unit remediation plan in docs/reviews/001-initial-implementation-review.md. - Scope split by mechanism, not one-per-finding: 15 tasks in generation 1 (parallelizable), 6 sequenced after their file-sharing precursors - Deliberately deferred until dependent fixes land: projection/doc fidelity partial (Unit 6 beyond dependency hygiene), coverage backfills (COV-01..07 via in-task acceptance for forward.rs), and per-finding minors (OAI-06/07, HY-02/04/06/10/11, CON-08) - Cross-crate WS-12 (alkcall demux 4 GiB discard alloc) noted for filing in alkcall, not here taskgraph: validate clean, no cycles, 6 generations
55 lines
2.1 KiB
Markdown
55 lines
2.1 KiB
Markdown
---
|
|
id: review-001-sse-parser
|
|
name: Incremental byte-level SSE parser (FWD-06)
|
|
status: pending
|
|
depends_on: []
|
|
scope: narrow
|
|
risk: high
|
|
impact: component
|
|
level: implementation
|
|
tags: [adapters, review-001]
|
|
---
|
|
|
|
## Description
|
|
|
|
Review 001 finding FWD-06 — silent subscription data loss, empirically
|
|
verified: `parse_sse_frames` (`src/adapters/forward.rs:409-417`) keeps
|
|
only the *last* line of each TCP chunk and discards any pending
|
|
multi-line `data_buffer`, so a chunk ending exactly at `data: …\n`
|
|
(blank line not yet arrived) silently loses the event. Verified: chunks
|
|
`"data: {\"n\":1}\n"` + `"\ndata: {\"n\":2}\n\n"` yield only event 2.
|
|
Single-chunk delivery (as in the tests) works, which is why the suite
|
|
passes.
|
|
|
|
Additional defects in the same parser: per-chunk `String::from_utf8_lossy`
|
|
(`:357`) corrupts multi-byte characters split at a chunk boundary (JSON
|
|
parse failure → event degraded to raw string); the trailing partial line
|
|
has no length cap (unbounded buffering); an event pending at EOF is
|
|
dropped (SSE says dispatch at EOF). For a subscription forwarder this is
|
|
silent data loss with no error signal.
|
|
|
|
Fix: an incremental **byte-level** parser carrying buffer state across
|
|
chunks (decode UTF-8 once over the reassembled buffer, not per chunk).
|
|
|
|
## Acceptance Criteria
|
|
|
|
- [ ] Multi-chunk test: event split across two TCP chunks is delivered (the review's empirically-verified case — the acceptance gate)
|
|
- [ ] Split multi-byte UTF-8 across chunks parses (test)
|
|
- [ ] Pending event dispatched at EOF; trailing partial line length-capped (tests)
|
|
- [ ] Existing single-chunk SSE tests unchanged and green
|
|
- [ ] `cargo test` and `cargo clippy --all-targets -- -D warnings` pass
|
|
|
|
## References
|
|
|
|
- docs/reviews/001-initial-implementation-review.md (Part D, FWD-06; Part I, COV-01)
|
|
|
|
## Notes
|
|
|
|
> Agent fills during implementation. Parser rewrite is isolated
|
|
> from the response-decode fixes (content-type, size caps, error bodies)
|
|
> in review-001-response-decoding so the delicate stateful rewrite lands
|
|
> alone. Same file — sequence or coordinate.
|
|
|
|
## Summary
|
|
|
|
> Filled on completion. |