refactor: code quality improvements across llm, config, scheduler, core#3400
Merged
refactor: code quality improvements across llm, config, scheduler, core#3400
Conversation
- Extract RouterState from RouterProvider: moves 10 shared Arc-wrapped signals (providers, turn_counter, embed_semaphore, etc.) into a dedicated RouterState struct; clone cost remains O(1) - Add RouterAware sealed extension trait: router-specific methods (set_memory_confidence, record_quality_outcome) moved out of the main LlmProvider trait into a sealed trait; silent no-op branches now emit tracing::trace! for observability; 4 unit tests added - Add tracing::info! to chat() hot path in router for turn-level observability (replaces zero-duration entered span) - Extend Migration registry to all 35 steps: previously the LazyLock<Vec<Box<dyn Migration>>> covered only steps 26-35; now covers steps 1-35 with wrapper structs for each free function; dispatch in src/commands/migrate.rs replaced 150-line match chain with a registry loop; Migration::name() returns &'static str - Fix misleading test name: registry_has_ten_entries renamed to registry_has_thirty_five_entries - Fix idempotency test: skip comment-only migrations (magic_docs) that cannot be idempotent by design - ScheduledTaskRecord: add Debug+Clone derives to ScheduledTaskInfo, Debug to JobStore; fix runner.rs to use named struct fields - zeph-core panic audit: replace bare unwrap() with descriptive expect() in plan.rs and session_digest.rs initialization paths - Fix pre-existing clippy warnings: unnecessary raw string hashes in security.rs, empty String construction in domain_match.rs, format string variable in shell/tests.rs
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
zeph-llm): 10 sharedArc-wrapped signals extracted fromRouterProviderintoRouterState; clone cost remains O(1); all field accesses updated fromself.fieldtoself.state.fieldzeph-llm): router-specific methods (set_memory_confidence,record_quality_outcome) moved out ofLlmProviderinto a sealedRouterAwareextension trait; silent no-op branches now emittracing::trace!;tracing::info!added tochat()hot path for turn-level observabilityzeph-config):Migrationtrait +LazyLock<Vec<Box<dyn Migration>>>covering all 35 sequential steps; 150-line manual dispatch chain insrc/commands/migrate.rsreplaced by registry loop;Migration::name()returns&'static strzeph-scheduler):ScheduledTaskInfo/JobStorederiveDebug/Clone;src/runner.rsupdated to named struct field accesszeph-core): bareunwrap()inplan.rsandsession_digest.rsinitialization paths replaced with descriptiveexpect("BUG: invariant")zeph-config,zeph-tools): unnecessary raw string hashes, emptyStringconstruction, format string variableTest plan
cargo nextest run --workspace --features full --lib --bins— 8859 passed, 0 failed (net +10 vs main)cargo +nightly fmt --check— cleancargo clippyon all touched crates — no new warnings