Skip to content

feat!: non-exhaustive public error enums, build-time E2E caps (0.11.0) - #150

Merged
JustinKovacich merged 1 commit into
mainfrom
feat/error-surface-and-caps
Aug 21, 2026
Merged

feat!: non-exhaustive public error enums, build-time E2E caps (0.11.0)#150
JustinKovacich merged 1 commit into
mainfrom
feat/error-surface-and-caps

Conversation

@JustinKovacich

Copy link
Copy Markdown
Contributor

Closes #144. Closes #147.

The first of the batch raised against the 0.10.0 surface. These two travel together because both land as 0.11.0 and both touch the "what can a consumer configure or match on" surface; #145, #146 and #148 follow separately.

#[non_exhaustive] on the public error enums (#144) — breaking

Applied to client::Error, server::Error, e2e::Error, protocol::Error, and protocol::sd::Error. transport::TransportError already had it — so this makes the treatment uniform rather than introducing it.

Six enums, not the five the issue named: protocol::sd::Error turned up in the sweep.

client::Error's doc carried a stability note asserting the opposite, and honestly spelling out the cost it was accepting — "any new variant added here is a breaking change." That note is rewritten rather than deleted, because the reasoning is still worth stating, just with the conclusion inverted.

Build-time E2E caps (#147) — additive

E2E_REGISTRY_CAP and E2E_RX_STATE_CAP now go through from_env_or, matching SERVICE_REGISTRY_CAP, the server caps, and the bare-metal runtime. Defaults unchanged at 32 and 64.

Verified all three paths, not just the happy one:

Build Result
SIMPLE_SOMEIP_E2E_RX_STATE_CAP=128 builds
SIMPLE_SOMEIP_E2E_RX_STATE_CAP=100 fails — E2E_RX_STATE_CAP must be a power of two for heapless::FnvIndexMap
SIMPLE_SOMEIP_E2E_REGISTRY_CAP=abc fails — non-digit guard

The power-of-two const _ assertions were previously defensive against a future edit; they are now load-bearing against user input, which is worth being deliberate about — a non-power-of-two fails the build rather than silently mis-sizing the map.

Two things reviewers should look at

from_env_or loses its #[cfg(any(feature = "server", feature = "client"))] gate. That gate existed because every caller lived in one of those modules and it would otherwise be dead code. e2e is compiled unconditionally, so once the caps use it the gate breaks --no-default-features outright — and there is no longer any configuration in which the function is dead. Caught by building that config; it is in the verification list below for that reason.

The 0.11.0 bump is two-part. simple-someip-embassy-net carries version = "0.11" next to its path = ".." dependency, so bumping only the root Cargo.toml fails resolution for the whole workspace. Same shape as the version bump in 0.10.0.

Also corrected in passing: from_env_or's non-digit assert said SIMPLE_SOMEIP_MAX_*, which only covers one of the two var families (MAX_OFFERS/MAX_SUBS vs the *_CAP set). It now says SIMPLE_SOMEIP_* and the doc names both.

Verification

  • cargo clippy -- -D warnings -D clippy::pedantic on all five lanes CI runs: the alloc/host workspace lane, --no-default-features, and the three bare_metal combinations.
  • cargo test --no-default-features — CI's test lane — green.
  • cargo doc --no-deps with RUSTDOCFLAGS=-D warnings for client, server,bare_metal, and the alloc set. This is what caught an intra-doc link I had first written into the new e2e docs pointing at client::SERVICE_REGISTRY_CAP, which is behind a feature the e2e module does not have.
  • cargo fmt --all -- --check clean.
  • --no-default-features builds — the configuration the cfg-gate change is about.

Unrelated, but noting it since it is visible if you run the full suite: cargo test --workspace --features $ALLOC_FEATURES fails 12 subscriber tests on unmodified main as well. That combination is not one CI's test lane runs. Not touched by this branch, and not investigated here.

@JustinKovacich JustinKovacich added the enhancement New feature or request label Aug 20, 2026
@JustinKovacich JustinKovacich self-assigned this Aug 20, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #150      +/-   ##
==========================================
- Coverage   81.26%   81.25%   -0.01%     
==========================================
  Files          46       46              
  Lines       15470    15470              
==========================================
- Hits        12571    12570       -1     
- Misses       2899     2900       +1     
Files with missing lines Coverage Δ
src/client/error.rs 100.00% <ø> (ø)
src/e2e/registry.rs 96.58% <ø> (ø)
src/lib.rs 0.00% <ø> (ø)
src/server/error.rs 100.00% <ø> (ø)

... and 1 file with indirect coverage changes

…configurable

Closes #144. Closes #147.

`client::Error`, `server::Error`, `e2e::Error`, `protocol::Error`, and
`protocol::sd::Error` gain `#[non_exhaustive]`; `transport::TransportError`
already had it. `client::Error` carried a stability note asserting the
opposite and spelling out the cost it accepted — that any added variant is
a breaking change. Removing that cost is the point: pre-1.0 with an active
cadence, every added variant broke every downstream match, including
consumers who only ever wanted a catch-all.

`E2E_REGISTRY_CAP` and `E2E_RX_STATE_CAP` now read
`SIMPLE_SOMEIP_E2E_REGISTRY_CAP` / `SIMPLE_SOMEIP_E2E_RX_STATE_CAP` through
the `from_env_or` mechanism their siblings already used. Defaults unchanged,
so that half is additive. `E2E_RX_STATE_CAP` is the one that wanted it:
receive state is keyed `(source, key)`, so it bounds sources x keys, and a
node demuxing many senders could not raise it without vendoring the crate.

Two consequences worth noting:

`from_env_or` loses its `server`/`client` cfg gate. `e2e` compiles
unconditionally, so the gate would have broken `--no-default-features` the
moment the caps started using it — and there is now no configuration in
which the function is dead code.

The power-of-two `const _` assertions become load-bearing rather than
defensive: a non-power-of-two supplied through the env var fails the build
instead of silently mis-sizing the FnvIndexMap. Verified, along with the
non-digit guard.

`simple-someip-embassy-net` carries an explicit version req next to its path
dependency, so the 0.11.0 bump is a two-part change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@JustinKovacich
JustinKovacich force-pushed the feat/error-surface-and-caps branch from ecd4697 to ecb337f Compare August 21, 2026 13:35
@JustinKovacich
JustinKovacich added this pull request to the merge queue Aug 21, 2026
Merged via the queue into main with commit 6369f1c Aug 21, 2026
8 checks passed
@JustinKovacich
JustinKovacich deleted the feat/error-surface-and-caps branch August 21, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

e2e: route E2E_REGISTRY_CAP / E2E_RX_STATE_CAP through from_env_or client: mark the public error enums #[non_exhaustive]

3 participants