Skip to content

refactor(transaction)!: build Txn V2 actions through constructors - #11014

Open
wjones127 wants to merge 4 commits into
mainfrom
will/transaction-v2-action-constructors
Open

wjones127 wants to merge 4 commits into
mainfrom
will/transaction-v2-action-constructors

Conversation

@wjones127

@wjones127 wjones127 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #8646. Replaces #10803, moved to a lance-format branch so the conflict-resolution PRs can stack on it.

Summary

Txn V2 actions had public fields, so nothing showed which ones make claims about storage that apply cannot check. This PR makes every field private and builds actions through constructors:

  • Safe actions (ConfigUpdate, AddField, DropIndex, ReserveRowIds, ...) get new / try_new and builders.
  • Actions that make storage claims get try_new_unchecked / new_unchecked, whose # Contract doc lists what the caller certifies. For example, AddDataFile: the file exists, is a valid Lance file, holds the fragment's physical rows, and holds the declared fields. Most callers are expected to go through a higher-level writer API instead.
  • Wide actions (AddFragment, AddIndexSegment, AdjustIndexCoverage) take a public-field *Parts struct, so changing one field means certifying again: AddFragment::new_unchecked(AddFragmentParts { physical_rows: n, ..add.parts().clone() }).
let file = AddDataFile::try_new_unchecked(
    Ref::Local(0), data_file, vec![FieldRef::Committed(0)], None, true,
)?;
let config = ConfigUpdate::default().with_config(updates);

Checks that need only the action itself moved from apply into the constructors, and decoding goes through the constructors too. Checks against the table stay in apply. Changes in behavior:

  • main's two deletion-file location checks (a well-formed location, and no derived path on a minted fragment) now run in the SetDeletionFile constructor, which proto decode also calls.
  • AddOverlays no longer has a data_change field, since apply already required it to be true. Decoding rejects data_unchanged = true.
  • Actions built in Rust now get the duplicate-fragment checks on row selections, which used to run only when decoding.
  • These are now rejected at construction instead of at apply:
    • empty index names;
    • unset coverage on an index other than MemWAL;
    • empty key-column or SSTable lists;
    • a fragment-reuse transition without sources or destinations;
    • a locally minted field in a read assertion.

Evidence

Tests that relied on states that can no longer be built became constructor or decode tests. No coverage was dropped.

Merge Risk

Door: two-way. lance-table API only; the transaction wire format is unchanged.
Blast Radius: transaction (Txn V2 actions, which are experimental).

🤖 Generated with Claude Code

@wjones127
wjones127 added this pull request to stack #8647 November 12, 2026 23:17
@wjones127
wjones127 marked this pull request as ready for review November 12, 2026 23:18

@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 12, 2026
@wjones127 wjones127 changed the title refactor(transaction): build Txn V2 actions through constructors refactor!(transaction): build Txn V2 actions through constructors Nov 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

ACTION NEEDED
Lance follows the Conventional Commits specification for release automation.

The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification.

For details on the error please inspect the "PR Title Check" action.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. and removed K-approved Latest Gatekeeper recommendation permits acceptance. labels Nov 13, 2026
@wjones127
wjones127 force-pushed the will/transaction-v2-action-constructors branch from a05757f to fb224e9 Compare November 17, 2026 00:21
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 17, 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 17, 2026
@wjones127
wjones127 force-pushed the will/transaction-v2-action-constructors branch from fb224e9 to c26c489 Compare November 17, 2026 19:25
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 17, 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 17, 2026
@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

@wjones127
wjones127 force-pushed the will/transaction-v2-action-constructors branch from c26c489 to 53e5204 Compare November 17, 2026 19:55
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 17, 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 17, 2026
@wjones127
wjones127 force-pushed the will/transaction-v2-action-constructors branch from 53e5204 to c7965e8 Compare November 17, 2026 21:34
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 17, 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 17, 2026
@wjones127
wjones127 removed this pull request from stack #8647 November 19, 2026 02:01
@wjones127
wjones127 added this pull request to stack #11242 November 19, 2026 02:02
@wjones127
wjones127 force-pushed the will/transaction-v2-action-constructors branch from 840f6eb to 66eb547 Compare November 30, 2026 17:54
@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 removed this pull request from stack #11242 November 30, 2026 18:23
@wjones127
wjones127 added this pull request to stack #11653 November 30, 2026 18:23
@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. and removed K-approved Latest Gatekeeper recommendation permits acceptance. labels 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 removed this pull request from stack #11653 November 30, 2026 21:20
@wjones127
wjones127 added this pull request to stack #11664 November 30, 2026 21:20
@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 18:38
- Document the constructor convention (`_unchecked`, `try_`, `*Parts`,
  `data_change`, decoding) once in the action module doc and drop the
  per-decoder certification comments.
- Name fragment and field refs in constructor errors as "fragment 0" /
  "local fragment token 0" / "field 0" instead of their Debug form.
- Restore `pub(super)` on per-action `is_data_change`; `Action` is the
  entry point.
- Fix stale doc links and wording; build test actions through
  constructors and drop unused test setup.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Xuanwo

Xuanwo commented Dec 1, 2026

Copy link
Copy Markdown
Member

[AI-generated review comment]

The Linux build on de69e4505 fails to compile the lance-table tests. Five struct literals in rust/lance-table/src/transaction/action/config_update.rs access fields that are now private (E0451). They construct TombstoneFieldData, AddDataFile, AddField (twice), and DropField.

Could you update those fixtures from the current base to use the new constructors? The dependent parity tests in #10159 also fail to compile at these sites. Linux build log

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. and removed K-approved Latest Gatekeeper recommendation permits acceptance. labels Dec 1, 2026
@wjones127
wjones127 force-pushed the will/transaction-v2-action-constructors branch from de69e45 to 7acc64d Compare December 1, 2026 19:11
@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.

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

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

breaking-change K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants