feat: support native artifact downloads on macOS and Windows#103
feat: support native artifact downloads on macOS and Windows#103Waishnav wants to merge 6 commits into
Conversation
📝 WalkthroughWalkthroughNative artifact downloads now use secure platform-specific filesystem targets for Linux, macOS, and Windows. The flow adds stricter destination validation, integrity checks, atomic publication, cleanup handling, platform tests, documentation updates, and the ChangesSecure artifact downloads
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant downloadIncomingArtifact
participant openSecureArtifactTarget
participant NativeArtifactTarget
participant DestinationFilesystem
downloadIncomingArtifact->>openSecureArtifactTarget: open workspace and destination target
openSecureArtifactTarget->>NativeArtifactTarget: dispatch by platform
downloadIncomingArtifact->>NativeArtifactTarget: writeAll(download chunks)
downloadIncomingArtifact->>NativeArtifactTarget: syncAndVerify(expected size)
NativeArtifactTarget->>DestinationFilesystem: publish verified partial without overwrite
NativeArtifactTarget-->>downloadIncomingArtifact: publication result
downloadIncomingArtifact->>NativeArtifactTarget: close and clean up resources
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/artifact-secure-filesystem.ts (1)
3-5: 🩺 Stability & Availability | 🔵 Trivial | 🏗️ Heavy liftStatic imports pull
koffiinto every platform, including Linux.
openSecureArtifactTargetonly needs one platform module at runtime, but the top-level imports ofartifact-secure-filesystem-darwin.jsandartifact-secure-filesystem-windows.js(both of whichimport koffi from "koffi") cause the nativekoffiaddon to be resolved even on Linux, where the descriptor-based Linux backend never touches it. Ifkoffifails to load (missing prebuilt for an arch, install issue), the artifact feature breaks on Linux too. Consider loading the platform module lazily inside each branch.♻️ Lazy per-platform loading
-import { openDarwinArtifactTarget } from "./artifact-secure-filesystem-darwin.js"; -import { openLinuxArtifactTarget } from "./artifact-secure-filesystem-linux.js"; -import { openWindowsArtifactTarget } from "./artifact-secure-filesystem-windows.js";export async function openSecureArtifactTarget( options: SecureArtifactTargetOptions, ): Promise<SecureArtifactTarget> { - if (process.platform === "linux") return openLinuxArtifactTarget(options); - if (process.platform === "darwin") return openDarwinArtifactTarget(options); - if (process.platform === "win32") return openWindowsArtifactTarget(options); + if (process.platform === "linux") { + return (await import("./artifact-secure-filesystem-linux.js")).openLinuxArtifactTarget(options); + } + if (process.platform === "darwin") { + return (await import("./artifact-secure-filesystem-darwin.js")).openDarwinArtifactTarget(options); + } + if (process.platform === "win32") { + return (await import("./artifact-secure-filesystem-windows.js")).openWindowsArtifactTarget(options); + } throw new ArtifactError(🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/artifact-secure-filesystem.ts` around lines 3 - 5, Update openSecureArtifactTarget to remove the top-level platform imports and lazily load only the selected backend module inside each platform branch. Ensure Linux uses artifact-secure-filesystem-linux.js without resolving the Darwin or Windows modules, and preserve the existing platform-specific target behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/artifact-secure-filesystem.ts`:
- Around line 3-5: Update openSecureArtifactTarget to remove the top-level
platform imports and lazily load only the selected backend module inside each
platform branch. Ensure Linux uses artifact-secure-filesystem-linux.js without
resolving the Darwin or Windows modules, and preserve the existing
platform-specific target behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 7d221925-6dbc-4901-b68a-aef19ab32c68
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (11)
docs/artifact-exchange.mddocs/configuration.mddocs/security.mdpackage.jsonsrc/artifact-download.test.tssrc/artifact-secure-filesystem-common.tssrc/artifact-secure-filesystem-darwin.tssrc/artifact-secure-filesystem-linux.tssrc/artifact-secure-filesystem-windows.tssrc/artifact-secure-filesystem.tssrc/artifact-tools.ts
Summary
Verification
Summary by CodeRabbit
0600; Windows downloads inherit the destination directory’s ACL.