Skip to content

chore(coderabbit): slop_detection + project finishing-touches recipes#62

Merged
Artic0din merged 1 commit into
devfrom
chore/sync-coderabbit-yaml
May 16, 2026
Merged

chore(coderabbit): slop_detection + project finishing-touches recipes#62
Artic0din merged 1 commit into
devfrom
chore/sync-coderabbit-yaml

Conversation

@Artic0din
Copy link
Copy Markdown
Owner

@Artic0din Artic0din commented May 16, 2026

Summary

Bring CodeRabbit slop_detection + 4 PriceHawk-specific finishing-touches
recipes from phase-3-multi-plan / phase-3-1-prep-eme-refdata2 back to
dev so future feature PRs targeting dev get richer review immediately,
decoupled from PR #28's merge timing.

What was broken

.coderabbit.yaml on dev (and main) is the older 145-line version. It
lacks:

  • slop_detection (flags low-quality AI-generated PRs with slop label)
  • finishing_touches.unit_tests
  • 4 project-specific custom recipes:
    • scrub-secrets — audits for hardcoded Amber API keys, HA LLATs, JWTs
    • no-hardcoded-rates — flags literal c/kWh tariff values in source
    • amber-api-limits — flags loops that exceed Amber's 50 req/5min budget
    • dashboard-protocol-safety — enforces location.protocol + non-hardcoded
      tokens in dashboard.html

Feature branches based on dev get the older review profile until #28
merges, which means any in-flight PR misses the project-specific guardrails
PriceHawk has already validated on the stacked-PR branches.

What this fixes

dev and every branch downstream of it (PRs from contributors, security
fixes, dashboard work, etc.) immediately benefit from the richer review
configuration without waiting for the v1.5.0 stack (#28 / #54) to land.

Test plan

  • python -c "import yaml; yaml.safe_load(open('.coderabbit.yaml'))" passes
  • git diff origin/dev -- .coderabbit.yaml shows only the +29-line addition
  • CodeRabbit picks up the new config on this PR itself (self-validation)
  • No regression in existing review behavior (path filters, ignore rules
    untouched)

Changes

Cherry-picked commit 4223ff2 from phase-3-multi-plan:

chore(coderabbit): add slop_detection + custom finishing-touches recipes
 .coderabbit.yaml | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

All additions live under existing reviews: keys — no structural changes,
no path filter changes, no ignore rule changes.

Why

The richer yaml was authored and validated on the PR #28 stack. Waiting
for #28 to merge before propagating means weeks of feature work on dev
without project-specific CR coverage. Splitting it out as its own tiny PR:

  • Decouples review-config improvements from feature-merge timing
  • Yaml-only diff is trivial to review (<5 min CR pass)
  • Cherry-pick keeps git history honest (original commit author + co-author
    preserved)

Breaking Changes

None. Configuration-only change. CodeRabbit re-reads .coderabbit.yaml on
next PR event.

Files Changed

  • .coderabbit.yaml (+29 lines)

🤖 Generated with Claude Code

Summary by Sourcery

Update CodeRabbit review configuration to enable stricter, project-specific automated review checks.

Enhancements:

  • Enable slop detection with a dedicated label for low-quality AI-generated pull requests.
  • Extend finishing-touches to cover unit tests and add custom project-specific review recipes for secrets, tariff rates, Amber API limits, and dashboard protocol safety.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 16, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • main
  • develop

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b1b2fe10-8989-4d24-abcc-1f571acb9d5a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/sync-coderabbit-yaml
  • 🛠️ scrub-secrets
  • 🛠️ no-hardcoded-rates
  • 🛠️ amber-api-limits
  • 🛠️ dashboard-protocol-safety

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

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 16, 2026

Reviewer's Guide

Updates the CodeRabbit configuration on dev by enabling slop detection, expanding finishing-touches to cover unit tests, and adding four project-specific review recipes, without altering existing structure, filters, or ignore rules.

File-Level Changes

Change Details Files
Enable CodeRabbit slop detection and label for low-quality AI-generated PRs.
  • Add slop_detection block under reviews with enabled set to true
  • Configure slop label name for flagged PRs
.coderabbit.yaml
Strengthen finishing-touches checks with unit test coverage and project-specific recipes.
  • Enable finishing_touches.unit_tests alongside existing docstrings checks
  • Introduce custom finishing_touches recipes for scrubbing secrets, prohibiting hardcoded tariff rates, enforcing Amber API call limits, and ensuring dashboard HTML protocol/token safety
  • Keep all additions nested under existing reviews/finishing_touches without changing other configuration keys, filters, or ignore rules
.coderabbit.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 security issue, and left some high level feedback:

Security issues:

  • Insecure WebSocket Detected. WebSocket Secure (wss) should be used for all WebSocket connections. (link)

General comments:

  • The no-hardcoded-rates recipe is quite broad ("flag any literal c/kWh number that looks like a tariff rate") and may generate a lot of noise; consider scoping it to specific paths/modules or explicitly excluding tests/docs/config examples to keep the signal high.
  • For scrub-secrets, you might want to include brief examples or patterns for Amber API keys, HA LLATs, and JWTs (e.g., prefixes/lengths) so the detector guidance is more precise and less likely to flag benign strings.
  • The dashboard-protocol-safety instructions currently apply globally; if this rule only makes sense for custom_components/pricehawk/www/dashboard.html, consider adding or documenting path scoping so it doesn't trigger on unrelated HTML/JS files in future.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `no-hardcoded-rates` recipe is quite broad ("flag any literal c/kWh number that looks like a tariff rate") and may generate a lot of noise; consider scoping it to specific paths/modules or explicitly excluding tests/docs/config examples to keep the signal high.
- For `scrub-secrets`, you might want to include brief examples or patterns for Amber API keys, HA LLATs, and JWTs (e.g., prefixes/lengths) so the detector guidance is more precise and less likely to flag benign strings.
- The `dashboard-protocol-safety` instructions currently apply globally; if this rule only makes sense for `custom_components/pricehawk/www/dashboard.html`, consider adding or documenting path scoping so it doesn't trigger on unrelated HTML/JS files in future.

## Individual Comments

### Comment 1
<location path=".coderabbit.yaml" line_range="51" />
<code_context>
          ws://. Token must come from URL params or postMessage, never
</code_context>
<issue_to_address>
**security (javascript.lang.security.detect-insecure-websocket):** Insecure WebSocket Detected. WebSocket Secure (wss) should be used for all WebSocket connections.

*Source: opengrep*
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .coderabbit.yaml
instructions: |
custom_components/pricehawk/www/dashboard.html MUST use
location.protocol for WebSocket URL detection. Never hardcode
ws://. Token must come from URL params or postMessage, never
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.lang.security.detect-insecure-websocket): Insecure WebSocket Detected. WebSocket Secure (wss) should be used for all WebSocket connections.

Source: opengrep

@Artic0din Artic0din merged commit 913c9d6 into dev May 16, 2026
6 of 10 checks passed
@Artic0din Artic0din deleted the chore/sync-coderabbit-yaml branch May 16, 2026 11:44
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