Skip to content

test(test-server): cover serve flags, cache policies, and discovery etag#746

Merged
EffortlessSteven merged 1 commit into
mainfrom
claude/test-server-serve-flags-coverage
May 16, 2026
Merged

test(test-server): cover serve flags, cache policies, and discovery etag#746
EffortlessSteven merged 1 commit into
mainfrom
claude/test-server-serve-flags-coverage

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Adds HTTP-level coverage for uselesskey-test-server branches that the existing spec-accessor tests do not exercise.

New tests in tests/serve_flags_and_cache.rs:

  • serve_discovery = false returns 404 on the discovery endpoint while JWKS still serves
  • serve_jwks = false returns 404 on the JWKS endpoint while discovery still serves
  • Both flags false together produce 404 on both endpoints
  • CachePolicySpec::no_store emits Cache-Control: no-store and no ETag
  • emit_etag = false with max_age_seconds > 0 sets only Cache-Control, never ETag
  • Discovery emits a body-derived ETag when caching is enabled (exercises the unwrap_or_else etag fallback in cached_json_response, which the JWKS endpoint never hits because it always carries a phase)
  • JWKS revalidation with a non-matching If-None-Match returns 200 plus the fresh ETag, distinguishing the mismatch branch from the 304 path

Test plan

  • cargo test -p uselesskey-test-server --test serve_flags_and_cache — all 7 tests pass
  • cargo clippy -p uselesskey-test-server --tests --all-features — clean
  • cargo fmt --check

Generated by Claude Code

Add tests for HTTP-level branches that the spec-accessor tests did not exercise:
- `serve_discovery = false` and `serve_jwks = false` return 404.
- `CachePolicySpec::no_store` emits `Cache-Control: no-store` with no ETag.
- `emit_etag = false` sets only `Cache-Control`, never `ETag`.
- Discovery emits a body-derived ETag when caching is enabled (the
  `unwrap_or_else` fallback in `cached_json_response`).
- JWKS revalidation with a non-matching `If-None-Match` returns 200 + ETag.
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented May 16, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@EffortlessSteven has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 40 minutes and 19 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8299e008-fd16-4257-925f-4cb2a8e807ee

📥 Commits

Reviewing files that changed from the base of the PR and between 89f7cad and 88fec3c.

📒 Files selected for processing (1)
  • crates/uselesskey-test-server/tests/serve_flags_and_cache.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/test-server-serve-flags-coverage

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.

@EffortlessSteven EffortlessSteven marked this pull request as ready for review May 16, 2026 20:47
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@EffortlessSteven EffortlessSteven merged commit 30b488c into main May 16, 2026
6 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.

2 participants