Files
alkhttp/tasks/gateway/review-002-gw16-status-drift.md
T
glm-5.3-flash e2c255d40c docs(tasks): decompose review-002 into 24 tasks (23 implementation + 1 bracketed follow-up)
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.
2026-08-30 10:50:34 +00:00

74 lines
3.4 KiB
Markdown

---
id: review-002-gw16-status-drift
name: Unify INVALID_INPUT status on hand-rolled publish/batch paths + sink-deadline decision (GW-16, GW-17)
status: pending
depends_on: [review-002-gw15-publish-body-cap]
scope: narrow
risk: low
impact: component
level: implementation
tags: [gateway, review-002]
---
## Description
Two review-002 gateway status/deadline findings, same files
(`routes.rs`, `dispatch.rs`), sequenced after the GW-15 body-cap task
because GW-15 adds one more hand-rolled status site:
- **GW-16**: the documented mapping is `INVALID_INPUT → 422`
(http-server.md:361), and mid-stream publish validation correctly
emits 422. But the new pre-dispatch paths hand-build
`CallError::invalid_input`-shaped responses with
`StatusCode::BAD_REQUEST`: empty body, missing `operation`, missing
`chunk`, invalid first-line JSON (:257-278), the line-cap error
(:459-464), and the `/batch` over-cap reject (:173-184). Same error
class, two statuses depending on where it fires — the GW-03 drift
class one table row down.
- **GW-17**: the documented 30 s deadline includes "the `/publish`
final envelope" (http-server.md:381-384) but `invoke_sink` has no
timeout (`dispatch.rs:132-145`) — the module doc justifies it as
"bounded by the client's upload," which bounds chunk arrival, not
the handler's final await. A hung sink handler parks the HTTP
connection forever.
## Acceptance Criteria
- [ ] Decide + implement the body-shape-fault status: either (a) route
all hand-rolled `INVALID_INPUT` responses through
`call_error_to_http_response_with_identity` (making them 422
like the documented mapping), or (b) sanction 400-for-body-shape
in http-server.md's table explicitly (documenting which paths
are "request shape" vs "per-chunk shape"). Implementer's choice;
whichever it is, `/publish` and `/batch` agree and the doc table
names both statuses' trigger conditions.
- [ ] GW-17: decide + implement: (a) wrap the sink handler's
completion in the same 30 s `tokio::time::timeout` family the
Once-op invoke uses (new error envelope on trip), or (b) amend
http-server.md to exclude the final envelope from the deadline
contract. Prefer (a) — the documented contract is the older
decision and hung-forever requests are the failure mode review
001 filed twice.
- [ ] Tests: each hand-rolled path's status asserted (publish
first-line/empty/line-cap/batch-cap); sink-deadline test with a
hung sink handler (mirroring dispatch.rs's hung-handler test)
if (a)
- [ ] http-server.md error/deadline tables updated to match the
implemented choice
- [ ] `cargo test`, `cargo clippy --all-targets -- -D warnings`,
`cargo fmt --check` pass
## References
- docs/reviews/002-post-remediation-review.md (Part C', GW-16, GW-17)
- src/gateway/routes.rs:173-184, 257-278, 459-464 (the hand-rolled 400s), dispatch.rs:132-145 (the sink await), error.rs:51 (the 422 mapping)
- docs/architecture/http-server.md:361 (the error table), :381-388 (the deadline contract)
- tasks/gateway/review-002-gw15-publish-body-cap.md (lands the line-cap error this task then normalizes)
## Notes
Do this after GW-15 so the line-cap path's final status is chosen once
(avoid two commits churning the same lines). ADR-023 governs the
error-code discipline — if (b) is chosen for GW-16, note the
body-shape-vs-chunk-shape distinction there or in http-server.md so
the next projection refresh captures it.