Skip to content

id: give sandboxed check phases a CA bundle so http_fetch tests pass in the nix build (#12608) - #12620

Merged
dezren39 merged 1 commit into
mainfrom
archer-lane-p/12608-nix-sandbox-ca-certs
Nov 22, 2026
Merged

dezren39 merged 1 commit into
mainfrom
archer-lane-p/12608-nix-sandbox-ca-certs

Conversation

@dezren39

@dezren39 dezren39 commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Closes #12608. Unblocks #1372's close condition (a completed full-nightly verdict) and #1374's readiness evidence.

Diagnosis

The three http_fetch_* schedule tests fetch plain HTTP from a local TcpListener — they never touch TLS — but constructing the production reqwest client is what fails in the nix build sandbox:

  1. id-worlds pins reqwest 0.13 with the rustls feature, which routes through rustls-platform-verifier 0.7.1. On Unix that verifier builds its root store only from rustls_native_certs::load_native_certs() and returns General("No CA certificates were loaded from the system") when the store comes back empty (rustls-platform-verifier verification/others.rs).
  2. The nix build sandbox has no system CA store — no /etc/ssl/certs, and nothing sets SSL_CERT_FILE — so the store is always empty there.
  3. world/http_fetch.rs's client() treats a builder error as recoverable and falls back to reqwest::blocking::Client::new(), which panics on the same error (reqwest blocking/client.rs:1278). The panic lands on the fetch thread, the join turns it into fetch_failed, and the three tests fail their assertions — failing the id (id-web) derivation's checkPhase and, with it, the dependency build of every NixOS VM check. Evidence: nightly run 45035241965, log lines 2026-11-22T15:35:53Z (panics) and 15:36:03Z (cascade from id-0.1.0.drv).

Fix

Give the sandboxed check environments a CA bundle instead of touching the client or the tests (assertions unchanged, production behavior unchanged — nothing outside the sandbox sets this):

  • pkgs/id/nix-common.nix: new shared testSslCertFile = the nixpkgs cacert bundle path, with the mechanism documented. rustls-native-certs honours SSL_CERT_FILE, so this is the loader's own supported route to a non-system store.
  • pkgs/id/flake.nix:
    • id-web and id-lib preCheck export SSL_CERT_FILE — their checkPhases run the workspace suite that contains the three tests (id-web is the derivation whose failure cascaded).
    • mkCheckWith sets SSL_CERT_FILE as a derivation attribute (the ID_TEST_FAKE_SH pattern), covering the just-recipe checks — test, test-unit, the shards, crash-gate, ci — which run the same lib tests under nextest in the sandbox and would panic identically in a full nix flake check.

Not covered, deliberately: pkgs/id/default.nix is the legacy standalone nix-build path (not used by the flake or the nightly) and carries the same latent shape; noted here rather than silently fixed out of scope.

Verification

  • Flake evaluation (fleet-run 45042314183, this branch): id-lib, id-web, checks.test-unit and checks.nixos-serve all instantiate.
  • Venue caveat, measured: the fleet-run container does not reproduce the failure — nix build .#id-lib on unfixed main (fleet-run 45042161414) passes with the three tests ok, so that venue's build sandbox is evidently not cert-free the way the GitHub-hosted nightly sandbox is. The before/after verdict therefore comes from the venue that produced the failure:
  • Before (unfixed main, real nightly sandbox): run 45035241965 — the three tests panic, id-0.1.0.drv checkPhase fails, VM checks never start (Lane I's evidence on id: http_fetch schedule tests panic in the nix build sandbox — reqwest finds no system CA certificates #12608).
  • After (this branch, same venue): targeted id e2e nightly dispatch, run 45045565708 with only_checks=nixos-serve test-unit — conclusion: success.
    • [nightly] check 'nixos-serve' passed (17:21:39Z): the id derivation's checkPhase is green — all three tests ok in the real sandbox (http_fetch_refuses_redirects_off_the_list_and_past_the_hop_cap, http_fetch_round_trip_through_the_actor, http_fetches_journal_nothing_and_replay_is_unaffected, log lines 17:20:16Z) — and the build proceeded into vm-test-run-id-serve, which started its VM ("start all VMs", "server: starting vm") and passed. Zero test result: FAILED lines and zero "No CA certificates" occurrences in the full 4.7 MB log.
    • [nightly] check 'test-unit' passed (17:33:43Z): the mkCheckWith half of the fix verified in the same sandbox. Targeted summary: "failed checks: none".
  • nix-fmt-check on this branch (fleet-run 45045965815, HEAD a6339d9): passed.

…tp_fetch tests can construct their reqwest client (#12608)
@dezren39
dezren39 requested a review from a team as a code owner November 22, 2026 16:15
@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 8 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 65b60a8c-cf85-433f-8cb4-42ceb3c74c9f
Commits

Reviewing files that changed from the base of the PR and between 6008fbb and a6339d9.

Files selected for processing: 2

  • pkgs/id/flake.nix
  • pkgs/id/nix-common.nix
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T16:17:20.330768Z a6339d9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

id: http_fetch schedule tests panic in the nix build sandbox — reqwest finds no system CA certificates

1 participant