OpenFn / OpenFn/lightning

Smelly redundancy in setting the lock_version

Open
#3,863 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Bit of a smell here, we shouldn't need to set the lock_version because we've just checked it was the same.

The name should never change without a lock_version bump.

However deleted_at, I can't say for sure that we actually replicate that change to the ydoc. Actually I'd be surprised if we did since we don't do an optimistic lock during mark_for_deletion, and so lock_version change and also we don't subscribe to workflow_updated events for Sessions/SharedDocs.

So I'm leaving this all in, going to hunt down the source of why setting these over here is needed, and also what happens if when a SharedDoc isn't running at the doc needs to reconciled.

Originally posted by @stuartc in https://github.com/OpenFn/lightning/pull/3855#discussion_r2465830591

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.

Research direction

Start by reviewing the discussion from pull request 3855 and trace why lock_version and deleted_at are set during reconciliation. Check how SharedDocs and Sessions handle workflow_updated events, including when a SharedDoc is not running; done means the source of the assignments and the reconciliation behavior are established.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
backend, distributed-systems
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.