Skip to content

πŸ§ͺ [testing improvement] Add tests for segmenter detect_boundaries#433

Closed
seonghobae wants to merge 8 commits into
developfrom
jules-12849318925392101422-1e80ebd7
Closed

πŸ§ͺ [testing improvement] Add tests for segmenter detect_boundaries#433
seonghobae wants to merge 8 commits into
developfrom
jules-12849318925392101422-1e80ebd7

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

🎯 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%.

PR created automatically by Jules for task 12849318925392101422 started by @seonghobae

@google-labs-jules

Copy link
Copy Markdown

πŸ‘‹ 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

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-agent

opencode-agent Bot commented Jun 22, 2026

Copy link
Copy Markdown

OpenCode Review Overview

  • Head SHA: be095e226847024f0ab844a8597db2be58d80610
  • Workflow run: 28374296081
  • Workflow attempt: 1
  • Gate result: APPROVE (exit 0)
BoundaryDetectionEdgeCases, PoC/execution: pytest services/analysis-engine/tests/test_segmenter.py, DDD/domain: Valid, CDD/context: Matches existing test patterns, Similar issues: None found, Standards search: N/A, Compatibility/convention: Follows pytest conventions, Breaking-change/backcompat: N/A, Performance: Test-only, Developer experience: Improves test coverage, User experience: N/A, Security/privacy: N/A\n\nVerification posture: CodeGraph evidence was initialized and bounded current-head evidence reviewed for changed-file evidence including services/analysis-engine/tests/test_segmenter.py.\nLinter/static: workflow/static review evidence is bounded by the current-head GitHub Checks gate and changed-file evidence.\nTDD/regression: coverage execution evidence and focused changed hunks were reviewed from bounded-review-evidence.md.\nCoverage: coverage execution evidence reports supported repository test suites passed.\nDocstring coverage: coverage execution evidence reports configured repository docstring gates passed or docstring coverage was advisory.\nDAG: Change Flow DAG maps services/analysis-engine/tests/test_segmenter.py through bounded evidence, review risk, and required checks.\nPoC/execution: coverage-evidence job executed on the current head and reported PASS.\nDDD/domain: workflow and repository-governance invariants were reviewed against changed files in bounded evidence.\nCDD/context: CodeGraph evidence, changed-file history, and focused hunks were reviewed from bounded-review-evidence.md.\nSimilar issues: changed-file history evidence was reviewed for comparable local precedents.\nClaim/concept check: bounded evidence, repository source, and current-head workflow evidence were used for claims.\nStandards 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.\nCompatibility/convention: changed workflow/script conventions and compatibility surfaces were checked in bounded evidence.\nBreaking-change/backcompat: deployment evidence and changed-file history were checked for backward-compatibility risk.\nPerformance: changed surfaces were checked for performance risk in bounded evidence.\nDeveloper experience: changed automation, review, and maintenance surfaces were checked for helpful or obstructive DX impact in bounded evidence.\nUser experience: changed files did not identify a user-facing UI surface; bounded evidence was reviewed for UX impact.\nSecurity/privacy: workflow-token, review-gate, and repository-automation security/privacy boundaries were checked in bounded evidence.","findings":[]}

-->

Change Flow DAG

flowchart 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"]
Loading

Copilot AI review requested due to automatic review settings June 25, 2026 08:51

Copilot AI 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.

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_boundaries tests 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.

Comment thread services/analysis-engine/tests/test_segmenter.py

@opencode-agent opencode-agent 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.

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_branches is largely redundant with the existing test_detect_boundaries_limits_max_segments earlier 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

@seonghobae seonghobae force-pushed the jules-12849318925392101422-1e80ebd7 branch from aff8b80 to 33d5830 Compare June 28, 2026 17:41
opencode-agent[bot]
opencode-agent Bot previously approved these changes Jun 28, 2026

@opencode-agent opencode-agent 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.

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

@seonghobae seonghobae enabled auto-merge June 29, 2026 09:04
seonghobae and others added 4 commits June 29, 2026 20:09
🎯 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%.
@seonghobae

Copy link
Copy Markdown
Collaborator Author

Closing as superseded by #532. This branch is DIRTY and includes broad workflow, CI, package, and unrelated test churn. #532 preserves the detect_boundaries edge coverage as a focused test-only PR against current develop.

@seonghobae seonghobae closed this Jul 2, 2026
auto-merge was automatically disabled July 2, 2026 08:55

Pull request was closed

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.

2 participants