Skip to content

feat(brew): support generic cask artifacts - #11963

Merged
jdx merged 1 commit into
agent/cask-flight-targetsfrom
agent/cask-staged-artifacts
Aug 14, 2026
Merged

jdx merged 1 commit into
agent/cask-flight-targetsfrom
agent/cask-staged-artifacts

Conversation

@jdx

@jdx jdx commented Aug 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add support for Homebrew cask artifact stanzas
  • constrain generic artifact targets to the Homebrew prefix
  • preserve directory symlinks and platform metadata while copying
  • include installed artifact paths in transactional rollback and receipt fingerprints

Context

This is the second PR in the cask lifecycle stack. It builds on #11962 and covers the generic prefix artifacts used by libcblite and libcblite-community.

Stack

  1. feat(brew): support structured cask symlinks #11962
  2. feat(brew): support generic cask artifacts #11963
  3. feat(brew): support cask copy and installer steps #11964

Validation

  • cargo test --bin mise system::packages::brew::cask::tests -- --test-threads=1
  • cargo clippy --tests --bin mise -- -D warnings
  • cargo fmt --all
  • git diff --check

AI-assisted — Tool: Codex; model: OpenAI/GPT-5; version: unavailable.


Note

Medium Risk
Large new code path that writes under the Homebrew prefix and may elevate via sudo, but targets are constrained and heavily validated with extensive tests.

Overview
Adds Homebrew cask artifact support so staged trees can be copied into $HOMEBREW_PREFIX (e.g. libcblite include dirs), with docs updated to list generic prefix artifacts alongside existing cask types.

Install path copies files or directories into prefix-relative targets, records them on the cask receipt, cleans up obsolete paths on upgrade, and wires the install into the existing flight/transaction journal. Flight rollback now distinguishes elevated vs trusted unprivileged backups via an elevate flag on recovery records.

Security-focused Unix plumbing: openat-based trusted parent traversal, prefix/symlink validation, private staging directories, optional sudo when targets are root-owned, and nix dir/fs features for safe copies (including fcopyfile on macOS). Permission-denied detection also treats wrapped nix::errno errors as retry-with-sudo cases. Generic artifacts are excluded from prune-safe casks.

Reviewed by Cursor Bugbot for commit 222fc68. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: e0884c91-38ed-4b1c-b56a-eeb837cbfbe8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@greptile-apps

greptile-apps Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds generic Homebrew cask artifacts, including prefix-target installation, transactional protection and recovery, receipt tracking, obsolete-target cleanup, and fd-relative filesystem operations for unprivileged Unix paths.

  • Parses and validates generic artifact stanzas and installs their trees beneath the Homebrew prefix.
  • Records generic targets in receipts and incorporates them into rollback, cleanup, and prune-safety behavior.
  • Adds Unix descriptor-relative copy, rename, and removal helpers plus elevated fallbacks.
  • Enables the required nix filesystem and directory features and updates brew-cask documentation.

Confidence Score: 3/5

The PR does not yet appear safe to merge because elevated generic-artifact operations can still be redirected outside the validated Homebrew prefix after a mutable path component is replaced.

The descriptor-bound changes protect unprivileged copying, cleanup, and rollback, but elevated copy, mkdir, cleanup, rollback, and recovery retain only canonicalized pathnames and pass them to sudo helpers that resolve them again after validation.

Files Needing Attention: src/system/packages/brew/cask.rs

Important Files Changed

Filename Overview
src/system/packages/brew/cask.rs Adds generic artifact lifecycle support and descriptor-relative unprivileged operations, but the elevated lifecycle still loses directory binding before privileged pathname mutations.
Cargo.toml Enables the nix directory and filesystem features required by the new fd-relative helpers.
docs/bootstrap/packages/brew.md Documents support for generic Homebrew-prefix artifact stanzas.

Reviews (48): Last reviewed commit: "feat(brew): support generic cask artifac..." | Re-trigger Greptile

Comment thread src/system/packages/brew/cask.rs Resolved
Comment thread src/system/packages/brew/cask.rs Resolved
@github-actions

github-actions Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Instruction counts

benchmark trend instructions Δ wall (min) Δ
env ▄▃▂▁▄███▁ 81,001,834 → 80,791,377 -0.26% 17.88 → 18.03ms +0.86%
hook-env ▆▄▃▅▄██▇▁ 82,487,466 → 82,352,676 -0.16% 18.92 → 19.34ms +2.23%
ls ▁▃▃▂▃███▂ 73,547,069 → 73,400,423 -0.20% 16.96 → 17.09ms +0.79%
registry ▇█▅▆█▃▄▅▁ 43,321,991 → 43,283,646 -0.09% 11.65 → 12.17ms +4.46%
startup ▇▇▂▂▁▇▇█▃ 15,583,457 → 15,569,166 -0.09% 9.60 → 9.77ms +1.82%

No instruction-count regression above 1%.

Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run.

Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.

222fc681943e vs 11d5eb2a1318 · measured on the runner, not pushed to the history.

@jdx
jdx force-pushed the agent/cask-staged-artifacts branch from eec445d to ff61c32 Compare August 13, 2026 16:33
Comment thread src/system/packages/brew/cask.rs Resolved
@jdx
jdx force-pushed the agent/cask-staged-artifacts branch 2 times, most recently from 7a3a4f5 to 71b95c4 Compare August 13, 2026 17:22
Comment thread src/system/packages/brew/cask.rs Resolved
@jdx
jdx force-pushed the agent/cask-staged-artifacts branch from 71b95c4 to cf98329 Compare August 13, 2026 17:47
Comment thread src/system/packages/brew/cask.rs Resolved
@jdx
jdx force-pushed the agent/cask-staged-artifacts branch from cf98329 to 5544d49 Compare August 13, 2026 17:55
Comment thread src/system/packages/brew/cask.rs Resolved
@jdx
jdx force-pushed the agent/cask-staged-artifacts branch from 5544d49 to 82238cf Compare August 13, 2026 18:00
@jdx
jdx force-pushed the agent/cask-staged-artifacts branch from 82238cf to 50ab820 Compare August 13, 2026 18:12
Comment thread src/system/packages/brew/cask.rs Resolved
@jdx
jdx force-pushed the agent/cask-staged-artifacts branch from 50ab820 to 6c804e8 Compare August 13, 2026 18:54
Comment thread src/system/packages/brew/cask.rs Resolved
@jdx
jdx force-pushed the agent/cask-staged-artifacts branch from 6c804e8 to d4a9adf Compare August 14, 2026 00:17
@jdx
jdx force-pushed the agent/cask-staged-artifacts branch from c186fce to 0b06681 Compare August 14, 2026 03:40
Comment thread src/system/packages/brew/cask.rs Resolved
Comment thread src/system/packages/brew/cask.rs Resolved
Comment thread src/system/packages/brew/cask.rs Resolved
@jdx
jdx force-pushed the agent/cask-staged-artifacts branch from 0b06681 to 07f5c21 Compare August 14, 2026 03:55
@jdx
jdx force-pushed the agent/cask-staged-artifacts branch from 07f5c21 to 4ac842b Compare August 14, 2026 04:01
Comment thread src/system/packages/brew/cask.rs Resolved
Comment thread src/system/packages/brew/cask.rs Resolved
@jdx
jdx force-pushed the agent/cask-staged-artifacts branch 2 times, most recently from 25b7c09 to a4caba3 Compare August 14, 2026 04:25
Comment thread src/system/packages/brew/cask.rs Resolved
@jdx
jdx force-pushed the agent/cask-staged-artifacts branch from a4caba3 to d75e37d Compare August 14, 2026 04:32
@jdx
jdx force-pushed the agent/cask-staged-artifacts branch from d75e37d to bd62b7e Compare August 14, 2026 04:38
Comment thread src/system/packages/brew/cask.rs Resolved
@jdx
jdx force-pushed the agent/cask-staged-artifacts branch from bd62b7e to 0445f2e Compare August 14, 2026 04:43
Comment thread src/system/packages/brew/cask.rs Resolved
@jdx
jdx force-pushed the agent/cask-staged-artifacts branch 2 times, most recently from 0bc8f8b to e3894b6 Compare August 14, 2026 04:57
Comment thread src/system/packages/brew/cask.rs Resolved
Comment thread src/system/packages/brew/cask.rs Resolved
Comment thread src/system/packages/brew/cask.rs Resolved
@jdx
jdx force-pushed the agent/cask-staged-artifacts branch 2 times, most recently from 102169b to 347a3e9 Compare August 14, 2026 05:13
Comment thread src/system/packages/brew/cask.rs Resolved

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit dcdd73a. Configure here.

Comment thread src/system/packages/brew/cask.rs Resolved
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