This repository was archived by the owner on Sep 30, 2024. It is now read-only.
gitserver: grpc: relax BlameAuthor name field to allow arbitrary byte sequences#62917
Merged
ggilmore merged 1 commit intoMay 29, 2024
Conversation
This was referenced May 24, 2024
Contributor
Author
6b8dd77 to
ba79370
Compare
51a7e8b to
61ec65a
Compare
eseliger
approved these changes
May 27, 2024
ba79370 to
a5c9f0a
Compare
61ec65a to
1c8fa59
Compare
a5c9f0a to
3e86bb8
Compare
1c8fa59 to
44aa557
Compare
3e86bb8 to
61f1d42
Compare
44aa557 to
c15fcdd
Compare
61f1d42 to
cca5b48
Compare
Base automatically changed from
05-24-gitserver_grpc_change_blamerequest_path_field_from_string_to_bytes
to
main
May 29, 2024 08:49
c15fcdd to
294234a
Compare
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


It seems that git author names are allowed to be non utf-8 fields.
As observed on sourcegraph.com (link).
{ "insertId": "rfy02652om7bc152", "jsonPayload": { "Function": "github.com/sourcegraph/sourcegraph/internal/grpc/internalerrs.doLog", "Resource": { "service.name": "gitserver", "service.instance.id": "gitserver-0", "service.version": "274109_2024-05-14_5.4-0d2f0e7fb786" }, "message": "grpc: error while marshaling: string field contains invalid UTF-8", "InstrumentationScope": "gitserver.gRPC.internal.error.reporter.streamingMethod.postMessageSend", "timestampNanos": 1715684539936480800, "Attributes": { "grpcService": "gitserver.v1.GitserverService", "nonUTF8StringFields": [ "hunk.author.name" ], "initialRequestJSON": "{\"repo_name\":\"github.com/torvalds/linux\",\"commit\":\"a38297e3fb012ddfa7ce0321a7e5a8daeb1872b6\",\"path\":\"drivers/usb/storage/unusual_devs.h\"}", "messageJSON": "{\"hunk\":{\"start_line\":2398,\"end_line\":2399,\"commit\":\"63dc3ff3e019287e8cb4647808de1d93acddd006\",\"author\":{\"name\":\"David H\\ufffdrdeman\",\"email\":\"david@2gen.com\",\"date\":{\"seconds\":1132789549}},\"message\":\"[PATCH] USB: fix USB key generates ioctl_internal_command errors issue\",\"filename\":\"drivers/usb/storage/unusual_devs.h\",\"previous_commit\":{\"commit\":\"21b1861fb2ba5b25b32c63bc540bbc7ca1d186f8\",\"filename\":\"drivers/usb/storage/unusual_devs.h\"}}}", "grpcCode": "Internal", "grpcMethod": "Blame" }, "Caller": "internalerrs/logging.go:239" }, "resource": { "type": "k8s_container", "labels": { "namespace_name": "prod", "container_name": "gitserver", "location": "us-central1-f", "cluster_name": "cloud", "project_id": "sourcegraph-dev", "pod_name": "gitserver-0" } }, "timestamp": "2024-05-14T11:02:19.936736171Z", "severity": "ERROR", "labels": { "k8s-pod/controller-revision-hash": "gitserver-65d76d6ff8", "k8s-pod/deploy": "sourcegraph", "k8s-pod/type": "gitserver", "k8s-pod/group": "backend", "k8s-pod/app": "gitserver", "k8s-pod/statefulset_kubernetes_io/pod-name": "gitserver-0", "compute.googleapis.com/resource_name": "gke-cloud-containerd-pool-3ff685fe-tvqd", "k8s-pod/purpose": "vertical-pod-autoscaler-try-recommend" }, "logName": "projects/sourcegraph-dev/logs/stderr", "receiveTimestamp": "2024-05-14T11:02:24.996687291Z" }As such, we need to relax the field type to allow for arbitrary byte sequences (as opposed to the string type that enforces uftf-8 encoding).
Test plan
Existing CI