Skip to content

refactor: reuse format transaction conversion in commit paths - #11390

Merged
Xuanwo merged 2 commits into
mainfrom
xuanwo/transaction-conversion-cleanup
Nov 23, 2026
Merged

Xuanwo merged 2 commits into
mainfrom
xuanwo/transaction-conversion-cleanup

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Nov 23, 2026

Copy link
Copy Markdown
Member

Summary

Use the existing lance_table::format::Transaction::try_from(&Transaction) conversion in the two places that rebuilt the format wrapper by hand:

  • detached commit collision retry, when rebuilding the inline transaction copy
  • injected foreign-commit test helper

Also correct the format::Transaction docs. The wrapper holds a pb::Transaction message in memory; the manifest writer serializes it at write_protobuf. Because inner and From<pb::Transaction> are public, wrapping does not imply validation. The reverse From only moves the message out without another conversion.

Behavior and compatibility

  • lance_table::format::Transaction, inner, as_pb, CommitHandler, and ManifestWriter are unchanged.
  • No durable-format change; inline/spill decisions and schema classification remain in their existing paths.
  • Commit outcome verification still compares durable protobuf messages, preserving the rewrite frag-reuse case.
  • The detached retry still only rebuilds the inline copy; the external .txn file is still written once before the retry loop.
  • The injected foreign-commit test still exercises the same retry path through the shared conversion.

Validation

  • cargo fmt --all -- --check
  • cargo clippy --all --tests --benches --profile ci -j 8 -- -D warnings
  • cargo test -p lance-table --lib --profile ci format::transaction: 4 passed
  • One cargo test -p lance --lib --profile ci -j 1 --no-run link; 18 targeted runtime tests passed from the same binary:
    • 8 commit outcome and transaction-file tests
    • 3 injected foreign-commit/raw-arrow retry tests (one rstest case pair)
    • 7 dataset transaction inline/external/detached tests

There is no deterministic test for the detached random-version collision retry itself; that branch is compile-covered, and the same conversion is exercised by the injected foreign-commit tests. The detached first-attempt path is covered by test_list_detached_manifests.

No diff overlap with #11232 (inline toggle), #11021 (expected-head mode), or #11280 (test metadata); none changes these conversion sites.

The detached retry and the injected foreign-commit test rebuilt the
format wrapper from its protobuf form by hand. Use the existing
`format::Transaction::try_from` conversion instead, matching the
namespace commit path.

Also correct the wrapper documentation: it is the optional protobuf
carrier passed to commit handlers and the manifest writer, not a
crate-local transaction representation.
The wrapper holds a protobuf message in memory; the manifest writer
serializes it with `write_protobuf`. Public `inner` and
`From<pb::Transaction>` also allow direct construction, so remove the
claim that the wrapped message was validated. The reverse `From` only
moves the message out.

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

This preserves the existing transaction payload and error behavior, including rebuilding only the inline copy on a detached retry. No material issues found.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 23, 2026
@Xuanwo
Xuanwo merged commit 2a53bab into main Nov 23, 2026
42 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/transaction-conversion-cleanup branch November 23, 2026 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants