Repository navigation
Fix #753: [Bug][macOS] v1.2.3 → v1.2.4 内置更新失败:codesign requirement 缺少 "=" 与 "field." - #754
Memtensor-AI wants to merge 1 commit into
Conversation
…ate logs
The macOS update helper passed a bare requirement expression to
`codesign --verify -R`, so codesign treated it as a requirement file path
("No such file or directory"), and the Developer ID certificate OID lacked the
`field.` prefix, which the requirement parser rejects at the first dot
("unexpected char: '.'"). Every signed in-app upgrade therefore failed at
staging with "Memmy update does not have the installed Apple Developer ID
identity", leaving the UI on a generic "try again later" message.
- Build the requirement through `buildMacSigningRequirement()`, which emits the
literal `=` prefix and `certificate leaf[field.<oid>] exists`, while keeping
the bundle ID, Developer ID extension, TeamIdentifier and full signature
check. Values containing quotes/backslashes are rejected instead of being
spliced into the shell script.
- Add real `codesign` coverage for the generated requirement on macOS: the
corrected form parses and matches bundle ID, team and Developer ID extension
via a throwaway self-signed identity, while the two legacy forms still fail
with the reported errors and a foreign team/bundle ID is rejected. A mock
codesign also asserts the helper now forwards the literal requirement.
- Show a "View update logs" action next to update failures. A new
`memmy:open-update-logs` IPC opens the updates directory, where
`mac-update-install.log` records the concrete failure reason.
Refs MemTensor#753
🤖 Open Code ReviewTarget: PR #754 🔍 OpenCodeReview found 6 issue(s) in this PR. 1.
|
🔧 Open Code Review requested Agent fixOpen Code Review found 6 issue(s). I have resumed the development Agent to fix them.
The Agent will push a new commit to this PR branch. OCR will recheck after the commit is pushed. |
|
We are closing this PR and will not continue the review fixes here. The macOS in-app update fixes are already on main: lipo receives the executable before -verify_arch, and the codesign -R requirement starts with = and uses the field.1.2.840.113635.100.6.1.13 OID. That change is 580413e, merged to main in PR 729, and it is also on release/v1.2.401. This PR is still based on 74b26fc and conflicts with current main. The six review comments are about the additional "View update logs" work. The signature fix does not depend on that UI. If we want the log action later, we will open a new PR from current main. |
Description
Fixes issue #753: macOS in-app updates from v1.2.3 to v1.2.4 failed because the generated update helper passed a malformed codesign requirement.
Root cause and fix (App/shell/desktop/src/main/mac-update-scripts.ts): the requirement string handed to
codesign --verify -Rhad two syntax errors — it lacked the literal "=" prefix (so codesign interpreted it as a requirement file path and reported "No such file or directory") and the Developer ID certificate extension OID lacked thefield.prefix (parser error "unexpected char: '.'"). A new exportedbuildMacSigningRequirement()builds the literal requirement as=anchor apple generic and identifier "cn.memtensor.memmy" and certificate leaf[field.1.2.840.113635.100.6.1.13] exists and certificate leaf[subject.OU] = "<team>", and is now the single source for both the stage and install helper scripts. The existing bundle-ID, Developer ID extension, TeamIdentifier and fullcodesign --verify --deep --strictchecks are all retained; the unsigned-build path is unchanged. Values containing quotes or backslashes are rejected instead of being spliced into the generated shell script.Tests (App/shell/desktop/tests/mac-update-scripts.test.ts, gated to macOS, plus cross-platform assertions): (1) the generated requirement starts with "=", uses
field.<oid>, and contains the bundle ID / subject.OU clauses; (2) both helper scripts embed the corrected literal and no longer contain the legacy forms; (3) unsigned builds omit the team requirement; (4) realcodesignverification of ad-hoc-signed .app fixtures proves the corrected value is treated as an inline requirement (no ENOENT / "unexpected char"), reproduces both legacy failures exactly as reported, matches the bundle ID and rejects a different one; (5) a throwaway self-signed identity (TeamIdentifier in subject.OU + Developer ID extension OID, in a temporary keychain) confirms a same-team package passes the team/extension clauses while a foreign team, foreign bundle ID, or missing extension is rejected, and that the full shipped requirement parses (only the Apple anchor excludes the synthetic fixture). A mock-codesign test also asserts the helper forwards the literal requirement string to-R. App/shell/desktop/tests/packaged-runtime-boundary.test.ts was extended to lock in the new IPC channel.UI (App/frontend/desktop): update failures now carry a
showLogsflag, and the About tab renders a "查看更新日志 / View update logs" action beside the error instead of only "安装更新失败,请稍后再试。". Newmemmy:open-update-logsIPC +openUpdateLogs()preload bridge opens the updates directory containingmac-update-install.log, where the concrete reason is recorded. New zh/en message keysettings.about.openUpdateLogs; settings-page test covers error, prepared-with-failure, success (no link), and English rendering.Verification:
tsc --noEmitclean for App/shell/desktop and App/frontend/desktop; eslint reports 0 errors (only pre-existing warnings); targeted suites pass — shell mac-update-scripts + packaged-runtime-boundary + windows-update-validation (115 passed, 28 macOS-skipped on this Linux runner), frontend settings-page + i18n + model-config parity (103 passed). Known unrelated pre-existing failures on this Linux runner: Reactactis not a function in several App/frontend/desktop/src/app interaction tests and a computer-use-agent-restart test (both reproduce on a clean tree); Electron-dependent shell suites cannot load electron on Linux. The new macOS-only codesign tests were not executed here and will run on macOS CI.Related Issue (Required): Fixes #753
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Automated tests are pending.
Checklist
Reviewer Checklist