gate unix-only bun staging items for the Windows worker build (#11856)

* fix: gate unix-only bun staging items so the Windows worker build compiles

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: compile bun_install_can_stage only where it is used

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-10-18 02:47:24 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 35d59e9020
commit 9e5c988770
@@ -847,6 +847,7 @@ fn install_ca_mounts(job_dir: &str, home: &str, envs: &HashMap<String, String>)
}
/// The files `bun install` reads from, and writes to, the directory it installs in.
#[cfg(unix)]
const BUN_INSTALL_INPUTS: [&str; 3] = ["package.json", "bun.lock", "bun.lockb"];
const BUN_INSTALL_OUTPUTS: [&str; 3] = ["node_modules", "bun.lock", "bun.lockb"];
/// What the worker reads or mounts from the job dir after an install that ran in it.
@@ -923,6 +924,7 @@ struct BunStagingDir {
root: Arc<fs::File>,
#[cfg(unix)]
dir: fs::File,
#[cfg(unix)]
name: String,
path: String,
}
@@ -949,11 +951,13 @@ impl Drop for BunStagingDir {
/// How long a staging dir may outlive its install before the next one deletes it: a
/// worker killed mid-install leaves it behind. Well past the longest install.
#[cfg(unix)]
const BUN_STAGING_MAX_AGE: std::time::Duration = std::time::Duration::from_secs(6 * 60 * 60);
/// Whether a bun install needs nothing of the job dir beyond [`BUN_INSTALL_INPUTS`]: no
/// dependency by path, no workspaces or patches, and no root lifecycle script, which bun
/// runs next to the manifest and which may read the job's other files.
#[cfg(any(unix, test))]
fn bun_install_can_stage(package_json: &str, lock: Option<&str>) -> bool {
const DEP_SECTIONS: [&str; 6] = [
"dependencies",