Repository navigation
fix(apps): let Update move a local-only grant to the app's repository - #30979
Conversation
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
0b336c2 to
ff57cdc
Compare
|
span=9487b5903595
|
|
span=4f71418ab9db
|
|
span=e63d9418f6e0
|
|
span=3748f099c3b9
|
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the consent proof is checked against the resolved row under the lifecycle lock, the grant is written before any repository code runs, it is put back on every failure path, and the owner gate is unchanged. Notes
[DESIGN-REVIEWED] 9cff5ac Description read[DESCRIPTION-READ] f2b982973ebe7d538df53e8375b2be5e6fa55476fa4cffb42853004ca420a86b That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS The blind reader read the main control, "Trust the repository and update", correctly and expected a confirmation, which it gets. The reluctance it reported is the consent dialog working as designed. The rough spots below are friction, not blockers. Notes
[UX-REVIEWED] 9cff5ac Description read[DESCRIPTION-READ] bf4ee1c220d6df5059a4ddf7a00140c594a5116fd8208eb6e8038107207143f3 That sha256 names everything this verdict read: the PR description, plus the 11 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Each item answers the reported dead end: an Update that either told the user to reinstall or claimed success it never had. Notes
What this change shipsInventory (8 items) — 8 justifiedIntent: Update an app first installed from a local folder to the registry version without uninstalling it first. This is a FIX.
The notification-bridge Discord sink files in the patch come from #32871, which is already on main. They are not inventoried here. [FIRST-PRINCIPLES-REVIEWED] 9cff5ac Description read[DESCRIPTION-READ] a1b279d9fbb4012d162154f198451a733bc74d4afb4c63cf63b14d69f2ead48e That sha256 names the PR description this verdict read. Recompute it with |
ff57cdc to
7531d43
Compare
|
span=1c4acca4f7da
|
|
span=e63d9418f6e0
|
7531d43 to
718267f
Compare
|
span=1427aa057fad
|
|
span=9487b5903595
|
718267f to
15381d1
Compare
|
span=898c6cff5962
|
An app installed from a local folder that a registry row offers a newer version of showed Update on both the Library tile and its detail page, but the two did different things. The tile re-copied the folder and reported success; the detail page ran the registry update, which the folder-only grant refuses with app_trust_local_only and a sentence telling the user to uninstall and reinstall. Update now installs the registry version on every surface (tile, Updates row, Update All, detail page), so each one reaches the same refusal. The refusal carries the repository it resolved, and the detail page's banner offers to trust that repository in the consent dialog. Confirming sends the registry update with that repository as consent proof; the update route checks the proof against the row the install resolves and that the grant is exactly the local one, records the repository grant before any repository code runs, and puts the local grant back if the update fails, before the old app restarts.
15381d1 to
9cff5ac
Compare
|
span=904770182ef4
|
bolichen97
left a comment
There was a problem hiding this comment.
Approving head 9cff5ac. The gate shows 97 checks passed, none red or pending.
What I checked in apps/local_trust_switch.py and the update route:
- The switch needs the owner's fresh consent and writes nothing on a mismatch.
check_switchrefuses unless the name holds exactly an unbound grant over positively local code (_grant_is_local_only) and the consent proof equals the freshly resolved row's normalized clone target. A stale proof isapp_trust_repository_mismatch, as the grant endpoint already answers. The coordinates are compared only and never echoed into responses or audit rows. - The grant is re-checked under the trust writer's lock.
bind_repositoryrepeats the check insidemutate_trust_settings, so a grant revoked or rebound meanwhile raisesGrantChangedand writes nothing. The binding lands before any repository bytes are fetched, in the same shape the consent dialog records for a fresh install. - A failed update fails closed.
restore_local_grantputs the local grant back only while the binding still names that repository and provenance is still local, and leaves an operator's own change alone. If that write fails, the repository grant that remains does not cover the restored local code, so the app is refused rather than widened.switch_cancel_safereverts a write that lands after a cancelled request. - Every step is audited under the existing grant operation.
This gives the owner a path the app_trust_local_only refusal had no way to offer. It does not widen any grant beyond what the consent dialog already records. No product regex and no new restriction.
…l to the trust step Follow-ups from the UX review of #30979 (issue #35913). - The detail page disables its plain Update while the local-only notice is up, with a title naming the notice's trust button. Pressing it only reran the refused update. - Update All's repository-trust and chat-control consent lines carry an "Open <app> details" button per named app, shown only while that notice is on screen. A trust app's button reruns the update on the detail page; a consent app's button only opens the page, since its update landed. - A trust retry that meets the local-only refusal hands off to the detail page, as a first refusal does. - The consent dialog's take-back line renders second, under the scope line, on every path. On a 390x844 phone it ended 283 px below the footer on the switch dialog and 139 px below it on the enable dialog; it now ends above both.
…l to the trust step Follow-ups from the UX review of #30979 (issue #35913). - The detail page hides its plain Update while the local-only notice is up, so the notice's trust button is the only Update on screen. Pressing the plain Update only reran the refused update, and a disabled copy kept its blue fill and still read as ready to press. - Update All's repository-trust and chat-control consent lines carry an "Open <app> details" button per named app, shown only while that notice is on screen. A trust app's button reruns the update on the detail page; a consent app's button only opens the page, since its update landed. - A trust retry that meets the local-only refusal hands off to the detail page, as a first refusal does. - The consent dialog's take-back line renders second, under the scope line, on every path. On a 390x844 phone it ended 283 px below the footer on the switch dialog and 139 px below it on the enable dialog; it now ends above both.
…l to the trust step Follow-ups from the UX review of #30979 (issue #35913). - The detail page hides its plain Update while the local-only notice is up, so the notice's trust button is the only Update on screen. Pressing the plain Update only reran the refused update, and a disabled copy kept its blue fill and still read as ready to press. - Update All's repository-trust and chat-control consent lines carry an "Open <app> details" button per named app, shown only while that notice is on screen. A trust app's button reruns the update on the detail page; a consent app's button only opens the page, since its update landed. - A trust retry that meets the local-only refusal hands off to the detail page, as a first refusal does. - The consent dialog's take-back line renders second, under the scope line, on every path. On a 390x844 phone it ended 283 px below the footer on the switch dialog and 139 px below it on the enable dialog; it now ends above both.
…l to the trust step (#35990) * fix(apps): hold Update under the local-only notice and link Update All to the trust step Follow-ups from the UX review of #30979 (issue #35913). - The detail page hides its plain Update while the local-only notice is up, so the notice's trust button is the only Update on screen. Pressing the plain Update only reran the refused update, and a disabled copy kept its blue fill and still read as ready to press. - Update All's repository-trust and chat-control consent lines carry an "Open <app> details" button per named app, shown only while that notice is on screen. A trust app's button reruns the update on the detail page; a consent app's button only opens the page, since its update landed. - A trust retry that meets the local-only refusal hands off to the detail page, as a first refusal does. - The consent dialog's take-back line renders second, under the scope line, on every path. On a 390x844 phone it ended 283 px below the footer on the switch dialog and 139 px below it on the enable dialog; it now ends above both. * test(apps): count the Update buttons that hide under the local-only notice The detail page's two Update buttons now carry an `!updateHidden` guard, so the locations test's line filter found none. Accept the guard. --------- Co-authored-by: EC2 Default User <ec2-user@ip-172-31-10-71.ec2.internal>
Problem / Motivation
Goal: Update on an app installed from a local folder does the same thing on every App Store surface, and its local-only trust refusal offers a button that trusts the app's repository and finishes the update.
An app installed from a local folder, which a registry also lists at a newer version, shows Update in two places that disagree. The detail page's Update runs the registry update, and the gateway refuses it with
app_trust_local_onlyand a sentence telling the user to uninstall the app and install it again from the App Store. The Library tile's Update re-copies the local folder and reports success, so the listed version never lands.Why it matters
Anyone who installs an app from a folder and later gets it from a registry hits this on every new version: the only way forward was to uninstall and reinstall, and the Library's Update said it had worked when it had not.
Not a goal
app_execution_denied,app_trust_repository_mismatch).What changed (motivation → approach → change)
The two buttons share a label but not a rule.
useAppUpdates.runUpdatepicked the action from the recorded source alone, so a folder install always took the folder re-copy, while the detail page's Update button runs the registry install. The fix makes Update mean "install the registry version" everywhere, so every surface meets the same refusal, and then gives that refusal a way forward.source: registry:<name>; a local-only refusal on a row opens the detail page, and Update All names the app and the trust stepPOST /api/apps/{name}/updatetrustRepositorywithsource: registry:<name>The refusal now carries
trustRepository, the normalized, credential-free coordinate of the row the install resolved; its sentence names no coordinate. The detail page shows that refusal in its error notice with its own translated sentence, naming the app and the repository, instead of the server's sentence. The notice keeps the agent hand-off and the journaled report, and carries the trust button in its footer. The button opens the existing consent dialog (appstore/TrustAppModal.tsx) on that repository. The dialog adds one line, above the list of what trust allows, saying the folder copy is replaced and the app's data is kept, and its confirm button uses the banner button's words. Confirming sends one update request with the repository as consent proof (api/client/apps.tsgains that argument), and the dialog writes no grant of its own. The notice (pages/AppDetailPageLocalOnlyNotice.tsx) and that hand-off (pages/appDetailPageLocalSwitch.ts) are their own modules, which keepsAppDetailPage.tsxunder the 2,000-line cap. After the update, the success message says the app was updated from its repository.The update route does the switch under the app's lifecycle lock (
apps/local_trust_switch.py). Before the install starts, it checks that the app holds a grant with no repository binding over local installed code, with or without the local marker that newer grants carry, and that the proof matches the row the install will use. Otherwise it answersapp_trust_switch_not_applicableorapp_trust_repository_mismatchand changes nothing. It then writes the grant the consent dialog writes for a fresh install, so no repository code runs under the folder's grant. The write checks the local grant again under the config lock. If the update fails, raises or is cancelled while the local copy is still installed, the route puts the grant back in its original shape, unless the operator changed the binding meanwhile. Since #32213 the app goes down only at the copy, so the revert runs through a newafter_failurehook on_reinstall_from_registry, before that helper restarts the old app, and the old backend starts trusted. The old app keeps running through the clone and build, and the health watch can stop it there because the repository grant does not cover its local code. So a failure before the copy puts the grant back and then starts the old backend again. Each step writes asecurity.trusted_apps.grantaudit row. The owner-only gate is unchanged, so an app token cannot switch its own trust.Specs updated in
docs/system-specs/modules/app-kit-platform.mdanddocs/system-specs/modules/security.md. Six new strings are translated in every locale underwebsite/src/i18n/locales.Backwards compatibility
Compatible: the update route gains one optional field and requests without it run as before; the refusal keeps its code and gains one field.
Removes nothing: no route, field, key or export is removed, and the folder re-copy stays available as Sync whenever no registry update is pending.
Tests
test/test_app_update_local_trust_switch.pypins the switch: the repository grant is in place when the install runs and stays on success; a refused, raising or stop-raising update restores the local grant before the old app starts, and a refusal before the copy restores it and then starts the old backend again; a grant without the local marker switches and is restored without one; a request cancelled mid-write reverts the grant that landed; a grant revoked between the check and the write is not put back; a failed revert still restores the app; a failure reported after the repository version was installed keeps the repository grant; a binding changed mid-update is left alone; a stale proof, a grant that is not local-only, malformed consent and an app token are each refused before anything stops, with config unchanged. Determinism: 5 repeats and 3 shuffled orders (seeds 11, 23, 47), all green; the flake-pattern ratchet passes.test/test_apps_registry_coverage_install.pypins the refusal's new field, normalized and without clone credentials, and that the coordinate stays out of the audited sentence.useAppUpdates.test.tsx,backendRefused.test.tsx,DiscoverPage.updatesTab.test.tsx,AppsPageW3Coverage.test.tsxandLibraryPageLaunchpad.test.tsxpin the routing: a folder install with a registry update opens the detail page from the Library, updates from the registry in place on the Updates row and in Update All, a local-only refusal on a row opens the detail page, and Update All names each app that needs repository trust and the step that grants it, instead of reporting it as failed; a folder install with nothing pending still syncs in place. These replace tests that pinned the folder re-copy for that case.AppDetailPageAutoAction.test.tsxpins the detail page: the Update navigation runs the registry install, the refusal shows the plain-words sentence with the repository address, the button and no empty install log, confirming sends one update with the proof and no separate grant, a failed switch reports the not-saved state, and other failures get no button.TrustAppModal.test.tsxpinslocalOnlyTrustRepository: it reads the code, not the field, and drops a credential-bearing value.Proof: PROVEN test/test_app_update_local_trust_switch.py::test_switch_binds_the_repository_before_the_install_and_keeps_it, test/test_app_update_local_trust_switch.py::test_a_legacy_local_grant_switches_and_keeps_the_repository_binding, test/test_app_update_local_trust_switch.py::test_a_failed_legacy_switch_restores_the_grant_without_a_local_marker, test/test_app_update_local_trust_switch.py::test_a_failed_update_puts_the_local_grant_back_before_the_old_app_starts[refused], test/test_app_update_local_trust_switch.py::test_a_failed_update_puts_the_local_grant_back_before_the_old_app_starts[refused-early] (head 0a921dd88b19)
Manual verification
Rendered the built SPA with dummy data (one app installed from a folder, a registry row at a newer version) and every
/api/**call answered from fixtures, then walked Update All, an Updates row's Update into the detail page, the refusal notice, the consent dialog and the confirmed update. The harness asserts the request each step sends. Screenshots below.Screenshots / video
The Library tile menu offers Update for a folder install that a registry lists at a newer version (dummy app "Field Notes").
Update All on the Updates page names the app that needs repository trust and the step that grants it, instead of reporting a failure:
An Updates row's Update opens the detail page, which shows the refusal in plain words with the trust button and the agent hand-off. Dark, light and phone width:
The consent dialog says the folder copy is replaced before the list of what trust allows, and its confirm button uses the notice button's words:
More: dialog on desktop, and the updated app
Related Issues
Fixes #30978
Sibling sweep
Swept: git grep -n "isRegistrySourced(" -- website/src, and git grep -n "updateApp(" -- website/src, excluding tests
Sibling: website/src/pages/apps/useAppUpdates.ts -- changed here
Sibling: website/src/pages/AppDetailPage.tsx -- changed here
Sibling: website/src/pages/apps/DiscoverPage.tsx -- not affected -- its Update navigates to the detail page, whose routing this PR changes
Pattern harvest
Rule candidate: review-prompt
Pattern: a control whose label is chosen by one predicate (an update is available) dispatches on a different one (the recorded source), so one word runs two actions
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)