Skip to content

PUT /api/v1/devices/:deviceId redeploys the target snapshot even when it has not changed #8813

Description

@andypalmi

The route decides whether the target changed with request.body.targetSnapshot !== device.targetSnapshotId, which compares the snapshot hashid with the numeric id, so it is always true.

Steps to reproduce

  1. Set a snapshot as a device's target.
  2. Set the same snapshot again.

The second call sends another update command to the device and writes another pair of device.snapshot.deployed and device.snapshot.target-set audit entries. A device in developer mode gets a forced update, which discards any unsaved changes in the device editor.

Expected

Setting the current target again is a no-op.

Reference

forge/routes/api/device.js:736. The UI avoids it by checking the current target first (SnapshotDetailsDrawer.vue:295), and so does the MCP tool in #8811.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:apiWork on the platform APItype:bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions