Skip to content

feat(stats): add min_case_length and max_case_length to LogStats#39

Merged
protosphinx merged 2 commits into
mainfrom
bot/stats-min-max-case-length
May 7, 2026
Merged

feat(stats): add min_case_length and max_case_length to LogStats#39
protosphinx merged 2 commits into
mainfrom
bot/stats-min-max-case-length

Conversation

@protosphinx
Copy link
Copy Markdown
Member

Why

LogStats already reports mean and median case length, but researchers
inspecting 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: Add min_case_length: int and
    max_case_length: int fields to LogStats. Compute them in
    summarize() alongside mean and median. Empty-log sentinel is 0,
    consistent with the existing mean_case_length / median_case_length
    behaviour.
  • tests/test_stats.py: Two new unit tests:
    • test_summarize_min_max_case_lengths - verifies correct values on
      a 3-case log (lengths 1, 2, 3).
    • test_summarize_empty_log_min_max_zero - verifies the empty-log
      sentinel is 0 for both fields.
    • Extended test_cli_stats_synthetic_toy to assert both new keys
      appear in the JSON output.

Tests

  • pytest tests/test_stats.py covers all new paths.
  • No existing test needed modification; two tests added, one assertion
    extended.

Self-merge gate

  • all CI checks pass
  • LOC delta < 250 (added + removed)
  • no public-API surface change
  • no runtime-dependency additions
  • no workflow file changes
  • tests added or extended

Generated by Claude Code

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.
@protosphinx protosphinx added the automated Opened by the daily bot label May 7, 2026 — with Claude
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.
@protosphinx protosphinx merged commit 5484a05 into main May 7, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated Opened by the daily bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant