feat(stats): add min_case_length and max_case_length to LogStats#39
Merged
Conversation
Extend LogStats with min and max case length fields so callers can quickly see the full case-length distribution without a second pass. Computed in summarize() alongside mean and median; empty-log sentinel is 0, consistent with the existing mean/median behaviour. Tests cover the normal case and the empty-log edge case.
The stats command serialises LogStats fields manually. Include the two new fields so the CLI output is consistent with the dataclass and the test assertion passes.
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.
Why
LogStatsalready reports mean and median case length, but researchersinspecting a new dataset routinely also want the min and max to
understand the full distribution shape (e.g., does the log contain
single-event traces? what is the longest case?). This closes a natural
gap without changing any existing field or the public API surface.
What
pm_bench/stats.py: Addmin_case_length: intandmax_case_length: intfields toLogStats. Compute them insummarize()alongside mean and median. Empty-log sentinel is0,consistent with the existing
mean_case_length/median_case_lengthbehaviour.
tests/test_stats.py: Two new unit tests:test_summarize_min_max_case_lengths- verifies correct values ona 3-case log (lengths 1, 2, 3).
test_summarize_empty_log_min_max_zero- verifies the empty-logsentinel is
0for both fields.test_cli_stats_synthetic_toyto assert both new keysappear in the JSON output.
Tests
pytest tests/test_stats.pycovers all new paths.extended.
Self-merge gate
Generated by Claude Code