refactor(common): consolidate ToolName/ProviderName/SkillName newtype boilerplate - #6193
Merged
Conversation
… boilerplate ToolName, ProviderName, and SkillName each independently reimplemented the same ~115-line block of Arc<str>-backed newtype trait impls (Default, Display, AsRef<str>, Borrow<str>, From<&str>, From<String>, FromStr, and 5 PartialEq directions), roughly 700 of the file's 950 lines. Replace the three hand-written copies with a private arc_str_newtype! macro parameterized by type name and per-type doc text, so each type keeps its own tailored rustdoc and doctests. ProviderName's is_empty/as_non_empty empty-sentinel helpers stay in a separate hand-written impl block, unchanged. Pure refactor, no public API or behavior change. Closes #5927
bug-ops
enabled auto-merge (squash)
July 12, 2026 23:51
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
ToolName,ProviderName,SkillNameincrates/zeph-common/src/types.rs) with a single privatearc_str_newtype!macro, parameterized per type via captured doc-comment text so each type keeps its own tailored rustdoc and doctests.ProviderName'sis_empty/as_non_emptyempty-sentinel helpers stay in a separate hand-writtenimplblock, unchanged.PartialEq(str/Stringon the left) was untested for all three types, andToolName::default()/SkillName::default()had no test/doctest coverage.crates/zeph-common/src/types.rs: 951 -> ~843 lines.Closes #5927
Test plan
cargo +nightly fmt --check(workspace)cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warningscargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins— 13283 passedRUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler"cargo test --doc -p zeph-common— all doc-tests passgitleaks protect --staged --no-banner --redact— no leaks