OpenFn / OpenFn/lightning

Clean up orphaned Y.Docs when workflows are deleted

Open
#4,172 2 comments 0 reactions 1 assignee View on GitHub

@theroinaochieng is already working on this.

Since Dec 10, 2025.

Dominant language
Elixir
Stars
296
Forks
86
Avg merge
1d 13h
Merged PRs (30d)
50

Description

When workflows are hard deleted (via project purge), their associated collaboration_document_states records are left behind as orphans. This is because the table uses a string document_name (e.g., "workflow:uuid") with no foreign key to workflows, which is intentional to keep the CRDT system decoupled.

We should add a trigger on workflow hard delete (record-level deletion, not soft delete) to clean up associated document states, and run a one-time purge of existing orphaned documents.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.