Skip to content

🧹 refactor: Extract section validation logic to shared utility - #249

Merged
seonghobae merged 9 commits into
developfrom
refactor/extract-section-validation-12150265503797372928
Jun 12, 2026
Merged

🧹 refactor: Extract section validation logic to shared utility#249
seonghobae merged 9 commits into
developfrom
refactor/extract-section-validation-12150265503797372928

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

🎯 What: Extracted duplicated section validation logic from roles/extractor.py, ranges/analyzer.py, and chords/analyzer.py into a new validate_section utility function in sections/utils.py.
💡 Why: This reduces code duplication and improves maintainability by centralizing the validation logic and logger warning.
Verification: Verified by ensuring the refactored code passes all 272 existing tests in the analysis-engine package with no regressions.
Result: Improved codebase readability and maintainability without altering functionality.


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

This change improves code maintainability by extracting duplicated
section validation logic from various analyzer modules into a single
shared utility function `validate_section` in `sections/utils.py`.
@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.

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@seonghobae, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 44 minutes and 43 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: def244df-3f09-4d63-981b-316fc456402f

📥 Commits

Reviewing files that changed from the base of the PR and between 5c03df7 and e3136e7.

📒 Files selected for processing (5)
  • services/analysis-engine/src/bandscope_analysis/chords/analyzer.py
  • services/analysis-engine/src/bandscope_analysis/ranges/analyzer.py
  • services/analysis-engine/src/bandscope_analysis/roles/extractor.py
  • services/analysis-engine/src/bandscope_analysis/sections/__init__.py
  • services/analysis-engine/src/bandscope_analysis/sections/utils.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/extract-section-validation-12150265503797372928
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch refactor/extract-section-validation-12150265503797372928

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


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 and usage tips.

This addresses the missing module-level docstring in
`src/bandscope_analysis/sections/utils.py` and organizes imports
to fix the D100 and I001 ruff linting errors.

@greptile-apps greptile-apps 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.

This review was skipped because it would exceed your organization's monthly flex usage limit. Raise the limit in billing settings or wait until the next billing period resets limits.

This addresses the `E501 Line too long` linting errors in
`scripts/release/package_desktop_artifact.py` by reformatting the code
to ensure lines are under the 100 character limit.
@seonghobae
seonghobae enabled auto-merge June 10, 2026 14:04
@seonghobae

Copy link
Copy Markdown
Collaborator Author

@coderabbitai resolve

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Rate Limit Exceeded

@seonghobae have exceeded the limit for the number of chat messages per hour. Please wait 3 minutes and 0 seconds before sending another message.

@google-labs-jules

Copy link
Copy Markdown

@coderabbitai resolve

I have pushed an update to fix the CI failure. It appears that the trivy-fs-scan was failing because the root package-lock.json contained an outdated version of brace-expansion. I have updated minimatch in package.json to require a newer version, forcing brace-expansion to upgrade to a secure version in package-lock.json.

This change updates the `minimatch` dependency to `^10.2.4` to force
an update to `brace-expansion`, resolving a moderate vulnerability
caught by the `trivy-fs-scan` GitHub Actions job.

This also includes the earlier `D100`, `I001`, and `E501` lint fixes.
@seonghobae

Copy link
Copy Markdown
Collaborator Author

@coderabbitai resolve

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 11, 2026
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Comments resolved and changes approved.

@google-labs-jules

Copy link
Copy Markdown

@coderabbitai resolve

I have successfully run npm audit fix which updated the package-lock.json and resolved the moderate vulnerability in the brace-expansion transitive dependency (which was preventing the CI trivy-fs-scan job from passing). I also ran local CI checks and they are green. Pushed as requested!

seonghobae and others added 5 commits June 11, 2026 03:17
This change updates the `minimatch` dependency to `^10.2.4` to force
an update to `brace-expansion`, resolving a moderate vulnerability
caught by the `trivy-fs-scan` GitHub Actions job.

This also includes the earlier `D100`, `I001`, and `E501` lint fixes.
…ection-validation-12150265503797372928

# Conflicts:
#	services/analysis-engine/src/bandscope_analysis/roles/extractor.py
@seonghobae

Copy link
Copy Markdown
Collaborator Author

Merged current develop and rebuilt this as the narrow shared section-validation refactor.

Validation:

  • uv run --project services/analysis-engine pytest services/analysis-engine/tests/test_chords.py services/analysis-engine/tests/test_ranges.py services/analysis-engine/tests/test_roles.py services/analysis-engine/tests/test_roles_ml.py -q -> 43 passed.
  • (cd services/analysis-engine && uv run ruff check src tests) -> passed.
  • (cd services/analysis-engine && uv run ruff format --check src tests) -> passed.
  • python3 scripts/checks/verify_supply_chain.py -> passed.
  • Guard check for stale script/workflow/lockfile changes -> passed.

Notes:

  • Final diff is only chords/analyzer.py, ranges/analyzer.py, roles/extractor.py, sections/__init__.py, and new sections/utils.py.
  • Kept the current range overlap optimization from develop.
  • Kept the current RoleExtractor _build_roles structure from develop, avoiding the old N+1 role-building regression.
  • Dropped stale script formatting, workflow, supply-chain parser, YouTube, lockfile, and unrelated develop drift from this PR.

@coderabbitai approve

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

@seonghobae Thank you for the thorough validation summary — all checks passing, clean scope, and the N+1 regression avoided. Approving now.

(‾▿‾) 🐇✨

✅ Action performed

Comments resolved and changes approved.

@google-labs-jules

Copy link
Copy Markdown

Merged current develop and rebuilt this as the narrow shared section-validation refactor.

Validation:

  • uv run --project services/analysis-engine pytest services/analysis-engine/tests/test_chords.py services/analysis-engine/tests/test_ranges.py services/analysis-engine/tests/test_roles.py services/analysis-engine/tests/test_roles_ml.py -q -> 43 passed.
  • (cd services/analysis-engine && uv run ruff check src tests) -> passed.
  • (cd services/analysis-engine && uv run ruff format --check src tests) -> passed.
  • python3 scripts/checks/verify_supply_chain.py -> passed.
  • Guard check for stale script/workflow/lockfile changes -> passed.

Notes:

  • Final diff is only chords/analyzer.py, ranges/analyzer.py, roles/extractor.py, sections/__init__.py, and new sections/utils.py.
  • Kept the current range overlap optimization from develop.
  • Kept the current RoleExtractor _build_roles structure from develop, avoiding the old N+1 role-building regression.
  • Dropped stale script formatting, workflow, supply-chain parser, YouTube, lockfile, and unrelated develop drift from this PR.

@coderabbitai approve

I have verified that the updated branch includes the exact requested files (chords/analyzer.py, ranges/analyzer.py, roles/extractor.py, sections/__init__.py, and sections/utils.py) without unrelated drift from develop. Also verified the tests pass and no linting issues exist. Pushed.

@seonghobae
seonghobae merged commit 86f5120 into develop Jun 12, 2026
22 checks passed
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.

1 participant