Skip to content

refactor(common): consolidate ToolName/ProviderName/SkillName newtype boilerplate - #6193

Merged
bug-ops merged 1 commit into
mainfrom
feat/5927-arc-str-newtype-dedup
Jul 12, 2026
Merged

refactor(common): consolidate ToolName/ProviderName/SkillName newtype boilerplate#6193
bug-ops merged 1 commit into
mainfrom
feat/5927-arc-str-newtype-dedup

Conversation

@bug-ops

@bug-ops bug-ops commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replaces three independently hand-written ~115-line Arc-backed newtype trait-impl blocks (ToolName, ProviderName, SkillName in crates/zeph-common/src/types.rs) with a single private arc_str_newtype! macro, parameterized per type via captured doc-comment 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.
  • Closes two pre-existing test-coverage gaps surfaced during review: reverse-direction PartialEq (str/String on the left) was untested for all three types, and ToolName::default()/SkillName::default() had no test/doctest coverage.
  • Pure refactor — no public API or behavior change. 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 warnings
  • cargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins — 13283 passed
  • RUSTFLAGS="-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 pass
  • gitleaks protect --staged --no-banner --redact — no leaks

… 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
@github-actions github-actions Bot added refactor Code refactoring without functional changes size/XL Extra large PR (500+ lines) documentation Improvements or additions to documentation rust Rust code changes labels Jul 12, 2026
@bug-ops
bug-ops enabled auto-merge (squash) July 12, 2026 23:51
@bug-ops
bug-ops merged commit 79875c0 into main Jul 12, 2026
43 checks passed
@bug-ops
bug-ops deleted the feat/5927-arc-str-newtype-dedup branch July 12, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation refactor Code refactoring without functional changes rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ToolName/ProviderName/SkillName newtypes triplicate ~230 lines of identical Arc<str> boilerplate

1 participant