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) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Brennan Benson
2026-11-01 23:20:09 -08:00
committed by GitHub
co-authored by Claude Opus 5.5
parent d8a66e41c9
commit f5a36554ff
2 changed files with 5 additions and 1 deletions
@@ -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(',')}` : ''
}
@@ -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]))
})
})