Skip to content

fix(cloud): repair cloud-feature login tests and clippy errors#83

Merged
hyperb1iss merged 2 commits into
mainfrom
fix/cloud-login-test-regression
May 19, 2026
Merged

fix(cloud): repair cloud-feature login tests and clippy errors#83
hyperb1iss merged 2 commits into
mainfrom
fix/cloud-login-test-regression

Conversation

@hyperb1iss
Copy link
Copy Markdown
Owner

Summary

Post-merge verification of the codex security batch surfaced two
latent defects in cloud-gated daemon code. The cloud feature has
no CI coverage (no build, test, or lint pass), so both shipped to
main unnoticed.

1. Login test regression (from #75)

#75 added a gate that rejects POST /cloud/login/start with 409
when cloud is disabled. Two tests built their AppState through
cloud_test_state, which hard-codes cloud.enabled = false:

  • cloud_login_start_stores_session_without_returning_device_code
    asserted 201 and got 409.
  • cloud_login_poll_keeps_pending_session_retryable then panicked
    on the login_id absent from the 409 error body.

Both now use cloud_test_state_with_cloud(.., true); the unused
cloud_test_state wrapper is removed.

2. Clippy duration_suboptimal_units errors

cloud_socket.rs and cloud_socket_tests.rs constructed durations
with Duration::from_secs(3_600) / from_secs(60), which clippy
rejects at -D warnings. Switched to Duration::from_hours(1) and
Duration::from_mins(1) — identical durations, no behavior change.

Verification

  • cargo test -p hypercolor-daemon --features cloud --test cloud_api_tests --test cloud_socket_tests
    — 26 + 11 passed (was 24 passed / 2 failed before)
  • cargo clippy -p hypercolor-daemon --features cloud --tests — clean
    (was 5 errors)
  • cargo clippy -p hypercolor-daemon --tests (no cloud) — clean
  • cargo fmt --all --check — clean

🤖 Generated with Claude Code

hyperb1iss and others added 2 commits May 19, 2026 03:18
PR #75 added a gate that rejects `POST /cloud/login/start` with 409
when cloud is disabled. Two login tests built their `AppState`
through `cloud_test_state`, which hard-codes `cloud.enabled = false`,
so after #75 they hit that gate. The start test asserted 201
and got 409; the poll test then panicked on the `login_id`
missing from the 409 error body.

The `cloud` feature carries no CI coverage, so the regression reached
main unnoticed. Point both tests at `cloud_test_state_with_cloud`
with cloud enabled and drop the now-unused `cloud_test_state`
wrapper.

Co-Authored-By: Nova (Claude Opus 4.7) <noreply@anthropic.com>
Clippy's `duration_suboptimal_units` flags `Duration::from_secs`
calls whose values land exactly on a larger unit. `cloud_socket.rs`
built a 3600-second heartbeat ceiling and a 60-second reconnect
cap that read more clearly as one hour and one minute.

Switch to `Duration::from_hours(1)` and `Duration::from_mins(1)`,
and update the matching `cloud_socket_tests.rs` assertions. The
durations are unchanged. These lints had accumulated because the
`cloud` feature has no CI lint pass.

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

coderabbitai Bot commented May 19, 2026

Warning

Rate limit exceeded

@hyperb1iss has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 15 minutes and 37 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fc32426b-af9a-4e6a-9a21-611c499f88ca

📥 Commits

Reviewing files that changed from the base of the PR and between 45768b1 and 77fd3d6.

📒 Files selected for processing (3)
  • crates/hypercolor-daemon/src/cloud_socket.rs
  • crates/hypercolor-daemon/tests/cloud_api_tests.rs
  • crates/hypercolor-daemon/tests/cloud_socket_tests.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cloud-login-test-regression

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.

@hyperb1iss hyperb1iss merged commit f2e5c9b into main May 19, 2026
18 of 21 checks passed
@hyperb1iss hyperb1iss deleted the fix/cloud-login-test-regression branch May 19, 2026 10:26
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