π§ͺ [Testing] Add tests for detect_capo_and_tuning - #371
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
Pull request overviewNo actionable findings or failed checks detected. PR #371 is ready for merge. FindingsNo blocking findings from OpenCode's independent review. Verification
Gate evidence
|
There was a problem hiding this comment.
Pull request overview
Adds a dedicated unit test module for the detect_capo_and_tuning heuristic in the analysis engine.
Changes:
- Introduces
test_capo.pywith multiple scenarios for capo/tuning detection outcomes.
π‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def test_detect_capo_empty_chords() -> None: | ||
| """Test with empty list of chords.""" | ||
| result = detect_capo_and_tuning([]) | ||
| assert result == {"capo": None, "tuning": "Standard"} | ||
|
|
||
|
|
||
| def test_detect_capo_drop_d() -> None: | ||
| """Test Drop D tuning detection.""" | ||
| result = detect_capo_and_tuning(["D5", "G5", "A5"]) | ||
| assert result == {"capo": 0, "tuning": "Drop D"} | ||
|
|
||
| # Mixed chords including D5 | ||
| result = detect_capo_and_tuning(["G", "C", "D5", "Em"]) | ||
| assert result == {"capo": 0, "tuning": "Drop D"} | ||
|
|
| def test_detect_capo_flat_keys_capo_1() -> None: | ||
| """Test detection of flat keys suggesting Capo 1.""" | ||
| # Exactly 2 flat keys | ||
| result = detect_capo_and_tuning(["Eb", "Bb", "Cm", "F"]) | ||
| assert result == {"capo": 1, "tuning": "Standard"} | ||
|
|
||
| # More than 2 flat keys | ||
| result = detect_capo_and_tuning(["Eb", "Bb", "Fm", "Ab"]) | ||
| assert result == {"capo": 1, "tuning": "Standard"} | ||
|
|
||
|
|
||
| def test_detect_capo_standard_tuning() -> None: | ||
| """Test standard tuning fallback for common non-flat keys.""" | ||
| # Common open chords | ||
| result = detect_capo_and_tuning(["G", "C", "D", "Em"]) | ||
| assert result == {"capo": 0, "tuning": "Standard"} | ||
|
|
||
| # Only one flat key shouldn't trigger capo 1 | ||
| result = detect_capo_and_tuning(["F", "Bb", "C", "Dm"]) | ||
| assert result == {"capo": 0, "tuning": "Standard"} | ||
|
|
||
| # Sharp keys | ||
| result = detect_capo_and_tuning(["A", "D", "E", "F#m"]) | ||
| assert result == {"capo": 0, "tuning": "Standard"} |
π― **What:** Ensure `GH_TOKEN` does not expire when waiting for other GitHub Checks to finish in the `.github/workflows/opencode-review.yml` pipeline by restoring it during retries. π **Coverage:** Impacts the OpenCode Review pipeline step. β¨ **Result:** CI checks correctly refresh the token instead of failing with a 401 Bad Credentials after 60 mins.
π― **What:** Ensure `GH_TOKEN` and `OPENCODE_APP_TOKEN` prefer the non-expiring static `secrets.OPENCODE_APP_TOKEN` instead of the OIDC generated token which expires after 60 minutes and causes HTTP 401 Bad Credentials errors when waiting for long jobs. π **Coverage:** Impacts the OpenCode Review pipeline step. β¨ **Result:** CI checks correctly refresh the token instead of failing with a 401 Bad Credentials after 60 mins.
β¦ properly assigning JOB_GITHUB_TOKEN π― **What:** Ensure `wait_for_peer_github_checks` correctly uses the non-expiring (job duration) `github.token` without globally polluting the shell's `GH_TOKEN` environment variable. π **Coverage:** Impacts the OpenCode Review pipeline step. β¨ **Result:** CI checks correctly refresh the token locally to the `gh` api execution context instead of failing with a 401 Bad Credentials after 60 mins and without clobbering the approval review token.
There was a problem hiding this comment.
Pull request overview
No actionable findings or failed checks detected. PR #371 is ready for merge.
Findings
No blocking findings from OpenCode's independent review.
Verification
- Review source: independent OpenCode review of the current checkout, focused changed hunks, and current-head GitHub Check evidence.
- Structural exploration: completed before approval; if structural exploration, changed-file inspection, or evidence completeness is missing, OpenCode must not approve.
- Result: APPROVE
- Reason: No source-backed blockers found and structural exploration completed.
Gate evidence
- Head SHA:
f80f0220c40f71998e61fa25d5419553de8b818e - Workflow run: 28159730882
- Workflow attempt: 1
|
Closing as superseded by the current capo/tuning coverage in test_chords.py and test_tuning.py. This older branch is conflicting and no longer provides a clean merge path. |
π― What: Adds missing unit tests for the heuristic function
detect_capo_and_tuningwithinservices/analysis-engine/src/bandscope_analysis/chords/capo.py.π Coverage: Covered scenarios:
β¨ Result: Test coverage for
capo.pyand overall codebase improves, contributing to the 100% test coverage metric in the CI pipeline.PR created automatically by Jules for task 9321211116098216221 started by @seonghobae