Skip to content

refactor(config): remove #[cfg(test)] type aliases for old config types#128

Merged
stephenleo merged 6 commits into
mainfrom
story-3-4-remove-cfg-test-type-aliases-for-old-config-types
Mar 27, 2026
Merged

refactor(config): remove #[cfg(test)] type aliases for old config types#128
stephenleo merged 6 commits into
mainfrom
story-3-4-remove-cfg-test-type-aliases-for-old-config-types

Conversation

@stephenleo
Copy link
Copy Markdown
Owner

Summary

  • Deletes the backwards-compatible #[cfg(test)] pub type CostSubfieldConfig and ContextWindowSubfieldConfig aliases from src/config.rs now that all test code uses SubfieldConfig directly
  • Replaces all ~9 usages of CostSubfieldConfig in src/modules/cost.rs tests with SubfieldConfig
  • Replaces all ~16 usages of ContextWindowSubfieldConfig in src/modules/context_window.rs tests with SubfieldConfig
  • Removes the now-unused impl_has_threshold_style! macro from src/config.rs (dead code found in code review)

Test plan

  • cargo clippy -- -D warnings — clean
  • cargo fmt --check — clean
  • cargo test — 319 unit tests + 66 integration tests, all pass
  • cargo install --path . — installs successfully

🤖 Generated with Claude Code

stephenleo and others added 6 commits March 27, 2026 10:29
…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>
@claude
Copy link
Copy Markdown

claude Bot commented Mar 27, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@stephenleo stephenleo merged commit 2bf3ebd into main Mar 27, 2026
3 checks passed
@stephenleo stephenleo deleted the story-3-4-remove-cfg-test-type-aliases-for-old-config-types branch March 27, 2026 12:47
stephenleo added a commit that referenced this pull request Mar 27, 2026
…test-type-aliases-for-old-config-types"

This reverts commit 2bf3ebd, reversing
changes made to d573141.
stephenleo added a commit that referenced this pull request Mar 27, 2026
revert: undo PR #126 and PR #128 (boilerplate refactor and type alias removal)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant