BOLT-1322 [7/7] api: integration tests for POST /v1/commands/vehicle/check-pairing-status
completedAdd integration / e2e tests for the new REST route at apps/api/src/routers/v1/commands/post.commands/vehicle/check-pairing-status/.
Cases:
1. POST against a Tesla vehicle → 200 with body { keyPaired: <bool>, applicable: true, extendedCapabilities: {...} }, latency well under 5s (one HTTP hop to adapter). Mock the adapter HTTP call.
2. POST against a non-Tesla vehicle (e.g. rivian, lucid) → 200 with body { keyPaired: null, applicable: false, manufacturer: "<actual>" }. NO adapter HTTP call made (assert mock not called).
3. POST against a non-vehicle device (e.g. battery, thermostat) → 400 with clear error message that this endpoint is for vehicles only.
4. POST against a device the caller is not authorized to see → 403.
5. POST against a non-existent device id → 404.
6. POST when adapter returns 502 → REST returns 502 with fall-back guidance OR returns last-known cached keyPaired from staticState with a stale:true flag — pick one based on what Amazon needs. RECOMMEND option (b): graceful degradation with stale flag.
7. Assert that successful Tesla path writes a Command audit row with output populated AND upserts vehicleStaticState.
Branch: havoc/bolt-1322-rest-integration-tests
Worktree: ../mono-bolt-1322-rest-integration-tests
Depends on: all of [1/7] [2/7] [3/7] [4-new] [5-new] [6/7]
Done when: integration tests green, route is exercised in CI, OpenAPI spec validates.
Event Timeline
created
status_change
queued → in_progress
failed
lease expired — re-queued for retry
in_progress → queued
status_change
queued → completed