fix: fix ut for sparse builder dump time#237
Merged
richyreachy merged 3 commits intomainfrom Mar 17, 2026
Merged
Conversation
Collaborator
Author
|
@greptile |
Collaborator
Author
|
@greptile |
Collaborator
Author
|
@greptile |
iaojnh
approved these changes
Mar 17, 2026
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.
fix ut for sparse builder dump time
Greptile Summary
This PR disables a flaky unit test assertion (
ASSERT_GT(stats.dumped_costtime(), 0UL)) inTestHalfFloatConverterand adds a missing newline at EOF. The dump-time assertion was likely failing intermittently on machines where the dump completes faster than the timer resolution allows.Key changes:
ASSERT_GT(stats.dumped_costtime(), 0UL)assertion is commented out rather than removed, leaving dead commented-out code in the test suite with no explanation of why it was disabled.Confidence Score: 3/5
Important Files Changed
ASSERT_GT(stats.dumped_costtime(), 0UL)is commented out instead of being properly removed, and a missing newline at EOF is fixed. The commented-out assertion weakens test coverage without explanation.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[TestHalfFloatConverter] --> B[Create & init builder] B --> C[Train on converted_holder] C --> D[Build on converted_holder] D --> E[Dump via FileDumper] E --> F[Assert stats counts] F --> G[Assert trained_costtime == 0] G --> H[Assert built_costtime == 0] H --> I{Assert dumped_costtime > 0} I -- "REMOVED in this PR (commented out)" --> J[⚠️ No coverage for dump time] I -- "Expected: records elapsed time" --> K[✅ Validate dump timing] J --> L[Cleanup & rebuild with holder2] L --> M[Dump again via FileDumper2] M --> N[Assert stats counts for rebuild] N --> O[No dumped_costtime assertion in rebuild section either]Comments Outside Diff (1)
tests/core/algorithm/flat_sparse/flat_sparse_builder_test.cc, line 291-296 (link)dumped_costtimeassertion in second dump cycleThe first dump cycle (around line 250) originally verified that
stats.dumped_costtime() > 0. The second rebuild-and-dump cycle (starting at line 285) never had any assertion fordumped_costtime()at all. If the concern about timer resolution applies to the first dump, it equally applies here — but it also means this second cycle has never had any coverage of the dump timing stat. Ifdumped_costtimeis worth asserting, it should be consistent across both dump cycles; if it's not reliable enough to assert, a comment explaining why (e.g., "timer resolution too coarse on fast CI machines") would help readers understand the omission.Last reviewed commit: f5880b7