sourcegraph / sourcegraph-public-snapshot

Code AI platform with Code Search & Cody
https://sourcegraph.com
Other
10.1k stars 1.28k forks source link

gRPC New gitserver endpoints QA plan #60293

Open ggilmore opened 8 months ago

ggilmore commented 8 months ago

QA Test Plan

Summary

diff --git a/internal/gitserver/v1/gitserver.proto b/internal/gitserver/v1/gitserver.proto
index 8839b41ae5..2ce80937f9 100644
--- a/internal/gitserver/v1/gitserver.proto
+++ b/internal/gitserver/v1/gitserver.proto
@@ -9,6 +9,7 @@ option go_package = "github.com/sourcegraph/sourcegraph/internal/gitserver/v1";

 service GitserverService {
   rpc BatchLog(BatchLogRequest) returns (BatchLogResponse) {
+    option deprecated = true;
     option idempotency_level = NO_SIDE_EFFECTS;
   }
   rpc CreateCommitFromPatchBinary(stream CreateCommitFromPatchBinaryRequest) returns (CreateCommitFromPatchBinaryResponse) {}
@@ -44,12 +45,136 @@ service GitserverService {
   rpc RepoUpdate(RepoUpdateRequest) returns (RepoUpdateResponse) {
     option idempotency_level = IDEMPOTENT;
   }
-  // TODO: Remove this endpoint after 5.2, it is deprecated.
-  rpc ReposStats(ReposStatsRequest) returns (ReposStatsResponse) {
-    option idempotency_level = IDEMPOTENT;
+  rpc IsPerforcePathCloneable(IsPerforcePathCloneableRequest) returns (IsPerforcePathCloneableResponse) {
+    option idempotency_level = NO_SIDE_EFFECTS;
+  }
+  rpc CheckPerforceCredentials(CheckPerforceCredentialsRequest) returns (CheckPerforceCredentialsResponse) {
+    option idempotency_level = NO_SIDE_EFFECTS;
+  }
+  rpc PerforceUsers(PerforceUsersRequest) returns (PerforceUsersResponse) {
+    option idempotency_level = NO_SIDE_EFFECTS;
+  }
+  rpc PerforceProtectsForUser(PerforceProtectsForUserRequest) returns (PerforceProtectsForUserResponse) {
+    option idempotency_level = NO_SIDE_EFFECTS;
+  }
+  rpc PerforceProtectsForDepot(PerforceProtectsForDepotRequest) returns (PerforceProtectsForDepotResponse) {
+    option idempotency_level = NO_SIDE_EFFECTS;
+  }
+  rpc PerforceGroupMembers(PerforceGroupMembersRequest) returns (PerforceGroupMembersResponse) {
+    option idempotency_level = NO_SIDE_EFFECTS;
+  }
+  rpc IsPerforceSuperUser(IsPerforceSuperUserRequest) returns (IsPerforceSuperUserResponse) {
+    option idempotency_level = NO_SIDE_EFFECTS;
+  }
+  rpc PerforceGetChangelist(PerforceGetChangelistRequest) returns (PerforceGetChangelistResponse) {
+    option idempotency_level = NO_SIDE_EFFECTS;
+  }
+  // MergeBase returns the merge base commit sha for the specified revspecs.
+  // If no common merge base exists, an empty string is returned.
+  //
+  // If the given repo is not cloned, it will be enqueued for cloning and a NotFound
+  // error will be returned, with a RepoNotFoundPayload in the details.
+  rpc MergeBase(MergeBaseRequest) returns (MergeBaseResponse) {
+    option idempotency_level = NO_SIDE_EFFECTS;
+  }
+  // Blame runs a blame operation on the specified file. It returns a stream of
+  // hunks as they are found. The --incremental flag is used on the git CLI level
+  // to achieve this behavior.
+  // The endpoint will verify that the user is allowed to blame the given file
+  // if subrepo permissions are enabled for the repo. If access is denied, an error
+  // with a UnauthorizedPayload in the details is returned.
+  //
+  // If the given repo is not cloned, it will be enqueued for cloning and a NotFound
+  // error will be returned, with a RepoNotFoundPayload in the details.
+  rpc Blame(BlameRequest) returns (stream BlameResponse) {
+    option idempotency_level = NO_SIDE_EFFECTS;
+  }
+  // DefaultBranch resolves HEAD to ref name and current commit SHA it points to.
+  // If HEAD points to an empty branch, it returns an error with a RevisionNotFoundPayload.
+  //
+  // If the given repo is not cloned, it will be enqueued for cloning and a NotFound
+  // error will be returned, with a RepoNotFoundPayload in the details.
+  rpc DefaultBranch(DefaultBranchRequest) returns (DefaultBranchResponse) {
+    option idempotency_level = NO_SIDE_EFFECTS;
+  }
+  // ReadFile gets a file from the repo ODB and streams the contents back.
+  // The endpoint will verify that the user is allowed to view the given file
+  // if subrepo permissions are enabled for the repo. If access is denied, an error
+  // with a UnauthorizedPayload in the details is returned.
+  // If the path points to a submodule, no error is returned and an empty file is
+  // streamed back.
+  //
+  // If the given repo is not cloned, it will be enqueued for cloning and a NotFound
+  // error will be returned, with a RepoNotFoundPayload in the details.
+  rpc ReadFile(ReadFileRequest) returns (stream ReadFileResponse) {
+    option idempotency_level = NO_SIDE_EFFECTS;
   }
 }

IsPerforcePathCloneable

Grafana link to "IsPerforcePathCloneable" RPC metrics

isperforcepathcloneable

PerforceUsers

Grafana link to "PerforceUsers" RPC metrics

perforce-users-grafana

PerforceProtectsForUser

Grafana link to "PerforceProtectsForUser" RPC metrics

PerforceProtectsForUser

IsPerforceSuperUser

Grafana link to "IsPerforceSuperUser" RPC metrics

IsPerforceSuperUser

Blame

Grafana link to "Blame" RPC metrics

blame-grafana

MergeBase

Grafana link to "MergeBase" RPC metrics

mergebasegitserver

DefaultBranch

Grafana link to "DefaultBranch" RPC metrics

default-branch-grafana

ReadFile

Grafana link to "ReadFile" RPC metrics

read-file-grafana

Test Plan

Functional testing: Verify that the application functions as expected and meets the requirements. This will include testing of user interfaces, inputs, outputs, and all other functionalities.

Integration testing: Verify that all the components of the application integrate and work together seamlessly.

Performance testing: Verify that the application performs efficiently and effectively under different loads and stress levels.

Security testing: Verify that the application is secure by default - customer data, repo permissions, IAM, and database security has not been compromised.

See secure coding training and secure coding practices for examples.

Usability testing: Verify that the application has met design guidelines and meets the needs of our users. If you did not work with a designer, or you have visual or UX changes that have not been QAed by a designer, please reach out at #ask-design as soon as possible!

Compatibility testing: Verify that the application works on all supported distribution environments (Compose, K8s, Helm, Dotcom, Cloud, etc).

QA Checklist

  1. Have you made any infra related changes to environment variables, new services, or deployment methods that could affect customers?

    • [ ] Yes - I've informed #team-cloud and #team-delivery of the changes.
    • [ ] Yes - Changelog or documentation has been updated, this includes changes to defaults and site config flags.
    • [x] No

    If your change is non-trivial, please review the Cloud Launch process.

    If you've made changes to documentation, please link them in the comments below.

    Comments:

  2. Which environments have the changes been tested on?

    • [ ] rctest.sourcegraph.com
    • [x] sourcegraph.sourcegraph.com
    • [x] sourcegraph.com
    • [ ] cody-dev.sgdev.dev (running based off 5.2 release branch)
    • [ ] scaletesting.sgdev.org
    • [ ] other

    If other, please specify:

  3. Experimental features have been marked and behind a feature flag?

    • [ ] Yes
    • [ ] No
    • [x] N/A

    If no, please specify why:

  4. Has telemetry been added as part of the product requirements?

    • [ ] Yes
    • [ ] No
    • [x] N/A
  5. Completed entry to release post.

    • [ ] Yes
    • [ ] No
    • [x] N/A
  6. Is a feature flagged in a way when turns the feature off, it behaves as-if the feature does not exist?

    • [ ] Yes
    • [ ] No
    • [x] N/A

    If no, please specify why:

  7. A CHANGELOG entry has been added for the feature/change?

    • [ ] Yes
    • [ ] No
    • [x] N/A
  8. Please provide any additional testing you've done that has not been covered above:


Tech Lead/DRI sign off: @kalanchan

eseliger commented 8 months ago

LGTM 👍

Perforce RPCs that I wasn't able to explicitly trigger on sourcegraph.sourcegraph.com (for the purposes of generating Prometheus metrics, Grafana, etc.) PerforceProtectsForDepot PerforceGroupMembers

I don't think PerforceProtectsForDepot can be triggered today, there's no implementation for repo centric syncs afaik. That also includes the only call to PerforceGroupMembers that I could find.

https://sourcegraph.com/github.com/sourcegraph/sourcegraph@main/-/blob/internal/authz/providers/perforce/perforce.go?L301%3A1-304%3A3