Skip to content

refactor(llm,commands,plugins,sanitizer,skills): add #[non_exhaustive] to extensible pub enums#4533

Merged
bug-ops merged 1 commit into
mainfrom
4515-non-exhaustive-enums
May 28, 2026
Merged

refactor(llm,commands,plugins,sanitizer,skills): add #[non_exhaustive] to extensible pub enums#4533
bug-ops merged 1 commit into
mainfrom
4515-non-exhaustive-enums

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented May 28, 2026

Summary

  • Mark 11 extensible pub enums across 6 crates with #[non_exhaustive]: StreamChunk, ThinkingBlock, ChatResponse, MessagePart, LlmError (zeph-llm), CommandOutput, GoalStatusView (zeph-commands), PluginError (zeph-plugins), ExfiltrationEvent (zeph-sanitizer), MatchResult, SkillMatcherBackend (zeph-skills)
  • Fix 14 exhaustive match arms in zeph-core, zeph-memory, zeph-subagent that became non-exhaustive after the attribute was applied
  • Role and MessageVisibility in zeph-llm intentionally left exhaustive (stable 3-value enums); ChatExtras already had the attribute

Motivation

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 — clean
  • cargo clippy --features desktop,ide,server,chat,pdf,scheduler --workspace -- -D warnings — clean
  • RUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler --locked — clean
  • cargo nextest run --config-file .github/nextest.toml --workspace --lib --bins — 10077 passed
  • cargo test --doc --workspace --features "desktop,ide,server,chat,pdf,scheduler" — 19 passed

Closes #4515, #4517, #4520

@github-actions github-actions Bot added refactor Code refactoring without functional changes documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) skills zeph-skills crate memory zeph-memory crate (SQLite) rust Rust code changes core zeph-core crate size/M Medium PR (51-200 lines) and removed refactor Code refactoring without functional changes labels May 28, 2026
…] 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
@bug-ops bug-ops force-pushed the 4515-non-exhaustive-enums branch from 94cb85b to 7d706b5 Compare May 28, 2026 16:40
@bug-ops bug-ops enabled auto-merge (squash) May 28, 2026 16:40
@github-actions github-actions Bot added the refactor Code refactoring without functional changes label May 28, 2026
@bug-ops bug-ops merged commit 342926c into main May 28, 2026
32 checks passed
@bug-ops bug-ops deleted the 4515-non-exhaustive-enums branch May 28, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) memory zeph-memory crate (SQLite) refactor Code refactoring without functional changes rust Rust code changes size/M Medium PR (51-200 lines) skills zeph-skills crate

Projects

None yet

1 participant