Skip to content

feat(transaction): name the user step in action set conflict errors - #11663

Open
wjones127 wants to merge 4 commits into
will/conflict-footprint-redesignfrom
will/txn-v2-conflict-errors
Open

wjones127 wants to merge 4 commits into
will/conflict-footprint-redesignfrom
will/txn-v2-conflict-errors

Conversation

@wjones127

@wjones127 wjones127 commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Action-set commit conflicts reach end users, who should not need to know about actions. Today the message is a footprint part's Debug output or the internals of the replay. This PR changes both messages to name the user's step (UserStep::description), the concurrent commit, and what collided.

Commit conflict: step "delete rows where a = 1" conflicts with a concurrent Delete (version 2): rows were removed from fragment 0, which this step writes. Retry the operation.

How it works:

  • Each footprint part and forbid records the index of the step that added it. A commit with no conflict does no extra work and no IO.
  • Verdict::Conflict now holds a structured Conflict: our step indices, the cause (a Part or a Collision), and an Attribution to the committed transaction and, when known, its step. The attribution is found by scanning the committed footprints the window already holds.
  • A named operation in the window still conflicts, but the manifest change now explains why.
  • A named operation that loses to an action set names the action set's steps, with the same wording. The named operation's footprint cannot be stated, so there is no cause to give.
  • ApplyError::Rejected now carries the index of the step being applied. The replay names that step and lists the commits since the read version.
  • One function in lance-table-runtime (conflict_resolver::message) produces the wording.
  • Part is exported from transaction::action again, since the wording names each kind of part.

Decisions:

  • A message names up to 3 conflicting steps and adds "and N more" with the exact count of the rest. Counting is free: a compatible transaction already checks every part, and the conflicting path checks no more than that.
  • A step with no description is named "step N of M" on its own, or "an unnamed step (N of M)" inside a list.
  • There is no convention for descriptions yet. A rustdoc note on UserStep::description says it is shown to end users.
  • The change is to the text of RetryableCommitConflict only. There is no typed source and no new lance_core::Error variant. Conflicts between two named operations keep their old messages.

Evidence

Before (output of the new tests on the base branch):

This CompositeOperation transaction was preempted by concurrent transaction Delete at version 2. Please retry.
This CompositeOperation transaction was preempted by the transactions committed after version 1 up to version 2: MapEntry { map: Config, key: "key-1193" } changed. Please retry.
this action set applies to the version it read, 1, but not to the latest, 2: Invalid user input: AddField names a field "c", but field 2 already has that name at the same level; field names are unique among siblings, rust/lance-table/src/transaction/action/apply.rs:677:24

Before, for a named operation losing to an action set:

This Delete transaction was preempted by concurrent transaction CompositeOperation at version 2. Please retry.

After:

Commit conflict: step "delete rows where a = 1" conflicts with a concurrent Delete (version 2): rows were removed from fragment 0, which this step writes. Retry the operation.
Commit conflict: steps "set a", "set b", "set c" and 2 more conflict with a concurrent step "step" (version 2): config key 'a' was changed. Retry the operation.
Commit conflict: this Delete conflicts with a concurrent step "add column 'c'" (version 2). Retry the operation.
Commit conflict: step 2 of 2 no longer applies after concurrent commits (version 2 "add column 'c'"): AddField names a field "c", but field 2 already has that name at the same level; field names are unique among siblings. Retry the operation.

Merge Risk

Door: Two-way. Only error text and in-memory types change, and the Transaction V2 API is experimental.
Blast Radius: The text of conflict errors when an action set is involved. Which commits conflict does not change.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the enhancement New feature or request label Nov 30, 2026
@wjones127
wjones127 added this pull request to stack #11664 November 30, 2026 21:20
@wjones127
wjones127 marked this pull request as ready for review November 30, 2026 23:22

@claude claude Bot 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.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 30, 2026
@wjones127
wjones127 force-pushed the will/txn-v2-conflict-errors branch from 8744d61 to 322132a Compare November 30, 2026 23:33
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 30, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 30, 2026
@wjones127
wjones127 force-pushed the will/txn-v2-conflict-errors branch from 322132a to 8470273 Compare December 1, 2026 16:39
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Dec 1, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Dec 1, 2026
@wjones127
wjones127 force-pushed the will/txn-v2-conflict-errors branch from 8470273 to 61ffa2d Compare December 1, 2026 18:21
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Dec 1, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Dec 1, 2026
wjones127 and others added 4 commits December 1, 2026 19:01
…tion set conflicts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion set conflicts

Conflict errors for action sets now name the user step, the concurrent commit
by operation or step, and what collided in terms of fields and fragments,
instead of footprint parts or action names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…et a named operation lost to

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…et a named operation lost to

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wjones127
wjones127 force-pushed the will/txn-v2-conflict-errors branch from 61ffa2d to 263e885 Compare December 1, 2026 19:12
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Dec 1, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Gate recommendation: approve.

Conflict detection and replay validation retain their existing behavior, with diagnostics derived from in-memory step attribution.

Please mark this PR with the breaking-change label: lance_table::transaction::action::Verdict::Conflict now carries Conflict instead of String, and lance_table::transaction::action::ApplyError::Rejected is now a struct variant with error and step fields, so Rust callers constructing or matching these variants must update their code.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Dec 1, 2026

@geruh geruh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like this direction, I pulled this down and ran some more combinations of transactions. But I think we're trying to infer a bit too much from the footprint though. For example, this is what I got with a column rewrite at v2 followed by a delete at v3:

Step "delete rows" conflicts with a concurrent step "rewrite col x" (version 2): rows were removed from fragment 0.

can we just do something like this instead?

Cannot commit "delete rows": the deletion file for fragment 0 changed between versions 1 and 3. [optionally can add a retry operation for a call to action if possible]

We can still include the commit and step when we actually know them. Otherwise just report what changed and the version range. I think this would simplify some of the logic without needing any additional state or IO. wdyt?


/// A committed transaction a conflict is attributed to.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Attribution {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: what do you think about ConflictSource or something close to that I think this pairs with the ConflictCause logic

for (forbid, step) in &self.forbids {
if cause.is_some() && steps.contains(step) {
continue;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What if our steps conflict with different commits? I tried this with config keys being changed in separate commits and the error reports both steps as conflicting w/ the commit that changed the first key

fn attribute(&self, part: &Part) -> Option<Attribution> {
let touching = |touches: &dyn Fn(&Part) -> bool| {
self.committed
.iter()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I tried this locally with a rewrite followed by a delete, and the error ended up calling out the rewrite for removing the rows. hit the same thing with an exact fragment exists match too. Since touching a part doesn't mean a commit actually changed it, would it be safer to just fall back to the version range when we aren't sure which commit did it?

/// exactly as it read it.
pub(super) fn touch(&mut self, part: Part) {
self.parts.insert(part);
self.parts.entry(part).or_insert(self.step);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't we lose the other steps that depend on this part?

Operation::CompositeOperation(operation) => {
let steps = match step {
Some(step) => Steps::named(operation, &[step], 0),
None => Steps::named(operation, &[], 0),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we don't know which step conflicted why are we listing the first few? The same behavior is in replay_conflict_message

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants