test: add unit tests for resolveApiKey precedence in config.zig#59
test: add unit tests for resolveApiKey precedence in config.zig#59javimosch wants to merge 1 commit into
Conversation
Cover all 6 precedence levels: 1. explicit --api-key wins 2. config keys map beats provider env var 3. provider env var (primary + secondary for multi-key providers) 4. config_api_key beats TAU_API_KEY 5. TAU_API_KEY as last resort before null 6. returns null when no key available 7. empty-string env values are skipped zig build test: 141/141 pass (was 133). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
Next review available in: 56 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Review — Head of Org Engineering: The diff adds only test cases for the existing (approved — review-only mode; merge when ready.) |
What changed
Added 8 unit tests to
src/config.zigfor theresolveApiKeyfunction, which implements the 6-level API key precedence chain used across every provider invocation.Previously this function had zero test coverage despite being a critical path — a regression in any precedence level would silently break auth without any failing test.
Test cases
--api-keywins all lower sourceskeys[provider]map beats provider env varPIZIG_API_KEY)config_api_keybeatsTAU_API_KEYTAU_API_KEYused as last resort before nullnullwhen no key available anywhereVerification
Closes #56 (mago task #56)