Skip to content

fix(nix): give moq-relay's check phase a CA bundle via cacert#1919

Merged
kixelated merged 1 commit into
mainfrom
claude/heuristic-mcnulty-fb756e
Jun 26, 2026
Merged

fix(nix): give moq-relay's check phase a CA bundle via cacert#1919
kixelated merged 1 commit into
mainfrom
claude/heuristic-mcnulty-fb756e

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Summary

nix build .#moq-relay fails during its check phase (doCheck = true) in the relay auth tests. The root cause:

  • Auth::new always builds a rustls client config up front (auth.rs:688).
  • That TLS builder defaults to loading native system roots and now hard-errors when none are found (tls.rs:323).
  • The Nix build sandbox has no system trust store, so rustls-native-certs returns no roots and the tests blow up, including plain-http:// wiremock helpers (e.g. key_dir: Some(format!("{}/keys/", server.uri()))) that never make a TLS connection.

This wires a CA bundle into the moq-relay crane build so the check phase passes:

nativeBuildInputs = [ final.cacert ];
SSL_CERT_FILE = "${final.cacert}/etc/ssl/certs/ca-bundle.crt";

Notes for reviewers

  • Scoped to moq-relay since it's the only crane package that constructs a TLS client during tests. moq-cli/moq-token-cli also run doCheck = true but don't hit this path.
  • The cross x86_64-apple-darwin relay output inherits these args but sets doCheck = false, so the extra env is inert there.
  • The nativeBuildInputs entry is redundant given the explicit SSL_CERT_FILE, but keeps the cacert dependency visible/idiomatic.

Test plan

  • nixfmt clean, flake still evaluates (nix eval .#moq-relay.drvPath).
  • Verified the derivation env now carries SSL_CERT_FILE=…/nss-cacert-3.123/etc/ssl/certs/ca-bundle.crt, nss-cacert in nativeBuildInputs, and doCheck=1 with cargo test -p moq-relay in the check phase.
  • Full nix build .#moq-relay (not run locally; long source build).

🤖 Generated with Claude Code

(Written by Claude)

Auth::new builds a rustls client config up front, and tls.rs now hard-errors
when rustls-native-certs finds no roots. The Nix build sandbox has no system
trust store, so `nix build .#moq-relay` (which runs doCheck=true) failed in
the relay auth tests, including the plain-http wiremock helpers that never
actually make a TLS connection.

Point SSL_CERT_FILE at cacert's bundle (and add cacert to nativeBuildInputs)
for the moq-relay build so rustls-native-certs has a root to load. Scoped to
moq-relay since it's the only crane package that constructs a TLS client
during tests; the cross x86_64-darwin output sets doCheck=false so the extra
env is inert there.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 65dff99b-e2c6-444b-bcc5-ef420a85f454

📥 Commits

Reviewing files that changed from the base of the PR and between 2af9777 and c95e67f.

📒 Files selected for processing (1)
  • nix/overlay.nix

Walkthrough

The Nix overlay for moq-relay now adds cacert to the build inputs and sets SSL_CERT_FILE to the bundled CA certificate file during the build/check phase. This changes the build environment used by rustls-based initialization.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the Nix fix for moq-relay's check phase using cacert.
Description check ✅ Passed The description directly explains the moq-relay CA bundle fix and its test failure context.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch claude/heuristic-mcnulty-fb756e

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.

@kixelated kixelated merged commit 86ff316 into main Jun 26, 2026
1 check passed
@kixelated kixelated deleted the claude/heuristic-mcnulty-fb756e branch June 26, 2026 17:06
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