π§ͺ [testing improvement] Add tests for segmenter detect_boundaries#433
π§ͺ [testing improvement] Add tests for segmenter detect_boundaries#433seonghobae wants to merge 8 commits into
Conversation
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
OpenCode Review Overview
--> Change Flow DAGflowchart LR
PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
Evidence --> S1["Test: test_segmenter.py"]
S1 --> I1["regression suite"]
I1 --> R1["Review risk: Test: test_segmenter.py"]
R1 --> V1["targeted test run"]
|
There was a problem hiding this comment.
Pull request overview
This PR improves unit test coverage for detect_boundaries in bandscope_analysis.sections.segmenter, specifically targeting edge cases around peak indexing, end-of-duration filtering, adaptive threshold minimums, flat novelty curves, min-segment spacing, max-segment truncation, and last-index peak handling.
Changes:
- Added multiple
detect_boundariestests covering edge-case peak handling and threshold behavior. - Added tests for boundary suppression near track end and for βtoo-closeβ boundary skipping.
- Added tests to exercise max-segment truncation behavior and last-index peak detection.
π‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
OpenCode reviewed the current-head evidence but found unresolved human review threads before approval.
- Problem: OpenCode reached an APPROVE control result, but the approval step found unresolved, non-outdated human review thread evidence on the current pull request.
- Root cause: Human review feedback can arrive after bounded model evidence is prepared, so the approval step must re-query GitHub immediately before publishing an approval.
- Fix: Address or resolve the listed human review thread(s), then re-run OpenCode on the current head.
- Regression test: Keep the approval gate querying reviewThreads(first: 100) after model output and before create_pull_review APPROVE.
Review thread evidence
Latest unresolved human review thread evidence
services/analysis-engine/tests/test_segmenter.py line 376
-
Latest human comment: @copilot-pull-request-reviewer at 2026-06-25T09:02:09Z
-
Comment URL: #433 (comment)
-
Comment excerpt:
test_detect_boundaries_all_branchesis largely redundant with the existingtest_detect_boundaries_limits_max_segmentsearlier in this file (both assert the MAX_SEGMENTS truncation), and its docstring frames the test as coverage-driven rather than behavior-driven. Consider renaming it and adding a behavioral assertion that isn't already covered (e.g., boundaries remain strictly increasing / unique after truncation), so it justifies its runtime cost and stays stable if coverage targets change. -
Result: REQUEST_CHANGES
-
Reason: unresolved human review thread(s) were present before approval.
-
Head SHA:
ed37b4d277ce39109fd8a474f7ce6d781ecabec2 -
Workflow run: 28158473223
-
Workflow attempt: 1
aff8b80 to
33d5830
Compare
There was a problem hiding this comment.
Pull request overview
OpenCode reviewed the current-head bounded evidence and found no blocking issues.
Findings
No blocking findings.
Summary
Added 7 new test cases for detect_boundaries covering: peak index validation, end-of-duration filtering, threshold floor, flat novelty handling, min segment enforcement, boundary ordering, and right-edge peaks. All tests pass with 100% coverage. Verification posture: Linter/static: passed; TDD/regression: new tests added; Coverage: 100%; Docstring coverage: 100%; DAG: test_segmenter.py["detect_boundaries"] -> boundary validation logic; PoC/execution: pytest passed; DDD/domain: audio segmentation; CDD/context: follows existing test patterns; Similar issues: none; Claim/concept check: tests match PR description; Standards search: N/A; Compatibility/convention: consistent; Breaking-change/backcompat: N/A; Performance: N/A; Developer experience: improves test coverage; User experience: N/A; Security/privacy: N/A
Verification posture: CodeGraph evidence was initialized and bounded current-head evidence reviewed for changed-file evidence including services/analysis-engine/tests/test_segmenter.py.
Linter/static: workflow/static review evidence is bounded by the current-head GitHub Checks gate and changed-file evidence.
TDD/regression: coverage execution evidence and focused changed hunks were reviewed from bounded-review-evidence.md.
Coverage: coverage execution evidence proves 100% test coverage.
Docstring coverage: coverage execution evidence proves 100% docstring coverage.
DAG: Change Flow DAG maps services/analysis-engine/tests/test_segmenter.py through bounded evidence, review risk, and required checks.
PoC/execution: coverage-evidence job executed on the current head and reported PASS.
DDD/domain: workflow and repository-governance invariants were reviewed against changed files in bounded evidence.
CDD/context: CodeGraph evidence, changed-file history, and focused hunks were reviewed from bounded-review-evidence.md.
Similar issues: changed-file history evidence was reviewed for comparable local precedents.
Claim/concept check: bounded evidence, repository source, and current-head workflow evidence were used for claims.
Standards search: standards and external-source checks are delegated to configured OpenCode web_search/Context7/DeepWiki sources when applicable; no evidence-backed standards blocker is present in bounded evidence.
Compatibility/convention: changed workflow/script conventions and compatibility surfaces were checked in bounded evidence.
Breaking-change/backcompat: deployment evidence and changed-file history were checked for backward-compatibility risk.
Performance: changed surfaces were checked for performance risk in bounded evidence.
Developer experience: changed automation, review, and maintenance surfaces were checked for helpful or obstructive DX impact in bounded evidence.
User experience: changed files did not identify a user-facing UI surface; bounded evidence was reviewed for UX impact.
Security/privacy: workflow-token, review-gate, and repository-automation security/privacy boundaries were checked in bounded evidence.
- Result: APPROVE
- Reason: Added comprehensive tests for boundary detection edge cases
- Head SHA:
b516d44119a1e4549d49750875c6171b03bc7c04 - Workflow run: 28338306434
- Workflow attempt: 1
π― What: The testing gap addressed
- Untested detect_boundaries edge cases, max segments limits, threshold bounds, and branch failures were identified in services/analysis-engine/src/bandscope_analysis/sections/segmenter.py.
π Coverage: What scenarios are now tested
- Ensures detect_boundaries ignores peaks if their index exceeds frame_times length.
- Ensures boundaries are not created within 1.0s of the total duration.
- Ensures adaptive threshold correctly defaults to 0.1 minimum.
- Ensures flat novelty curves do not produce boundaries.
- Ensures boundaries that are too close to the previous boundary are skipped.
- Covers max segment truncation by mocking a curve with over MAX_SEGMENTS bounds.
- Covers the right=float('-inf') edge case logic for end peaks.
β¨ Result: The improvement in test coverage
- services/analysis-engine/src/bandscope_analysis/sections/segmenter.py test coverage increased to 100%.
Pull request was closed
π― What: The testing gap addressed
detect_boundariesedge cases, max segments limits, threshold bounds, and branch failures were identified inservices/analysis-engine/src/bandscope_analysis/sections/segmenter.py.π Coverage: What scenarios are now tested
detect_boundariesignores peaks if their index exceedsframe_timeslength.MAX_SEGMENTSbounds.right=float('-inf')edge case logic for end peaks.β¨ Result: The improvement in test coverage
services/analysis-engine/src/bandscope_analysis/sections/segmenter.pytest coverage increased to 100%.PR created automatically by Jules for task 12849318925392101422 started by @seonghobae