Skip to content

refactor(epic-1973): Extract config loaders from zeph-core (Phase 1b)#2006

Merged
bug-ops merged 4 commits intomainfrom
phase-1b-config-loaders
Mar 18, 2026
Merged

refactor(epic-1973): Extract config loaders from zeph-core (Phase 1b)#2006
bug-ops merged 4 commits intomainfrom
phase-1b-config-loaders

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 18, 2026

Summary

Epic #1973 Phase 1b: Extract config loaders (Config::load, env/TOML parsing) from zeph-core god crate into zeph-config (Layer 1).

This completes the second phase of god crate decomposition, following Phase 1a (pure config types extraction).

Changes

Moved to zeph-config:

  • Secret + VaultError → zeph-common/src/secret.rs (Layer 0)
  • Config struct + ResolvedSecrets → zeph-config/src/root.rs
  • ConfigError → zeph-config/src/error.rs
  • Config::load(), validate() → zeph-config/src/loader.rs
  • apply_env_overrides() → zeph-config/src/env.rs
  • ConfigMigrator → zeph-config/src/migrate.rs

New in zeph-core:

  • SecretResolver extension trait (preserves method syntax for resolve_secrets)

Deleted from zeph-core:

  • zeph-core/src/config/env.rs (moved to zeph-config)
  • zeph-core/src/config/migrate.rs (moved to zeph-config)
  • zeph-core/src/config/types/ (moved in Phase 1a, snapshots now removed)

Metrics

LOC reduction:

  • zeph-core: 79,383 → 73,510 lines (-5,873 lines)
  • zeph-config: 31,000 → 35,900 lines (+4,900 lines)

Test coverage: 6,078 tests pass, 15 skipped

Build verification: ✅ check, ✅ clippy, ✅ nextest

Validation

✅ Code review: APPROVED
✅ Performance review: OK (removed unused zeph-skills, regex deps)
✅ Security audit: SECURE
✅ Implementation review: APPROVED

Closes #1973

bug-ops added 3 commits March 18, 2026 22:40
Phase 1a: Create new zeph-config (Layer 1) crate with all pure-data config types.

Changes:
- Create crates/zeph-config/ with 16 modules (config, orchestration, subagent, sanitizer, features, etc.)
- Move pure-data types: SecurityConfig, RateLimitConfig, TaskEvent, TaskId, TaskOutcome, MemoryScope, PermissionMode, etc.
- zeph-core re-exports all types at original paths (backward compatible)
- Delete 9 orphaned type definition files from zeph-core/src/config/types/
- Widen escape_delimiter_tags, apply_spotlight to pub (required by agent/context/assembly.rs)
- Add SubAgentHandle::for_test() helper for agent tests
- Update root Cargo.toml to include zeph-config in workspace

Test results: 6,160 tests pass, 0 failures, feature gates preserved.

Closes #1973 Phase 1a
…rate to zeph-config

Phase 1b of architecture audit (EPIC-01): move Config struct, loader, validator,
env-var overrides, and migrate module from zeph-core to zeph-config.

Changes:
- zeph-common: add Secret newtype + VaultError to shared primitives (Layer 0).
  Avoids circular dep: both zeph-config and zeph-core can now use Secret.
- zeph-config: add Config + ResolvedSecrets (root.rs), ConfigError (error.rs),
  Config::load() + Config::validate() + normalize_legacy_runtime_defaults() (loader.rs),
  Config::apply_env_overrides() (env.rs), ConfigMigrator (migrate.rs).
  Move config/default.toml from zeph-core to zeph-config.
- zeph-core: replace Config/ResolvedSecrets/ConfigError with re-exports from zeph-config.
  Extract resolve_secrets() into SecretResolver trait (impl for Config).
  Callers add `use zeph_core::config::SecretResolver` to bring the trait into scope.
- Remove dead code: zeph-core/src/config/types/ directory (orphaned since Phase 1a),
  zeph-core/src/config/env.rs, zeph-core/src/config/migrate.rs.

Net LOC reduction in zeph-core: ~5,873 lines (79,383 -> 73,510).
All 6078 tests pass. Clippy clean. fmt clean.
- Remove unused zeph-skills dep from zeph-config (confirmed no imports)
- Remove unused regex dep from zeph-config (only appeared in doc comments)
- Delete orphaned snapshot files from zeph-core/src/config/snapshots/
  (stale artifacts from Phase 1a, tests deleted since types/ removed)
@bug-ops bug-ops added core zeph-core crate size/L Large PR (201-500 lines) refactor Code refactoring without functional changes labels Mar 18, 2026
@github-actions github-actions bot added documentation Improvements or additions to documentation rust Rust code changes dependencies Dependency updates size/XL Extra large PR (500+ lines) and removed size/L Large PR (201-500 lines) labels Mar 18, 2026
@github-actions github-actions bot removed the documentation Improvements or additions to documentation label Mar 18, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 18, 2026 22:38
@bug-ops bug-ops merged commit 0812969 into main Mar 18, 2026
20 checks passed
@bug-ops bug-ops deleted the phase-1b-config-loaders branch March 18, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate dependencies Dependency updates 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.

EPIC: zeph-core God Crate Decomposition

1 participant