Commit 64541af
Fix Client::list_sessions wire shape — wrap filter under params.filter
The hand-authored `Client::list_sessions` was serializing the optional
`SessionListFilter` directly onto the JSON-RPC `params` object,
flattening fields like `repository` / `branch` / `cwd` / `gitRoot` to
the top level. The `session.list` request shape that the runtime accepts
puts the filter under `params.filter` — and that's what every other SDK
sends:
- Node `nodejs/src/client.ts:1178-1180`: `sendRequest("session.list", { filter })`
- Go `go/types.go`: `listSessionsRequest { Filter *SessionListFilter }`
- Python `python/copilot/client.py:1907-1911`: `payload["filter"] = ...`
- .NET `dotnet/src/Client.cs`: `record ListSessionsRequest(SessionListFilter? Filter)`
Because the runtime silently ignores unknown top-level keys on
`session.list`, calling `list_sessions(Some(filter))` was functionally
equivalent to `list_sessions(None)` in 0.0.x — every filter field was
discarded by the runtime, returning an unfiltered session list. No
runtime error, no log, just silently broken. Functionally dead on the
wire, same class as the elicitation `requestedSchema` fix in `c58e2f2`.
The mock-server test `list_sessions_serializes_typed_filter` asserted on
the flat shape it observed (`request["params"]["repository"]`) rather
than the schema's wrapped shape, so the bug round-tripped through both
ends — the implementation produced the wrong shape, the test verified
the wrong shape. Same root cause as the elicitation test gap.
Fix:
- `Client::list_sessions` now wraps the filter: `Some(f) ->
serde_json::json!({ "filter": f })`, `None -> serde_json::json!({})`.
`None` omits the filter key entirely (matches Go's `omitempty`
behavior; Node's `{ filter: undefined }` also omits via JSON-stringify).
- Mock-server test now asserts on the wrapped path
(`params.filter.repository`, `params.filter.branch`) AND explicitly
asserts the flattened fallback is gone (`params.get("repository")`
must return `None`). Same regression-prevention pattern as the
elicitation fix at `session_test.rs:1248-1251`.
- CHANGELOG entry under `### Fixed` documenting the wire-shape fix and
the test gap that masked it.
Validation:
- 209 tests pass (no count change — same test, stricter assertions).
- `cargo doc -D warnings` clean.
- `cargo +nightly-2026-04-14 fmt --check` clean.
- `cargo clippy --all-features --all-targets -- -D warnings` clean.
Caught by the gap-analysis structural-correctness pass walking every
hand-authored `client.call("...")` site against the schema and the four
other SDKs. This is the second wire-shape bug found by that pass; the
first was the `SessionUi::elicitation` `schema` -> `requestedSchema`
fix in `c58e2f2`. The audit confirms `session.list` is the only other
new bug — three Rust-unique surfaces (`session.respondToUserInput`,
`session.sendTelemetry`, top-level `sendTelemetry` /
`server.sendTelemetry`) are uncheckable cross-SDK and queued as
post-0.1.0 runtime-acceptance verification.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent a7c8215 commit 64541af
3 files changed
Lines changed: 24 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
344 | 355 | | |
345 | 356 | | |
346 | 357 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1199 | 1199 | | |
1200 | 1200 | | |
1201 | 1201 | | |
1202 | | - | |
| 1202 | + | |
1203 | 1203 | | |
1204 | 1204 | | |
1205 | 1205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
679 | 679 | | |
680 | 680 | | |
681 | 681 | | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | | - | |
686 | | - | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
687 | 694 | | |
688 | 695 | | |
689 | 696 | | |
| |||
0 commit comments