Commit 42e8ecd
authored
fix: handle FDv2 intentCode none as listening, reject unknown codes (#555)
Bring the FDv2 protocol handler's `server-intent` dispatch in line with
the spec and the Java implementation.
- `intentCode: none` keeps the handler in listening state so a
subsequent partial cycle works.
- Unrecognised intent codes return a protocol error instead of being
collapsed with `none`.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes streaming protocol state machine behavior for `server-intent`,
which can affect how clients process FDv2 payloads; scope is limited to
intent dispatch with new tests.
>
> **Overview**
> Aligns **`server-intent`** handling in `FDv2ProtocolHandler` with the
FDv2 spec and Java client.
>
> For **`intentCode: none`**, the handler still emits an immediate empty
**`kNone`** changeset, but it now leaves internal state in
**partial/listening** mode instead of **inactive**, so a later
**`put-object`** / **`payload-transferred`** cycle can produce a partial
changeset.
>
> **Unrecognized** intent codes (deserialized as **`kUnknown`**) are no
longer treated like **`none`**: the handler **resets** and returns a
**`ProtocolError`** with *"server-intent had an unrecognized intent
code"*.
>
> Tests cover a partial cycle after **`none`** and protocol errors for
unknown codes (e.g. **`future-code`**).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f40b13f. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent d6368b8 commit 42e8ecd
2 files changed
Lines changed: 38 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
77 | | - | |
78 | | - | |
| 76 | + | |
| 77 | + | |
79 | 78 | | |
80 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
81 | 85 | | |
82 | 86 | | |
83 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
65 | 96 | | |
66 | 97 | | |
67 | 98 | | |
| |||
0 commit comments