Skip to content

refactor(vault,sanitizer,config): split monolithic source files into focused submodules#3407

Merged
bug-ops merged 4 commits intomainfrom
code-quality-improvements
Apr 25, 2026
Merged

refactor(vault,sanitizer,config): split monolithic source files into focused submodules#3407
bug-ops merged 4 commits intomainfrom
code-quality-improvements

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Apr 25, 2026

Summary

  • zeph-vault: split 1302-line lib.rs into age.rs, arc.rs, env.rs, mock.rs — each backend in its own file; lib.rs now contains only the VaultProvider trait and re-exports
  • zeph-sanitizer: extract ContentSanitizer struct and all pipeline logic into sanitizer.rs; lib.rs reduced to module declarations and re-exports; fix pub mod sanitizermod sanitizer to avoid dual public path
  • zeph-config/migrate: split 5080-line migrate.rs into migrate/mod.rs (trait, registry, migration functions) and migrate/steps.rs (35 zero-size wrapper structs); replace wildcard use super::* and use steps::* with explicit imports

Additional:

  • Standardize deferred-refactor comment markers across 41 files to // TODO(review): prefix (searchable, consistent with existing TODO(B2) convention from main)
  • Fix error message casing in zeph-skills and zeph-index error enums

Excluded from this PR (per critic review)

  • Agent god-struct decomposition (P1.3) — requires dedicated SDD spec; in-code TODO at agent/mod.rs:154 explicitly defers this
  • runner.rs split — 102 #[cfg(feature)] directives; needs feature-flag inventory + multi-PR approach
  • Error taxonomy unification — AgentError::Other callsites are already minimal (3, all in tests)

Test plan

  • cargo check --workspace — clean
  • cargo clippy --workspace -- -D warnings — zero warnings
  • cargo nextest run --config-file .github/nextest.toml --workspace --features testing --lib --bins — 8500/8500 passed
  • cargo +nightly fmt --check — clean

bug-ops added 3 commits April 25, 2026 21:21
…ariants

Add ApiError { provider, status } to LlmError to replace the common pattern
of wrapping non-success HTTP responses in Other(String). Add NoActiveSession
to ChannelError to replace Other("no active chat"/"no active channel") across
telegram, discord, and slack adapters.

Move context-length detection from is_context_length_error() into a
pub(crate) body_is_context_length_error() helper used at the transport layer
in each provider (claude, openai, gemini). is_context_length_error() now only
matches ContextLengthExceeded, removing the string-heuristic fallback.

Update all affected tests to assert on the new typed error format.
Split monolithic source files into focused submodules:
- zeph-vault: extract age/arc/env/mock backends from lib.rs (1302 → ~150 lines)
- zeph-sanitizer: extract ContentSanitizer into sanitizer.rs (2313 → ~150 lines)
- zeph-config: split 5080-line migrate.rs into migrate/mod.rs + migrate/steps.rs

Replace wildcard `use super::*` and `use steps::*` in migrate split with
explicit imports to satisfy clippy::wildcard_imports.

Standardize deferred-refactor comment markers across 41 files to a
searchable `TODO(review):` prefix.

Fix error message casing in zeph-skills and zeph-index error enums.
@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 llm zeph-llm crate (Ollama, Claude) skills zeph-skills crate memory zeph-memory crate (SQLite) channels zeph-channels crate (Telegram) rust Rust code changes core zeph-core crate and removed size/XL Extra large PR (500+ lines) refactor Code refactoring without functional changes labels Apr 25, 2026
@bug-ops bug-ops enabled auto-merge (squash) April 25, 2026 19:23
@github-actions github-actions Bot added refactor Code refactoring without functional changes size/XL Extra large PR (500+ lines) labels Apr 25, 2026
@bug-ops bug-ops merged commit df49867 into main Apr 25, 2026
32 checks passed
@bug-ops bug-ops deleted the code-quality-improvements branch April 25, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channels zeph-channels crate (Telegram) 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/XL Extra large PR (500+ lines) skills zeph-skills crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant