Skip to content

feat: v5.1.0 — add ByteMessageInfo::response_kind, closing the response-classification gap - #138

Merged
SoundMatt merged 2 commits into
mainfrom
feat/response-classifier
Aug 1, 2026
Merged

feat: v5.1.0 — add ByteMessageInfo::response_kind, closing the response-classification gap#138
SoundMatt merged 2 commits into
mainfrom
feat/response-classifier

Conversation

@SoundMatt

Copy link
Copy Markdown
Owner

Summary

No function anywhere in this crate classified a decoded response header's evt field into TC18 §11.3 Table 15's four response semantics (Acknowledge/Write/Read/Error) — a gap found during a cross-repo architecture inventory (RELAY docs/RCP-ARCHITECTURE.md) that also found the identical gap in go-RCP and a related, now-fixed bug in c-RCP (rcp_acf_classify_response never checking evt at all — c-RCP#151).

The gap was already partially documented: Evt's doc comment named the missing piece REQ-RESP-004 and Evt::sub_opcode's own requirement (REQ-EVT-001) cross-referenced it — but REQ-RESP-004 was never actually added to .fusa-reqs.json, just forward-referenced in prose. This lands the real requirement alongside the implementation.

ByteMessageInfo::response_kind() implements TC18 §11.3.1-§11.3.4: evt[3:0] == 0xF identifies an Acknowledge unconditionally, checked before err/op — a rejected Acknowledge is still an Acknowledge, not a ResponseKind::Error. Matches cpp-RCP's response_kind_of(), the cross-repo reference implementation.

Evt gains raw_nibble() (the ack+sub_opcode → wire-nibble packing the encoder already did inline), now shared between the encoder and the new classifier instead of duplicated bit arithmetic.

Additive public API — MINOR bump per this crate's SEMVER.md.

Test plan

  • Mutation-tested: reverting the evt-first check makes exactly the 3 acknowledge-specific test cases fail, the same failure shape the c-RCP bug had
  • cargo build --release, cargo test --all-features (1109+32 tests) all clean
  • cargo fmt --check, cargo clippy --all-targets --all-features -- -D warnings clean
  • bash scripts/fusa-gap-check.sh → 608/608 (100%), no gaps

…se-classification gap

No function anywhere in this crate classified a decoded response header's
evt field into TC18 §11.3 Table 15's four response semantics
(Acknowledge/Write/Read/Error) -- a gap found during a cross-repo
architecture inventory (RELAY docs/RCP-ARCHITECTURE.md) that also found
the identical gap in go-RCP and a related, now-fixed bug in c-RCP
(rcp_acf_classify_response never checking evt at all).

The gap was already partially documented: Evt's own doc comment named
the missing piece "REQ-RESP-004" and Evt::sub_opcode's requirement
(REQ-EVT-001) cross-referenced it -- but REQ-RESP-004 was never actually
added to .fusa-reqs.json, just forward-referenced in prose. This commit
lands the real requirement alongside the implementation, matching what
was already promised.

ByteMessageInfo::response_kind() implements TC18 §11.3.1-§11.3.4:
evt[3:0] == 0xF identifies an Acknowledge unconditionally, checked
before err/op -- a rejected Acknowledge (err = true) is still an
Acknowledge, not a ResponseKind::Error, which is a distinct
evt[3:0] < 0x9 case. Matches cpp-RCP's response_kind_of(), the cross-repo
reference implementation for this concern.

Evt gains raw_nibble() (the ack+sub_opcode -> wire-nibble packing
encode_byte_message_info already did inline) as a small shared primitive,
now used by both the encoder and the new classifier instead of
duplicating the bit arithmetic.

Mutation-tested: reverting the evt-first check makes exactly the 3
acknowledge-specific test cases fail, the same failure shape the c-RCP
bug had.

Additive public API (new pub fn/enum/const, no existing signature
changed) -- MINOR bump per this crate's own SEMVER.md.

Signed-off-by: Matt <47545907+SoundMatt@users.noreply.github.com>
…urface

CI's Public API stability check failed: this branch adds pub items
(ResponseKind, ByteMessageInfo::response_kind, Evt::raw_nibble,
EVT_RESPONSE_ACKNOWLEDGE) without updating the committed snapshot.
rustup isn't available in this environment to run
`cargo +nightly public-api` directly, so this snapshot was updated by
hand from CI's own computed diff (job 91401638000), applied verbatim --
not re-derived or guessed at.

Signed-off-by: Matt <47545907+SoundMatt@users.noreply.github.com>
@SoundMatt
SoundMatt merged commit bd6d32f into main Aug 1, 2026
18 checks passed
@SoundMatt
SoundMatt deleted the feat/response-classifier branch August 1, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant