refactor(config): remove #[cfg(test)] type aliases for old config types#128
Merged
stephenleo merged 6 commits intoMar 27, 2026
Merged
Conversation
…sed HasThresholdStyle impls - Merged CostSubfieldConfig and ContextWindowSubfieldConfig into a unified SubfieldConfig struct with #[cfg(test)] type aliases for backward compat. - Added HasThresholdStyle trait and impl_has_threshold_style! macro to config.rs; only ContextWindowConfig gets an impl (the three unused CostConfig, ContextBarConfig, UsageLimitsConfig impls are intentionally absent per Story 3.1). - Added render_styled_value() to format.rs with six unit tests covering all paths (format, threshold, invert_threshold, parent fallback, no-sub/no-parent). - Replaced all inline threshold/style boilerplate in cost.rs (5 functions) and context_window.rs (8 functions) with render_styled_value() calls. - cargo build, cargo test (65/65), and cargo clippy -- -D warnings all exit 0. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…shold-style-impls' into story-3-4-remove-cfg-test-type-aliases-for-old-config-types
… and ContextWindowSubfieldConfig Replace all test usages with SubfieldConfig directly so test code honestly reflects the real type and future type divergence is not masked by silent-compiling aliases. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove the dead `impl_has_threshold_style!` macro (defined but never invoked) from config.rs and relocate the `#[cfg(test)] use SubfieldConfig` import in cost.rs from file-top to inside the test module where it belongs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
4 tasks
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
#[cfg(test)] pub type CostSubfieldConfigandContextWindowSubfieldConfigaliases fromsrc/config.rsnow that all test code usesSubfieldConfigdirectlyCostSubfieldConfiginsrc/modules/cost.rstests withSubfieldConfigContextWindowSubfieldConfiginsrc/modules/context_window.rstests withSubfieldConfigimpl_has_threshold_style!macro fromsrc/config.rs(dead code found in code review)Test plan
cargo clippy -- -D warnings— cleancargo fmt --check— cleancargo test— 319 unit tests + 66 integration tests, all passcargo install --path .— installs successfully🤖 Generated with Claude Code