feat(cloud): validate devices and OS versions against live API data - #190
Merged
Merged
Conversation
dcd cloud rejected any --ios-device, --ios-version, --android-device or --android-api-level value missing from the CLI's hard-coded enums before the API was consulted, so a device the API already runs could not be used until a CLI release listed it (5.5.0 refuses the iPhone 17, iPhone Air, iPhone 18 Pro and M5 iPads). Those values are now checked only against the compatibility data the API returns, which DeviceValidationService already used for the device/version pair; the enums remain as help text. An unknown device still fails before anything is uploaded, and now lists the devices the API offers: Play requests list the Play devices, and a device that exists but has no Play image says so. A lone device or version is still checked against the API's global defaults (iPhone 14 on iOS 17, Pixel 7 on API 34), because the API fills in the same defaults and rejects an incompatible pair; the error now says which default was checked and which flag to pass. If the API stops offering the device the CLI assumes is its default, a version-only request is left to the API instead of being refused against the stale assumption. The MCP run tool gets the same messages, naming its own parameters.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
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.
What & why
dcd cloudvalidated--ios-device,--ios-version,--android-deviceand--android-api-levelwithvalidateEnumagainst the CLI's hard-coded enums before the API was consulted. Any value missing from the enum was refused, even when the API runs it: the live 5.5.0 refusesiphone-17,iphone-air,iphone-18-pro(-max)andipad-pro-m5-11/-13, and #187 only fixed that for the devices known today.These values are now checked only against the compatibility data the API returns (
GET /results/compatibility/data).DeviceValidationServicealready checked the device/version pair against that data. The enums are kept for--helponly, so new devices and OS versions no longer need a CLI release. An unknown device still fails before anything is uploaded, and the error now lists what the API offers:(Output from the built CLI against the mock API.)
Lone device or lone version (API follow-up)
If a request names only a device, or only a version, the other half is still checked against the API's global defaults: iOS 17 / API 34 for the version, iphone-14 / pixel-7 for the device. The API does the same thing. In
test-request-validator.service.ts, on both dcdproduction(f53533fd) anddev(efb9face), the body destructuresiOSVersion = '17'andandroidApiLevel = '34'and returns a 400 for an incompatible pair. It never picks a version that suits the device.So
--ios-device iphone-17or--android-device pixel-10on its own fails in both places. The CLI error now says which default was checked and which flag to pass:Follow-up for the API (not changed here): the API could resolve a version that suits the device, or publish its defaults in the compatibility payload. The CLI's copy of the defaults (
device-validation.service.ts) has to change whenever the API's do, for example with the announced 19 Oct (API 36) and 26 Oct (pixel-10) default changes. One exception is already handled: if the API stops offering the device the CLI assumes is the default, a version-only request goes through to the API rather than being refused on a stale assumption.Matrix, per-flow, MCP
--ios-device-matrix/--android-device-matrixcells were already validated one by one through this service, never the enums. They get the new messages.DEVICECLOUD_OVERRIDE_*devices are validated by the API, whose execution planner returns errors that name the flow. The CLI never checked them against the enums, so nothing changes there.dcd_run_cloud_test(MCP) uses the same service. Its hints name its own parameters (iosVersion,androidDevice, …), not CLI flags.Type of change
fix— bug fixfeat— new featureperf— performance improvementrefactor— code change that's neither a fix nor a featuredocs— documentation onlychore/ci/build/test— tooling, no user-facing change!or PR notes a breaking-change footer)Checklist
pnpm lintpasses (0 errors; the 32 existing warnings are unchanged)pnpm typecheckpassespnpm buildpassesCHANGELOG.md(release-please handles this)README.md/STYLE_GUIDE.mdupdated if behaviour or output changedHow to test
pnpm lint && pnpm typecheck && pnpm test. The integration suite ran locally against a Prism mock of dcd-dev'sswagger.json(efb9face, #1425), and this change touches the API surface. Result: 249 passing (228 before, plus 19 unit and 2 integration tests).test/unit/device-validation.service.test.tsuses a payload with devices the enum doesn't have (iphone-19,pixel-12). It covers unknown and gated devices, the Play-specific message, default-version and default-device hints, MCP parameter names, and a prototype-key slug.dcd cloud <app.zip> <flow.yaml> --ios-device iphone-17 --ios-version 26 --dry-runis accepted.🤖 Generated with Claude Code