refactor(llm,commands,plugins,sanitizer,skills): add #[non_exhaustive] to extensible pub enums#4533
Merged
Merged
Conversation
This was
linked to
issues
May 28, 2026
Closed
…] to extensible pub enums Mark 11 extensible pub enums across 6 crates with #[non_exhaustive] so that adding new variants in the future does not constitute a breaking API change for downstream consumers. Enums marked: - zeph-llm: StreamChunk, ThinkingBlock, ChatResponse, MessagePart, LlmError - zeph-commands: CommandOutput, GoalStatusView - zeph-plugins: PluginError - zeph-sanitizer: ExfiltrationEvent - zeph-skills: MatchResult, SkillMatcherBackend Fix 14 exhaustive match arms in zeph-core, zeph-memory, and zeph-subagent that would no longer compile once the attribute was applied. Wildcards added where semantically correct; filter_map used in llm_dispatch where discarding unknown ThinkingBlock variants is the only forward-compatible option. Closes #4515, #4517, #4520
94cb85b to
7d706b5
Compare
This was referenced May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#[non_exhaustive]:StreamChunk,ThinkingBlock,ChatResponse,MessagePart,LlmError(zeph-llm),CommandOutput,GoalStatusView(zeph-commands),PluginError(zeph-plugins),ExfiltrationEvent(zeph-sanitizer),MatchResult,SkillMatcherBackend(zeph-skills)zeph-core,zeph-memory,zeph-subagentthat became non-exhaustive after the attribute was appliedRoleandMessageVisibilityin zeph-llm intentionally left exhaustive (stable 3-value enums);ChatExtrasalready had the attributeMotivation
Without
#[non_exhaustive], adding a new variant to these enums is a semver-breaking change for any downstream crate that pattern-matches on them. All 11 enums are explicitly expected to grow (new LLM providers, new content part types, new tool result shapes).Test plan
cargo build --workspace— cleancargo clippy --features desktop,ide,server,chat,pdf,scheduler --workspace -- -D warnings— cleanRUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler --locked— cleancargo nextest run --config-file .github/nextest.toml --workspace --lib --bins— 10077 passedcargo test --doc --workspace --features "desktop,ide,server,chat,pdf,scheduler"— 19 passedCloses #4515, #4517, #4520