Skip to content
This repository was archived by the owner on Jul 30, 2026. It is now read-only.

test(core): split large inline test modules - #107

Merged
makoMakoGo merged 1 commit into
personal/local-clientsfrom
codex/issue-95-split-large-tests
Jul 4, 2026
Merged

test(core): split large inline test modules#107
makoMakoGo merged 1 commit into
personal/local-clientsfrom
codex/issue-95-split-large-tests

Conversation

@makoMakoGo

@makoMakoGo makoMakoGo commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Move the large tokscale-core root test module into src/lib_tests.rs.
  • Move the large pricing lookup test module into src/pricing/lookup_tests.rs.
  • Leave implementation logic unchanged; this PR only splits inline test modules out of implementation files.

Closes #95

Built on the current personal/local-clients baseline.

Validation

  • cargo test -p tokscale-core -- --list | wc -l -> 1084, matching the current personal/local-clients baseline
  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets
  • cargo test --workspace (1886 passed, 4 ignored)
  • wc -l crates/tokscale-core/src/lib.rs crates/tokscale-core/src/lib_tests.rs crates/tokscale-core/src/pricing/lookup.rs crates/tokscale-core/src/pricing/lookup_tests.rs:
    • crates/tokscale-core/src/lib.rs -> 1288
    • crates/tokscale-core/src/lib_tests.rs -> 5604
    • crates/tokscale-core/src/pricing/lookup.rs -> 1932
    • crates/tokscale-core/src/pricing/lookup_tests.rs -> 3322
  • git diff --name-status fork/personal/local-clients...HEAD shows only:
    • crates/tokscale-core/src/lib.rs
    • crates/tokscale-core/src/lib_tests.rs
    • crates/tokscale-core/src/pricing/lookup.rs
    • crates/tokscale-core/src/pricing/lookup_tests.rs

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@makoMakoGo, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 7 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 64e252d6-1313-4b04-9d87-528e7a2472ea

📥 Commits

Reviewing files that changed from the base of the PR and between 9435e6a and d585eef.

📒 Files selected for processing (4)
  • crates/tokscale-core/src/lib.rs
  • crates/tokscale-core/src/lib_tests.rs
  • crates/tokscale-core/src/pricing/lookup.rs
  • crates/tokscale-core/src/pricing/lookup_tests.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/issue-95-split-large-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@makoMakoGo makoMakoGo left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed against #95.

No blocking findings.

What I checked:

  • #95 asks for a pure test-file organization change: move the large inline test modules out of crates/tokscale-core/src/lib.rs and crates/tokscale-core/src/pricing/lookup.rs, without changing implementation logic or opportunistically refactoring tests.
  • This PR only changes the expected four files: lib.rs, lib_tests.rs, pricing/lookup.rs, and pricing/lookup_tests.rs.
  • The implementation files now only retain the #[cfg(test)] #[path = ...] mod tests; hook, while the moved test files preserve the same parent-module access pattern (use super::... / use super::*). This is the cleanest version of the split within the scope of the issue; no extra abstraction or compatibility layer was introduced.
  • The compare stats are consistent with a pure extraction rather than behavior work: large deletions from the two implementation files, matching additions in the two new test files, and no unrelated files touched.
  • The PR-reported validation says the tokscale-core test listing stayed unchanged, and the current head has a successful GitHub Actions test workflow.

Because the PR is still draft and stacked on #106, I am leaving this as a non-blocking review comment rather than an approval. Once #106 lands or this PR is retargeted to the landing branch, I would be comfortable approving this.

@makoMakoGo
makoMakoGo force-pushed the codex/issue-97-split-cli-main branch 3 times, most recently from 22b3221 to 212d84b Compare July 4, 2026 03:46
@makoMakoGo
makoMakoGo changed the base branch from codex/issue-97-split-cli-main to personal/local-clients July 4, 2026 04:11
@makoMakoGo
makoMakoGo force-pushed the codex/issue-95-split-large-tests branch from b1f0367 to d585eef Compare July 4, 2026 04:11
@codspeed-hq

codspeed-hq Bot commented Jul 4, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 27 untouched benchmarks


Comparing codex/issue-95-split-large-tests (d585eef) with personal/local-clients (9435e6a)

Open in CodSpeed

@makoMakoGo makoMakoGo left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed after the rebuild onto the current personal/local-clients baseline.

GitHub will not let the current account approve this PR because it is treated as the PR owner's account, but from code-review perspective this is approved.

Reasoning:

  • The PR now targets personal/local-clients directly and is one commit ahead of that base.
  • The diff is still exactly the narrow #95 shape: only crates/tokscale-core/src/lib.rs, crates/tokscale-core/src/lib_tests.rs, crates/tokscale-core/src/pricing/lookup.rs, and crates/tokscale-core/src/pricing/lookup_tests.rs changed.
  • The implementation files now retain only the #[cfg(test)] #[path = ...] mod tests; hooks. That preserves the tests as child modules of the original implementation modules, so private access and test names stay stable without adding abstraction.
  • The extracted test files keep the same use super::... / use super::* access model and appear to be a pure module-boundary move rather than a semantic rewrite.
  • This matches the issue decision: split oversized inline tests out of implementation files, do not change implementation logic, do not opportunistically refactor tests.
  • Current head CI is green, and the PR validation reports the core test list count still matches the current baseline.

No blocking findings.

@makoMakoGo
makoMakoGo marked this pull request as ready for review July 4, 2026 04:39
@makoMakoGo
makoMakoGo merged commit 4f47596 into personal/local-clients Jul 4, 2026
9 checks passed
@makoMakoGo
makoMakoGo deleted the codex/issue-95-split-large-tests branch July 4, 2026 15:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

R4: 将大型实现文件中的测试拆到独立文件

1 participant