Skip to content

test(claude): inject NSS stat failures across platforms - #8963

Merged
lidge-jun merged 1 commit into
devfrom
fix/picker-trust-linux-stat-windows
Nov 19, 2026
Merged

lidge-jun merged 1 commit into
devfrom
fix/picker-trust-linux-stat-windows

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Replace the oversized-path fixture in the Linux picker trust test with a path-scoped lstatSync spy that throws EACCES for the legacy NSS directory. The spy delegates other calls to the real implementation and is restored in finally.
  • Preserve the assertions for an unknown trust state and zero certutil calls across platforms. The Windows shard in CI run 44559432373 reported the long path as absent. This PR changes one test file.

Verification

  • bun test tests/claude-integration/claude-picker-trust-linux.test.ts tests/claude-integration/claude-picker-trust.test.ts — 46 passed, 0 failed, 0 skipped on macOS with Bun 1.4.4.
  • bun test tests/ci-workflows/file-size-ratchet.test.ts tests/test-layout.test.ts — 11 passed, 0 failed, 0 skipped. The test file is 807 lines, below the 2,000-line threshold.
  • bun run typecheck — passed across 2,666 files.
  • bun run privacy:scan and git diff --check — passed. The committed diff also passed git diff --check HEAD^ HEAD.
  • Mutation check on macOS — temporarily classified EACCES as absence in statIfPresent. The targeted test exited 1, expecting unknown and receiving untrusted. Restored the original production bytes before running the two picker suites.
  • NOT RUN: Windows execution and the full local suite. Local coverage used the two picker files and the two repository guards for this test-only change.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed. This test-only change required neither.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. The diff changes only a test fixture and the privacy scan passed.

Summary by CodeRabbit

  • Tests
    • Updated coverage for systems where access to the certificate database is denied. The test now verifies that its status is reported as unknown and that certificate inspection does not continue when the database cannot be accessed. This replaces a test setup that relied on an unusually long home-directory path to simulate an inaccessible location.

Throw EACCES for the legacy NSS directory lookup so the trust regression
covers a stat failure independently of OS-specific path length errors.
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner November 19, 2026 16:49
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 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-19T16:50:52.044357Z 121d790 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.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Nov 19, 2026
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Linux NSS trust inspection test now simulates an EACCES error while inspecting the expected .pki/nssdb path. It checks that inspection returns "unknown", does not call certutil, and restores the spy.

Changes: Linux NSS trust inspection test

Layer / File(s) Summary
Simulate NSS directory access error
tests/claude-integration/claude-picker-trust-linux.test.ts
The test replaces the long-home-path case with an lstatSync spy that throws EACCES for .pki/nssdb. It asserts an "unknown" result and no certutil calls, then restores the spy in a finally block.

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Other

Possibly related PRs

  • lidge-jun/opencodex#8775: Adds the Linux NSS trust adapter and its contract for returning "unknown" when directory inspection fails.
Merge Risk: Minimal · up to 121d7

This change makes a Linux trust-state test more reliable across platforms by simulating an access error instead of relying on path-length behavior. It does not affect production behavior. The test was verified on macOS, and Windows CI is the remaining place to confirm it, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "test(claude): inject NSS stat failures across platforms" matches the main change: the NSS-directory inspection test now injects an EACCES failure through a path-scoped lstatSync spy instead…
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.
Full details: Title check

Explanation

The title "test(claude): inject NSS stat failures across platforms" matches the main change: the NSS-directory inspection test now injects an EACCES failure through a path-scoped lstatSync spy instead of relying on an oversized path. It is concise, specific, and follows a conventional commit style. The title says "across platforms", but the diff only touches the Linux test file and the objectives note Windows execution was not run, so that phrase is somewhat overstated. The core change is still clearly described.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 62ffebb and 121d790.

Files selected for processing: 1

  • tests/claude-integration/claude-picker-trust-linux.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@lidge-jun

Copy link
Copy Markdown
Owner Author

Maintainer integration (lidge-jun, dev-only path in MAINTAINERS.md; dev-fix freeze exception assigned by the coordinator) at head 121d790bf2:

  • Failure: release-gate run 44559432373 on dev 62ffebbe90, windows 4/14, claude-picker-trust-linux.test.ts "an NSS directory stat failure reads as unknown without invoking certutil". The test forced a stat failure with a 512-character path. That gives ENAMETOOLONG on POSIX, but Windows reports ENOENT, which the code correctly treats as confirmed absence.
  • Fix: test only. A path-scoped lstatSync spy throws EACCES for the legacy NSS directory and is restored in finally. Both assertions are unchanged (unknown, zero certutil calls). There is no production change.
  • Review: an independent gpt-6.2-sol reviewer approved with no findings. Its mutation check showed that treating EACCES as absence turns the test red, and the spy uses the same native path.join as the production code.
  • Windows evidence (desktop-c795oh4, Bun 1.3.14): on dev 62ffebbe90 the file had 28 passed, 8 skipped, 1 failed, with the target test returning untrusted and reproducing the runner failure. On this head it had 29 passed, 8 skipped, 0 failed.
  • CI and gates: all 27 checks succeeded on this exact head. scripts/ci/assert-mergeable-review.sh --maintainer-integration 8963 passed. On a local merge with dev 62ffebbe90, structure:check and typecheck (2,666 files) passed, and 169 tests passed across the ratchet, import-cycle, structure SSOT, layout, Spanish docs and picker trust files.

NOT RUN: full local suite, the lane=all Windows batch (left to the coordinator).

@lidge-jun
lidge-jun merged commit 87edd82 into dev Nov 19, 2026
31 checks passed
@lidge-jun
lidge-jun deleted the fix/picker-trust-linux-stat-windows branch November 19, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant