apache / apache/fluss-rust

Surface a typed error when ApiVersionsResponse fields exceed int16 range

Open
#535 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
58
Forks
50
PR merge metrics
No merged PRs in 30d

Description

### Search before asking

- [x] I searched in the [issues](https://github.com/apache/fluss-rust/issues) and found nothing similar.

### Description

PbApiVersion carries api_key, min_version, max_version as int32 for forward-compat, but both clients use them as int16/short internally. Today:
- Java silently truncates with (short) intValue. A server advertising e.g. api_key = 70000 becomes 4464, a different (probably invalid) API key — with no signal to the operator.
- Rust panics via i16::try_from(...).unwrap(). A misbehaving server can crash a client connection task by advertising any value outside i16 range.

Both behaviors are wrong. Better: validate at the wire boundary and surface a typed protocol error (e.g. InvalidApiVersionException / Error::UnsupportedVersion) carrying the offending field name and value, then close the connection. No panic, no silent corruption.

Trivial change in both clients, should land together to keep cross-language behavior aligned.
Lower priority as this has low chances to happen in practice

### Willingness to contribute

- [ ] I'm willing to submit a PR!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.