fix(mobile): keep a provider's configuration error as INVALID_CONFIG
Closed
FI
2d ago+63+63+01234567890123456789-2-2-0123456789
What
- A device provider whose
acquireorreleasethrows aConfigurationErrornow fails the run with that error's code (for exampleINVALID_CONFIG, exit code 2) instead ofENGINE_FAILURE(exit code 3). The message still names the provider. Any other error is stillENGINE_FAILURE.
Why
allOrFirstFailure()wrapped every provider rejection asENGINE_FAILURE, so a provider that reports a missing API key or an unknown device exited 3, and CI that retries infrastructure failures retried a run that could not pass. This keeps the provider's configuration error as one.
How it works
allOrFirstFailure()rethrows a rejectedConfigurationErroras aConfigurationErrorwith the same code, thedevice provider "<name>" could not ...prefix, and the original ascause(packages/mobile/src/provider.ts:237). Other rejections take the existingEngineError('ENGINE_FAILURE')path on the next line. Bothprepare(acquire, line 273) andfinish(release, line 317) go through this function.isConfigurationError()(packages/mobile/src/provider.ts:223) also matches aConfigurationErrorfrom a provider's own copy of@e2e-dev/core, which failsinstanceof, by itscategory: 'configuration'and stringcode. Engine packages import only@e2e-dev/core/engine, which does not exportisE2EError.- Unit tests drive
preparewith a provider whoseacquirethrowsConfigurationError('INVALID_CONFIG', ...)(packages/mobile/tests/unit/provider.test.ts:446), and one that throws such an error from another copy with codeMISSING_KEY(line 463). They check the class, code, and message. docs/mobile.mdx:696says which error gives which exit code.
Issue
Fixes #2542
Verified
Ran it locally: yes
-
I ran
e2e run; echo $?against packages built frommain(114a497c9) and from this branch (df4e0db28), with four configs:- the issue's config,
mobile({ platform: 'ios', device: limrun() })withLIMRUN_API_KEYunset; - the same config with
@e2e-dev/limrunloading its own copy ofe2eand@e2e-dev/core, so itsConfigurationErrorfailsinstanceof; - a minimal provider whose
acquirethrowsConfigurationError('INVALID_CONFIG', …); - the same provider throwing a plain
Error('service unreachable').
Each run fails while getting a device, so no device or account is needed.
- the issue's config,
| main | this PR | |
|---|---|---|
limrun(), no LIMRUN_API_KEY | ENGINE_FAILURE, exit 3 | INVALID_CONFIG, exit 2 |
limrun() on a second copy of @e2e-dev/core | ENGINE_FAILURE, exit 3 | INVALID_CONFIG, exit 2 |
acquire throws ConfigurationError | ENGINE_FAILURE, exit 3 | INVALID_CONFIG, exit 2 |
acquire throws Error | ENGINE_FAILURE, exit 3 | ENGINE_FAILURE, exit 3 |
main, limrun():
ERROR infrastructure error ENGINE_FAILURE (launch)
device provider "Limrun" could not lease a device: @e2e-dev/limrun requires LIMRUN_API_KEY in the run environment while preparing engine mobile for target "ios"
this PR, limrun():
ERROR configuration error INVALID_CONFIG (launch)
device provider "Limrun" could not lease a device: @e2e-dev/limrun requires LIMRUN_API_KEY in the run environment
Checklist
- Changeset added (
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only. - Breaking change: title carries
!, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md). - Docs updated in the same PR: the
docs/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it. - Contract change: emitted
.d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures. - Engine contract change (
e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.
🤖 Generated with Claude Code
Summary by CodeRabbit
- Bug Fixes
- Configuration errors raised while acquiring or releasing a device now fail the run with the provider’s error code, such as
INVALID_CONFIG(exit code 2), instead ofENGINE_FAILURE(exit code 3). The error message continues to identify the provider.
- Configuration errors raised while acquiring or releasing a device now fail the run with the provider’s error code, such as
- Documentation
- Clarified that if any worker slot cannot be leased, the run ends before tests start and previously acquired leases are released. Documented how configuration errors and other provider errors affect run status and exit codes.