Repository navigation
Apps contract 1: device re-read after app changes; Add discloses the chosen channel's release - #1345
Merged
Merged
Conversation
…'s ports are the device's An app's services are its device's services, and every part of the portal that connects to one (its row's terminal button, its connect panel, Open, Open terminal on the Apps section and the app's page) reads where it listens from the device in the store. A port setting moved the port in graphql, and only the apps were read again: the app's page showed the new port while Open terminal connected to the old one until some other device refresh. useDeviceApps now reads the device again (devices.fetchSingleFull, under the device's account) after a port setting and after any app change that went through, since enabling, disabling, removing or moving an app to another release can add, remove or move its services with no event saying so while the service stays online. The app's page reads its services' ports from the device too, so DeviceAppService.ports, a second copy of the same fact, is no longer asked for. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nly for that choice The Add dialog sent the channel chosen but disclosed what the account's channel's release asks (CatalogApp.root and capabilities), so choosing beta where beta's release asks ssh-exec, or runs as root, never said so. addAsks (appsHelper) resolves the releases an add gives as graphql does (releaseFor, channelVersion): the pin; else the chosen channel's, the account's where none is: its candidate to the devices in its share and its current to the rest, a channel naming none giving stable's, a withdrawn release none. Root and capabilities are what those releases ask together, each as CatalogApp.releases lists it; one not among the releases read asks what the app's own fields say, graphql refusing an add whose consent does not cover its release. The yes is kept with what it was given for (target, product, releases): another channel, pin, target or product asks it again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Author
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two findings Codex raised on #1344 (apps-contract-1 into device-trust).
An app change reads its device again; a service's ports are the device's
A port setting moved the service's port in graphql (
setAppSettingre-applies the app's service before it answers), but onlyuseDeviceAppsre-read the apps. The device in the store (DeviceContext.device.services) kept the old port, so the app's page showed the new port while Open terminal (AppTerminalAction,servicePort(device, …)) connected to the old one. The same stale device fed the service row's terminal button, the connect panel and Open (which goes through the service's connect page).useDeviceAppsreads the device again withdevices.fetchSingleFull({ id, accountId, hidden: true, silent: true })after a port setting and after any app change that went through (enable, disable, add, remove, channel, pin). Those can add, remove or move the app's services, and while a service stays online no device event says so. Callers pass the device'saccountIdso the device is re-read under the account it was loaded for.IDevice.services, and only the app's page readDeviceAppService.ports. Switching the connection paths to graphql's app view would still leave the service list and connect panel on the device. So the app's page now reads its services' ports from the device too, andDeviceAppService.portsis no longer queried. The apps re-read after a port setting is gone because nothing reads that copy now.Add an app: what the chosen channel's releases ask
The Add dialog sent the chosen
channelbut disclosedCatalogApp.root/capabilities, which describe the account's channel's release.addAsks(helpers/appsHelper) resolves the releases an add gives the way graphql does (releaseFor,channelVersion):Root and capabilities are what those releases ask together, each as
CatalogApp.releaseslists it. A release missing from the releases read (only the newest 50 are) falls back to the app's own fields, asuseReleaseAsksalready does. graphql still refuses an add whose consent doesn't cover its release. The API has every field this needs (CatalogApp.channels { current candidate share },releases { root capabilities withdrawn }).The consent is now stored with what it was given for (target, product, releases). Changing the channel, pin, target or product unticks it.
Follow-up (not in this PR)
graphql on device-trust asks
consentRootfor any release whose manifest declares capabilities, not only root ones (asksConsentin app-catalog.ts; device-apps.ts refuses "asks for … takes consentRoot"). The portal still asks a yes for root releases only. A restricted app that declaresperson-certificatesorssh-execis shown with its capabilities but no checkbox, in this dialog and inuseAppSwitch, so graphql would refuse that add or enable.Tests
useDeviceApps.test: device re-read after a port setting (service's or listener's), after an enable that went through; not after a non-port setting, a refused change or a refused setting.appsHelper.test(addAsks): account channel, chosen channel, candidate share, stable fallback, pin, withdrawn, release not read.AppAddDialog.test: beta's capabilities disclosed, a root candidate asks the yes and passeschannel+consentRoot; the yes is invalidated by channel, pin and target changes.DeviceAppPage.test: service ports from the device.npm run typecheck, andnpm run i18n:extract(no catalog changes) all pass.🤖 Generated with Claude Code