-
Notifications
You must be signed in to change notification settings - Fork 0
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
Revamp CreateCommits to just create Commits and add specialized Push and Rebase endpoints #43
Conversation
// returned. Additionally, each patch in the request asserts the expected state of the branch. If | ||
// the actual state does not match the expected state, the patch is rejected and an error is | ||
// returned. | ||
rpc PatchBranchHistories(PatchBranchHistoriesRequest) returns (PatchBranchHistoriesResponse); |
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 didn't put any idempotentcy annotations on these two RPCs yet. I think that PatchBranchHistories
is IDEMPOTENT
but I'm unclear on what PushCommits
is. I also don't understand why CreateCommits
is IDEMPOTENT
... it will fail if invoked repeatedly.
I updated with some edits - for ease of reference, here's the entire diff: 6d72e67...ad64ae8 Some main points:
Please double-check that I didn't miss anything and that the comments make sense and reflect the correct behavior, but assuming I didn't miss anything this is good to go from my end (but please triple-check). |
// a BranchRef that refers to the same Branch. An error will be returned if any | ||
// two BranchRefs refer to the same Branch. | ||
repeated Value values = 1 [(buf.validate.field).repeated.min_items = 1]; | ||
} |
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.
@saquibmian do we need to support pushing to multiple branches simultaneously - push is last writer wins anyways, so maybe it's not worthwhile? If we got rid of that, we'd be able to simplify this RPC and get rid of the nested Value
message entirely.
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.
We do not, but not supporting batching is inconsistent with the rest of the schema. Every RPC today supports batching, except the List*
RPCs (which in theory could support batching trivially).
// - If a Digest is referenced, this is interpreted to mean the latest released Commit that has this Digest. | ||
// Digests referencing unreleased Commits cannot be referenced. | ||
// | ||
// TODO: what is "latest released Commit" if we now have "head Commit"? |
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 think we need to re-evaluate everywhere in this API we use the word "released" given our new buf sync model
Is "released" a property of a BSR commit?
- If a BSR commit can be on multiple branches, then I don't think we can make released a property on a BSR commit (because "released" only makes sense within the context of a history).
- If a BSR commit can only ever be on a single branch, they it would maybe be ok to model it this way
Also need to take a look at branches service and probably rename references to "release branch" to "default branch"
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.
Yes we need to re-evaluate this
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.
Is this something we can do separate from this PR, or do we want to formalize "released" now and rope it into this PR?
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 think we should try to land this PR and save this bigger TODO for a followup
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.
Perfect, I'll leave this here for now and we can clean up/formalize "release" after this.
Co-authored-by: Akshay Shah <[email protected]>
Co-authored-by: Nick Snyder <[email protected]>
Co-authored-by: Nick Snyder <[email protected]>
// The id of the latest Commit created on the Branch. | ||
string latest_commit_id = 10 [ | ||
// The id of the head Commit created on the Branch. | ||
string head_commit_id = 10 [ | ||
(buf.validate.field).required = true, |
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 noticed this is required. Does this imply that an empty Branch does not exist, or should we relax this constraint?
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.
Unless this causes a problem elsewhere, it makes sense to me that an empty branch doesn't exist because this is true in Git (a branch pointer has to point to a commit).
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 updated the docs to reflect this.
Please clean up PR description to reflect the actual implementation/names we landed on (and remove the TODO list). Basically make the PR description what the merged commit description should look like. |
Akshay lgtm'd in Slack and Peter told me live today that minor changes are fine and don't need his re-review, so I am going to click the merge button on this. The only changes that happened since Peter took a look were docs changes and idempotency (which Akshay reviewed). |
There are two things going on in this PR:
CreateCommits
is updated so that it simply creates Commits for Modules without pushing them onto any Branch or assigning any Tags to them.sync
, where potentially 1000s of Commits need to be created before pushing them on a Branch. Because Branch history should be patched atomically and with a lock, creating Commits in-band becomes untenable.ID
,Digest
, or aVCSCommitRef
if there was anyAssociatedVCSCommit
.Branch
's history:BranchService.Push
andBranchService.Rebase
.Push
provides no assertions on the final state of aBranch
's history. This is the model thatbuf push
currently uses, where all concurrent writes win, but the last write is king and becomes the latest commit.Rebase
allows the caller to assert on the final state of aBranch
's history. Concurrent writes are idempotent as long as they assert the same final state. If they don't, the first write wins and all others lose. This is the model thatbuf sync
will use.