Skip to content

test(link): use the system BSD stat in the Darwin trust fixture - #9030

Merged
lidge-jun merged 1 commit into
devfrom
fix/link-trust-bsd-stat-fixture
Nov 21, 2026
Merged

lidge-jun merged 1 commit into
devfrom
fix/link-trust-bsd-stat-fixture

Conversation

@lidge-jun

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

Copy link
Copy Markdown
Owner

Summary

The dev batch gate (run 44878221019, dev e97f8167e) is red on macOS: job "macos 3/4" fails tests/clients/link-served-runtime-trust.test.ts › "BSD stat preserves sticky ancestors and zero-padded permission bits" with fallback instead of served. The suite came in with #8981.

The product code is correct. The macOS CI jobs add Homebrew coreutils' gnubin to the front of PATH (ci.yml: echo "$(brew --prefix coreutils)/libexec/gnubin" >> "$GITHUB_PATH"), so Bun.which("stat") is GNU stat there. The test's Darwin stub then ran <GNU stat> -f '%u %Mp%03Lp' <path>. GNU reads -f as --file-system and the format as a path, so it fails, served_path_info reports nothing, and the gate correctly refuses the recorded runtime.

The stub now calls /usr/bin/stat on Darwin, which is always the BSD stat, so the case exercises real BSD -f output regardless of PATH. The assertion is unchanged, and the Linux emulation branch is untouched.

Verification

On macOS (mac-studio), Bun 1.4.4 runner, bun scripts/test.ts tests/clients/link-served-runtime-trust.test.ts:

  • origin/dev e567fd1a4 with /opt/homebrew/opt/coreutils/libexec/gnubin first on PATH (as in CI): 28 pass, 1 fail. The failure is the same test with the same served vs fallback diff as the CI job.
  • This branch, gnubin first on PATH: 29 pass, 1 skip, 0 fail.
  • This branch, system PATH (/usr/bin/stat): 29 pass, 1 skip, 0 fail.
  • bun run typecheck: no type errors.

PR CI runs only on Ubuntu, where this branch is unchanged. The next dev batch gate covers macOS.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Summary by CodeRabbit

  • Tests
    • Updated the test setup to locate the appropriate stat command on macOS and other platforms, improving cross-platform test compatibility.

The macOS CI jobs put Homebrew coreutils' gnubin first on PATH, so
Bun.which("stat") returned GNU stat and the Darwin branch of the BSD stat
stub ran `stat -f <format>`, which GNU reads as --file-system. The gate then
saw no path info and fell back. Call /usr/bin/stat, always the BSD stat on
macOS, so the case keeps exercising real BSD output on any PATH.
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner November 21, 2026 07:14
@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The BSD stat test now selects /usr/bin/stat on macOS. On other platforms, it continues to use Bun.which("stat").

Changes: Stat Test Path

Layer / File(s) Summary
Select the stat executable
tests/clients/link-served-runtime-trust.test.ts
At lines 158–159, the test selects /usr/bin/stat on Darwin and Bun.which("stat") on other platforms.

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

Change: Other

Merge Risk: Minimal · up to 43570

This change only adjusts a macOS test fixture so it uses the system BSD stat regardless of PATH. It has no production impact and no remaining merge risk.

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 names the main change: the Darwin trust test fixture now calls the system BSD stat (/usr/bin/stat) rather than whatever stat is first on PATH. The raw summary confirms the test now uses /usr…
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 names the main change: the Darwin trust test fixture now calls the system BSD stat (/usr/bin/stat) rather than whatever stat is first on PATH. The raw summary confirms the test now uses /usr/bin/stat on macOS and Bun.which("stat") elsewhere, and the objectives describe the same intent, so the title matches the changeset.

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 e567fd1 and 43570ab.

Files selected for processing: 1

  • tests/clients/link-served-runtime-trust.test.ts

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 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-21T07:15:21.123282Z 43570ab 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 github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Nov 21, 2026
@lidge-jun

Copy link
Copy Markdown
Owner Author

Maintainer integration into dev (per MAINTAINERS.md; maintainer integration, not an independent approval)

  • Exact head: 43570abd2a7d159e9536ade475c956405527237d
  • Checks on this head: 12 passed, 15 skipped, none pending or failing (Ubuntu PR CI; Windows/macOS are covered by the next dev batch gate).
  • Review threads: none unresolved.
  • Repairs the dev batch gate (run 44878221019, job macos 3/4). Root cause is the fixture: macOS CI puts coreutils gnubin first on PATH, so the Darwin stub ran GNU stat -f. The product helper already tries stat -c before BSD stat -f.
  • Review: gpt-6.1-terra, verdict PASS. Independently reproduced the failure on dev with gnubin first on PATH (28 pass / 1 fail) and the pass on this head with both PATH orders (29 pass / 1 skip / 0 fail).
  • Assertion unchanged; the Linux emulation branch is untouched. macOS is covered by the next dev batch gate.

@lidge-jun
lidge-jun merged commit 061e4ac into dev Nov 21, 2026
31 checks passed
@lidge-jun
lidge-jun deleted the fix/link-trust-bsd-stat-fixture branch November 21, 2026 07:25
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