Skip to content

Conversation

@CoMPaTech
Copy link
Owner

@CoMPaTech CoMPaTech commented Sep 26, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of unauthorized and forbidden responses, consistently surfacing authentication errors.
    • Prevents misleading setup errors when access is denied, providing clearer feedback during connection attempts.
  • Chores

    • Bumped version to 0.5.2.

@coderabbitai
Copy link

coderabbitai bot commented Sep 26, 2025

Walkthrough

Updates HTTP error handling in airos/base.py to treat 401 and 403 as authentication errors, raising AirOSConnectionAuthenticationError on 403. Project version is incremented from 0.5.1 to 0.5.2 in pyproject.toml.

Changes

Cohort / File(s) Change summary
Core HTTP error handling
airos/base.py
Extends aiohttp.ClientResponseError handling: 401 and 403 map to authentication errors; 403 now raises AirOSConnectionAuthenticationError rather than proceeding to setup error handling. No changes to login flow or JSON parsing.
Project metadata
pyproject.toml
Bumps version from 0.5.1 to 0.5.2.

Sequence Diagram(s)

sequenceDiagram
  actor Caller
  participant Client as airos/base.py:_request_json
  participant Server as AirOS HTTP API

  Caller->>Client: _request_json(url, ...)
  Client->>Server: HTTP request
  Server-->>Client: HTTP response

  alt 200 OK
    Client-->>Caller: Parsed JSON
  else 401 Unauthorized
    note over Client: Map to authentication error
    Client-->>Caller: raise AirOSConnectionAuthenticationError
  else 403 Forbidden
    note over Client: Now treated as authentication error
    Client-->>Caller: raise AirOSConnectionAuthenticationError
  else Other ClientResponseError
    Client-->>Caller: raise AirOSConnectionSetupError
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Further refactoring #70 — Adjusts _request_json error handling to map 401/403 to authentication errors and updates exception types, overlapping with this PR’s logic.

Poem

I thump my paws at codes that err,
401, 403—now crystal-clear!
A hop to bump the tiny version,
Fences fixed with swift diversion.
In burrows deep, requests align—
Authentication? Now just fine. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly captures the key change of extending error handling to both unauthorized (401) and forbidden (403) responses, directly reflecting the main update in the pull request.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch authfix

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d17fece and 7f827fd.

📒 Files selected for processing (2)
  • airos/base.py (1 hunks)
  • pyproject.toml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Run mypy
🔇 Additional comments (1)
airos/base.py (1)

244-246: Authentication errors mapped to dedicated exception

Handling both 401 and 403 with AirOSConnectionAuthenticationError is exactly what we needed—callers can now reliably trigger re-auth flows for either response instead of treating them as generic setup failures. No further action required.

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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.

@sonarqubecloud
Copy link

@codecov
Copy link

codecov bot commented Sep 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.85%. Comparing base (128b113) to head (7f827fd).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #96   +/-   ##
=======================================
  Coverage   91.85%   91.85%           
=======================================
  Files           7        7           
  Lines         909      909           
=======================================
  Hits          835      835           
  Misses         74       74           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@CoMPaTech CoMPaTech merged commit 301a1e5 into main Sep 26, 2025
14 checks passed
@CoMPaTech CoMPaTech deleted the authfix branch September 26, 2025 21:08
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