Skip to content

Conversation

dmiller-figma
Copy link
Contributor

Without this change we incur the cost of an extra unnecessary syscall on every file we need to sync. In my testing this didn't make a perceivable difference with small sets of changed files, however it could make a difference on large ones.

This change works just fine on Linux. However, on macOS you get a permission error if you try to copy over an existing file without grant_sandbox_write_permissions = True. So on macOS we only enable this optimization if grant_sandbox_write_permissions == True, otherwise we unlink the file like we did before.


Changes are visible to end-users: no

Test plan

Existing tests

If it is possible to write a test that only runs on macOS, we could test that code path. However, I'm not sure how feasible that is.

Copy link

aspect-workflows bot commented Mar 3, 2025

Test

⚠️ Buildkite build #7580 failed.

Failed tests (1)
//docs:update_9_test [k8-fastbuild] 🔗

💡 To reproduce the test failures, run

bazel test //docs:update_9_test

Test

e2e/bzlmod

All tests were cache hits

5 tests (100.0%) were fully cached saving 502ms.


Test

e2e/gyp_no_install_script

All tests were cache hits

2 tests (100.0%) were fully cached saving 183ms.


Test

e2e/js_image_oci

All tests were cache hits

1 test (100.0%) was fully cached saving 8s.


Test

e2e/npm_link_package

All tests were cache hits

3 tests (100.0%) were fully cached saving 448ms.


Test

e2e/npm_link_package-esm

All tests were cache hits

3 tests (100.0%) were fully cached saving 533ms.


Test

e2e/npm_translate_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 30ms.


Test

e2e/npm_translate_lock_empty

All tests were cache hits

1 test (100.0%) was fully cached saving 30ms.


Test

e2e/npm_translate_lock_multi

All tests were cache hits

2 tests (100.0%) were fully cached saving 268ms.


Test

e2e/npm_translate_lock_partial_clone

All tests were cache hits

1 test (100.0%) was fully cached saving 31ms.


Test

e2e/npm_translate_lock_replace_packages

All tests were cache hits

3 tests (100.0%) were fully cached saving 603ms.


Test

e2e/npm_translate_lock_subdir_patch

All tests were cache hits

1 test (100.0%) was fully cached saving 98ms.


Test

e2e/npm_translate_package_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 31ms.


Test

e2e/npm_translate_yarn_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 31ms.


Test

e2e/package_json_module

All tests were cache hits

1 test (100.0%) was fully cached saving 253ms.


Test

e2e/pnpm_lockfiles

All tests were cache hits

42 tests (100.0%) were fully cached saving 3s.


Test

e2e/pnpm_workspace

All tests were cache hits

10 tests (100.0%) were fully cached saving 2s.


Test

e2e/pnpm_workspace_rerooted

All tests were cache hits

12 tests (100.0%) were fully cached saving 2s.


Test

e2e/repo_mapping

All tests were cache hits

3 tests (100.0%) were fully cached saving 404ms.


Test

e2e/rules_foo

All tests were cache hits

2 tests (100.0%) were fully cached saving 187ms.


Test

e2e/runfiles

All tests were cache hits

1 test (100.0%) was fully cached saving 173ms.


Test

e2e/vendored_node

All tests were cache hits

1 test (100.0%) was fully cached saving 99ms.


Buildifier

Buildifier managed files require formatting

--- ./e2e/js_run_devserver/src/BUILD.bazel	2025-03-12 23:15:49.045607043 +0000
+++ /tmp/buildifier-tmp-1065325043	2025-03-12 23:16:19.457527224 +0000
@@ -120,8 +120,8 @@
         ":simple",
         ":web_files",
     ],
-    log_level = "debug",
     grant_sandbox_write_permissions = True,
+    log_level = "debug",
 )
 
 # Now the js_binary variant
@@ -140,9 +140,9 @@
     data = [
         ":web_files",
     ],
+    grant_sandbox_write_permissions = True,
     log_level = "debug",
     tool = ":simple_bin",
-    grant_sandbox_write_permissions = True,
 )
 
 # Intentionally a js_library and not a js_binary to test that transitive npm are

💡 Run the following to apply the suggested formatting fixes

bazel run //:buildifier

Format

Formatting check has failed

💡 Some formatting failures can be fixed automatically by running the command below, while others may require manual fixes

bazel run //:format -- e2e/js_run_devserver/src/BUILD.bazel

ℹ️ A patch file containing the changes has been archived as an artifact of this build

console.error(`Dst exists: ${exists}`)
}
if (exists) {
await fs.promises.unlink(dst)
Copy link
Member

Choose a reason for hiding this comment

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

Don't we need to keep this when !grant_sandbox_write_permissions?

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.

2 participants