Skip to content

error: make public errors structured and fatal-only#134

Draft
zRedShift wants to merge 6 commits into
algesten:mainfrom
zRedShift:fix/drop-recordless-incomplete-datagrams-upstream
Draft

error: make public errors structured and fatal-only#134
zRedShift wants to merge 6 commits into
algesten:mainfrom
zRedShift:fix/drop-recordless-incomplete-datagrams-upstream

Conversation

@zRedShift
Copy link
Copy Markdown
Contributor

@zRedShift zRedShift commented May 28, 2026

Draft follow-up to #126.

This keeps transient parser failures internal and reshapes the public Error API so public errors represent connection-fatal outcomes rather than recoverable UDP/parser noise.

Changes:

  • removes public ParseIncomplete, ParseError, and TooManyRecords from Error;
  • replaces stringly public error payloads with structured enums;
  • changes dimpl-owned crypto provider error surfaces from String to typed errors;
  • preserves diagnostic detail without allocating String payloads;
  • reduces public Error size from 32 bytes to 16 bytes on this target.

Validation:

  • cargo fmt --check
  • git diff --check
  • snowflake local check
  • cargo test --all-targets --features rcgen
  • cargo clippy --all-targets --features rcgen -- -D warnings
  • cargo test --no-default-features --features rust-crypto
  • cargo clippy --no-default-features --features rust-crypto -- -D warnings
  • cargo test --doc --features rcgen

@algesten
Copy link
Copy Markdown
Owner

126 merged. this can be rebased

@zRedShift zRedShift force-pushed the fix/drop-recordless-incomplete-datagrams-upstream branch from 4b5d3ec to 1706bdd Compare May 28, 2026 09:15
@zRedShift zRedShift marked this pull request as ready for review May 28, 2026 09:15
@algesten
Copy link
Copy Markdown
Owner

@zRedShift what's the point of this PR? Feels like we're handling empty records in like 2 places in the code path already.

@zRedShift
Copy link
Copy Markdown
Contributor Author

@algesten the intent here isn’t to handle parsed empty records.

this is before we have a record at all: a datagram that only contains an incomplete DTLS record header or body currently bubbles up as ParseIncomplete from handle_packet. the PR makes that look like normal UDP loss/truncation and drops it without turning it into a connection-level error.

@algesten
Copy link
Copy Markdown
Owner

@zRedShift ok, but what about what we said in Discord about maybe not having ParseIncomplete as an error at all?

@zRedShift
Copy link
Copy Markdown
Contributor Author

@algesten i was a bit hesitant to take that plunge wholesale since it might become a big pr, but i agree this pr is too narrow and doesn’t buy us much. how about i rework it into a proper implementation of that idea and we’ll see from there?

@zRedShift zRedShift force-pushed the fix/drop-recordless-incomplete-datagrams-upstream branch from 1706bdd to 2bc19e3 Compare May 28, 2026 16:29
@zRedShift zRedShift force-pushed the fix/drop-recordless-incomplete-datagrams-upstream branch from 2bc19e3 to 9ee8e62 Compare May 29, 2026 13:00
@zRedShift zRedShift marked this pull request as draft May 29, 2026 13:01
@zRedShift zRedShift changed the title dtls: drop recordless incomplete datagrams error: make public errors structured and fatal-only May 29, 2026
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.

2 participants