From f5a36554ff145b6c81f5f215ea4dd736f503ec06 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:20:09 -0800 Subject: [PATCH] fix(plugins): keep the plugin consent fingerprint Hermes-compatible so main's Mobile checks pass (#37370) * fix(plugins): build the consent fingerprint without toSorted so the phone bundle passes Hermes checks Main's Mobile verify has failed since #37316 because the plugin consent fingerprint (bundled into the phone app via src/shared) used Array.prototype.toSorted, which Hermes lacks. flatMap already returns a fresh array, so sorting it in place keeps the same result. * test(plugins): pin the consent fingerprint's command-order independence Co-Authored-By: Claude Opus 5.5 (1M context) --------- Co-authored-by: Claude Opus 5.5 (1M context) --- src/shared/plugins/approval/plugin-consent-fingerprint.ts | 3 ++- .../plugins/contributions/plugin-command-replaces.test.ts | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shared/plugins/approval/plugin-consent-fingerprint.ts b/src/shared/plugins/approval/plugin-consent-fingerprint.ts index 497bf8ed861..300ab62ec88 100644 --- a/src/shared/plugins/approval/plugin-consent-fingerprint.ts +++ b/src/shared/plugins/approval/plugin-consent-fingerprint.ts @@ -76,7 +76,8 @@ function replacementIdentity(manifest: PluginConsentSubject): string { .flatMap((command) => isPluginJsonObject(command) && typeof command.replaces === 'string' ? [command.replaces] : [] ) - .toSorted() + // flatMap already copied; the phone's Hermes engine lacks toSorted. + .sort() return actions.length > 0 ? `\0replaces:${actions.join(',')}` : '' } diff --git a/src/shared/plugins/contributions/plugin-command-replaces.test.ts b/src/shared/plugins/contributions/plugin-command-replaces.test.ts index d19875cc9e2..97b55d8c8dc 100644 --- a/src/shared/plugins/contributions/plugin-command-replaces.test.ts +++ b/src/shared/plugins/contributions/plugin-command-replaces.test.ts @@ -102,5 +102,8 @@ describe('consent for a replacement', () => { const replacing = fingerprint([{ id: 'tasks', title: 'Tasks', replaces: 'view.tasks' }]) expect(replacing).not.toBe(plain) expect(fingerprint([{ id: 'other', title: 'Other' }])).toBe(plain) + const tasks = { id: 'tasks', title: 'Tasks', replaces: 'view.tasks' } + const ports = { id: 'ports', title: 'Ports', replaces: 'sidebar.ports.toggle' } + expect(fingerprint([ports, tasks])).toBe(fingerprint([tasks, ports])) }) })