Skip to content

The agent that grows with you

fix(build): skip macOS Finder metadata in build freshness hashing (#122632)

PRATHAMESH7564eca050eccf
diff --git a/scripts/build/freshness.mjs b/scripts/build/freshness.mjs
index 0f3475d0e65..4c1aec34d08 100644
--- a/scripts/build/freshness.mjs
+++ b/scripts/build/freshness.mjs
@@ -9,6 +9,15 @@ const receiptName = 'hermes-build.json'
const workspaces = { tui: 'ui-tui', web: 'web', desktop: 'apps/desktop' }
const generated = new Set(['node_modules', 'dist', 'build', 'release', '.cache', '.git', 'coverage', 'test-results', 'playwright-report'])
+// macOS Finder metadata is never a build input, and it can land in ANY hashed tree
+// (source, output or a prepared dir) the moment the checkout is opened in Finder mid-build
+// — .DS_Store, AppleDouble ._* sidecars and .localized. Skip it everywhere so it can't flip
+// a freshness hash and abort `hermes update` (#122632).
+const macMetadata = name => {
+ const base = name.split('/').pop()
+ return base === '.DS_Store' || base === '.localized' || base.startsWith('._')
+}
+
// buildTui bundles these source roots (including the Ink source alias), not
// the workspaces' documentation, test runners or other product recipes.
const tuiInputs = [
@@ -22,7 +31,7 @@ const tuiInputs = [
function treeHash(root, inputs, skip, contents = () => true) {
const hash = createHash('sha256')
function visit(name) {
- if (skip(name)) return
+ if (macMetadata(name) || skip(name)) return
const file = join(root, name)
hash.update(name.replaceAll('\\', '/')).update('\0')
if (!existsSync(file)) { hash.update('missing\0'); return }
diff --git a/tests-js/product-builders.test.mjs b/tests-js/product-builders.test.mjs
index de0e41ceeea..2883b9d1415 100644
--- a/tests-js/product-builders.test.mjs
+++ b/tests-js/product-builders.test.mjs
@@ -238,6 +238,11 @@ test('built web freshness follows shared sources and build inputs, not mtimes or
expect(productCurrent({ source, product: 'web', out })).toBe(true)
put(source, 'web/node_modules/.tmp/tsbuildinfo', 'generated')
expect(productCurrent({ source, product: 'web', out })).toBe(true)
+ // macOS Finder metadata written into hashed input dirs must not invalidate the build (#122632).
+ put(source, 'web/public/.DS_Store', 'finder metadata')
+ put(source, 'apps/shared/src/._client.ts', 'apple double sidecar')
+ put(source, 'assets/.localized', '')
+ expect(productCurrent({ source, product: 'web', out })).toBe(true)
// Install completion rewrites the runtime identity after building products.
put(source, 'install-stamp.json', '{"builtAt": "later"}')
expect(productCurrent({ source, product: 'web', out })).toBe(true)