Skip to content

test(simple): add direct unit tests for next_target and excluded (Fixes #257) - #258

Open
agarwalpranav0711 wants to merge 1 commit into
AOSSIE-Org:mainfrom
agarwalpranav0711:test/next-target-unit-tests
Open

agarwalpranav0711 wants to merge 1 commit into
AOSSIE-Org:mainfrom
agarwalpranav0711:test/next-target-unit-tests

Conversation

@agarwalpranav0711

@agarwalpranav0711 agarwalpranav0711 commented Oct 28, 2026 •

Copy link
Copy Markdown

Addressed Issues:

Fixes #257

Screenshots/Recordings:

N/A (Backend / CPU unit tests in tests/simple/test_ovl.py)

Additional Notes:

Adds direct unit testing in tests/simple/test_ovl.py for excluded() and next_target() from simple/ovl.py.

Existing coverage tests in test_ovl.py test step() batch processing when an exclusion is present, but do not directly test next_target across all edge cases (empty exclusion lists, exact boundary cursors at $s$ and $s+n$, contiguous multi-document exclusions, and overlapping spans).

Verified locally:

  • ruff check simple src/ovllm.py src/verifier.py src/publish.py src/signing.py tests/simple tests/test_verifier.py passes with zero warnings.
  • python -m pytest -q tests/simple/test_ovl.py passes 25/25 tests on CPU.

AI Usage Disclosure:

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.

Check one of the checkboxes below:

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have read the AI Usage Policy and this PR complies with this policy. I have tested the code locally and I am responsible for it.

I have used the following AI models and tools: Gemini 3.8 Flash via Google Antigravity IDE.
I used the AI assistant to help structure edge-case unit test combinations for the pure functions next_target and excluded. I executed and verified all tests locally on CPU under pytest, confirmed Ruff linting passes with zero warnings, and manually verified all assertions against the source implementation in simple/ovl.py.

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.
  • I have filled this PR template completely and carefully, and I understand that my PR may be closed without review otherwise.

Summary by CodeRabbit

  • Tests
    • Expanded test coverage for target selection and exclusion handling across empty, adjacent, overlapping, and boundary-range scenarios. Tests also verify that exclusions are sorted and filtered by phase.

AOSSIE-Org#257)

Signed-off-by: Pranav Agarwal <agarwalpranav0711@gmail.com>
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 364fb88 and a1c1f1c.

Files selected for processing: 1
  • tests/simple/test_ovl.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The change adds direct unit tests for exclusion sorting and phase filtering, and for next_target behavior with empty, adjacent, separated, and overlapping ranges.

Changes

Exclusion helper tests

Layer / File(s) Summary
Exclusion selection and cursor behavior
tests/simple/test_ovl.py
Tests check that exclusions are sorted and filtered by phase. They also cover next_target with empty ranges, varied cursor positions, range boundaries, adjacent ranges, separated ranges, and overlapping ranges.

Priority: Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Suggested reviewers: ryoari

Merge Risk: Minimal · up to a1c1f

No merge-blocking issue was identified in the added tests.

Pre-merge checks: Passed 4
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the added direct unit tests for next_target and excluded.
Linked Issues check Passed Issue #257 (direct, open) requires a CPU-only unit test suite for excluded() and next_target() in simple/ovl.py. The head version of tests/simple/test_ovl.py adds class NextTargetAndExclusionTests wit…
Out of Scope Changes check Passed The supplied change scope lists one changed file, tests/simple/test_ovl.py, with 52 added lines and no removed lines. Every added element is a test for excluded() or next_target() from issue #257. The…
Full details: Linked Issues check

Explanation

Issue #257 (direct, open) requires a CPU-only unit test suite for excluded() and next_target() in simple/ovl.py. The head version of tests/simple/test_ovl.py adds class NextTargetAndExclusionTests with these tests:

  • Sorting and phase filtering: test_excluded_sorts_and_filters_by_phase checks sorted output [(10, 5), (50, 10)], a conversation phase that returns [], and a missing exclude key that returns [].
  • Empty ranges: test_next_target_empty_ranges checks next_target(10, []) == 10.
  • Cursors before, inside, and after a range: test_next_target_cursor_before_and_after_range and test_next_target_cursor_inside_range, using range (10, 5).
  • Exact boundaries: test_next_target_boundaries_exact_s_and_exact_end checks cursor 10 returns 15 and cursor 15 returns 15.
  • Contiguous ranges: test_next_target_back_to_back_contiguous_ranges uses [(10, 5), (15, 7)] and expects 22 from cursors 10, 12, 15, and 22.
  • Separated ranges: test_next_target_multiple_spaced_ranges uses [(10, 5), (30, 10)].
  • Overlapping ranges: test_next_target_overlapping_ranges uses [(10, 8), (14, 6)] and expects 20 from cursors 10 and 15. I traced the source logic for this case and the expected values match.
    The tests import the real module through importlib and do not add dependencies. The head source of excluded() and next_target() matches the issue text. Every requirement in #257 has a matching test. The PR summary reports 25/25 passing tests. I did not run the tests; the assessment relies on reading the code. The base revision of tests/simple/test_ovl.py was not readable, so the exact added lines rest on the supplied +52/-0 summary and the head file.
Full details: Out of Scope Changes check

Explanation

The supplied change scope lists one changed file, tests/simple/test_ovl.py, with 52 added lines and no removed lines. Every added element is a test for excluded() or next_target() from issue #257. The source functions in simple/ovl.py are not changed. The PR description mentions ruff runs on other paths. Those runs are verification steps and do not add changes. The whole-PR file list from the base revision was not readable, so this verdict relies on the supplied change summary.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

test(simple): add direct unit tests for next_target and excluded in simple/ovl.py

1 participant