DreamLake

Mounts left by deleted resources

Before issue #1343, deleting a workflow, artifact, annotation or scene changed only the resource row. Its kind: 'resource' nodes stayed live in every project tree. Readers hide them, because the resource is no longer readable, but the folder name check still counts them. A same-named resource therefore could not be mounted where the old one was, and the 409 named an entry no listing showed. A leftover mount also makes project grants answer 404, because a grant re-checks every attached resource.

Servers with the fix (not yet released) remove every mount and its Bindr memberships in the same transaction as the soft delete or purge (unmountEverywhere). A soft delete keeps external mount grants; a purge revokes them. Restore does not re-create mounts. Rows written by older servers remain until someone clears them; there is no migration.

Find them

Read-only. Run against the database you are authorized to inspect:

js
const catalogs = { workflow: 'Workflow', artifact: 'ArtifactCatalog', annotation: 'AnnotationCatalog', env: 'EnvCatalog' };
for (const [type, coll] of Object.entries(catalogs)) {
  db.Node.aggregate([
    { $match: { kind: 'resource', resourceType: type, $or: [{ deletedAt: null }, { deletedAt: { $exists: false } }] } },
    { $lookup: { from: coll, let: { rid: { $convert: { input: '$resourceId', to: 'objectId', onError: null, onNull: null } } },
      pipeline: [{ $match: { $expr: { $eq: ['$_id', '$$rid'] } } }, { $project: { deletedAt: 1 } }], as: 'resource' } },
    { $match: { $or: [{ resource: { $size: 0 } }, { 'resource.deletedAt': { $type: 'date' } }] } },
    { $project: { namespaceId: 1, projectNodeId: 1, path: 1, name: 1, resourceType: 1, resourceId: 1,
      state: { $cond: [{ $eq: [{ $size: '$resource' }, 0] }, 'missing', 'soft-deleted'] } } },
  ]).forEach(printjson);
}

missing means the resource was purged or its row is gone. soft-deleted means it is in the Trash, or it is a deleted workflow.

Clear them

Each of these goes through a normal route and its authorization. Only run them on production data with explicit approval.

  • Any type, one project: DELETE /namespaces/:slug/projects/:proj/resources with { "resourceType": "...", "resourceId": "<old id>" }. It needs project content-delete access and removes the node and its Bindr tags. This is the only route for deleted workflows and purged resources.
  • Trashed artifact: send DELETE /namespaces/:slug/artifacts/:id again. It is idempotent and now unmounts the artifact from every project.
  • Trashed artifact, scene or annotation that should go for good: purge it. A purge removes the mounts too.

A trashed scene or annotation answers 404 to a second soft delete, so use one of the other two routes. Run the query again afterwards; it should return nothing for the rows you cleared.