Skip to content

LEP: Successor locks for scoped causality tracking - #39

Closed
mjansson wants to merge 2 commits into
mainfrom
mjansson/successor-locks-lep
Closed

LEP: Successor locks for scoped causality tracking#39
mjansson wants to merge 2 commits into
mainfrom
mjansson/successor-locks-lep

Conversation

@mjansson

Copy link
Copy Markdown
Collaborator

Summary

This proposal adds causal exclusive locks for unmergeable files in Lore's free branching model.

Each unmergeable file gains a server-side per-file "head" pointer naming the latest revision that modified it within a lock scope. An exclusive lock can only be acquired on a branch whose last-modification revision for the file (looked up via Lore's existing per-file-id back-pointer index) equals that head — i.e. the branch already contains every prior committed edit in scope.

Each unmergeable file becomes one linear edit chain per scope, embedded in the larger DAG; the lock acquisition is the gate that enforces successor-only progress within the scope. Scopes are first-class server-side entities with their own identity and lifecycle, independent of any specific branch; each branch carries a scope_id in its metadata, inherited from its parent at creation.

A repository has a default scope that all branches join unless they explicitly opt into another scope; a repository that only ever uses the default scope behaves identically to a global per-file chain (the degenerate case).

The check is constant-bounded — a single revision-id comparison against Lore's existing back-pointer lookup — with no path-keyed state and no materialized (branch × file) indices.

@mjansson
mjansson requested review from ayyyee and ragnarula June 20, 2026 02:31

@rajpratham1 rajpratham1 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This proposal is well thought out and addresses a real limitation of exclusive locking in a free-branching workflow. The distinction between temporal locking and causal ordering is clearly explained, and the introduction of scoped successor locks provides a scalable solution without introducing expensive global state. The design also does a good job of leveraging existing infrastructure (back-pointer index and mutable store) instead of adding complex new indexing.

@rajpratham1 rajpratham1 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice proposal overall. I like how it separates lock state from causality rather than trying to make a single mechanism solve both problems. The motivation clearly explains why traditional exclusive locks are insufficient under free branching, and the scoped successor-chain approach feels like a natural extension of Lore's existing architecture.

The design also scales well by reusing the existing per-file back-pointer lookup and keeping the validation to a constant-bounded revision comparison instead of introducing branch × file state. The scope abstraction is well motivated and avoids unnecessary coupling between release branches, main, and experimental work.
I also appreciate that the proposal discusses lifecycle management, enforcement policies, and the degenerate cases up front, making it easier to reason about operational behavior.

I don't see any blocking concerns from what I've reviewed. Looks solid to me and I'm happy to approve. Nice work! 🚀

@mjansson
mjansson force-pushed the mjansson/successor-locks-lep branch from eec6169 to cf76f1b Compare June 22, 2026 00:40
Signed-off-by: Mattias Jansson <mattias.jansson@epicgames.com>
@mjansson
mjansson force-pushed the mjansson/successor-locks-lep branch from cf76f1b to a09b07c Compare June 22, 2026 00:42
Signed-off-by: Mattias Jansson <mattias.jansson@epicgames.com>
@ajcarberry ajcarberry added LEP Lore Enhancement Proposal documentation Improvements or additions to documentation labels Aug 19, 2026
@mjansson mjansson added the ready-to-import Approved by Epic staff for import into Lore label Aug 31, 2026
@epic-lore-bot epic-lore-bot Bot added imported Imported into Lore for internal review and removed ready-to-import Approved by Epic staff for import into Lore labels Aug 31, 2026
@epic-lore-bot

epic-lore-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

Imported as Lore CR-498.

epic-lore-bot Bot pushed a commit that referenced this pull request Aug 31, 2026
## Summary
This proposal adds causal exclusive locks for unmergeable files in Lore's free branching model. 

Each unmergeable file gains a server-side per-file "head" pointer naming the latest revision that modified it within a *lock scope*. An exclusive lock can only be acquired on a branch whose last-modification revision for the file (looked up via Lore's existing per-file-id back-pointer index) equals that head — i.e. the branch already contains every prior committed edit in scope.

Each unmergeable file becomes one linear edit chain per scope, embedded in the larger DAG; the lock acquisition is the gate that enforces successor-only progress within the scope. Scopes are first-class server-side entities with their own identity and lifecycle, independent of any specific branch; each branch carries a `scope_id` in its metadata, inherited from its parent at creation.

A repository has a default scope that all branches join unless they explicitly opt into another scope; a repository that only ever uses the default scope behaves identically to a global per-file chain (the degenerate case).

The check is constant-bounded — a single revision-id comparison against Lore's existing back-pointer lookup — with no path-keyed state and no materialized (branch × file) indices.

```
Imported-PR: #39
Imported-From: bc0af0d
Imported-Base: e64d000
Imported-Merge: 4650071
Imported-Merge-Strategy: verbatim
Imported-Merged-Paths: 0
Imported-Author: Mattias Jansson (mjansson)
Signed-off-by: Mattias Jansson <mattias.jansson@epicgames.com>
GH-URL: #39
```

Lore-RevId: 846
Lore-Signature: 3ec7ee3afd64444783d7cd529e7a8eaf9c7b795b3cb6b5eb828b25e4746544d0
@mjansson

mjansson commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

Committed and going into implementation

@mjansson mjansson closed this Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation imported Imported into Lore for internal review LEP Lore Enhancement Proposal

Development

Successfully merging this pull request may close these issues.

3 participants