Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add squash-merging flag to transactions #313

Merged
merged 1 commit into from
Jan 9, 2025
Merged

Add squash-merging flag to transactions #313

merged 1 commit into from
Jan 9, 2025

Conversation

nicholasjng
Copy link
Collaborator

lakeFS v1.48.0 added squash-merging, which, as the name suggests, merges a source branch into a target branch by squashing the additional history into a single commit (which is also actually the merge commit in lakeFS).

The interesting thing is that it enables squashing by default, which changes the user-facing behavior of our (merge-based) transactions, and also all other merges done via tx.merge().

This broke some of our transaction tests, which try to assert correct behavior by counting commits since branch creation, and verify by commit message.

This commit fixes the tests by introducing a new squash flag to the transaction class, which controls squash-merging of the transaction branch and any other branches/refs merged via tx.merge().

Interestingly, no special logic is needed to backport the extra keyword argument to Reference.merge_into() - I suspect that this is some pydantic compatibility detail.


I tested this change with several server versions other than latest/v1.48.0, namely v1.41.0 and v1.47.0. No idea why this works, @AdrianoKF knows pydantic better than me.

lakeFS v1.48.0 added squash-merging, which, as the name suggests, merges
a source branch into a target branch by squashing the additional history
into a single commit (which is also actually the merge commit in lakeFS).

The interesting thing is that it enables squashing _by default_, which changes
the user-facing behavior of our (merge-based) transactions, and also all
other merges done via `tx.merge()`.

This broke some of our transaction tests, which try to assert correct behavior
by counting commits since branch creation, and verify by commit message.

This commit fixes the tests by introducing a new `squash` flag to the transaction
class, which controls squash-merging of the transaction branch and any other
branches/refs merged via `tx.merge()`.

Interestingly, no special logic is needed to backport the extra keyword argument
to `Reference.merge_into()` - I suspect that this is some pydantic compatibility
detail.
Copy link

codecov bot commented Jan 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.15%. Comparing base (08b4d3a) to head (ab64ca0).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #313      +/-   ##
==========================================
+ Coverage   94.89%   95.15%   +0.26%     
==========================================
  Files           5        5              
  Lines         411      413       +2     
  Branches       92       92              
==========================================
+ Hits          390      393       +3     
  Misses         15       15              
+ Partials        6        5       -1     
Flag Coverage Δ
3.10 94.43% <100.00%> (+0.02%) ⬆️
3.12 94.43% <100.00%> (+0.02%) ⬆️
3.13 94.43% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nicholasjng nicholasjng merged commit 7cd1ec8 into main Jan 9, 2025
14 checks passed
@nicholasjng nicholasjng deleted the add-squashing branch January 9, 2025 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant