Skip to content

Delete methods should return last known state data #636

@stack72

Description

@stack72

Problem

When a model's delete method succeeds, the response contains only metadata (modelId, modelName, type, methodName) — no data field. This is true even though the type schema defines dataOutputSpecs for the delete method with a state spec.

After a delete, there's no programmatic way to confirm what was removed. This matters for automation and audit logging where you want to record "deleted volume 8290fa55" or "deleted SSH key 54622838".

Observed behavior

{
  "modelId": "ca9547ff-...",
  "modelName": "test-volume",
  "type": "@stack72/digitalocean/volume",
  "methodName": "delete"
}

Expected behavior

The delete response should include the last known state from local data, e.g.:

{
  "modelId": "ca9547ff-...",
  "modelName": "test-volume",
  "type": "@stack72/digitalocean/volume",
  "methodName": "delete",
  "data": {
    "attributes": { "id": "8290fa55-...", "name": "swamp-crud-test-vol", ... }
  }
}

Proposed solution

Since the upstream API typically returns 204 No Content for deletes, swamp core should attach the last known state from its local data store as the delete response data. The data already exists locally from prior create/get/update calls — it just needs to be included in the delete response.

Scope

This is a swamp core issue, not provider-specific. The dataOutputSpecs are already defined on delete methods, suggesting the intent was to return data. Changes would be in the method execution path where delete responses are assembled.

Reproduction

Tested across 6 DigitalOcean model types (tag, ssh-key, project, vpc, volume, domain) — all delete methods return no data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureFeature request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions