Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ Use small pull requests to verify review dispatch, review comments, and the fina
- This repository contains test material only.
- Do not commit credentials, tokens, or private company code.
- This initial README does not configure a webhook, workflow, or merge requirement.

## Unified review rollout probe: clean

This branch adds a small offline review-progress calculation fixture.
Run `python3 -m unittest discover -s tests -p 'test_*.py'`.
This pull request is test material and must not be merged.
11 changes: 11 additions & 0 deletions src/review_rollout_probe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""Small review progress helper used by the isolated OCR rollout tests."""

def completed_ratio(completed: int, total: int) -> float:
"""Return completed/total; an empty batch is fully complete.

Counts must satisfy 0 <= completed <= total. Partial progress must retain
its fractional component so a half-complete batch reports 0.5.
"""
if total < 0 or completed < 0 or completed > total:
raise ValueError("invalid review counts")
return completed / total if total else 1.0
29 changes: 29 additions & 0 deletions tests/test_review_rollout_probe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""Offline, standard-library checks for the review progress fixture."""
import unittest

from src.review_rollout_probe import completed_ratio


class ReviewProgressTests(unittest.TestCase):
def test_empty_batch_is_complete(self):
self.assertEqual(completed_ratio(0, 0), 1.0)

def test_no_completed_reviews(self):
self.assertEqual(completed_ratio(0, 4), 0.0)

def test_all_reviews_complete(self):
self.assertEqual(completed_ratio(4, 4), 1.0)

def test_partial_progress_keeps_fraction(self):
self.assertEqual(completed_ratio(1, 2), 0.5)
self.assertAlmostEqual(completed_ratio(1, 3), 1 / 3)

def test_invalid_counts_are_rejected(self):
for completed, total in [(-1, 2), (3, 2), (0, -1), (1, 0)]:
with self.subTest(completed=completed, total=total):
with self.assertRaises(ValueError):
completed_ratio(completed, total)


if __name__ == "__main__":
unittest.main()
Loading