Skip to content

test(score): add edge-case tests for score boundary conditions - #55

Merged
protosphinx merged 1 commit into
mainfrom
bot/score-edge-tests
Sep 3, 2026
Merged

protosphinx merged 1 commit into
mainfrom
bot/score-edge-tests

Conversation

@protosphinx

Copy link
Copy Markdown
Member

Why

tests/test_score.py covers the happy path and several error paths
for all five scoring functions, but a few boundary conditions are not
exercised. These gaps are easy to hit accidentally during a refactor
and would be caught immediately by the new tests.

What

New file tests/test_score_edge.py with 9 targeted tests:

  • score_next_event: all predictions miss top-3 (top3=0.0); truth at
    exactly rank 3 (counts for top3, not top1); truth at rank 4 (misses
    both)
  • score_conformance: perfect model/test overlap (fitness=precision=
    fscore=1.0); single-transition perfect match
  • score_bottleneck: k < n_transitions with a correct top-k ranking
    (NDCG@k=1.0); k=1 with the correct top prediction
  • score_remaining_time: n=1 minimum valid input; zero-prediction
    model (predictions can be 0.0)

Tests

  • New file: tests/test_score_edge.py, 9 tests
  • All 9 new tests pass; full suite: 328 passed, 0 failed
  • ruff check tests/test_score_edge.py: clean

Self-merge gate

  • all CI checks pass
  • LOC delta < 250 (107 lines added, 0 removed)
  • no public-API surface change (no changes to pm_bench/__init__.py)
  • no runtime-dependency additions
  • no workflow file changes
  • tests added (new tests/test_score_edge.py, 9 tests)

🤖 Daily bot


Generated by Claude Code

Covers paths not exercised by the existing test_score.py:
- score_next_event: all predictions miss top-3 (top3=0.0), truth at
  rank 3 (counts for top3 only), truth at rank 4 (misses top3)
- score_conformance: perfect model/test overlap (fscore=1.0),
  single-transition perfect match
- score_bottleneck: k < n_transitions with correct top-k, k=1 with
  correct top prediction
- score_remaining_time: n=1 minimum input, zero-prediction model

All 9 new tests pass; full suite: 328 passed, 0 failed.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-03T16:11:18.909043Z 57c4cb3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@protosphinx
protosphinx merged commit a2ffde6 into main Sep 3, 2026
6 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 57c4cb3ac7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/test_score_edge.py
Comment on lines +77 to +78
preds = {("a", "b"): 10.0, ("c", "d"): 5.0, ("e", "f"): 1.0}
s = score_bottleneck(preds, truth, k=2)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Make the cutoff test distinguish top-k from full ranking

If score_bottleneck regresses to calculating DCG over every transition instead of slicing at k, this test still passes because preds gives a perfect ranking across all three transitions. Use at least four transitions with the top two ordered correctly and the tail deliberately misordered; then the expected NDCG@2 remains 1.0 while an implementation that ignores the cutoff produces a lower score.

Useful? React with 👍 / 👎.

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