chore(scripts): fail the check when an agent-device pin or its engine floor falls out of step

MA
19h ago
+304-2

What

  • pnpm check:peer-ranges (part of pnpm check) also fails when a package that depends on agent-device or an @agent-device/* plugin, regular or optional:
    • pins another version than @e2e-dev/mobile,
    • has no @e2e-dev/mobile peer, or
    • peers on @e2e-dev/mobile with a floor that does not ship that pin. The message names the floor to use.
  • On success it prints the packages on the pin: agent-device: @e2e-dev/e2b, @e2e-dev/limrun, @e2e-dev/mobile, @e2e-dev/revyl, @e2e-dev/testmu on 0.21.44.

Why

  • Each provider checks its agent-device against the engine's only when a device is leased (packages/mobile/src/lease/plugin.ts:26). npm cannot see that, so a pin or a peer floor that an agent-device bump missed installs cleanly and fails the run.
  • It happened in #2304: every pin moved 0.21.42 -> 0.21.43 while the providers' floors still named releases on older pins, and #2299 / #2319 raised them to >=0.12.10 by hand.

How it works

  1. agentDevicePins takes the agent-device version @e2e-dev/mobile pins, and every other package's dependencies and optionalDependencies entry for agent-device or a plugin must equal it. An optional entry wins over a regular one of the same name, as npm installs it (scripts/agent-device-pins.ts:66-95).
  2. Each such package must peer on @e2e-dev/mobile. Its floor is valid when the tagged @e2e-dev/mobile@<floor> release pins the same agent-device, or, with no tag, when the floor is at or above the engine's current version: the release still to come, or the one version-packages just cut and publish has not tagged yet. A failure names the first release on the pin, or the next patch when none is released (scripts/agent-device-pins.ts:96-106).
  3. check-peer-ranges.ts reads the engine's release history from its @e2e-dev/mobile@* tags with git show (scripts/check-peer-ranges.ts:52). spec.yml checks out with fetch-depth: 0, so CI has the tags. A checkout without them still checks the pins and prints a note that the floors were skipped; a git that cannot run fails the check instead. The floor parser is the one public-packages.ts already uses for wide ranges (wideRangeFloor).
  4. AGENTS.md states the rule after the peer-range paragraph.

A changesets fixed group would also keep the pins in step, but would republish every provider on every engine release, so the check enforces it instead. A user who updates @e2e-dev/mobile alone can still meet the runtime error; semver ranges cannot express "the same agent-device".

Issue

Fixes #2434

Verified

Ran it locally: yes, rebased on 5a2adf15f.

  • pnpm test:scripts: 292 of 292 pass, 13 of them in scripts/agent-device-pins.test.ts. That includes the case the review found: every pin moved and no floor, against a released 0.12.10. Lint, fallow, and tsc -p scripts are clean.
  • Replayed the manifests from #2304 (342e95abe) against the real tags:
@e2e-dev/e2b peers on @e2e-dev/mobile ">=0.12.6 <1", but @e2e-dev/mobile 0.12.6 pins agent-device "0.21.36", not "0.21.43": raise it to >=0.12.10, the first @e2e-dev/mobile release on agent-device 0.21.43
@e2e-dev/revyl peers on @e2e-dev/mobile ">=0.12.9 <1", but @e2e-dev/mobile 0.12.9 pins agent-device "0.21.42", not "0.21.43": raise it to >=0.12.10, the first @e2e-dev/mobile release on agent-device 0.21.43
@e2e-dev/testmu peers on @e2e-dev/mobile ">=0.12.8 <1", but @e2e-dev/mobile 0.12.8 pins agent-device "0.21.39", not "0.21.43": raise it to >=0.12.10, the first @e2e-dev/mobile release on agent-device 0.21.43
exit=1

>=0.12.10 is the floor #2299 and #2319 set by hand.

  • On today's main, moving every pin to 0.21.45 and no floor passes, correctly: 0.12.10 is not released yet (the engine is at 0.12.9), so the next release ships 0.21.45. Once 0.12.10 is tagged with 0.21.44, the same edit fails, as the unit test shows.
  • Simulated a missed bump (@e2e-dev/revyl's plugin at 0.21.43):
mainthis PR
check:peer-ranges passesexit 1: @e2e-dev/revyl depends on @agent-device/revyl "0.21.43"; @e2e-dev/mobile pins agent-device "0.21.44"

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/**/*.mdx page for the behavior, and skills/e2e/ if the skill describes it.
  • Contract change: emitted .d.ts reviewed, tests/types/sdk-types.ts updated; wire change edits the schema and both fixtures.
  • Engine contract change (e2e/engine): changesets for e2e, @e2e-dev/web, and @e2e-dev/mobile.

Summary by CodeRabbit

  • Chores
    • Expanded package consistency checks to cover packages that use agent-device or its plugins, including matching version pins and required peer version floors.
    • Checks report consistency issues, note when release history is unavailable for floor checks, and display pinned packages when all checks pass.
  • Documentation
    • Documented the additional consistency requirements and how agent-device version updates affect related pins and floors.
  • Tests
    • Added coverage for matching and mismatched versions, missing dependencies, peer floors, and release-history edge cases.