refactor: declare the profile fields each provider consumes, once

Merged
AM
2mo ago
+886-82

Summary

Split out of #3118 and stacked on #3165. Please review only the top three commits. This is the single consumed-field admission you asked us to keep in core.

  • A new @agent-device/contracts/provider-profile-fields export holds:
    • ProviderProfileFieldDeclaration, a full consumed/refused record over the profile fields.
    • rejectRefusedProviderProfileFields.
  • Each provider declares the fields it consumes: BrowserStack, AWS Device Farm (CLOUD_WEBDRIVER_PROFILE_FIELDS) and Limrun (LIMRUN_PROFILE_FIELDS). The runtime's profileFields is required.
  • That one declaration is enforced on connect, direct leases.allocate, remote-config, and repeat allocation of a live lease.
  • If a repeat allocation fails, the reused lease is no longer released.
  • Review nit [1]: PROVIDER_PROFILE_FIELD_FLAGS is the single field-to-flag map, and the BrowserStack device-feature specs derive their flags from it.

Behaviour changes (nit [5]): flags that were silently ignored are now refused:

  • AWS Device Farm refuses --provider-app, --provider-os-version (and its --os-version alias), --provider-project and --provider-build.
  • BrowserStack refuses --aws-*.
  • Limrun refuses every flag except --provider-app.

None of the documented examples or help text use a refused flag.

Validation

  • pnpm check:affected --run passes, including replay-compat with release tags fetched.
  • eager-closure-budgets passes.

🤖 Generated with Claude Code