Skip to content

test(synth): add unit tests for is_positive_outcome#40

Merged
protosphinx merged 1 commit into
mainfrom
bot/synth-outcome-unit-tests
May 14, 2026
Merged

test(synth): add unit tests for is_positive_outcome#40
protosphinx merged 1 commit into
mainfrom
bot/synth-outcome-unit-tests

Conversation

@protosphinx
Copy link
Copy Markdown
Member

Why

is_positive_outcome in pm_bench/_synth.py is the ground-truth rule for the synthetic-toy outcome task (a case is positive iff it ends with delivery_confirmed). It had zero direct unit tests: the only coverage came from the full outcome-pipeline e2e test, which uses a different _is_pay stub and would not catch a regression in the actual delivery_confirmed check.

This closes that gap without touching any production code.

What

  • Six new test functions added to tests/test_synth.py
  • Covers: empty list (False), single-event positive (True), negative ending (False), delivery_confirmed not in last position (False), typical three-event positive (True)
  • Probabilistic rate check: synthetic_log(n_cases=500, seed=42) must produce a positive rate in [0.05, 0.20], consistent with WEIGHTS[4] = 0.10

Tests

  • pytest tests/test_synth.py - all 10 tests pass (4 existing + 6 new)
  • Full suite: 248 passed, 0 failed
  • ruff check tests/test_synth.py - clean

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

is_positive_outcome had no direct tests; it was only exercised through
the full outcome-pipeline e2e test. The new tests cover the four
boundary conditions: empty list, single-event positive, activity-not-last,
and ordinary negative. A probabilistic rate test verifies that the
synthetic log produces roughly the 10% positive share dictated by
PATHS/WEIGHTS for large n_cases.
@protosphinx protosphinx added the automated Opened by the daily bot label May 14, 2026 — with Claude
@protosphinx protosphinx merged commit 7251303 into main May 14, 2026
6 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