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

gitserver: Add CommitLog API to replace client-side Commits #62606

Merged

Conversation

eseliger
Copy link
Member

@eseliger eseliger commented May 10, 2024

This PR moves the Commits API to the server side and is the last gRPC API to migrate (considering LogReverseEach is already out for review).

Yet again (lack of integration tests), I had to reimplement some logic for the rockskip tests. We should investigate ways to run tests against actual gitservers, ideally without having to compile the whole server image and running that.

Closes #61690

Test plan:

Existing tests are still passing, moved the ~extensive unit test coverage this had on the client side to the server side, and reimplemented the subrepoperms tests for the new backend.

@eseliger eseliger force-pushed the es/05-10-gitserverfixdurationreprotedforchangedfiles branch from 58c7993 to d6d0969 Compare May 10, 2024 22:25
@eseliger eseliger force-pushed the es/05-11-gitserveraddcommitlogapitoreplaceclient-sidecommits branch from 0c868de to 223176c Compare May 10, 2024 22:25
@eseliger eseliger force-pushed the es/05-10-gitserverfixdurationreprotedforchangedfiles branch from d6d0969 to 245f9d6 Compare May 10, 2024 22:30
@eseliger eseliger force-pushed the es/05-11-gitserveraddcommitlogapitoreplaceclient-sidecommits branch from 223176c to 75decf8 Compare May 10, 2024 22:30
@eseliger eseliger force-pushed the es/05-10-gitserverfixdurationreprotedforchangedfiles branch from 245f9d6 to 8d42c6f Compare May 10, 2024 22:37
@eseliger eseliger force-pushed the es/05-11-gitserveraddcommitlogapitoreplaceclient-sidecommits branch from 75decf8 to 218c861 Compare May 10, 2024 22:37
@eseliger eseliger force-pushed the es/05-10-gitserverfixdurationreprotedforchangedfiles branch from 8d42c6f to 683aa34 Compare May 13, 2024 02:06
@eseliger eseliger force-pushed the es/05-11-gitserveraddcommitlogapitoreplaceclient-sidecommits branch from 218c861 to 6a12a69 Compare May 13, 2024 02:06
@eseliger eseliger force-pushed the es/05-10-gitserverfixdurationreprotedforchangedfiles branch from 683aa34 to dfd8c89 Compare May 13, 2024 03:37
@eseliger eseliger force-pushed the es/05-11-gitserveraddcommitlogapitoreplaceclient-sidecommits branch from 6a12a69 to 8d6dc0c Compare May 13, 2024 03:37
Base automatically changed from es/05-10-gitserverfixdurationreprotedforchangedfiles to main May 13, 2024 12:38
@eseliger eseliger force-pushed the es/05-11-gitserveraddcommitlogapitoreplaceclient-sidecommits branch 5 times, most recently from 4af6a15 to b3a07ae Compare May 17, 2024 18:11
Comment on lines +19 to +25
// TODO:
// Add tests for:
// - AllRefs
// - FollowOnlyFirstParent
// - Order
// - FollowPathRenames

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These didn't exist previously, I added tests for a few more settings here than we had before, but these are a bit more involved and don't impact the goal of finalizing the migration - so I decided to leave that for a rainy day.

Comment on lines +407 to 409
message CommitLogResponse {
repeated GetCommitResponse commits = 1;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on this? It's basically a batched GetCommit, and that response already carries the optional modified_files slice that we need for subrepo perms checks.

Alternatives I considered:

  • Making a separate type, but otherwise same contents
  • Add ModifiedFiles to message GitCommit directly, and use field masks to not compute it (sadly they're purely additive so I'd need to always send a mask for the default case of don't include them)
  • Use a view field like Google has in their gRPC APIs (I dislike that kinda, because there's no good tooling to know which view of a resource you got back -> easy to use a field on the client side that wasn't actually sent

@eseliger eseliger force-pushed the es/05-11-gitserveraddcommitlogapitoreplaceclient-sidecommits branch 4 times, most recently from 413fc7e to 535cfbc Compare May 17, 2024 20:28
This PR moves the Commits API to the server side and is the last gRPC API to migrate.

Test plan:

Existing tests are still passing, moved the ~extensive unit test coverage this had on the client side to the server side.
}

// Safety check: ensure we are always starting with a record separator
if data[0] != '\x1e' {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we extract that into a constant?

Suggested change
if data[0] != '\x1e' {
const recordSeparator = '\x1e'
if data[0] != recordSeparator {

@eseliger eseliger merged commit 4a5d5e0 into main May 21, 2024
16 checks passed
@eseliger eseliger deleted the es/05-11-gitserveraddcommitlogapitoreplaceclient-sidecommits branch May 21, 2024 13:21
Copy link
Member Author

Merge activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed team/product-platform team/source Tickets under the purview of Source - the one Source to graph it all
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gitserver: Move Commits to new gRPC pattern
2 participants