-
Notifications
You must be signed in to change notification settings - Fork 359
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 support for hidden branches #8375
Conversation
♻️ PR Preview 4a48b43 has been successfully destroyed since this PR has been closed. 🤖 By surge-preview |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, thanks! This make isolation on lakeFS so much better!
Small things:
- I would prefer to mark this "experimental". While I am quite sure that we will want to keep it, I can imagine the API changing.
- Check annotation in catalog_test.go suggests we need to run gomock or something.
- Not sure about controller tests.
Larger issue: I would like us to re-think how we handle "special-purpose" metadata.
I imagine we will end up with user metadata for branches. Indeed I can think of several purposes for this already. I think I would prefer to have general metadata for branches -- key-value, essentially. If we had then, we could declare that we continue to own the ::lakefs::*
namespace (same as we do on objects) -- and then a branch is hidden if it has ::lakefs::hidden
set.
I do like the new interface for ListBranches. If (as an alternative) we implemented ListBranches as "list branches with this general filter language for branch metadata", then hidden branches would not really be hidden unless you asked for that. So I do not want to do that!
pkg/api/controller_test.go
Outdated
if len(results) != 2 { | ||
t.Fatalf("expected 2 branches to return, got %d", len(results)) | ||
} | ||
require.Equal(t, results[0].Id, "main2") | ||
require.Equal(t, results[1].Id, "main3") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to compare outputs directly, it makes debugging easier when there are any failures. So in this case I would extract .Id
s to a slice, and then use a contents comparison such as deep.Equal (or perhaps testify has a usable slice equality test).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry - but this feels like a complete overkill.
We're comparing strings, why would we need deep equals? Also I don't understand how putting the expected and received in a slice and comparing slices makes it easier to debug?
These tests run in ms, so putting a breakpoint where you need and looking and the variables takes less than a second.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debuggers are the antithesis of testing.
The advantage of comparing slices of strings correctly is that you see entire context.
- For instance, suppose you receive ["main3"]. You get the useless error message "expected 2 branches to return", and not even the branches you did get.
- For instance, suppose you receive ["main3", "main2"] (maybe some KV weirdness). You get the useless error message "got main3 expected main2" which still doesn't say what happened.
- For instance, suppose you receive ["main1", "main2"] (some filtering is broken). You get the useless error message "got main1 expected main2" which still doesn't say what happened.
Tests should fail with a useful error message, if only to help understand how much work is required to fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modified
Co-authored-by: Ariel Shaqed (Scolnicov) <ariels@treeverse.io>
Thanks for the review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Asking for better tests but not requiring it for approval.
pkg/api/controller_test.go
Outdated
if len(results) != 2 { | ||
t.Fatalf("expected 2 branches to return, got %d", len(results)) | ||
} | ||
require.Equal(t, results[0].Id, "main2") | ||
require.Equal(t, results[1].Id, "main3") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debuggers are the antithesis of testing.
The advantage of comparing slices of strings correctly is that you see entire context.
- For instance, suppose you receive ["main3"]. You get the useless error message "expected 2 branches to return", and not even the branches you did get.
- For instance, suppose you receive ["main3", "main2"] (maybe some KV weirdness). You get the useless error message "got main3 expected main2" which still doesn't say what happened.
- For instance, suppose you receive ["main1", "main2"] (some filtering is broken). You get the useless error message "got main1 expected main2" which still doesn't say what happened.
Tests should fail with a useful error message, if only to help understand how much work is required to fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting for product feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
api/swagger.yml
Outdated
schema: | ||
type: boolean | ||
default: false | ||
description: When set - list all branches including hidden branches |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description: When set - list all branches including hidden branches | |
description: When set - list all branches including hidden branches. *EXPERIMENTAL* |
* Add support for hidden branches (#8375) * Add support for hidden branches * Update api/swagger.yml Co-authored-by: Ariel Shaqed (Scolnicov) <ariels@treeverse.io> * CR Fixes * CR Fixes 2 * CR Fixes 3 --------- Co-authored-by: Ariel Shaqed (Scolnicov) <ariels@treeverse.io> * Create infra for plugins * Create usage example --------- Co-authored-by: N-o-Z <ozery.nir@gmail.com> Co-authored-by: Ariel Shaqed (Scolnicov) <ariels@treeverse.io> Co-authored-by: Itai Gilo <itai.gilo@treeverse.io>
Closes #8355
Change Description
Background
This came as a discussion regarding the use of ephemeral branches. For example for the use of transactions (Python SDK)
New Feature
Add support for creating hidden branches
Hidden branches by default not shown on branch listing
Added a new flag for branch listing to show all branches (disabled by default)
Hidden branches can still be fetched using the GetBranch API
Testing Details
Add unit testing for graveler and controller
Breaking Change?
No