[style] automate Go import grouping and protobuf aliasing

Implement a project-wide standard for Go import organization and
automate its enforcement via a new pre-commit tool, fix_go_imports.py.

Standardized 4-section layout:
1. Standard Library (unaliased)
2. External & Internal (unaliased)
3. Aliased (e.g., tspb, bespb)
4. Blank/Underscore (e.g., _ "testsetup")

Key changes:
- scripts/fix_go_imports.py: A new Python tool that reorganizes
  import blocks and enforces strict protobuf aliasing rules. It uses
  a centralized registry of known protobuf packages to ensure
  consistent alias naming (e.g., 'tspb' for timestamppb).
- scripts/precommit.sh: Integrated the fixer using 'git ls-files' to
  ensure .gitignore-aware file discovery.
- Added rules_python to MODULE.bazel to manage the script's toolchain
  and unit tests hermetically.
- Mass-cleanup: Performed a project-wide fix-up of over all Go files to
  align with the new standards.

Bug: 487240814
Change-Id: Idc6d0d40c97bc66c830fea086e2517541eefb222
Reviewed-on: https://fuchsia-review.googlesource.com/c/rsclient/+/1630313
Reviewed-by: Jay Zhuang <jayzhuang@google.com>
SLSA-Policy-Verified: SLSA Policy Verification Service <devtools-gerritcodereview-exitgate@google.com>
Commit-Queue: David Fang <fangism@google.com>
diff --git a/MODULE.bazel b/MODULE.bazel
index cedd63d..0742e09 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -51,6 +51,13 @@
 bazel_dep(name = "abseil-cpp", version = "20240722.0")
 bazel_dep(name = "protobuf", version = "29.0", repo_name = "com_google_protobuf")
 bazel_dep(name = "rules_proto", version = "7.0.2")
+bazel_dep(name = "rules_python", version = "1.1.0")
+
+python = use_extension("@rules_python//python/extensions:python.bzl", "python")
+python.toolchain(
+    is_default = True,
+    python_version = "3.12",
+)
 
 ## C++ Dependencies
 
diff --git a/cmd/besproxy/main_test.go b/cmd/besproxy/main_test.go
index 37b0077..5d1b204 100644
--- a/cmd/besproxy/main_test.go
+++ b/cmd/besproxy/main_test.go
@@ -27,9 +27,10 @@
 	"github.com/bazelbuild/rsclient/internal/pkg/grpcutil/grpctest"
 	"github.com/bazelbuild/rsclient/internal/pkg/grpcutil/proxy"
 	"github.com/bazelbuild/rsclient/internal/pkg/netutil"
-	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 	"github.com/google/go-cmp/cmp"
 	"google.golang.org/grpc"
+
+	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
 func TestMainFromConfig_Standalone_ReadyFile(t *testing.T) {
diff --git a/cmd/buildminder/main_test.go b/cmd/buildminder/main_test.go
index e764ed2..7324aeb 100644
--- a/cmd/buildminder/main_test.go
+++ b/cmd/buildminder/main_test.go
@@ -19,9 +19,10 @@
 	"path/filepath"
 	"testing"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"google.golang.org/protobuf/encoding/prototext"
-	"google.golang.org/protobuf/types/known/timestamppb"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+	tspb "google.golang.org/protobuf/types/known/timestamppb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
@@ -54,7 +55,7 @@
 					Event: &jspb.InvocationEvent_Declaration{
 						Declaration: &jspb.InvocationDeclaration{
 							Attributes: &jspb.InvocationAttributes{},
-							Initial:    &jspb.InvocationUpdate{Timestamp: timestamppb.Now()},
+							Initial:    &jspb.InvocationUpdate{Timestamp: tspb.Now()},
 						},
 					},
 				},
diff --git a/cmd/fakebuild/main.go b/cmd/fakebuild/main.go
index f385a74..a8d5090 100644
--- a/cmd/fakebuild/main.go
+++ b/cmd/fakebuild/main.go
@@ -32,9 +32,9 @@
 	"github.com/golang/glog"
 	"github.com/google/uuid"
 	"google.golang.org/protobuf/encoding/prototext"
-	"google.golang.org/protobuf/types/known/fieldmaskpb"
 
 	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
+	fmpb "google.golang.org/protobuf/types/known/fieldmaskpb"
 )
 
 var (
@@ -109,7 +109,7 @@
 		},
 		{
 			UploadOperation: rspb.UploadRequest_UPDATE,
-			UpdateMask: &fieldmaskpb.FieldMask{
+			UpdateMask: &fmpb.FieldMask{
 				Paths: []string{"status_attributes", "invocation_attributes.exit_code"},
 			},
 			Resource: &rspb.UploadRequest_Invocation{
diff --git a/cmd/jobstatus_adapter/adapter_test.go b/cmd/jobstatus_adapter/adapter_test.go
index 4be6038..7e6f4fc 100644
--- a/cmd/jobstatus_adapter/adapter_test.go
+++ b/cmd/jobstatus_adapter/adapter_test.go
@@ -24,13 +24,13 @@
 	"github.com/bazelbuild/rsclient/internal/pkg/jobstatus/service"
 	"google.golang.org/grpc"
 	"google.golang.org/protobuf/proto"
-	"google.golang.org/protobuf/types/known/anypb"
-	"google.golang.org/protobuf/types/known/timestamppb"
 
 	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
 	buildpb "google.golang.org/genproto/googleapis/devtools/build/v1"
 	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
+	anypb "google.golang.org/protobuf/types/known/anypb"
+	tspb "google.golang.org/protobuf/types/known/timestamppb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
@@ -125,7 +125,7 @@
 		InvocationId: invID,
 		Invocation: &rspb.Invocation{
 			InvocationAttributes: &rspb.InvocationAttributes{Description: "Test Invocation"},
-			Timing:               &rspb.Timing{StartTime: timestamppb.Now()},
+			Timing:               &rspb.Timing{StartTime: tspb.Now()},
 		},
 	})
 	if err != nil {
diff --git a/cmd/jobstatus_adapter/main.go b/cmd/jobstatus_adapter/main.go
index 805bd20..d71ad9c 100644
--- a/cmd/jobstatus_adapter/main.go
+++ b/cmd/jobstatus_adapter/main.go
@@ -22,11 +22,12 @@
 	"sync"
 	"syscall"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/cli"
 	"github.com/bazelbuild/rsclient/internal/pkg/grpcutil"
 	"github.com/bazelbuild/rsclient/internal/pkg/jobstatus/service"
 	"google.golang.org/grpc"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 )
 
 // setupSignalHandler starts a goroutine to listen for interrupt and termination
diff --git a/internal/pkg/besmsg/digests.go b/internal/pkg/besmsg/digests.go
index 5b33326..9a9d89d 100644
--- a/internal/pkg/besmsg/digests.go
+++ b/internal/pkg/besmsg/digests.go
@@ -20,6 +20,7 @@
 
 	"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
 	"github.com/bazelbuild/rsclient/internal/pkg/casmsg"
+
 	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
 )
 
diff --git a/internal/pkg/besmsg/digests_test.go b/internal/pkg/besmsg/digests_test.go
index 5fec82f..8868819 100644
--- a/internal/pkg/besmsg/digests_test.go
+++ b/internal/pkg/besmsg/digests_test.go
@@ -18,8 +18,10 @@
 	"testing"
 
 	"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
-	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
+
 	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
+
+	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
 var (
diff --git a/internal/pkg/besmsg/extractor.go b/internal/pkg/besmsg/extractor.go
index 72acbc0..0fff4bf 100644
--- a/internal/pkg/besmsg/extractor.go
+++ b/internal/pkg/besmsg/extractor.go
@@ -15,9 +15,10 @@
 package besmsg
 
 import (
+	"google.golang.org/protobuf/proto"
+
 	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
 	buildpb "google.golang.org/genproto/googleapis/devtools/build/v1"
-	"google.golang.org/protobuf/proto"
 )
 
 // ExtractBuildEvent is a transformation helper that extracts the inner
diff --git a/internal/pkg/besmsg/extractor_test.go b/internal/pkg/besmsg/extractor_test.go
index bb6bdaf..236e6d4 100644
--- a/internal/pkg/besmsg/extractor_test.go
+++ b/internal/pkg/besmsg/extractor_test.go
@@ -20,10 +20,10 @@
 	"github.com/google/go-cmp/cmp"
 	"google.golang.org/protobuf/proto"
 	"google.golang.org/protobuf/testing/protocmp"
-	"google.golang.org/protobuf/types/known/anypb"
 
 	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
 	buildpb "google.golang.org/genproto/googleapis/devtools/build/v1"
+	anypb "google.golang.org/protobuf/types/known/anypb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
diff --git a/internal/pkg/besmsg/responder_test.go b/internal/pkg/besmsg/responder_test.go
index d7d638b..3e14f1f 100644
--- a/internal/pkg/besmsg/responder_test.go
+++ b/internal/pkg/besmsg/responder_test.go
@@ -20,8 +20,9 @@
 	"github.com/google/go-cmp/cmp"
 	"google.golang.org/protobuf/testing/protocmp"
 
-	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 	buildpb "google.golang.org/genproto/googleapis/devtools/build/v1"
+
+	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
 // TestNewResponse verifies that BES acknowledgements are correctly
diff --git a/internal/pkg/besmsg/text_sink.go b/internal/pkg/besmsg/text_sink.go
index 42875dd..852c1b7 100644
--- a/internal/pkg/besmsg/text_sink.go
+++ b/internal/pkg/besmsg/text_sink.go
@@ -18,8 +18,9 @@
 	"io"
 
 	"github.com/bazelbuild/rsclient/internal/pkg/protoutil"
-	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
 	"google.golang.org/protobuf/reflect/protoregistry"
+
+	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
 )
 
 // NewBESTextSink creates a TextSink configured to expand BES-related
diff --git a/internal/pkg/besmsg/text_sink_test.go b/internal/pkg/besmsg/text_sink_test.go
index b2063da..6006eaf 100644
--- a/internal/pkg/besmsg/text_sink_test.go
+++ b/internal/pkg/besmsg/text_sink_test.go
@@ -19,11 +19,11 @@
 	"strings"
 	"testing"
 
-	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
 	"google.golang.org/protobuf/proto"
-	"google.golang.org/protobuf/types/known/anypb"
 
+	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
 	buildpb "google.golang.org/genproto/googleapis/devtools/build/v1"
+	anypb "google.golang.org/protobuf/types/known/anypb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
diff --git a/internal/pkg/besproxy/funnel_test.go b/internal/pkg/besproxy/funnel_test.go
index b262dab..be81a63 100644
--- a/internal/pkg/besproxy/funnel_test.go
+++ b/internal/pkg/besproxy/funnel_test.go
@@ -24,13 +24,13 @@
 	"github.com/google/go-cmp/cmp"
 	"google.golang.org/protobuf/proto"
 	"google.golang.org/protobuf/testing/protocmp"
-	"google.golang.org/protobuf/types/known/anypb"
 
 	repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
 	tracepb "github.com/bazelbuild/rsclient/internal/pkg/besproxy/translation/proto"
 	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
 	bspb "google.golang.org/genproto/googleapis/bytestream"
 	buildpb "google.golang.org/genproto/googleapis/devtools/build/v1"
+	anypb "google.golang.org/protobuf/types/known/anypb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
diff --git a/internal/pkg/besproxy/responder.go b/internal/pkg/besproxy/responder.go
index fc80ec9..d77e32e 100644
--- a/internal/pkg/besproxy/responder.go
+++ b/internal/pkg/besproxy/responder.go
@@ -22,11 +22,11 @@
 	"github.com/bazelbuild/rsclient/internal/pkg/grpcutil"
 	"github.com/bazelbuild/rsclient/internal/pkg/grpcutil/proxy"
 	"google.golang.org/protobuf/proto"
-	"google.golang.org/protobuf/types/known/emptypb"
 
 	repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
 	bspb "google.golang.org/genproto/googleapis/bytestream"
 	buildpb "google.golang.org/genproto/googleapis/devtools/build/v1"
+	emptypb "google.golang.org/protobuf/types/known/emptypb"
 )
 
 // besResponderFactory creates stateful responders for BES streams.
diff --git a/internal/pkg/besproxy/translation/joiner.go b/internal/pkg/besproxy/translation/joiner.go
index 0576f7b..5ca21a2 100644
--- a/internal/pkg/besproxy/translation/joiner.go
+++ b/internal/pkg/besproxy/translation/joiner.go
@@ -19,15 +19,16 @@
 	"sync"
 
 	"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
-	repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/besmsg"
-	tracepb "github.com/bazelbuild/rsclient/internal/pkg/besproxy/translation/proto"
 	"github.com/bazelbuild/rsclient/internal/pkg/casmsg"
 	"github.com/bazelbuild/rsclient/internal/pkg/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/router"
-	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
 	"github.com/golang/glog"
+
+	repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+	tracepb "github.com/bazelbuild/rsclient/internal/pkg/besproxy/translation/proto"
+	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
 	bsgrpc "google.golang.org/genproto/googleapis/bytestream"
 	buildpb "google.golang.org/genproto/googleapis/devtools/build/v1"
 )
diff --git a/internal/pkg/besproxy/translation/joiner_test.go b/internal/pkg/besproxy/translation/joiner_test.go
index 379e43b..5d1b153 100644
--- a/internal/pkg/besproxy/translation/joiner_test.go
+++ b/internal/pkg/besproxy/translation/joiner_test.go
@@ -21,13 +21,14 @@
 	"time"
 
 	"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
-	tracepb "github.com/bazelbuild/rsclient/internal/pkg/besproxy/translation/proto"
 	"github.com/bazelbuild/rsclient/internal/pkg/casmsg"
-	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
 	"github.com/google/go-cmp/cmp"
 	"google.golang.org/protobuf/encoding/prototext"
 	"google.golang.org/protobuf/testing/protocmp"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+	tracepb "github.com/bazelbuild/rsclient/internal/pkg/besproxy/translation/proto"
+	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
 	tspb "google.golang.org/protobuf/types/known/timestamppb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
diff --git a/internal/pkg/besproxy/translation/joiner_trace_test.go b/internal/pkg/besproxy/translation/joiner_trace_test.go
index 6830186..8e099b7 100644
--- a/internal/pkg/besproxy/translation/joiner_trace_test.go
+++ b/internal/pkg/besproxy/translation/joiner_trace_test.go
@@ -22,8 +22,10 @@
 	"testing"
 
 	"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/casmsg"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
diff --git a/internal/pkg/besproxy/translation/trace.go b/internal/pkg/besproxy/translation/trace.go
index 7114912..051c12d 100644
--- a/internal/pkg/besproxy/translation/trace.go
+++ b/internal/pkg/besproxy/translation/trace.go
@@ -21,9 +21,10 @@
 	"path/filepath"
 	"sync"
 
-	tracepb "github.com/bazelbuild/rsclient/internal/pkg/besproxy/translation/proto"
 	"github.com/bazelbuild/rsclient/internal/pkg/protoutil"
 	"github.com/bazelbuild/rsclient/internal/pkg/router"
+
+	tracepb "github.com/bazelbuild/rsclient/internal/pkg/besproxy/translation/proto"
 )
 
 const traceDelimiter = "# ---- TraceEvent ----"
diff --git a/internal/pkg/besproxy/translation/trace_test.go b/internal/pkg/besproxy/translation/trace_test.go
index d1beba0..10fa0cc 100644
--- a/internal/pkg/besproxy/translation/trace_test.go
+++ b/internal/pkg/besproxy/translation/trace_test.go
@@ -19,12 +19,13 @@
 	"path/filepath"
 	"testing"
 
+	"github.com/google/go-cmp/cmp"
+	"google.golang.org/protobuf/testing/protocmp"
+
 	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	tracepb "github.com/bazelbuild/rsclient/internal/pkg/besproxy/translation/proto"
 	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
-	"github.com/google/go-cmp/cmp"
-	"google.golang.org/protobuf/testing/protocmp"
-	"google.golang.org/protobuf/types/known/timestamppb"
+	tspb "google.golang.org/protobuf/types/known/timestamppb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
@@ -37,7 +38,7 @@
 	recorder := NewTraceRecorder(path)
 	events := []*tracepb.TraceEvent{
 		{
-			Timestamp: timestamppb.Now(),
+			Timestamp: tspb.Now(),
 			Event: &tracepb.TraceEvent_BuildEvent{
 				BuildEvent: &bespb.BuildEvent{
 					Payload: &bespb.BuildEvent_Started{
@@ -47,7 +48,7 @@
 			},
 		},
 		{
-			Timestamp: timestamppb.Now(),
+			Timestamp: tspb.Now(),
 			Event: &tracepb.TraceEvent_BuildEvent{
 				BuildEvent: &bespb.BuildEvent{
 					Payload: &bespb.BuildEvent_Finished{
diff --git a/internal/pkg/besproxy/translation/validation_helpers_test.go b/internal/pkg/besproxy/translation/validation_helpers_test.go
index f878d2b..74529e7 100644
--- a/internal/pkg/besproxy/translation/validation_helpers_test.go
+++ b/internal/pkg/besproxy/translation/validation_helpers_test.go
@@ -18,6 +18,7 @@
 	"testing"
 
 	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
diff --git a/internal/pkg/buildminder/app.go b/internal/pkg/buildminder/app.go
index 5e408f8..3bc2deb 100644
--- a/internal/pkg/buildminder/app.go
+++ b/internal/pkg/buildminder/app.go
@@ -31,8 +31,9 @@
 	"github.com/bazelbuild/rsclient/internal/pkg/simulation"
 	"github.com/bazelbuild/rsclient/internal/pkg/tui"
 	"github.com/bazelbuild/rsclient/internal/pkg/wrapper"
-	tea "github.com/charmbracelet/bubbletea"
 	"github.com/golang/glog"
+
+	tea "github.com/charmbracelet/bubbletea"
 )
 
 // Config represents the application configuration.
diff --git a/internal/pkg/buildminder/app_test.go b/internal/pkg/buildminder/app_test.go
index 90cc16e..17b87de 100644
--- a/internal/pkg/buildminder/app_test.go
+++ b/internal/pkg/buildminder/app_test.go
@@ -20,11 +20,12 @@
 	"strings"
 	"testing"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/buildminder/ui"
 	"github.com/bazelbuild/rsclient/internal/pkg/buildstate"
 	"google.golang.org/protobuf/encoding/prototext"
-	"google.golang.org/protobuf/types/known/timestamppb"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+	tspb "google.golang.org/protobuf/types/known/timestamppb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
@@ -207,7 +208,7 @@
 					Event: &jspb.InvocationEvent_Declaration{
 						Declaration: &jspb.InvocationDeclaration{
 							Attributes: &jspb.InvocationAttributes{},
-							Initial:    &jspb.InvocationUpdate{Timestamp: timestamppb.Now()},
+							Initial:    &jspb.InvocationUpdate{Timestamp: tspb.Now()},
 						},
 					},
 				},
@@ -241,7 +242,7 @@
 					Event: &jspb.InvocationEvent_Declaration{
 						Declaration: &jspb.InvocationDeclaration{
 							Attributes: &jspb.InvocationAttributes{},
-							Initial:    &jspb.InvocationUpdate{Timestamp: timestamppb.Now()},
+							Initial:    &jspb.InvocationUpdate{Timestamp: tspb.Now()},
 						},
 					},
 				},
diff --git a/internal/pkg/buildminder/buildsim/simulator.go b/internal/pkg/buildminder/buildsim/simulator.go
index f93eb1c..588b2c1 100644
--- a/internal/pkg/buildminder/buildsim/simulator.go
+++ b/internal/pkg/buildminder/buildsim/simulator.go
@@ -20,10 +20,11 @@
 	"sort"
 	"time"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/buildstate"
 	"github.com/bazelbuild/rsclient/internal/pkg/simulation"
 	"google.golang.org/protobuf/encoding/prototext"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 )
 
 // TimedEvent pairs a build event with its extracted timestamp.
diff --git a/internal/pkg/buildminder/buildsim/simulator_test.go b/internal/pkg/buildminder/buildsim/simulator_test.go
index fe45ad4..7518ad1 100644
--- a/internal/pkg/buildminder/buildsim/simulator_test.go
+++ b/internal/pkg/buildminder/buildsim/simulator_test.go
@@ -20,10 +20,11 @@
 	"testing"
 	"time"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/buildstate"
 	"google.golang.org/protobuf/encoding/prototext"
-	"google.golang.org/protobuf/types/known/timestamppb"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+	tspb "google.golang.org/protobuf/types/known/timestamppb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
@@ -42,7 +43,7 @@
 						Event: &jspb.InvocationEvent_Declaration{
 							Declaration: &jspb.InvocationDeclaration{
 								Attributes: &jspb.InvocationAttributes{},
-								Initial:    &jspb.InvocationUpdate{State: jspb.InvocationUpdate_STARTED, Timestamp: timestamppb.New(t0)},
+								Initial:    &jspb.InvocationUpdate{State: jspb.InvocationUpdate_STARTED, Timestamp: tspb.New(t0)},
 							},
 						},
 					},
@@ -56,7 +57,7 @@
 						Event: &jspb.ActionEvent_Declaration{
 							Declaration: &jspb.ActionDeclaration{
 								Attributes: &jspb.ActionAttributes{},
-								Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_RUNNING, Timestamp: timestamppb.New(t1)},
+								Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_RUNNING, Timestamp: tspb.New(t1)},
 							},
 						},
 					},
@@ -68,7 +69,7 @@
 						InvocationId: "inv1",
 						ActionId:     "act1",
 						Event: &jspb.ActionEvent_Update{
-							Update: &jspb.ActionUpdate{State: jspb.ActionUpdate_COMPLETED, Timestamp: timestamppb.New(t2)},
+							Update: &jspb.ActionUpdate{State: jspb.ActionUpdate_COMPLETED, Timestamp: tspb.New(t2)},
 						},
 					},
 				},
@@ -160,7 +161,7 @@
 						Event: &jspb.InvocationEvent_Declaration{
 							Declaration: &jspb.InvocationDeclaration{
 								Attributes: &jspb.InvocationAttributes{},
-								Initial:    &jspb.InvocationUpdate{State: jspb.InvocationUpdate_STARTED, Timestamp: timestamppb.New(t0)},
+								Initial:    &jspb.InvocationUpdate{State: jspb.InvocationUpdate_STARTED, Timestamp: tspb.New(t0)},
 							},
 						},
 					},
@@ -227,7 +228,7 @@
 						Event: &jspb.InvocationEvent_Declaration{
 							Declaration: &jspb.InvocationDeclaration{
 								Attributes: &jspb.InvocationAttributes{},
-								Initial:    &jspb.InvocationUpdate{State: jspb.InvocationUpdate_STARTED, Timestamp: timestamppb.New(t0)},
+								Initial:    &jspb.InvocationUpdate{State: jspb.InvocationUpdate_STARTED, Timestamp: tspb.New(t0)},
 							},
 						},
 					},
diff --git a/internal/pkg/buildminder/service/server.go b/internal/pkg/buildminder/service/server.go
index 2101809..4d30858 100644
--- a/internal/pkg/buildminder/service/server.go
+++ b/internal/pkg/buildminder/service/server.go
@@ -19,12 +19,13 @@
 	"net"
 	"os"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/buildstate"
 	"github.com/bazelbuild/rsclient/internal/pkg/netutil"
 	"github.com/bazelbuild/rsclient/internal/pkg/syncutil"
 	"github.com/golang/glog"
 	"google.golang.org/grpc"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 )
 
 // Server encapsulates the gRPC server for JobStatus updates.
diff --git a/internal/pkg/buildminder/service/server_test.go b/internal/pkg/buildminder/service/server_test.go
index 732fc2d..0e5f062 100644
--- a/internal/pkg/buildminder/service/server_test.go
+++ b/internal/pkg/buildminder/service/server_test.go
@@ -22,11 +22,12 @@
 	"testing"
 	"time"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/buildstate"
 	"github.com/bazelbuild/rsclient/internal/pkg/grpcutil"
 	"github.com/bazelbuild/rsclient/internal/pkg/netutil"
 
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
diff --git a/internal/pkg/buildminder/service/service.go b/internal/pkg/buildminder/service/service.go
index 180c8f1..79516f8 100644
--- a/internal/pkg/buildminder/service/service.go
+++ b/internal/pkg/buildminder/service/service.go
@@ -18,9 +18,10 @@
 import (
 	"io"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/buildstate"
 	"github.com/golang/glog"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 )
 
 // JobStatusServer implements the jspb.JobStatusServer interface.
diff --git a/internal/pkg/buildminder/service/service_test.go b/internal/pkg/buildminder/service/service_test.go
index 38f1207..5f1d045 100644
--- a/internal/pkg/buildminder/service/service_test.go
+++ b/internal/pkg/buildminder/service/service_test.go
@@ -20,13 +20,14 @@
 	"testing"
 	"time"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/buildstate"
 	"github.com/bazelbuild/rsclient/internal/pkg/grpcutil/grpctest"
 	"github.com/google/go-cmp/cmp"
 	"github.com/google/go-cmp/cmp/cmpopts"
 	"google.golang.org/grpc"
-	"google.golang.org/protobuf/types/known/timestamppb"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+	tspb "google.golang.org/protobuf/types/known/timestamppb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
@@ -49,7 +50,7 @@
 	}
 
 	t0 := time.Date(2026, 3, 4, 10, 0, 0, 0, time.UTC)
-	ts0 := timestamppb.New(t0)
+	ts0 := tspb.New(t0)
 
 	// Here, we just make sure there are no RPC errors.
 	// buildInfo keeps track of its own errors (invalid messages).
@@ -146,7 +147,7 @@
 						Event: &jspb.InvocationEvent_Update{
 							Update: &jspb.InvocationUpdate{
 								State:     jspb.InvocationUpdate_COMPLETED,
-								Timestamp: timestamppb.New(t0.Add(time.Second)),
+								Timestamp: tspb.New(t0.Add(time.Second)),
 							},
 						},
 					},
diff --git a/internal/pkg/buildminder/tiles/action_detail.go b/internal/pkg/buildminder/tiles/action_detail.go
index ed5892f..a52fe63 100644
--- a/internal/pkg/buildminder/tiles/action_detail.go
+++ b/internal/pkg/buildminder/tiles/action_detail.go
@@ -21,6 +21,7 @@
 	"github.com/bazelbuild/rsclient/internal/pkg/buildstate"
 	"github.com/bazelbuild/rsclient/internal/pkg/layout"
 	"github.com/bazelbuild/rsclient/internal/pkg/tui"
+
 	tea "github.com/charmbracelet/bubbletea"
 )
 
diff --git a/internal/pkg/buildminder/tiles/action_detail_test.go b/internal/pkg/buildminder/tiles/action_detail_test.go
index fbe5285..9477bc4 100644
--- a/internal/pkg/buildminder/tiles/action_detail_test.go
+++ b/internal/pkg/buildminder/tiles/action_detail_test.go
@@ -19,12 +19,13 @@
 	"testing"
 	"time"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/buildstate"
 	"github.com/bazelbuild/rsclient/internal/pkg/tui"
 	"github.com/bazelbuild/rsclient/internal/pkg/tui/tuitest"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	tea "github.com/charmbracelet/bubbletea"
-	"google.golang.org/protobuf/types/known/timestamppb"
+	tspb "google.golang.org/protobuf/types/known/timestamppb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
@@ -46,7 +47,7 @@
 						Attributes: &jspb.InvocationAttributes{},
 						Initial: &jspb.InvocationUpdate{
 							State:     jspb.InvocationUpdate_STARTED,
-							Timestamp: timestamppb.New(t0),
+							Timestamp: tspb.New(t0),
 						},
 					},
 				},
@@ -69,7 +70,7 @@
 						},
 						Initial: &jspb.ActionUpdate{
 							State:     jspb.ActionUpdate_FAILED,
-							Timestamp: timestamppb.New(t0.Add(time.Second)),
+							Timestamp: tspb.New(t0.Add(time.Second)),
 							Output: []*jspb.ConsoleOutput{
 								{Text: "Error: something went wrong\n", Stream: jspb.ConsoleOutput_STDERR},
 							},
@@ -147,7 +148,7 @@
 						Attributes: &jspb.InvocationAttributes{},
 						Initial: &jspb.InvocationUpdate{
 							State:     jspb.InvocationUpdate_STARTED,
-							Timestamp: timestamppb.New(t0),
+							Timestamp: tspb.New(t0),
 						},
 					},
 				},
@@ -171,7 +172,7 @@
 						},
 						Initial: &jspb.ActionUpdate{
 							State:     jspb.ActionUpdate_RUNNING,
-							Timestamp: timestamppb.New(t0.Add(time.Second)),
+							Timestamp: tspb.New(t0.Add(time.Second)),
 						},
 					},
 				},
@@ -218,7 +219,7 @@
 						Attributes: &jspb.InvocationAttributes{},
 						Initial: &jspb.InvocationUpdate{
 							State:     jspb.InvocationUpdate_STARTED,
-							Timestamp: timestamppb.New(t0),
+							Timestamp: tspb.New(t0),
 						},
 					},
 				},
@@ -237,7 +238,7 @@
 						},
 						Initial: &jspb.ActionUpdate{
 							State:     jspb.ActionUpdate_RUNNING,
-							Timestamp: timestamppb.New(t0.Add(time.Second)),
+							Timestamp: tspb.New(t0.Add(time.Second)),
 						},
 					},
 				},
diff --git a/internal/pkg/buildminder/tiles/failed_actions.go b/internal/pkg/buildminder/tiles/failed_actions.go
index 94bc7a3..3e23095 100644
--- a/internal/pkg/buildminder/tiles/failed_actions.go
+++ b/internal/pkg/buildminder/tiles/failed_actions.go
@@ -21,6 +21,7 @@
 	"github.com/bazelbuild/rsclient/internal/pkg/buildstate"
 	"github.com/bazelbuild/rsclient/internal/pkg/simulation"
 	"github.com/bazelbuild/rsclient/internal/pkg/tui"
+
 	tea "github.com/charmbracelet/bubbletea"
 )
 
diff --git a/internal/pkg/buildminder/tiles/failed_actions_test.go b/internal/pkg/buildminder/tiles/failed_actions_test.go
index 24ff539..8896137 100644
--- a/internal/pkg/buildminder/tiles/failed_actions_test.go
+++ b/internal/pkg/buildminder/tiles/failed_actions_test.go
@@ -18,10 +18,11 @@
 	"testing"
 	"time"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/buildstate"
 	"github.com/bazelbuild/rsclient/internal/pkg/tui"
 	"github.com/bazelbuild/rsclient/internal/pkg/tui/tuitest"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	tea "github.com/charmbracelet/bubbletea"
 	tspb "google.golang.org/protobuf/types/known/timestamppb"
 
diff --git a/internal/pkg/buildminder/tiles/running_actions.go b/internal/pkg/buildminder/tiles/running_actions.go
index 233dca8..032c35e 100644
--- a/internal/pkg/buildminder/tiles/running_actions.go
+++ b/internal/pkg/buildminder/tiles/running_actions.go
@@ -23,6 +23,7 @@
 	"github.com/bazelbuild/rsclient/internal/pkg/layout"
 	"github.com/bazelbuild/rsclient/internal/pkg/simulation"
 	"github.com/bazelbuild/rsclient/internal/pkg/tui"
+
 	tea "github.com/charmbracelet/bubbletea"
 )
 
diff --git a/internal/pkg/buildminder/tiles/running_actions_test.go b/internal/pkg/buildminder/tiles/running_actions_test.go
index bf77a5b..0cb6f29 100644
--- a/internal/pkg/buildminder/tiles/running_actions_test.go
+++ b/internal/pkg/buildminder/tiles/running_actions_test.go
@@ -18,13 +18,13 @@
 	"testing"
 	"time"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/buildstate"
 	"github.com/bazelbuild/rsclient/internal/pkg/simulation"
 	"github.com/bazelbuild/rsclient/internal/pkg/tui/tuitest"
-	tea "github.com/charmbracelet/bubbletea"
 
-	"google.golang.org/protobuf/types/known/timestamppb"
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+	tea "github.com/charmbracelet/bubbletea"
+	tspb "google.golang.org/protobuf/types/known/timestamppb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
@@ -68,7 +68,7 @@
 						Attributes: &jspb.InvocationAttributes{},
 						Initial: &jspb.InvocationUpdate{
 							State:     jspb.InvocationUpdate_STARTED,
-							Timestamp: timestamppb.New(t0),
+							Timestamp: tspb.New(t0),
 						},
 					},
 				},
@@ -90,7 +90,7 @@
 						},
 						Initial: &jspb.ActionUpdate{
 							State:     jspb.ActionUpdate_RUNNING,
-							Timestamp: timestamppb.New(t0.Add(time.Second)),
+							Timestamp: tspb.New(t0.Add(time.Second)),
 						},
 					},
 				},
diff --git a/internal/pkg/buildminder/ui/model.go b/internal/pkg/buildminder/ui/model.go
index fae66e7..c091c84 100644
--- a/internal/pkg/buildminder/ui/model.go
+++ b/internal/pkg/buildminder/ui/model.go
@@ -22,6 +22,7 @@
 
 	"github.com/bazelbuild/rsclient/internal/pkg/buildminder/buildsim"
 	"github.com/bazelbuild/rsclient/internal/pkg/tui"
+
 	tea "github.com/charmbracelet/bubbletea"
 )
 
diff --git a/internal/pkg/buildminder/ui/model_test.go b/internal/pkg/buildminder/ui/model_test.go
index e4dbf3d..3c4ca5e 100644
--- a/internal/pkg/buildminder/ui/model_test.go
+++ b/internal/pkg/buildminder/ui/model_test.go
@@ -25,6 +25,7 @@
 	"github.com/bazelbuild/rsclient/internal/pkg/buildminder/buildsim"
 	"github.com/bazelbuild/rsclient/internal/pkg/buildstate"
 	"github.com/bazelbuild/rsclient/internal/pkg/tui"
+
 	tea "github.com/charmbracelet/bubbletea"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
diff --git a/internal/pkg/buildminder/ui/simulator_tile.go b/internal/pkg/buildminder/ui/simulator_tile.go
index 4189505..fe7ac42 100644
--- a/internal/pkg/buildminder/ui/simulator_tile.go
+++ b/internal/pkg/buildminder/ui/simulator_tile.go
@@ -24,6 +24,7 @@
 	"github.com/bazelbuild/rsclient/internal/pkg/buildstate"
 	"github.com/bazelbuild/rsclient/internal/pkg/layout"
 	"github.com/bazelbuild/rsclient/internal/pkg/tui"
+
 	tea "github.com/charmbracelet/bubbletea"
 )
 
diff --git a/internal/pkg/buildminder/ui/simulator_tile_test.go b/internal/pkg/buildminder/ui/simulator_tile_test.go
index 022f7a1..bd3b4ac 100644
--- a/internal/pkg/buildminder/ui/simulator_tile_test.go
+++ b/internal/pkg/buildminder/ui/simulator_tile_test.go
@@ -26,6 +26,7 @@
 	"github.com/bazelbuild/rsclient/internal/pkg/buildstate"
 	"github.com/bazelbuild/rsclient/internal/pkg/tui"
 	"github.com/bazelbuild/rsclient/internal/pkg/tui/tuitest"
+
 	tea "github.com/charmbracelet/bubbletea"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
diff --git a/internal/pkg/buildstate/buildstate.go b/internal/pkg/buildstate/buildstate.go
index deb615f..0b0d674 100644
--- a/internal/pkg/buildstate/buildstate.go
+++ b/internal/pkg/buildstate/buildstate.go
@@ -29,10 +29,11 @@
 	"sync"
 	"time"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/rsmsg"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
-	"google.golang.org/protobuf/types/known/timestamppb"
+	tspb "google.golang.org/protobuf/types/known/timestamppb"
 )
 
 // LifecycleState represents the phase of a build entity.
@@ -1041,7 +1042,7 @@
 		}
 	}
 	if actionTiming != nil {
-		invTiming := &rspb.Timing{StartTime: timestamppb.New(invInfo.StartTime())}
+		invTiming := &rspb.Timing{StartTime: tspb.New(invInfo.StartTime())}
 		if rsmsg.ClampTiming(invTiming, actionTiming) {
 			// Update the event timestamp with the clamped value.
 			clampedTs := actionTiming.StartTime
diff --git a/internal/pkg/buildstate/buildstate_test.go b/internal/pkg/buildstate/buildstate_test.go
index 8ecea8d..347e8d7 100644
--- a/internal/pkg/buildstate/buildstate_test.go
+++ b/internal/pkg/buildstate/buildstate_test.go
@@ -22,10 +22,11 @@
 	"testing"
 	"time"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/google/go-cmp/cmp"
 	"github.com/google/go-cmp/cmp/cmpopts"
-	"google.golang.org/protobuf/types/known/timestamppb"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+	tspb "google.golang.org/protobuf/types/known/timestamppb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
@@ -54,7 +55,7 @@
 		Event: &jspb.InvocationEvent_Declaration{
 			Declaration: &jspb.InvocationDeclaration{
 				Attributes: &jspb.InvocationAttributes{},
-				Initial:    &jspb.InvocationUpdate{State: jspb.InvocationUpdate_STARTED, Timestamp: timestamppb.New(ts)},
+				Initial:    &jspb.InvocationUpdate{State: jspb.InvocationUpdate_STARTED, Timestamp: tspb.New(ts)},
 			},
 		},
 	}))
@@ -69,7 +70,7 @@
 		Event: &jspb.ActionEvent_Declaration{
 			Declaration: &jspb.ActionDeclaration{
 				Attributes: &jspb.ActionAttributes{},
-				Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_PENDING, Timestamp: timestamppb.New(ts)},
+				Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_PENDING, Timestamp: tspb.New(ts)},
 			},
 		},
 	}))
@@ -83,7 +84,7 @@
 		Event: &jspb.ActionEvent_Update{
 			Update: &jspb.ActionUpdate{
 				State:     state,
-				Timestamp: timestamppb.New(ts),
+				Timestamp: tspb.New(ts),
 			},
 		},
 	}))
@@ -96,7 +97,7 @@
 		Event: &jspb.InvocationEvent_Update{
 			Update: &jspb.InvocationUpdate{
 				State:     state,
-				Timestamp: timestamppb.New(ts),
+				Timestamp: tspb.New(ts),
 			},
 		},
 	}))
@@ -300,7 +301,7 @@
 		Event: &jspb.ActionEvent_Declaration{
 			Declaration: &jspb.ActionDeclaration{
 				Attributes: &jspb.ActionAttributes{Description: "Test Action 1"},
-				Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_PENDING, Timestamp: timestamppb.New(t0)},
+				Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_PENDING, Timestamp: tspb.New(t0)},
 			},
 		},
 	})
@@ -318,7 +319,7 @@
 		Event: &jspb.ActionEvent_Declaration{
 			Declaration: &jspb.ActionDeclaration{
 				Attributes: &jspb.ActionAttributes{Description: "Test Action 1 on Inv2"},
-				Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_PENDING, Timestamp: timestamppb.New(t0)},
+				Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_PENDING, Timestamp: tspb.New(t0)},
 			},
 		},
 	})
@@ -366,7 +367,7 @@
 }
 
 func TestInvocationInfo_HandleActionEvent(t *testing.T) {
-	ts1 := timestamppb.New(time.Date(2026, 2, 26, 10, 0, 0, 0, time.UTC))
+	ts1 := tspb.New(time.Date(2026, 2, 26, 10, 0, 0, 0, time.UTC))
 	ii, _ := newInvocationInfo("testInv", &jspb.InvocationDeclaration{
 		Attributes: &jspb.InvocationAttributes{},
 		Initial:    &jspb.InvocationUpdate{State: jspb.InvocationUpdate_STARTED, Timestamp: ts1},
@@ -407,7 +408,7 @@
 	}
 
 	// 2. Update
-	ts2 := timestamppb.New(ts1.AsTime().Add(time.Second))
+	ts2 := tspb.New(ts1.AsTime().Add(time.Second))
 	updEvent := &jspb.ActionEvent{
 		InvocationId: "testInv",
 		ActionId:     "action1",
@@ -439,7 +440,7 @@
 		InvocationId: "inv",
 		ActionId:     "act",
 		Event: &jspb.ActionEvent_Update{
-			Update: &jspb.ActionUpdate{State: jspb.ActionUpdate_RUNNING, Timestamp: timestamppb.New(t0)},
+			Update: &jspb.ActionUpdate{State: jspb.ActionUpdate_RUNNING, Timestamp: tspb.New(t0)},
 		},
 	}))
 
@@ -462,7 +463,7 @@
 		Event: &jspb.ActionEvent_Declaration{
 			Declaration: &jspb.ActionDeclaration{
 				Attributes: &jspb.ActionAttributes{},
-				Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_RUNNING, Timestamp: timestamppb.New(t0.Add(time.Second))},
+				Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_RUNNING, Timestamp: tspb.New(t0.Add(time.Second))},
 			},
 		},
 	}))
@@ -485,7 +486,7 @@
 				InvocationId: "inv",
 				ActionId:     "act",
 				Event: &jspb.ActionEvent_Update{
-					Update: &jspb.ActionUpdate{State: tc.state, Timestamp: timestamppb.New(lastTime)},
+					Update: &jspb.ActionUpdate{State: tc.state, Timestamp: tspb.New(lastTime)},
 				},
 			}))
 			if (err != nil) != tc.wantErr {
@@ -510,7 +511,7 @@
 			err := b.HandleBuildEvent(wrapInvocation(&jspb.InvocationEvent{
 				InvocationId: "inv",
 				Event: &jspb.InvocationEvent_Update{
-					Update: &jspb.InvocationUpdate{State: tc.state, Timestamp: timestamppb.New(lastTime)},
+					Update: &jspb.InvocationUpdate{State: tc.state, Timestamp: tspb.New(lastTime)},
 				},
 			}))
 			if (err != nil) != tc.wantErr {
@@ -533,7 +534,7 @@
 				Attributes: &jspb.InvocationAttributes{},
 				Initial: &jspb.InvocationUpdate{
 					State:           jspb.InvocationUpdate_STARTED,
-					Timestamp:       timestamppb.New(t0),
+					Timestamp:       tspb.New(t0),
 					ProgressMessage: "Starting build...",
 				},
 			},
@@ -550,7 +551,7 @@
 		Event: &jspb.InvocationEvent_Update{
 			Update: &jspb.InvocationUpdate{
 				State:           jspb.InvocationUpdate_STARTED,
-				Timestamp:       timestamppb.New(t0.Add(time.Second)),
+				Timestamp:       tspb.New(t0.Add(time.Second)),
 				ProgressMessage: "In progress...",
 			},
 		},
@@ -568,7 +569,7 @@
 				Attributes: &jspb.ActionAttributes{},
 				Initial: &jspb.ActionUpdate{
 					State:           jspb.ActionUpdate_PENDING,
-					Timestamp:       timestamppb.New(t0.Add(2 * time.Second)),
+					Timestamp:       tspb.New(t0.Add(2 * time.Second)),
 					ProgressMessage: "Waiting for slot...",
 				},
 			},
@@ -586,7 +587,7 @@
 		Event: &jspb.ActionEvent_Update{
 			Update: &jspb.ActionUpdate{
 				State:           jspb.ActionUpdate_RUNNING,
-				Timestamp:       timestamppb.New(t0.Add(3 * time.Second)),
+				Timestamp:       tspb.New(t0.Add(3 * time.Second)),
 				ProgressMessage: "Compiling...",
 			},
 		},
@@ -615,7 +616,7 @@
 		Event: &jspb.ActionEvent_Declaration{
 			Declaration: &jspb.ActionDeclaration{
 				Attributes: &jspb.ActionAttributes{},
-				Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_RUNNING, Timestamp: timestamppb.New(t0.Add(time.Second))},
+				Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_RUNNING, Timestamp: tspb.New(t0.Add(time.Second))},
 			},
 		},
 	}))
@@ -629,7 +630,7 @@
 	mustHandle(t, b, wrapInvocation(&jspb.InvocationEvent{
 		InvocationId: "inv1",
 		Event: &jspb.InvocationEvent_Update{
-			Update: &jspb.InvocationUpdate{State: jspb.InvocationUpdate_COMPLETED, Timestamp: timestamppb.New(t0.Add(2 * time.Second))},
+			Update: &jspb.InvocationUpdate{State: jspb.InvocationUpdate_COMPLETED, Timestamp: tspb.New(t0.Add(2 * time.Second))},
 		},
 	}))
 
@@ -665,13 +666,13 @@
 	mustHandle(t, b, wrapInvocation(&jspb.InvocationEvent{
 		InvocationId: "inv1",
 		Event: &jspb.InvocationEvent_Update{
-			Update: &jspb.InvocationUpdate{State: jspb.InvocationUpdate_COMPLETED, Timestamp: timestamppb.New(t3)},
+			Update: &jspb.InvocationUpdate{State: jspb.InvocationUpdate_COMPLETED, Timestamp: tspb.New(t3)},
 		},
 	}))
 	mustHandle(t, b, wrapInvocation(&jspb.InvocationEvent{
 		InvocationId: "inv2",
 		Event: &jspb.InvocationEvent_Update{
-			Update: &jspb.InvocationUpdate{State: jspb.InvocationUpdate_FAILED, Timestamp: timestamppb.New(t2)},
+			Update: &jspb.InvocationUpdate{State: jspb.InvocationUpdate_FAILED, Timestamp: tspb.New(t2)},
 		},
 	}))
 
@@ -715,7 +716,7 @@
 		Event: &jspb.InvocationEvent_Declaration{
 			Declaration: &jspb.InvocationDeclaration{
 				Attributes: &jspb.InvocationAttributes{},
-				Initial:    &jspb.InvocationUpdate{State: jspb.InvocationUpdate_STARTED, Timestamp: timestamppb.New(t0)},
+				Initial:    &jspb.InvocationUpdate{State: jspb.InvocationUpdate_STARTED, Timestamp: tspb.New(t0)},
 			},
 		},
 	}))
@@ -739,7 +740,7 @@
 		Event: &jspb.ActionEvent_Declaration{
 			Declaration: &jspb.ActionDeclaration{
 				Attributes: &jspb.ActionAttributes{},
-				Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_PENDING, Timestamp: timestamppb.New(t0)},
+				Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_PENDING, Timestamp: tspb.New(t0)},
 			},
 		},
 	}))
@@ -788,7 +789,7 @@
 		InvocationId: "inv1",
 		ActionId:     "act1",
 		Event: &jspb.ActionEvent_Update{
-			Update: &jspb.ActionUpdate{State: jspb.ActionUpdate_RUNNING, Timestamp: timestamppb.New(t3)},
+			Update: &jspb.ActionUpdate{State: jspb.ActionUpdate_RUNNING, Timestamp: tspb.New(t3)},
 		},
 	}))
 
@@ -807,7 +808,7 @@
 		Event: &jspb.ActionEvent_Update{
 			Update: &jspb.ActionUpdate{
 				State:           jspb.ActionUpdate_RUNNING,
-				Timestamp:       timestamppb.New(t4),
+				Timestamp:       tspb.New(t4),
 				ProgressMessage: "Still going...",
 			},
 		},
@@ -823,13 +824,13 @@
 		InvocationId: "inv1",
 		ActionId:     "act1",
 		Event: &jspb.ActionEvent_Update{
-			Update: &jspb.ActionUpdate{State: jspb.ActionUpdate_COMPLETED, Timestamp: timestamppb.New(t5)},
+			Update: &jspb.ActionUpdate{State: jspb.ActionUpdate_COMPLETED, Timestamp: tspb.New(t5)},
 		},
 	}))
 	mustHandle(t, b, wrapInvocation(&jspb.InvocationEvent{
 		InvocationId: "inv1",
 		Event: &jspb.InvocationEvent_Update{
-			Update: &jspb.InvocationUpdate{State: jspb.InvocationUpdate_COMPLETED, Timestamp: timestamppb.New(t5)},
+			Update: &jspb.InvocationUpdate{State: jspb.InvocationUpdate_COMPLETED, Timestamp: tspb.New(t5)},
 		},
 	}))
 
@@ -881,7 +882,7 @@
 				Event: &jspb.InvocationEvent_Declaration{
 					Declaration: &jspb.InvocationDeclaration{
 						Attributes: &jspb.InvocationAttributes{ToolName: "stress-tool"},
-						Initial:    &jspb.InvocationUpdate{State: jspb.InvocationUpdate_STARTED, Timestamp: timestamppb.New(baseTime)},
+						Initial:    &jspb.InvocationUpdate{State: jspb.InvocationUpdate_STARTED, Timestamp: tspb.New(baseTime)},
 					},
 				},
 			}))
@@ -899,7 +900,7 @@
 						Event: &jspb.ActionEvent_Declaration{
 							Declaration: &jspb.ActionDeclaration{
 								Attributes: &jspb.ActionAttributes{Mnemonic: "STRESS"},
-								Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_PENDING, Timestamp: timestamppb.New(baseTime)},
+								Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_PENDING, Timestamp: tspb.New(baseTime)},
 							},
 						},
 					}))
@@ -974,7 +975,7 @@
 						Event: &jspb.ActionEvent_Update{
 							Update: &jspb.ActionUpdate{
 								State:     state,
-								Timestamp: timestamppb.New(ts),
+								Timestamp: tspb.New(ts),
 								Output: []*jspb.ConsoleOutput{
 									{Stream: jspb.ConsoleOutput_STDOUT, Text: "."},
 								},
@@ -1004,7 +1005,7 @@
 				Attributes: &jspb.InvocationAttributes{},
 				Initial: &jspb.InvocationUpdate{
 					State:     jspb.InvocationUpdate_STARTED,
-					Timestamp: timestamppb.New(t0),
+					Timestamp: tspb.New(t0),
 				},
 			},
 		},
@@ -1049,7 +1050,7 @@
 			Declaration: &jspb.ActionDeclaration{
 				Attributes: &jspb.ActionAttributes{},
 				Initial: &jspb.ActionUpdate{
-					Timestamp: timestamppb.New(ts1),
+					Timestamp: tspb.New(ts1),
 					State:     jspb.ActionUpdate_PENDING,
 				},
 			},
@@ -1067,7 +1068,7 @@
 		InvocationId: "inv1",
 		ActionId:     "act1",
 		Event: &jspb.ActionEvent_Update{
-			Update: &jspb.ActionUpdate{State: jspb.ActionUpdate_PENDING, Timestamp: timestamppb.New(ts1)},
+			Update: &jspb.ActionUpdate{State: jspb.ActionUpdate_PENDING, Timestamp: tspb.New(ts1)},
 		},
 	}))
 	if off := act1.ReadyOffset(time.Time{}); off != 0 {
@@ -1151,7 +1152,7 @@
 		ActionId:     "act1",
 		Event: &jspb.ActionEvent_Update{
 			Update: &jspb.ActionUpdate{
-				Timestamp: timestamppb.New(ts.Add(time.Second)),
+				Timestamp: tspb.New(ts.Add(time.Second)),
 				Output: []*jspb.ConsoleOutput{
 					{Stream: jspb.ConsoleOutput_STDOUT, Text: "Hello ", IsIncremental: true},
 					{Stream: jspb.ConsoleOutput_STDERR, Text: "Error ", IsIncremental: true},
@@ -1164,7 +1165,7 @@
 		ActionId:     "act1",
 		Event: &jspb.ActionEvent_Update{
 			Update: &jspb.ActionUpdate{
-				Timestamp: timestamppb.New(ts.Add(2 * time.Second)),
+				Timestamp: tspb.New(ts.Add(2 * time.Second)),
 				Output: []*jspb.ConsoleOutput{
 					{Stream: jspb.ConsoleOutput_STDOUT, Text: "World", IsIncremental: true},
 					{Stream: jspb.ConsoleOutput_STDERR, Text: "123", IsIncremental: true},
@@ -1186,7 +1187,7 @@
 		ActionId:     "act1",
 		Event: &jspb.ActionEvent_Update{
 			Update: &jspb.ActionUpdate{
-				Timestamp: timestamppb.New(ts.Add(3 * time.Second)),
+				Timestamp: tspb.New(ts.Add(3 * time.Second)),
 				Output: []*jspb.ConsoleOutput{
 					{Stream: jspb.ConsoleOutput_STDOUT, Text: "Overwritten", IsIncremental: false},
 				},
@@ -1203,7 +1204,7 @@
 		InvocationId: "inv1",
 		Event: &jspb.InvocationEvent_Update{
 			Update: &jspb.InvocationUpdate{
-				Timestamp: timestamppb.New(ts.Add(4 * time.Second)),
+				Timestamp: tspb.New(ts.Add(4 * time.Second)),
 				Output: []*jspb.ConsoleOutput{
 					{Stream: jspb.ConsoleOutput_STDOUT, Text: "Inv Line 1\n", IsIncremental: true},
 				},
@@ -1214,7 +1215,7 @@
 		InvocationId: "inv1",
 		Event: &jspb.InvocationEvent_Update{
 			Update: &jspb.InvocationUpdate{
-				Timestamp: timestamppb.New(ts.Add(5 * time.Second)),
+				Timestamp: tspb.New(ts.Add(5 * time.Second)),
 				Output: []*jspb.ConsoleOutput{
 					{Stream: jspb.ConsoleOutput_STDOUT, Text: "Inv Line 2\n", IsIncremental: true},
 				},
@@ -1245,7 +1246,7 @@
 		Event: &jspb.ActionEvent_Update{
 			Update: &jspb.ActionUpdate{
 				State:     jspb.ActionUpdate_RUNNING,
-				Timestamp: timestamppb.New(t1),
+				Timestamp: tspb.New(t1),
 			},
 		},
 	}))
@@ -1265,7 +1266,7 @@
 		Event: &jspb.ActionEvent_Update{
 			Update: &jspb.ActionUpdate{
 				State:     jspb.ActionUpdate_RUNNING,
-				Timestamp: timestamppb.New(t2),
+				Timestamp: tspb.New(t2),
 			},
 		},
 	}))
@@ -1292,7 +1293,7 @@
 		InvocationId: "inv1",
 		Event: &jspb.InvocationEvent_Update{
 			Update: &jspb.InvocationUpdate{
-				Timestamp: timestamppb.New(t1),
+				Timestamp: tspb.New(t1),
 			},
 		},
 	}))
@@ -1303,7 +1304,7 @@
 		InvocationId: "inv1",
 		Event: &jspb.InvocationEvent_Update{
 			Update: &jspb.InvocationUpdate{
-				Timestamp: timestamppb.New(t2),
+				Timestamp: tspb.New(t2),
 			},
 		},
 	}))
@@ -1320,7 +1321,7 @@
 		InvocationId: "inv1",
 		Event: &jspb.InvocationEvent_Update{
 			Update: &jspb.InvocationUpdate{
-				Timestamp: timestamppb.New(t3),
+				Timestamp: tspb.New(t3),
 			},
 		},
 	}))
@@ -1388,7 +1389,7 @@
 				},
 				Initial: &jspb.InvocationUpdate{
 					State:     jspb.InvocationUpdate_STARTED,
-					Timestamp: timestamppb.New(t0),
+					Timestamp: tspb.New(t0),
 				},
 			},
 		},
@@ -1407,7 +1408,7 @@
 				},
 				Initial: &jspb.ActionUpdate{
 					State:     jspb.ActionUpdate_RUNNING,
-					Timestamp: timestamppb.New(t0.Add(time.Second)),
+					Timestamp: tspb.New(t0.Add(time.Second)),
 					Output: []*jspb.ConsoleOutput{
 						{Stream: jspb.ConsoleOutput_STDOUT, Text: "Initial stdout"},
 						{Stream: jspb.ConsoleOutput_STDERR, Text: "Initial stderr"},
@@ -1499,7 +1500,7 @@
 
 func TestGetEventTimestamp(t *testing.T) {
 	ts := time.Date(2026, 3, 10, 12, 0, 0, 0, time.UTC)
-	tspb := timestamppb.New(ts)
+	tspb := tspb.New(ts)
 
 	tests := []struct {
 		name    string
@@ -1658,7 +1659,7 @@
 			Event: &jspb.ActionEvent_Update{
 				Update: &jspb.ActionUpdate{
 					State:     jspb.ActionUpdate_RUNNING,
-					Timestamp: timestamppb.New(startTime),
+					Timestamp: tspb.New(startTime),
 				},
 			},
 		}))
@@ -1672,7 +1673,7 @@
 			Event: &jspb.ActionEvent_Update{
 				Update: &jspb.ActionUpdate{
 					State:     jspb.ActionUpdate_COMPLETED,
-					Timestamp: timestamppb.New(endTime),
+					Timestamp: tspb.New(endTime),
 				},
 			},
 		}))
@@ -1889,7 +1890,7 @@
 		Event: &jspb.ActionEvent_Declaration{
 			Declaration: &jspb.ActionDeclaration{
 				Attributes: &jspb.ActionAttributes{},
-				Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_RUNNING, Timestamp: timestamppb.New(tPast)},
+				Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_RUNNING, Timestamp: tspb.New(tPast)},
 			},
 		},
 	}))
@@ -1929,7 +1930,7 @@
 		Event: &jspb.ActionEvent_Declaration{
 			Declaration: &jspb.ActionDeclaration{
 				Attributes: &jspb.ActionAttributes{},
-				Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_RUNNING, Timestamp: timestamppb.New(t1)},
+				Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_RUNNING, Timestamp: tspb.New(t1)},
 			},
 		},
 	}))
@@ -1943,7 +1944,7 @@
 		Event: &jspb.ActionEvent_Declaration{
 			Declaration: &jspb.ActionDeclaration{
 				Attributes: &jspb.ActionAttributes{},
-				Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_RUNNING, Timestamp: timestamppb.New(t2)},
+				Initial:    &jspb.ActionUpdate{State: jspb.ActionUpdate_RUNNING, Timestamp: tspb.New(t2)},
 			},
 		},
 	}))
diff --git a/internal/pkg/casmsg/dispatcher.go b/internal/pkg/casmsg/dispatcher.go
index c9d05e5..04f8a80 100644
--- a/internal/pkg/casmsg/dispatcher.go
+++ b/internal/pkg/casmsg/dispatcher.go
@@ -18,10 +18,11 @@
 	"context"
 	"fmt"
 
-	repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
 	"github.com/bazelbuild/rsclient/internal/pkg/grpcutil"
-	bspb "google.golang.org/genproto/googleapis/bytestream"
 	"google.golang.org/protobuf/proto"
+
+	repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
+	bspb "google.golang.org/genproto/googleapis/bytestream"
 )
 
 const (
diff --git a/internal/pkg/casmsg/responder.go b/internal/pkg/casmsg/responder.go
index a7b664e..7d4f50a 100644
--- a/internal/pkg/casmsg/responder.go
+++ b/internal/pkg/casmsg/responder.go
@@ -16,16 +16,16 @@
 
 import (
 	repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
-	"github.com/bazelbuild/remote-apis/build/bazel/semver"
-	"google.golang.org/genproto/googleapis/bytestream"
+	svpb "github.com/bazelbuild/remote-apis/build/bazel/semver"
+	bspb "google.golang.org/genproto/googleapis/bytestream"
 )
 
 // NewCapabilitiesResponse returns a minimalist ServerCapabilities response
 // sufficient for most clients (including Bazel) to proceed with CAS operations.
 func NewCapabilitiesResponse() *repb.ServerCapabilities {
 	return &repb.ServerCapabilities{
-		LowApiVersion:  &semver.SemVer{Major: 2},
-		HighApiVersion: &semver.SemVer{Major: 2},
+		LowApiVersion:  &svpb.SemVer{Major: 2},
+		HighApiVersion: &svpb.SemVer{Major: 2},
 		CacheCapabilities: &repb.CacheCapabilities{
 			DigestFunctions: []repb.DigestFunction_Value{repb.DigestFunction_SHA256},
 			ActionCacheUpdateCapabilities: &repb.ActionCacheUpdateCapabilities{
@@ -66,8 +66,8 @@
 
 // NewWriteResponse generates a final WriteResponse for a Bytestream Write operation.
 // In Sink Mode, we simply acknowledge the requested write.
-func NewWriteResponse(committedSize int64) *bytestream.WriteResponse {
-	return &bytestream.WriteResponse{
+func NewWriteResponse(committedSize int64) *bspb.WriteResponse {
+	return &bspb.WriteResponse{
 		CommittedSize: committedSize,
 	}
 }
diff --git a/internal/pkg/casmsg/responder_test.go b/internal/pkg/casmsg/responder_test.go
index 3176639..5bd44ba 100644
--- a/internal/pkg/casmsg/responder_test.go
+++ b/internal/pkg/casmsg/responder_test.go
@@ -21,6 +21,7 @@
 	"google.golang.org/protobuf/testing/protocmp"
 
 	repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
+
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
diff --git a/internal/pkg/fakebes/server.go b/internal/pkg/fakebes/server.go
index 8edc337..a72d84a 100644
--- a/internal/pkg/fakebes/server.go
+++ b/internal/pkg/fakebes/server.go
@@ -26,9 +26,9 @@
 	"google.golang.org/grpc"
 	"google.golang.org/protobuf/encoding/protojson"
 	"google.golang.org/protobuf/proto"
-	"google.golang.org/protobuf/types/known/emptypb"
 
 	buildpb "google.golang.org/genproto/googleapis/devtools/build/v1"
+	emptypb "google.golang.org/protobuf/types/known/emptypb"
 )
 
 // RequestSink defines a callback for real-time capture of raw gRPC messages.
diff --git a/internal/pkg/fakebes/server_test.go b/internal/pkg/fakebes/server_test.go
index 9527389..734f47f 100644
--- a/internal/pkg/fakebes/server_test.go
+++ b/internal/pkg/fakebes/server_test.go
@@ -21,9 +21,10 @@
 
 	"github.com/bazelbuild/rsclient/internal/pkg/grpcutil/grpctest"
 	"github.com/bazelbuild/rsclient/internal/pkg/protoutil"
-	buildpb "google.golang.org/genproto/googleapis/devtools/build/v1"
 	"google.golang.org/grpc"
 
+	buildpb "google.golang.org/genproto/googleapis/devtools/build/v1"
+
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
diff --git a/internal/pkg/fakecas/server.go b/internal/pkg/fakecas/server.go
index 7131937..b61ea29 100644
--- a/internal/pkg/fakecas/server.go
+++ b/internal/pkg/fakecas/server.go
@@ -22,15 +22,16 @@
 
 	"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
 	"github.com/bazelbuild/remote-apis-sdks/go/pkg/fakes"
-	regrpc "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
 	"github.com/bazelbuild/rsclient/internal/pkg/casmsg"
 	"github.com/bazelbuild/rsclient/internal/pkg/fakerbe"
 	"github.com/bazelbuild/rsclient/internal/pkg/protoutil"
-	bsgrpc "google.golang.org/genproto/googleapis/bytestream"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
 	"google.golang.org/protobuf/proto"
+
+	regrpc "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
+	bsgrpc "google.golang.org/genproto/googleapis/bytestream"
 )
 
 var (
diff --git a/internal/pkg/fakecas/server_test.go b/internal/pkg/fakecas/server_test.go
index d1530b3..39befc0 100644
--- a/internal/pkg/fakecas/server_test.go
+++ b/internal/pkg/fakecas/server_test.go
@@ -20,9 +20,10 @@
 	"testing"
 
 	"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
-	regrpc "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
 	"github.com/bazelbuild/rsclient/internal/pkg/casmsg"
 	"github.com/bazelbuild/rsclient/internal/pkg/protoutil"
+
+	regrpc "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
 	bsgrpc "google.golang.org/genproto/googleapis/bytestream"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
diff --git a/internal/pkg/fakejobstatus/server.go b/internal/pkg/fakejobstatus/server.go
index 9dacf6c..1843ac6 100644
--- a/internal/pkg/fakejobstatus/server.go
+++ b/internal/pkg/fakejobstatus/server.go
@@ -20,8 +20,9 @@
 	"net"
 	"sync"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"google.golang.org/grpc"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 )
 
 // ReceivedRequests contains the requests received by the fake server.
diff --git a/internal/pkg/fakejobstatus/server_test.go b/internal/pkg/fakejobstatus/server_test.go
index 80d3c58..78689d8 100644
--- a/internal/pkg/fakejobstatus/server_test.go
+++ b/internal/pkg/fakejobstatus/server_test.go
@@ -20,9 +20,10 @@
 	"testing"
 	"time"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/grpcutil/grpctest"
 
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
diff --git a/internal/pkg/fakerbe/fakerbe.go b/internal/pkg/fakerbe/fakerbe.go
index 7111993..85d5d17 100644
--- a/internal/pkg/fakerbe/fakerbe.go
+++ b/internal/pkg/fakerbe/fakerbe.go
@@ -17,15 +17,15 @@
 
 import (
 	regrpc "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
-	semver "github.com/bazelbuild/remote-apis/build/bazel/semver"
+	svpb "github.com/bazelbuild/remote-apis/build/bazel/semver"
 )
 
 // MinimalCapabilities returns a standard minimal ServerCapabilities response.
 // This is used by multiple fake services to satisfy client capability checks.
 func MinimalCapabilities() *regrpc.ServerCapabilities {
 	return &regrpc.ServerCapabilities{
-		LowApiVersion:  &semver.SemVer{Major: 2},
-		HighApiVersion: &semver.SemVer{Major: 2},
+		LowApiVersion:  &svpb.SemVer{Major: 2},
+		HighApiVersion: &svpb.SemVer{Major: 2},
 		CacheCapabilities: &regrpc.CacheCapabilities{
 			DigestFunctions: []regrpc.DigestFunction_Value{regrpc.DigestFunction_SHA256},
 		},
diff --git a/internal/pkg/fakeresultstore/server_test.go b/internal/pkg/fakeresultstore/server_test.go
index de8d553..a8e948d 100644
--- a/internal/pkg/fakeresultstore/server_test.go
+++ b/internal/pkg/fakeresultstore/server_test.go
@@ -27,8 +27,9 @@
 	"github.com/bazelbuild/rsclient/internal/pkg/rsmsg"
 	"google.golang.org/grpc"
 
-	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
+
+	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
 const (
diff --git a/internal/pkg/fifo/fifo_test.go b/internal/pkg/fifo/fifo_test.go
index f52563a..fe087d5 100644
--- a/internal/pkg/fifo/fifo_test.go
+++ b/internal/pkg/fifo/fifo_test.go
@@ -27,6 +27,7 @@
 
 	"github.com/bazelbuild/rsclient/internal/pkg/fifo"
 	"github.com/bazelbuild/rsclient/internal/pkg/fifo/fifotest"
+
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
diff --git a/internal/pkg/grpcutil/message_recorder_test.go b/internal/pkg/grpcutil/message_recorder_test.go
index 691b563..2473bca 100644
--- a/internal/pkg/grpcutil/message_recorder_test.go
+++ b/internal/pkg/grpcutil/message_recorder_test.go
@@ -22,7 +22,6 @@
 
 	"github.com/bazelbuild/rsclient/internal/pkg/router"
 	"github.com/google/go-cmp/cmp"
-
 	"google.golang.org/grpc/metadata"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
diff --git a/internal/pkg/grpcutil/message_router_test.go b/internal/pkg/grpcutil/message_router_test.go
index 4cc5278..0b1d802 100644
--- a/internal/pkg/grpcutil/message_router_test.go
+++ b/internal/pkg/grpcutil/message_router_test.go
@@ -22,11 +22,12 @@
 
 	"github.com/bazelbuild/rsclient/internal/pkg/router"
 	"google.golang.org/protobuf/proto"
-	"google.golang.org/protobuf/types/known/anypb"
+
+	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
+	anypb "google.golang.org/protobuf/types/known/anypb"
 	wpb "google.golang.org/protobuf/types/known/wrapperspb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
-	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
 )
 
 const (
diff --git a/internal/pkg/jobstatus/service/bes.go b/internal/pkg/jobstatus/service/bes.go
index e414835..1dd0057 100644
--- a/internal/pkg/jobstatus/service/bes.go
+++ b/internal/pkg/jobstatus/service/bes.go
@@ -21,15 +21,15 @@
 	"io"
 	"os"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/jobstatus"
-	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
 	"github.com/golang/glog"
 	"google.golang.org/grpc"
 	"google.golang.org/protobuf/proto"
-	"google.golang.org/protobuf/types/known/emptypb"
 
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
 	buildpb "google.golang.org/genproto/googleapis/devtools/build/v1"
+	emptypb "google.golang.org/protobuf/types/known/emptypb"
 )
 
 // RegisterBazelBEPServer registers a Bazel BES server.
diff --git a/internal/pkg/jobstatus/service/bes_test.go b/internal/pkg/jobstatus/service/bes_test.go
index 39c5791..d210429 100644
--- a/internal/pkg/jobstatus/service/bes_test.go
+++ b/internal/pkg/jobstatus/service/bes_test.go
@@ -17,13 +17,13 @@
 import (
 	"testing"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
-	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
 	"google.golang.org/grpc"
 	"google.golang.org/protobuf/proto"
-	"google.golang.org/protobuf/types/known/anypb"
 
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
 	buildpb "google.golang.org/genproto/googleapis/devtools/build/v1"
+	anypb "google.golang.org/protobuf/types/known/anypb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
diff --git a/internal/pkg/jobstatus/service/config.go b/internal/pkg/jobstatus/service/config.go
index 406c238..4c2d204 100644
--- a/internal/pkg/jobstatus/service/config.go
+++ b/internal/pkg/jobstatus/service/config.go
@@ -17,8 +17,9 @@
 import (
 	"fmt"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"google.golang.org/grpc"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 )
 
 // IngressConfig holds the listening addresses for various ingress protocols.
diff --git a/internal/pkg/jobstatus/service/harness_test.go b/internal/pkg/jobstatus/service/harness_test.go
index c2a61a7..2eb077c 100644
--- a/internal/pkg/jobstatus/service/harness_test.go
+++ b/internal/pkg/jobstatus/service/harness_test.go
@@ -19,10 +19,11 @@
 	"testing"
 	"time"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/grpcutil/grpctest"
 	"google.golang.org/grpc"
 
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
diff --git a/internal/pkg/jobstatus/service/rs.go b/internal/pkg/jobstatus/service/rs.go
index 1c68637..15d5926 100644
--- a/internal/pkg/jobstatus/service/rs.go
+++ b/internal/pkg/jobstatus/service/rs.go
@@ -19,13 +19,13 @@
 	"fmt"
 	"os"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/rsmsg"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
 
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
 )
 
diff --git a/internal/pkg/jobstatus/service/rs_test.go b/internal/pkg/jobstatus/service/rs_test.go
index c8b7f99..adc033f 100644
--- a/internal/pkg/jobstatus/service/rs_test.go
+++ b/internal/pkg/jobstatus/service/rs_test.go
@@ -17,9 +17,10 @@
 import (
 	"testing"
 
+	"google.golang.org/grpc"
+
 	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
-	"google.golang.org/grpc"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
diff --git a/internal/pkg/jobstatus/service/server.go b/internal/pkg/jobstatus/service/server.go
index 41a2392..d152a42 100644
--- a/internal/pkg/jobstatus/service/server.go
+++ b/internal/pkg/jobstatus/service/server.go
@@ -20,9 +20,10 @@
 	"os"
 	"sync"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/netutil"
 	"google.golang.org/grpc"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 )
 
 // IngressManager manages multiple gRPC ingress servers.
diff --git a/internal/pkg/jobstatus/service/server_test.go b/internal/pkg/jobstatus/service/server_test.go
index ea10235..8585dd8 100644
--- a/internal/pkg/jobstatus/service/server_test.go
+++ b/internal/pkg/jobstatus/service/server_test.go
@@ -19,10 +19,11 @@
 	"sync"
 	"testing"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/grpcutil/grpctest"
 	"google.golang.org/grpc"
 
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
diff --git a/internal/pkg/jobstatus/service/worker.go b/internal/pkg/jobstatus/service/worker.go
index dca99ee..1128a7a 100644
--- a/internal/pkg/jobstatus/service/worker.go
+++ b/internal/pkg/jobstatus/service/worker.go
@@ -21,13 +21,14 @@
 	"sync"
 	"time"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/router"
 	"github.com/golang/glog"
 	"google.golang.org/api/support/bundler"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
 	"google.golang.org/protobuf/proto"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 )
 
 // EgressConfig holds configuration for the egress worker's bundling behavior.
diff --git a/internal/pkg/jobstatus/service/worker_test.go b/internal/pkg/jobstatus/service/worker_test.go
index 78babbd..33ac1ff 100644
--- a/internal/pkg/jobstatus/service/worker_test.go
+++ b/internal/pkg/jobstatus/service/worker_test.go
@@ -20,10 +20,11 @@
 	"testing"
 	"time"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/grpcutil/grpctest"
 	"google.golang.org/grpc"
 
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
diff --git a/internal/pkg/jobstatus/translate_bazel.go b/internal/pkg/jobstatus/translate_bazel.go
index d22f383..84aa67c 100644
--- a/internal/pkg/jobstatus/translate_bazel.go
+++ b/internal/pkg/jobstatus/translate_bazel.go
@@ -19,7 +19,7 @@
 
 	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
-	"google.golang.org/protobuf/types/known/timestamppb"
+	tspb "google.golang.org/protobuf/types/known/timestamppb"
 )
 
 // TranslateBuildEvent converts a Bazel BuildEvent into a jspb.BuildEvent.
@@ -205,13 +205,13 @@
 	}
 
 	// Calculate end time: StartTime + Duration
-	var endTime *timestamppb.Timestamp
+	var endTime *tspb.Timestamp
 	if result.TestAttemptStart != nil && result.TestAttemptDuration != nil {
 		start := result.TestAttemptStart.AsTime()
 		duration := result.TestAttemptDuration.AsDuration()
-		endTime = timestamppb.New(start.Add(duration))
+		endTime = tspb.New(start.Add(duration))
 	} else {
-		endTime = timestamppb.Now() // Fallback
+		endTime = tspb.Now() // Fallback
 	}
 
 	return &jspb.ActionEvent{
diff --git a/internal/pkg/jobstatus/translate_bazel_test.go b/internal/pkg/jobstatus/translate_bazel_test.go
index fef46da..9f77278 100644
--- a/internal/pkg/jobstatus/translate_bazel_test.go
+++ b/internal/pkg/jobstatus/translate_bazel_test.go
@@ -18,12 +18,13 @@
 	"testing"
 	"time"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
-	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
 	"github.com/google/go-cmp/cmp"
 	"google.golang.org/protobuf/testing/protocmp"
-	"google.golang.org/protobuf/types/known/durationpb"
-	"google.golang.org/protobuf/types/known/timestamppb"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+	bespb "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream"
+	dpb "google.golang.org/protobuf/types/known/durationpb"
+	tspb "google.golang.org/protobuf/types/known/timestamppb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
@@ -31,7 +32,7 @@
 var (
 	// Use a fixed time for deterministic tests.
 	testTime = time.Date(2026, 3, 3, 12, 0, 0, 0, time.UTC)
-	testTS   = timestamppb.New(testTime)
+	testTS   = tspb.New(testTime)
 )
 
 func TestTranslateBuildEvent_Action(t *testing.T) {
@@ -86,7 +87,7 @@
 
 func TestTranslateBuildEvent_TestResult(t *testing.T) {
 	duration := time.Second * 5
-	expectedEnd := timestamppb.New(testTime.Add(duration))
+	expectedEnd := tspb.New(testTime.Add(duration))
 
 	event := &bespb.BuildEvent{
 		Id: &bespb.BuildEventId{
@@ -103,7 +104,7 @@
 			TestResult: &bespb.TestResult{
 				Status:              bespb.TestStatus_PASSED,
 				TestAttemptStart:    testTS,
-				TestAttemptDuration: durationpb.New(duration),
+				TestAttemptDuration: dpb.New(duration),
 			},
 		},
 	}
diff --git a/internal/pkg/jobstatus/translate_ninja_rs.go b/internal/pkg/jobstatus/translate_ninja_rs.go
index 560297b..3a61fd1 100644
--- a/internal/pkg/jobstatus/translate_ninja_rs.go
+++ b/internal/pkg/jobstatus/translate_ninja_rs.go
@@ -22,7 +22,7 @@
 
 	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
-	fpb "google.golang.org/protobuf/types/known/fieldmaskpb"
+	fmpb "google.golang.org/protobuf/types/known/fieldmaskpb"
 	tspb "google.golang.org/protobuf/types/known/timestamppb"
 )
 
@@ -104,7 +104,7 @@
 //	mask: The field mask from the UploadRequest that restricts which fields
 //	  are updated.
 //	invocation: The ResultStore Invocation resource containing the data to translate.
-func translateNinjaInvocation(reqID *rspb.UploadRequest_Id, op rspb.UploadRequest_UploadOperation, mask *fpb.FieldMask, invocation *rspb.Invocation) *jspb.InvocationEvent {
+func translateNinjaInvocation(reqID *rspb.UploadRequest_Id, op rspb.UploadRequest_UploadOperation, mask *fmpb.FieldMask, invocation *rspb.Invocation) *jspb.InvocationEvent {
 	if invocation == nil {
 		return nil
 	}
@@ -192,7 +192,7 @@
 //	mask: The field mask from the UploadRequest that restricts which fields
 //	  are updated.
 //	action: The ResultStore Action resource containing the data to translate.
-func translateNinjaAction(reqID *rspb.UploadRequest_Id, op rspb.UploadRequest_UploadOperation, mask *fpb.FieldMask, action *rspb.Action) *jspb.ActionEvent {
+func translateNinjaAction(reqID *rspb.UploadRequest_Id, op rspb.UploadRequest_UploadOperation, mask *fmpb.FieldMask, action *rspb.Action) *jspb.ActionEvent {
 	if action == nil {
 		return nil
 	}
diff --git a/internal/pkg/jobstatus/translate_ninja_rs_test.go b/internal/pkg/jobstatus/translate_ninja_rs_test.go
index 501fb9c..69c0911 100644
--- a/internal/pkg/jobstatus/translate_ninja_rs_test.go
+++ b/internal/pkg/jobstatus/translate_ninja_rs_test.go
@@ -18,11 +18,12 @@
 	"strings"
 	"testing"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/rsmsg"
 	"github.com/google/go-cmp/cmp"
-	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
 	"google.golang.org/protobuf/testing/protocmp"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
 	dpb "google.golang.org/protobuf/types/known/durationpb"
 	fmpb "google.golang.org/protobuf/types/known/fieldmaskpb"
 	tspb "google.golang.org/protobuf/types/known/timestamppb"
diff --git a/internal/pkg/jobstatus/translate_resultstore.go b/internal/pkg/jobstatus/translate_resultstore.go
index 915618c..dcbff43 100644
--- a/internal/pkg/jobstatus/translate_resultstore.go
+++ b/internal/pkg/jobstatus/translate_resultstore.go
@@ -17,12 +17,12 @@
 import (
 	"fmt"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/rsmsg"
-	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
 
-	"google.golang.org/protobuf/types/known/fieldmaskpb"
-	"google.golang.org/protobuf/types/known/timestamppb"
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
+	fmpb "google.golang.org/protobuf/types/known/fieldmaskpb"
+	tspb "google.golang.org/protobuf/types/known/timestamppb"
 )
 
 // TranslateUploadRequest converts a ResultStore UploadRequest into a jspb.BuildEvent.
@@ -189,7 +189,7 @@
 // translateInvocation handles the common translation logic for Invocation-related requests.
 // It maps ResultStore status and timing to jobstatus state and timestamp,
 // and handles both CREATE (Declaration) and UPDATE/FINALIZE (Update) operations.
-func translateInvocation(op rspb.UploadRequest_UploadOperation, mask *fieldmaskpb.FieldMask, invocation *rspb.Invocation) *jspb.InvocationEvent {
+func translateInvocation(op rspb.UploadRequest_UploadOperation, mask *fmpb.FieldMask, invocation *rspb.Invocation) *jspb.InvocationEvent {
 	if invocation == nil {
 		return nil
 	}
@@ -211,7 +211,7 @@
 	}
 
 	// Map ResultStore timing to jobstatus timestamp if requested by the field mask.
-	var timestamp *timestamppb.Timestamp
+	var timestamp *tspb.Timestamp
 	if shouldProcessTiming(op, mask) {
 		timestamp = translateRSTiming(invocation.Timing)
 	}
@@ -257,7 +257,7 @@
 // It extracts ID information, maps status and timing, and handles both
 // CREATE (Declaration) and UPDATE/FINALIZE (Update) operations.
 // For CREATE operations, it also populates mnemonic and description from the action type.
-func translateAction(op rspb.UploadRequest_UploadOperation, mask *fieldmaskpb.FieldMask, action *rspb.Action) *jspb.ActionEvent {
+func translateAction(op rspb.UploadRequest_UploadOperation, mask *fmpb.FieldMask, action *rspb.Action) *jspb.ActionEvent {
 	if action == nil {
 		return nil
 	}
@@ -279,7 +279,7 @@
 	}
 
 	// Map ResultStore timing to jobstatus timestamp if requested by the field mask.
-	var timestamp *timestamppb.Timestamp
+	var timestamp *tspb.Timestamp
 	if shouldProcessTiming(op, mask) {
 		timestamp = translateRSTiming(action.Timing)
 	}
diff --git a/internal/pkg/jobstatus/translate_resultstore_test.go b/internal/pkg/jobstatus/translate_resultstore_test.go
index 1d1dc4e..7d1605f 100644
--- a/internal/pkg/jobstatus/translate_resultstore_test.go
+++ b/internal/pkg/jobstatus/translate_resultstore_test.go
@@ -17,12 +17,13 @@
 import (
 	"testing"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/bazelbuild/rsclient/internal/pkg/rsmsg"
 	"github.com/google/go-cmp/cmp"
-	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
 	"google.golang.org/protobuf/testing/protocmp"
-	"google.golang.org/protobuf/types/known/fieldmaskpb"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
+	fmpb "google.golang.org/protobuf/types/known/fieldmaskpb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
@@ -295,7 +296,7 @@
 func TestTranslateUploadRequest_ActionUpdate_WithFieldMask(t *testing.T) {
 	req := &rspb.UploadRequest{
 		UploadOperation: rspb.UploadRequest_UPDATE,
-		UpdateMask: &fieldmaskpb.FieldMask{
+		UpdateMask: &fmpb.FieldMask{
 			Paths: []string{"status_attributes"},
 		},
 		Resource: &rspb.UploadRequest_Action{
diff --git a/internal/pkg/jobstatus/translate_resultstore_utils.go b/internal/pkg/jobstatus/translate_resultstore_utils.go
index 3fcff30..eecaade 100644
--- a/internal/pkg/jobstatus/translate_resultstore_utils.go
+++ b/internal/pkg/jobstatus/translate_resultstore_utils.go
@@ -19,13 +19,13 @@
 
 	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
-	"google.golang.org/protobuf/types/known/fieldmaskpb"
-	"google.golang.org/protobuf/types/known/timestamppb"
+	fmpb "google.golang.org/protobuf/types/known/fieldmaskpb"
+	tspb "google.golang.org/protobuf/types/known/timestamppb"
 )
 
 // shouldProcess returns true if any of the given allowed field paths should be
 // processed based on the upload operation and field mask.
-func shouldProcess(op rspb.UploadRequest_UploadOperation, mask *fieldmaskpb.FieldMask, allowedPaths ...string) bool {
+func shouldProcess(op rspb.UploadRequest_UploadOperation, mask *fmpb.FieldMask, allowedPaths ...string) bool {
 	// Field masks are ignored for CREATE and FINALIZE.
 	if op == rspb.UploadRequest_CREATE || op == rspb.UploadRequest_FINALIZE {
 		return true
@@ -49,15 +49,15 @@
 	return false
 }
 
-func shouldProcessStatus(op rspb.UploadRequest_UploadOperation, mask *fieldmaskpb.FieldMask) bool {
+func shouldProcessStatus(op rspb.UploadRequest_UploadOperation, mask *fmpb.FieldMask) bool {
 	return shouldProcess(op, mask, "status_attributes", "status_attributes.status")
 }
 
-func shouldProcessTiming(op rspb.UploadRequest_UploadOperation, mask *fieldmaskpb.FieldMask) bool {
+func shouldProcessTiming(op rspb.UploadRequest_UploadOperation, mask *fmpb.FieldMask) bool {
 	return shouldProcess(op, mask, "timing", "timing.start_time", "timing.duration")
 }
 
-func shouldProcessFiles(op rspb.UploadRequest_UploadOperation, mask *fieldmaskpb.FieldMask) bool {
+func shouldProcessFiles(op rspb.UploadRequest_UploadOperation, mask *fmpb.FieldMask) bool {
 	return shouldProcess(op, mask, "files")
 }
 
@@ -99,12 +99,12 @@
 	}
 }
 
-func translateRSTiming(timing *rspb.Timing) *timestamppb.Timestamp {
+func translateRSTiming(timing *rspb.Timing) *tspb.Timestamp {
 	if timing == nil || timing.StartTime == nil {
 		return nil
 	}
 	if timing.Duration != nil {
-		return timestamppb.New(timing.StartTime.AsTime().Add(timing.Duration.AsDuration()))
+		return tspb.New(timing.StartTime.AsTime().Add(timing.Duration.AsDuration()))
 	}
 	return timing.StartTime
 }
diff --git a/internal/pkg/jobstatus/translate_resultstore_utils_test.go b/internal/pkg/jobstatus/translate_resultstore_utils_test.go
index 93f69f0..ffe49e8 100644
--- a/internal/pkg/jobstatus/translate_resultstore_utils_test.go
+++ b/internal/pkg/jobstatus/translate_resultstore_utils_test.go
@@ -18,13 +18,14 @@
 	"testing"
 	"time"
 
-	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	"github.com/google/go-cmp/cmp"
-	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
 	"google.golang.org/protobuf/testing/protocmp"
-	"google.golang.org/protobuf/types/known/durationpb"
-	"google.golang.org/protobuf/types/known/fieldmaskpb"
-	"google.golang.org/protobuf/types/known/timestamppb"
+
+	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
+	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
+	dpb "google.golang.org/protobuf/types/known/durationpb"
+	fmpb "google.golang.org/protobuf/types/known/fieldmaskpb"
+	tspb "google.golang.org/protobuf/types/known/timestamppb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
@@ -33,21 +34,21 @@
 	tests := []struct {
 		name string
 		op   rspb.UploadRequest_UploadOperation
-		mask *fieldmaskpb.FieldMask
+		mask *fmpb.FieldMask
 		path string
 		want bool
 	}{
 		{
 			name: "CREATE ignores mask",
 			op:   rspb.UploadRequest_CREATE,
-			mask: &fieldmaskpb.FieldMask{Paths: []string{"other"}},
+			mask: &fmpb.FieldMask{Paths: []string{"other"}},
 			path: "status_attributes",
 			want: true,
 		},
 		{
 			name: "FINALIZE ignores mask",
 			op:   rspb.UploadRequest_FINALIZE,
-			mask: &fieldmaskpb.FieldMask{Paths: []string{"other"}},
+			mask: &fmpb.FieldMask{Paths: []string{"other"}},
 			path: "status_attributes",
 			want: true,
 		},
@@ -61,35 +62,35 @@
 		{
 			name: "UPDATE with empty mask returns true",
 			op:   rspb.UploadRequest_UPDATE,
-			mask: &fieldmaskpb.FieldMask{Paths: []string{}},
+			mask: &fmpb.FieldMask{Paths: []string{}},
 			path: "status_attributes",
 			want: true,
 		},
 		{
 			name: "UPDATE with exact match",
 			op:   rspb.UploadRequest_UPDATE,
-			mask: &fieldmaskpb.FieldMask{Paths: []string{"status_attributes"}},
+			mask: &fmpb.FieldMask{Paths: []string{"status_attributes"}},
 			path: "status_attributes",
 			want: true,
 		},
 		{
 			name: "UPDATE with wildcard",
 			op:   rspb.UploadRequest_UPDATE,
-			mask: &fieldmaskpb.FieldMask{Paths: []string{"*"}},
+			mask: &fmpb.FieldMask{Paths: []string{"*"}},
 			path: "status_attributes",
 			want: true,
 		},
 		{
 			name: "UPDATE with prefix match",
 			op:   rspb.UploadRequest_UPDATE,
-			mask: &fieldmaskpb.FieldMask{Paths: []string{"status_attributes"}},
+			mask: &fmpb.FieldMask{Paths: []string{"status_attributes"}},
 			path: "status_attributes.status",
 			want: true,
 		},
 		{
 			name: "UPDATE with no match",
 			op:   rspb.UploadRequest_UPDATE,
-			mask: &fieldmaskpb.FieldMask{Paths: []string{"timing"}},
+			mask: &fmpb.FieldMask{Paths: []string{"timing"}},
 			path: "status_attributes",
 			want: false,
 		},
@@ -107,7 +108,7 @@
 func TestShouldProcessStatus(t *testing.T) {
 	// Verifies that status attributes are processed when explicitly masked
 	// or when the operation is CREATE/FINALIZE.
-	mask := &fieldmaskpb.FieldMask{Paths: []string{"status_attributes.status"}}
+	mask := &fmpb.FieldMask{Paths: []string{"status_attributes.status"}}
 	if !shouldProcessStatus(rspb.UploadRequest_UPDATE, mask) {
 		t.Errorf("shouldProcessStatus(UPDATE, %v) = false, want true", mask)
 	}
@@ -119,7 +120,7 @@
 func TestShouldProcessTiming(t *testing.T) {
 	// Verifies that timing information is processed when explicitly masked
 	// or when the operation is CREATE/FINALIZE.
-	mask := &fieldmaskpb.FieldMask{Paths: []string{"timing.duration"}}
+	mask := &fmpb.FieldMask{Paths: []string{"timing.duration"}}
 	if !shouldProcessTiming(rspb.UploadRequest_UPDATE, mask) {
 		t.Errorf("shouldProcessTiming(UPDATE, %v) = false, want true", mask)
 	}
@@ -131,7 +132,7 @@
 func TestShouldProcessFiles(t *testing.T) {
 	// Verifies that file-related information is processed when explicitly masked
 	// or when the operation is CREATE/FINALIZE.
-	mask := &fieldmaskpb.FieldMask{Paths: []string{"files"}}
+	mask := &fmpb.FieldMask{Paths: []string{"files"}}
 	if !shouldProcessFiles(rspb.UploadRequest_UPDATE, mask) {
 		t.Errorf("shouldProcessFiles(UPDATE, %v) = false, want true", mask)
 	}
@@ -208,12 +209,12 @@
 
 func TestTranslateRSTiming(t *testing.T) {
 	start := time.Date(2026, 3, 4, 12, 0, 0, 0, time.UTC)
-	startPB := timestamppb.New(start)
+	startPB := tspb.New(start)
 
 	tests := []struct {
 		name   string
 		timing *rspb.Timing
-		want   *timestamppb.Timestamp
+		want   *tspb.Timestamp
 	}{
 		{
 			name:   "nil timing",
@@ -234,9 +235,9 @@
 			name: "start time and duration",
 			timing: &rspb.Timing{
 				StartTime: startPB,
-				Duration:  durationpb.New(10 * time.Second),
+				Duration:  dpb.New(10 * time.Second),
 			},
-			want: timestamppb.New(start.Add(10 * time.Second)),
+			want: tspb.New(start.Add(10 * time.Second)),
 		},
 	}
 
diff --git a/internal/pkg/protoutil/delimited_prototext_test.go b/internal/pkg/protoutil/delimited_prototext_test.go
index 43b14c0..c661212 100644
--- a/internal/pkg/protoutil/delimited_prototext_test.go
+++ b/internal/pkg/protoutil/delimited_prototext_test.go
@@ -22,10 +22,12 @@
 	"strings"
 	"testing"
 
-	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 	"github.com/google/go-cmp/cmp"
 	"google.golang.org/protobuf/testing/protocmp"
-	"google.golang.org/protobuf/types/known/wrapperspb"
+
+	wpb "google.golang.org/protobuf/types/known/wrapperspb"
+
+	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
 // TestDelimitedPrototext verifies the end-to-end cycle of writing and reading
@@ -36,11 +38,11 @@
 		Delimiter: "# ---- Test Delimiter ----",
 	}
 	// Fully automated instantiation via type token.
-	pIO := NewDelimitedPrototextIO((*wrapperspb.StringValue)(nil), config)
+	pIO := NewDelimitedPrototextIO((*wpb.StringValue)(nil), config)
 
-	msgs := []*wrapperspb.StringValue{
-		wrapperspb.String("first message"),
-		wrapperspb.String("second message"),
+	msgs := []*wpb.StringValue{
+		wpb.String("first message"),
+		wpb.String("second message"),
 	}
 
 	var buf bytes.Buffer
@@ -65,8 +67,8 @@
 
 	// 3. Round-Trip: Read messages back using ReadStream.
 	t.Run("ReadStream", func(t *testing.T) {
-		var got []*wrapperspb.StringValue
-		err := pIO.ReadStream(ctx, bytes.NewReader(buf.Bytes()), func(m *wrapperspb.StringValue) error {
+		var got []*wpb.StringValue
+		err := pIO.ReadStream(ctx, bytes.NewReader(buf.Bytes()), func(m *wpb.StringValue) error {
 			got = append(got, m)
 			return nil
 		})
@@ -86,7 +88,7 @@
 		// Cancel immediately to ensure no messages are processed even if data is present.
 		cancel()
 
-		err := pIO.ReadStream(ctx, bytes.NewReader(buf.Bytes()), func(m *wrapperspb.StringValue) error {
+		err := pIO.ReadStream(ctx, bytes.NewReader(buf.Bytes()), func(m *wpb.StringValue) error {
 			t.Errorf("Should not have processed any messages after context cancellation")
 			return nil
 		})
@@ -138,12 +140,12 @@
 	config := DelimitedPrototextConfig{
 		Delimiter: "--- LARGE MESSAGE DELIMITER ---",
 	}
-	pIO := NewDelimitedPrototextIO((*wrapperspb.StringValue)(nil), config)
+	pIO := NewDelimitedPrototextIO((*wpb.StringValue)(nil), config)
 
 	// Create a message significantly larger than 64KB (e.g., 200KB).
 	// This forces the scanner to use its extended internal buffer.
 	largeStr := strings.Repeat("ABCDEFGH ", 25000)
-	msg := wrapperspb.String(largeStr)
+	msg := wpb.String(largeStr)
 
 	var buf bytes.Buffer
 	// 1. Write the large message.
@@ -181,8 +183,8 @@
 	config := DelimitedPrototextConfig{
 		Delimiter: "--- DELIMITER ---",
 	}
-	pIO := NewDelimitedPrototextIO((*wrapperspb.StringValue)(nil), config)
-	msg := wrapperspb.String("test")
+	pIO := NewDelimitedPrototextIO((*wpb.StringValue)(nil), config)
+	msg := wpb.String("test")
 
 	t.Run("WriterError", func(t *testing.T) {
 		err := pIO.Write(ctx, errorWriter{}, msg)
@@ -202,10 +204,10 @@
 	config := DelimitedPrototextConfig{
 		Delimiter: "---",
 	}
-	pIO := NewDelimitedPrototextIO((*wrapperspb.StringValue)(nil), config)
+	pIO := NewDelimitedPrototextIO((*wpb.StringValue)(nil), config)
 
 	// StringValue.Value is a string. We provide invalid UTF-8 bytes.
-	msg := &wrapperspb.StringValue{
+	msg := &wpb.StringValue{
 		Value: string([]byte{0xff, 0xfe, 0xfd}),
 	}
 
@@ -227,12 +229,12 @@
 	config := DelimitedPrototextConfig{
 		Delimiter: "---",
 	}
-	pIO := NewDelimitedPrototextIO((*wrapperspb.StringValue)(nil), config)
+	pIO := NewDelimitedPrototextIO((*wpb.StringValue)(nil), config)
 
 	// Malformed prototext data.
 	malformed := "--- \n { not valid prototext }"
 
-	err := pIO.ReadStream(ctx, strings.NewReader(malformed), func(m *wrapperspb.StringValue) error {
+	err := pIO.ReadStream(ctx, strings.NewReader(malformed), func(m *wpb.StringValue) error {
 		return nil
 	})
 
@@ -253,7 +255,7 @@
 	cfg := DelimitedPrototextConfig{Delimiter: "---"}
 
 	// 1. Use for StringValue
-	pIO_String := NewDelimitedPrototextIO((*wrapperspb.StringValue)(nil), cfg)
+	pIO_String := NewDelimitedPrototextIO((*wpb.StringValue)(nil), cfg)
 	sBuf := bytes.NewBufferString("---\nvalue: \"hello\"\n")
 	sGot, _ := pIO_String.ReadAll(ctx, sBuf)
 	if len(sGot) != 1 || sGot[0].Value != "hello" {
@@ -261,7 +263,7 @@
 	}
 
 	// 2. Use for BoolValue (Demonstrates reuse for a different schema)
-	pIO_Bool := NewDelimitedPrototextIO((*wrapperspb.BoolValue)(nil), cfg)
+	pIO_Bool := NewDelimitedPrototextIO((*wpb.BoolValue)(nil), cfg)
 	bBuf := bytes.NewBufferString("---\nvalue: true\n")
 	bGot, _ := pIO_Bool.ReadAll(ctx, bBuf)
 	if len(bGot) != 1 || !bGot[0].Value {
diff --git a/internal/pkg/protoutil/jsonl_sink_test.go b/internal/pkg/protoutil/jsonl_sink_test.go
index f2a4c11..4eca78c 100644
--- a/internal/pkg/protoutil/jsonl_sink_test.go
+++ b/internal/pkg/protoutil/jsonl_sink_test.go
@@ -22,7 +22,7 @@
 	"sync"
 	"testing"
 
-	"google.golang.org/protobuf/types/known/wrapperspb"
+	wpb "google.golang.org/protobuf/types/known/wrapperspb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
@@ -33,7 +33,7 @@
 
 	t.Run("SingleWrite", func(t *testing.T) {
 		buf.Reset()
-		msg := wrapperspb.String("hello")
+		msg := wpb.String("hello")
 		label := "test.Method"
 
 		if err := sink.Write(label, msg); err != nil {
@@ -82,7 +82,7 @@
 			go func(id int) {
 				defer wg.Done()
 				for j := 0; j < numWrites; j++ {
-					msg := wrapperspb.String(fmt.Sprintf("msg-%d-%d", id, j))
+					msg := wpb.String(fmt.Sprintf("msg-%d-%d", id, j))
 					if err := sink.Write("test.Concurrent", msg); err != nil {
 						errs <- err
 					}
@@ -127,7 +127,7 @@
 	errMock := fmt.Errorf("disk full")
 	sink := NewJSONLSink(&stubErrorWriter{err: errMock})
 
-	msg := wrapperspb.String("test")
+	msg := wpb.String("test")
 	err := sink.Write("label", msg)
 
 	if err == nil {
diff --git a/internal/pkg/protoutil/text_sink_test.go b/internal/pkg/protoutil/text_sink_test.go
index ed47f65..a3f6fef 100644
--- a/internal/pkg/protoutil/text_sink_test.go
+++ b/internal/pkg/protoutil/text_sink_test.go
@@ -21,13 +21,15 @@
 	"sync"
 	"testing"
 
-	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 	"google.golang.org/protobuf/reflect/protoregistry"
-	"google.golang.org/protobuf/types/known/anypb"
-	"google.golang.org/protobuf/types/known/wrapperspb"
+
+	anypb "google.golang.org/protobuf/types/known/anypb"
+	wpb "google.golang.org/protobuf/types/known/wrapperspb"
+
+	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
-func mustAnyPBNew(t *testing.T, m *wrapperspb.StringValue) *anypb.Any {
+func mustAnyPBNew(t *testing.T, m *wpb.StringValue) *anypb.Any {
 	t.Helper()
 	any, err := anypb.New(m)
 	if err != nil {
@@ -40,7 +42,7 @@
 	var buf bytes.Buffer
 	sink := NewTextSink(&buf, nil)
 
-	msg := wrapperspb.String("hello world")
+	msg := wpb.String("hello world")
 	if err := sink.Write("TestLabel", msg); err != nil {
 		t.Fatalf("Write failed: %v", err)
 	}
@@ -58,12 +60,12 @@
 	var buf bytes.Buffer
 	// Create a local registry and register StringValue.
 	reg := &protoregistry.Types{}
-	reg.RegisterMessage((&wrapperspb.StringValue{}).ProtoReflect().Type())
+	reg.RegisterMessage((&wpb.StringValue{}).ProtoReflect().Type())
 
 	sink := NewTextSink(&buf, reg)
 
 	// Wrap a StringValue in an Any.
-	inner := wrapperspb.String("expanded content")
+	inner := wpb.String("expanded content")
 	anyMsg := mustAnyPBNew(t, inner)
 
 	if err := sink.Write("AnyLabel", anyMsg); err != nil {
@@ -100,7 +102,7 @@
 			defer wg.Done()
 			for j := 0; j < msgsPerGoroutine; j++ {
 				label := fmt.Sprintf("Label-%d", id)
-				msg := wrapperspb.String(fmt.Sprintf("data-%d", j))
+				msg := wpb.String(fmt.Sprintf("data-%d", j))
 				// Each Write is protected by a mutex inside the sink.
 				if err := sink.Write(label, msg); err != nil {
 					t.Errorf("Write failed in goroutine %d: %v", id, err)
diff --git a/internal/pkg/protoutil/worker_test.go b/internal/pkg/protoutil/worker_test.go
index 1c5ed48..1a86a08 100644
--- a/internal/pkg/protoutil/worker_test.go
+++ b/internal/pkg/protoutil/worker_test.go
@@ -21,8 +21,9 @@
 	"testing"
 	"time"
 
+	wpb "google.golang.org/protobuf/types/known/wrapperspb"
+
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
-	"google.golang.org/protobuf/types/known/wrapperspb"
 )
 
 // TestPrototextWorker_Run verifies the core functionality of the PrototextWorker.
@@ -32,12 +33,12 @@
 	var buf bytes.Buffer
 	// Create a sink that writes to our buffer. No custom resolver is needed for StringValue.
 	sink := NewTextSink(&buf, nil)
-	worker := NewPrototextWorker[*wrapperspb.StringValue]("WorkerName", sink)
+	worker := NewPrototextWorker[*wpb.StringValue]("WorkerName", sink)
 
 	// Create a buffered channel and populate it with test messages.
-	inbound := make(chan *wrapperspb.StringValue, 2)
-	inbound <- wrapperspb.String("msg1")
-	inbound <- wrapperspb.String("msg2")
+	inbound := make(chan *wpb.StringValue, 2)
+	inbound <- wpb.String("msg1")
+	inbound <- wpb.String("msg2")
 	close(inbound) // Closing the channel signals the worker to finish after draining.
 
 	// Run the worker. It should exit successfully after processing both messages.
@@ -61,9 +62,9 @@
 func TestPrototextWorker_ContextCancellation(t *testing.T) {
 	var buf bytes.Buffer
 	sink := NewTextSink(&buf, nil)
-	worker := NewPrototextWorker[*wrapperspb.StringValue]("CancelWorker", sink)
+	worker := NewPrototextWorker[*wpb.StringValue]("CancelWorker", sink)
 
-	inbound := make(chan *wrapperspb.StringValue)
+	inbound := make(chan *wpb.StringValue)
 
 	// Create a context that we can cancel manually.
 	ctx, cancel := context.WithCancel(t.Context())
@@ -92,10 +93,10 @@
 func TestPrototextWorker_WriteError(t *testing.T) {
 	// Create a sink that uses our failing errorWriter.
 	sink := NewTextSink(errorWriter{}, nil)
-	worker := NewPrototextWorker[*wrapperspb.StringValue]("ErrorWorker", sink)
+	worker := NewPrototextWorker[*wpb.StringValue]("ErrorWorker", sink)
 
-	inbound := make(chan *wrapperspb.StringValue, 1)
-	inbound <- wrapperspb.String("should fail")
+	inbound := make(chan *wpb.StringValue, 1)
+	inbound <- wpb.String("should fail")
 
 	// Run the worker. It should return an error when it tries to write.
 	err := worker.Run(t.Context(), inbound)
diff --git a/internal/pkg/rsmsg/names_test.go b/internal/pkg/rsmsg/names_test.go
index 543174c..25c3495 100644
--- a/internal/pkg/rsmsg/names_test.go
+++ b/internal/pkg/rsmsg/names_test.go
@@ -18,9 +18,10 @@
 	"testing"
 
 	"github.com/google/go-cmp/cmp"
-	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
 	"google.golang.org/protobuf/testing/protocmp"
 
+	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
+
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
diff --git a/internal/pkg/rsmsg/request_builder.go b/internal/pkg/rsmsg/request_builder.go
index 6cf2d7f..4f86f75 100644
--- a/internal/pkg/rsmsg/request_builder.go
+++ b/internal/pkg/rsmsg/request_builder.go
@@ -18,10 +18,9 @@
 import (
 	"time"
 
-	dpb "google.golang.org/protobuf/types/known/durationpb"
-	fpb "google.golang.org/protobuf/types/known/fieldmaskpb"
-
 	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
+	dpb "google.golang.org/protobuf/types/known/durationpb"
+	fmpb "google.golang.org/protobuf/types/known/fieldmaskpb"
 )
 
 // Common status aliases for brevity.
@@ -154,7 +153,7 @@
 	return []*rspb.UploadRequest{
 		{
 			UploadOperation: rspb.UploadRequest_UPDATE,
-			UpdateMask: &fpb.FieldMask{
+			UpdateMask: &fmpb.FieldMask{
 				Paths: []string{
 					"status_attributes",
 					"timing.duration",
diff --git a/internal/pkg/rsmsg/responder_test.go b/internal/pkg/rsmsg/responder_test.go
index a134407..c324ba0 100644
--- a/internal/pkg/rsmsg/responder_test.go
+++ b/internal/pkg/rsmsg/responder_test.go
@@ -20,8 +20,9 @@
 	"github.com/google/go-cmp/cmp"
 	"google.golang.org/protobuf/testing/protocmp"
 
-	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
+
+	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
 func TestNewCreateInvocationResponse(t *testing.T) {
diff --git a/internal/pkg/rsmsg/transform_test.go b/internal/pkg/rsmsg/transform_test.go
index fd0c46f..0867e71 100644
--- a/internal/pkg/rsmsg/transform_test.go
+++ b/internal/pkg/rsmsg/transform_test.go
@@ -19,9 +19,10 @@
 	"testing"
 
 	"github.com/google/go-cmp/cmp"
-	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
 	"google.golang.org/protobuf/testing/protocmp"
 
+	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
+
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
diff --git a/internal/pkg/rsmsg/validation_test.go b/internal/pkg/rsmsg/validation_test.go
index d195a7c..e8b7e23 100644
--- a/internal/pkg/rsmsg/validation_test.go
+++ b/internal/pkg/rsmsg/validation_test.go
@@ -18,9 +18,8 @@
 	"testing"
 	"time"
 
-	"google.golang.org/protobuf/types/known/timestamppb"
-
 	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
+	tspb "google.golang.org/protobuf/types/known/timestamppb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
@@ -80,8 +79,8 @@
 
 func TestValidateTimingConsistency(t *testing.T) {
 	// Protobuf timestamps for testing.
-	t0 := timestamppb.New(time.Date(2026, 4, 15, 10, 0, 0, 0, time.UTC))
-	t1 := timestamppb.New(t0.AsTime().Add(time.Second))
+	t0 := tspb.New(time.Date(2026, 4, 15, 10, 0, 0, 0, time.UTC))
+	t1 := tspb.New(t0.AsTime().Add(time.Second))
 
 	tests := []struct {
 		name    string
@@ -132,15 +131,15 @@
 
 func TestClampTiming(t *testing.T) {
 	// Protobuf timestamps for testing.
-	t0 := timestamppb.New(time.Date(2026, 4, 15, 10, 0, 0, 0, time.UTC))
-	t1 := timestamppb.New(t0.AsTime().Add(time.Second))
+	t0 := tspb.New(time.Date(2026, 4, 15, 10, 0, 0, 0, time.UTC))
+	t1 := tspb.New(t0.AsTime().Add(time.Second))
 
 	tests := []struct {
 		name      string
 		parent    *rspb.Timing
 		child     *rspb.Timing
 		wantMod   bool
-		wantChild *timestamppb.Timestamp
+		wantChild *tspb.Timestamp
 	}{
 		{
 			name:      "no clamp needed: child is already after parent",
@@ -182,8 +181,8 @@
 }
 
 func TestClampUploadRequestTimingWithClone(t *testing.T) {
-	t0 := timestamppb.New(time.Date(2026, 4, 15, 10, 0, 0, 0, time.UTC))
-	t1 := timestamppb.New(t0.AsTime().Add(time.Second))
+	t0 := tspb.New(time.Date(2026, 4, 15, 10, 0, 0, 0, time.UTC))
+	t1 := tspb.New(t0.AsTime().Add(time.Second))
 
 	tests := []struct {
 		name         string
diff --git a/internal/pkg/rsproxy/jobstatus_egress_test.go b/internal/pkg/rsproxy/jobstatus_egress_test.go
index 373e144..e798d28 100644
--- a/internal/pkg/rsproxy/jobstatus_egress_test.go
+++ b/internal/pkg/rsproxy/jobstatus_egress_test.go
@@ -32,7 +32,7 @@
 
 	jspb "github.com/bazelbuild/rsclient/api/jobstatus"
 	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
-	fpb "google.golang.org/protobuf/types/known/fieldmaskpb"
+	fmpb "google.golang.org/protobuf/types/known/fieldmaskpb"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
@@ -128,7 +128,7 @@
 		},
 		{
 			UploadOperation: rspb.UploadRequest_UPDATE,
-			UpdateMask: &fpb.FieldMask{
+			UpdateMask: &fmpb.FieldMask{
 				Paths: []string{"status_attributes"},
 			},
 			Resource: &rspb.UploadRequest_Invocation{
diff --git a/internal/pkg/rsproxy/prototext_writer.go b/internal/pkg/rsproxy/prototext_writer.go
index 93775fe..93bfc7b 100644
--- a/internal/pkg/rsproxy/prototext_writer.go
+++ b/internal/pkg/rsproxy/prototext_writer.go
@@ -21,6 +21,7 @@
 	"os"
 
 	"github.com/bazelbuild/rsclient/internal/pkg/protoutil"
+
 	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
 )
 
diff --git a/internal/pkg/rsproxy/resultstore_egress.go b/internal/pkg/rsproxy/resultstore_egress.go
index c0f97af..815feb4 100644
--- a/internal/pkg/rsproxy/resultstore_egress.go
+++ b/internal/pkg/rsproxy/resultstore_egress.go
@@ -40,11 +40,11 @@
 	"google.golang.org/grpc"
 	"google.golang.org/protobuf/encoding/prototext"
 	"google.golang.org/protobuf/proto"
-	fpb "google.golang.org/protobuf/types/known/fieldmaskpb"
-	wpb "google.golang.org/protobuf/types/known/wrapperspb"
 
 	rsgrpc "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
 	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
+	fmpb "google.golang.org/protobuf/types/known/fieldmaskpb"
+	wpb "google.golang.org/protobuf/types/known/wrapperspb"
 )
 
 const (
@@ -805,7 +805,7 @@
 				Files: []*rspb.File{},
 			},
 		},
-		UpdateMask: &fpb.FieldMask{Paths: []string{"files"}},
+		UpdateMask: &fmpb.FieldMask{Paths: []string{"files"}},
 	}
 	invocation := mergeReq.GetInvocation()
 	for _, f := range filelist {
diff --git a/internal/pkg/rsproxy/stream_ingress.go b/internal/pkg/rsproxy/stream_ingress.go
index 7106e48..f08bb00 100644
--- a/internal/pkg/rsproxy/stream_ingress.go
+++ b/internal/pkg/rsproxy/stream_ingress.go
@@ -22,6 +22,7 @@
 
 	"github.com/bazelbuild/rsclient/internal/pkg/fifo"
 	"github.com/golang/glog"
+
 	rspb "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
 )
 
diff --git a/internal/pkg/tui/keymap.go b/internal/pkg/tui/keymap.go
index 4188ebc..703e491 100644
--- a/internal/pkg/tui/keymap.go
+++ b/internal/pkg/tui/keymap.go
@@ -19,6 +19,7 @@
 	"strings"
 
 	"github.com/bazelbuild/rsclient/internal/pkg/layout"
+
 	tea "github.com/charmbracelet/bubbletea"
 )
 
diff --git a/internal/pkg/tui/list_model_test.go b/internal/pkg/tui/list_model_test.go
index 95aefd7..9447189 100644
--- a/internal/pkg/tui/list_model_test.go
+++ b/internal/pkg/tui/list_model_test.go
@@ -18,6 +18,7 @@
 	"testing"
 
 	"github.com/bazelbuild/rsclient/internal/pkg/tui/tuitest"
+
 	tea "github.com/charmbracelet/bubbletea"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
diff --git a/internal/pkg/tui/pager_model.go b/internal/pkg/tui/pager_model.go
index 6cfafa0..dcec20f 100644
--- a/internal/pkg/tui/pager_model.go
+++ b/internal/pkg/tui/pager_model.go
@@ -20,8 +20,9 @@
 	"time"
 
 	"github.com/bazelbuild/rsclient/internal/pkg/layout"
-	tea "github.com/charmbracelet/bubbletea"
 	"github.com/mattn/go-runewidth"
+
+	tea "github.com/charmbracelet/bubbletea"
 )
 
 // PagerModel is a generic Bubble Tea model for rendering scrollable text.
diff --git a/internal/pkg/tui/pager_model_test.go b/internal/pkg/tui/pager_model_test.go
index cc22946..b4a0024 100644
--- a/internal/pkg/tui/pager_model_test.go
+++ b/internal/pkg/tui/pager_model_test.go
@@ -19,6 +19,7 @@
 	"testing"
 
 	"github.com/bazelbuild/rsclient/internal/pkg/tui/tuitest"
+
 	tea "github.com/charmbracelet/bubbletea"
 
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
diff --git a/internal/pkg/tui/vertical_partition.go b/internal/pkg/tui/vertical_partition.go
index b087826..7160f36 100644
--- a/internal/pkg/tui/vertical_partition.go
+++ b/internal/pkg/tui/vertical_partition.go
@@ -19,8 +19,9 @@
 	"strings"
 
 	"github.com/bazelbuild/rsclient/internal/pkg/layout"
-	tea "github.com/charmbracelet/bubbletea"
 	"github.com/mattn/go-runewidth"
+
+	tea "github.com/charmbracelet/bubbletea"
 )
 
 // tileState represents the persisted state of a single tile.
diff --git a/internal/pkg/tui/vertical_partition_test.go b/internal/pkg/tui/vertical_partition_test.go
index 118146b..e9e4bfa 100644
--- a/internal/pkg/tui/vertical_partition_test.go
+++ b/internal/pkg/tui/vertical_partition_test.go
@@ -19,9 +19,10 @@
 	"testing"
 
 	"github.com/bazelbuild/rsclient/internal/pkg/tui/tuitest"
-	tea "github.com/charmbracelet/bubbletea"
 	"github.com/mattn/go-runewidth"
 
+	tea "github.com/charmbracelet/bubbletea"
+
 	_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"
 )
 
diff --git a/internal/pkg/version/version.go b/internal/pkg/version/version.go
index 583c1ea..4a2c492 100644
--- a/internal/pkg/version/version.go
+++ b/internal/pkg/version/version.go
@@ -17,12 +17,14 @@
 package version
 
 import (
-	_ "embed" // needed for embed directive
 	"fmt"
 	"os"
 
-	log "github.com/golang/glog"
 	"golang.org/x/mod/modfile"
+
+	log "github.com/golang/glog"
+
+	_ "embed" // needed for embed directive
 )
 
 const undef = "undefined"
diff --git a/scripts/BUILD.bazel b/scripts/BUILD.bazel
index 96ecb7c..d4ca7f9 100644
--- a/scripts/BUILD.bazel
+++ b/scripts/BUILD.bazel
@@ -12,6 +12,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+load("@rules_python//python:py_library.bzl", "py_library")
+load("@rules_python//python:py_test.bzl", "py_test")
 load(
     "//cmd/rsproxy_wrap:lib.bzl",
     "rsproxy_wrapper",
@@ -300,3 +302,16 @@
     args = ["$(location //prebuilt:jq)"],
     data = ["//prebuilt:jq"],
 )
+
+py_library(
+    name = "fix_go_imports_lib",
+    srcs = ["fix_go_imports.py"],
+    imports = ["."],
+    visibility = ["//visibility:public"],
+)
+
+py_test(
+    name = "fix_go_imports_test",
+    srcs = ["fix_go_imports_test.py"],
+    deps = [":fix_go_imports_lib"],
+)
diff --git a/scripts/fix_go_imports.py b/scripts/fix_go_imports.py
new file mode 100755
index 0000000..1bce495
--- /dev/null
+++ b/scripts/fix_go_imports.py
@@ -0,0 +1,342 @@
+#!/usr/bin/env python3
+# Copyright 2026 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Tool to fix and validate Go import grouping and aliasing.
+
+Conventions:
+1. Three sections in the import block, separated by a newline:
+   a. Standard library (unaliased).
+   b. External and internal packages (unaliased).
+   c. Aliased and blank (_) imports.
+2. All protobuf message packages must be aliased.
+3. Protobuf aliases must end in 'pb' or 'grpc'.
+"""
+
+import sys
+import re
+import argparse
+from pathlib import Path
+
+# Known protobuf package paths and their preferred aliases.
+# All packages in this map MUST be aliased when imported.
+KNOWN_PROTOS: dict[str, str] = {
+    "google.golang.org/protobuf/types/known/timestamppb": "tspb",
+    "google.golang.org/protobuf/types/known/fieldmaskpb": "fmpb",
+    "google.golang.org/protobuf/types/known/durationpb": "dpb",
+    "google.golang.org/protobuf/types/known/wrapperspb": "wpb",
+    "google.golang.org/protobuf/types/known/anypb": "anypb",
+    "google.golang.org/protobuf/types/known/emptypb": "emptypb",
+    "google.golang.org/genproto/googleapis/devtools/resultstore/v2": "rspb",
+    "google.golang.org/genproto/googleapis/devtools/build/v1": "buildpb",
+    "google.golang.org/genproto/googleapis/bytestream": "bspb",
+    "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2": "repb",
+    "github.com/bazelbuild/remote-apis/build/bazel/semver": "svpb",
+    "github.com/bazelbuild/rsclient/api/jobstatus": "jspb",
+    "github.com/bazelbuild/rsclient/third_party/bazel/build_event_stream": "bespb",
+    "github.com/bazelbuild/rsclient/internal/pkg/besproxy/translation/proto": "tracepb",
+}
+
+# Regex for an import line with an optional alias.
+# Match: alias "path" // comment
+# Alias can be an identifier, _, or .
+IMPORT_LINE_WITH_ALIAS_RE: re.Pattern = re.compile(
+    r'^([a-zA-Z0-9_]+|[_.]|)\s*"([^"]+)"(?:\s+(//.*))?$'
+)
+
+# Regex for an import line without an alias.
+# Match: "path" // comment
+IMPORT_LINE_NO_ALIAS_RE: re.Pattern = re.compile(r'^"([^"]+)"(?:\s+(//.*))?$')
+
+
+def is_stdlib(path: str) -> bool:
+    """Returns True if the given import path is likely a Go standard library package.
+
+    Args:
+        path: The Go import path string.
+
+    Returns:
+        bool: True if it's a standard library package, False otherwise.
+    """
+    if not path:
+        return False
+    # CGO is special
+    if path == "C":
+        return True
+    first_part = path.split("/")[0]
+    return "." not in first_part
+
+
+def parse_import_line(line: str) -> dict[str, str | None] | None:
+    """Parses a single line from an import block.
+
+    Args:
+        line: The raw line string from the Go source file.
+
+    Returns:
+        dict: A dictionary with 'alias', 'path', and 'comment' keys if the line
+              matches an import statement, or None if it doesn't.
+    """
+    stripped = line.strip()
+    if not stripped:
+        return None
+
+    match = IMPORT_LINE_WITH_ALIAS_RE.match(stripped)
+    if match:
+        alias, path, comment = match.groups()
+        if not alias:
+            alias = None
+        return {"alias": alias, "path": path, "comment": comment}
+
+    match = IMPORT_LINE_NO_ALIAS_RE.match(stripped)
+    if match:
+        path, comment = match.groups()
+        return {"alias": None, "path": path, "comment": comment}
+
+    return None
+
+
+def transform_import_block(
+    import_lines: list[str],
+    file_path: str = "<string>",
+    known_protos: dict[str, str] | None = None,
+) -> tuple[list[str] | None, list[str]]:
+    """Transforms a list of raw import lines into the standardized grouped format.
+
+    Args:
+        import_lines: A list of raw strings representing the lines inside an
+                      import (...) block.
+        file_path: Optional file path for error reporting.
+        known_protos: Optional mapping of proto paths to preferred aliases.
+                      Defaults to KNOWN_PROTOS.
+
+    Returns:
+        tuple: (new_import_block, errors). new_import_block is a list of strings
+               representing the new formatted block, or None if errors occurred.
+               errors is a list of validation error strings.
+    """
+    if known_protos is None:
+        known_protos = KNOWN_PROTOS
+
+    parsed_imports: list[dict[str, any]] = []
+    current_header_comments: list[str] = []
+
+    for line in import_lines:
+        stripped = line.strip()
+        if not stripped:
+            continue
+        if stripped.startswith("//"):
+            current_header_comments.append(line)
+            continue
+
+        parsed = parse_import_line(line)
+        if parsed:
+            parsed["header_comments"] = current_header_comments
+            parsed_imports.append(parsed)
+            current_header_comments = []
+        else:
+            raise ValueError(
+                f"{file_path}: Could not parse import line: {line.strip()}"
+            )
+
+    # Categorize and Validate
+    stdlib_group: list[dict[str, any]] = []
+    external_group: list[dict[str, any]] = []
+    aliased_group: list[dict[str, any]] = []
+    blank_group: list[dict[str, any]] = []
+    errors: list[str] = []
+
+    for imp in parsed_imports:
+        path: str = imp["path"]
+        alias: str | None = imp["alias"]
+
+        # Validation: Protobufs must be aliased and match preferred alias
+        preferred_alias = known_protos.get(path)
+        if preferred_alias:
+            if alias is None:
+                errors.append(
+                    f"Protobuf import must be aliased: {path} (preferred: {preferred_alias})"
+                )
+            elif alias != "_" and alias != preferred_alias:
+                # Allow grpc variant if preferred ends in pb
+                is_grpc_variant = preferred_alias.endswith("pb") and alias == (
+                    preferred_alias[:-2] + "grpc"
+                )
+                if not is_grpc_variant:
+                    msg = f"Invalid alias '{alias}' for proto '{path}'; preferred is '{preferred_alias}'"
+                    if preferred_alias.endswith("pb"):
+                        msg += f" (or '{preferred_alias[:-2] + 'grpc'}' if appropriate)"
+                    errors.append(msg)
+
+        # Categorization
+        if alias == "_":
+            blank_group.append(imp)
+        elif alias:
+            aliased_group.append(imp)
+        elif is_stdlib(path):
+            stdlib_group.append(imp)
+        else:
+            external_group.append(imp)
+
+    if errors:
+        return None, errors
+
+    # Build the new import block
+    def format_group(group: list[dict[str, any]]) -> list[str]:
+        res: list[str] = []
+        for imp in group:
+            res.extend(imp["header_comments"])
+            line = "\t"
+            if imp["alias"]:
+                line += imp["alias"] + " "
+            line += f'"{imp["path"]}"'
+            if imp["comment"]:
+                line += " " + imp["comment"]
+            res.append(line + "\n")
+        return res
+
+    new_import_block: list[str] = []
+    if stdlib_group:
+        new_import_block.extend(format_group(stdlib_group))
+
+    if external_group:
+        if new_import_block:
+            new_import_block.append("\n")
+        new_import_block.extend(format_group(external_group))
+
+    if aliased_group:
+        if new_import_block:
+            new_import_block.append("\n")
+        new_import_block.extend(format_group(aliased_group))
+
+    if blank_group:
+        if new_import_block:
+            new_import_block.append("\n")
+        new_import_block.extend(format_group(blank_group))
+
+    # Append any leftover comments that were at the end of the block
+    if current_header_comments:
+        if new_import_block:
+            new_import_block.append("\n")
+        new_import_block.extend(current_header_comments)
+
+    return new_import_block, []
+
+
+def process_file(file_path: Path, write: bool = False) -> bool:
+    """Processes a single Go file, validating and optionally fixing its imports.
+
+    Args:
+        file_path: Path object to the .go file.
+        write: If True, writes the fixed import block back to the file.
+
+    Returns:
+        bool: True if the file is compliant (or was fixed), False if violations remain.
+    """
+    if file_path.suffix != ".go":
+        return True
+
+    # Safety check: skip third_party and internal tool dirs
+    exclude_dirs = {"third_party", "for_context_only", ".cipd", ".git"}
+    if any(ex in file_path.parts for ex in exclude_dirs):
+        return True
+
+    try:
+        with open(file_path, "r") as f:
+            lines = f.readlines()
+    except Exception as e:
+        print(f"Error reading {file_path}: {e}")
+        return False
+
+    start_index = -1
+    end_index = -1
+    import_lines: list[str] = []
+
+    # Find the multi-line import block
+    for i, line in enumerate(lines):
+        if line.startswith("import ("):
+            start_index = i
+            for j in range(i + 1, len(lines)):
+                if lines[j].startswith(")"):
+                    end_index = j
+                    break
+                import_lines.append(lines[j])
+            break
+
+    if start_index == -1 or end_index == -1:
+        # No multi-line import block found. Skip single imports or files without imports.
+        return True
+
+    try:
+        new_import_block, errors = transform_import_block(
+            import_lines, str(file_path)
+        )
+    except ValueError as e:
+        print(e, file=sys.stderr)
+        return False
+
+    if errors:
+        for err in errors:
+            print(f"{file_path}: {err}", file=sys.stderr)
+        return False
+
+    # Check if anything changed (ignoring whitespace differences within the block that gofmt will fix)
+    if "".join(import_lines) == "".join(new_import_block):
+        return True
+
+    if write:
+        new_file_content = (
+            lines[: start_index + 1] + new_import_block + lines[end_index:]
+        )
+        with open(file_path, "w") as f:
+            f.writelines(new_file_content)
+        return True
+    else:
+        print(
+            f"{file_path}: Import block is not correctly grouped. Run with --write to fix."
+        )
+        return False
+
+
+def main(argv: list[str] | None = None) -> None:
+    """Main entry point for the tool.
+
+    Args:
+        argv: Optional list of command-line arguments. If None, sys.argv[1:] is used.
+    """
+    parser = argparse.ArgumentParser(
+        description="Fix and validate Go import grouping."
+    )
+    parser.add_argument(
+        "files",
+        nargs="+",
+        type=Path,
+        help="Go files to process.",
+    )
+    parser.add_argument(
+        "-w", "--write", action="store_true", help="Write changes to files"
+    )
+    args = parser.parse_args(argv)
+
+    success = True
+    for file_path in args.files:
+        if not process_file(file_path, write=args.write):
+            success = False
+
+    if not success:
+        sys.exit(1)
+
+
+if __name__ == "__main__":
+    main(sys.argv[1:])
diff --git a/scripts/fix_go_imports_test.py b/scripts/fix_go_imports_test.py
new file mode 100644
index 0000000..1e0e25d
--- /dev/null
+++ b/scripts/fix_go_imports_test.py
@@ -0,0 +1,220 @@
+#!/usr/bin/env python3
+# Copyright 2026 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Tests for the fix_go_imports tool."""
+
+import unittest
+from fix_go_imports import (
+    is_stdlib,
+    parse_import_line,
+    transform_import_block,
+)
+
+
+def _to_go_lines(lines: list[str]) -> list[str]:
+    """Helper to add Go-style tabs and newlines to clean strings."""
+    return [(f"\t{l}\n" if l else "\n") for l in lines]
+
+
+class TestIsStdlib(unittest.TestCase):
+    """Tests for the is_stdlib function."""
+
+    def test_is_stdlib(self) -> None:
+        """Tests standard library path detection."""
+        self.assertTrue(is_stdlib("fmt"))
+        self.assertTrue(is_stdlib("context"))
+        self.assertTrue(is_stdlib("os/signal"))
+        self.assertTrue(is_stdlib("C"))
+        self.assertFalse(
+            is_stdlib("github.com/bazelbuild/rsclient/internal/pkg/netutil")
+        )
+        self.assertFalse(is_stdlib("google.golang.org/grpc"))
+
+
+class TestParseImportLine(unittest.TestCase):
+    """Tests for the parse_import_line function."""
+
+    def test_parse_import_line(self) -> None:
+        """Tests parsing of individual import lines with and without aliases."""
+        self.assertEqual(
+            parse_import_line('\t"fmt"'),
+            {"alias": None, "path": "fmt", "comment": None},
+        )
+        self.assertEqual(
+            parse_import_line('\ttspb "google.golang.org/protobuf"'),
+            {
+                "alias": "tspb",
+                "path": "google.golang.org/protobuf",
+                "comment": None,
+            },
+        )
+        self.assertEqual(
+            parse_import_line('\t_ "github.com/testsetup" // isolation'),
+            {
+                "alias": "_",
+                "path": "github.com/testsetup",
+                "comment": "// isolation",
+            },
+        )
+
+
+class TestTransformImportBlock(unittest.TestCase):
+    """Tests for the transform_import_block function."""
+
+    def test_success(self) -> None:
+        """Tests successful grouping and partitioning of an import block."""
+        input_lines = _to_go_lines(
+            [
+                '"context"',
+                '"github.com/bazelbuild/rsclient/internal/pkg/netutil"',
+                '"fmt"',
+                'tspb "google.golang.org/protobuf/types/known/timestamppb"',
+                '_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"',
+            ]
+        )
+        # Use a minimal test-only proto registry to decouple from production data.
+        test_protos = {
+            "google.golang.org/protobuf/types/known/timestamppb": "tspb",
+        }
+        expected_output = _to_go_lines(
+            [
+                '"context"',
+                '"fmt"',
+                "",
+                '"github.com/bazelbuild/rsclient/internal/pkg/netutil"',
+                "",
+                'tspb "google.golang.org/protobuf/types/known/timestamppb"',
+                "",
+                '_ "github.com/bazelbuild/rsclient/internal/pkg/testsetup"',
+            ]
+        )
+        output, errors = transform_import_block(
+            input_lines, known_protos=test_protos
+        )
+        self.assertEqual(errors, [])
+        self.assertEqual(output, expected_output)
+
+    def test_four_section_layout(self) -> None:
+        """Verifies the standard 4-section layout: stdlib, unaliased, aliased, blank."""
+        input_lines = _to_go_lines(
+            [
+                '_ "blank"',
+                'alias "aliased"',
+                '"github.com/external"',
+                '"fmt"',
+            ]
+        )
+        expected_output = _to_go_lines(
+            [
+                '"fmt"',
+                "",
+                '"github.com/external"',
+                "",
+                'alias "aliased"',
+                "",
+                '_ "blank"',
+            ]
+        )
+        output, errors = transform_import_block(input_lines, known_protos={})
+        self.assertEqual(errors, [])
+        self.assertEqual(output, expected_output)
+
+    def test_missing_alias(self) -> None:
+        """Tests that missing mandatory aliases are correctly reported."""
+        input_lines = _to_go_lines(
+            ['"google.golang.org/genproto/googleapis/devtools/resultstore/v2"']
+        )
+        test_protos = {
+            "google.golang.org/genproto/googleapis/devtools/resultstore/v2": "rspb"
+        }
+        output, errors = transform_import_block(
+            input_lines, known_protos=test_protos
+        )
+        self.assertIsNone(output)
+        self.assertIn("Protobuf import must be aliased", errors[0])
+        self.assertIn("preferred: rspb", errors[0])
+
+    def test_invalid_alias(self) -> None:
+        """Tests that non-compliant aliases are correctly reported."""
+        input_lines = _to_go_lines(
+            [
+                'rs "google.golang.org/genproto/googleapis/devtools/resultstore/v2"'
+            ]
+        )
+        test_protos = {
+            "google.golang.org/genproto/googleapis/devtools/resultstore/v2": "rspb"
+        }
+        output, errors = transform_import_block(
+            input_lines, known_protos=test_protos
+        )
+        self.assertIsNone(output)
+        self.assertIn("Invalid alias 'rs' for proto", errors[0])
+        self.assertIn("preferred is 'rspb'", errors[0])
+
+    def test_grpc_variant(self) -> None:
+        """Tests that gRPC variants of 'pb' aliases are permitted."""
+        input_lines = _to_go_lines(
+            [
+                'rsgrpc "google.golang.org/genproto/googleapis/devtools/resultstore/v2"'
+            ]
+        )
+        test_protos = {
+            "google.golang.org/genproto/googleapis/devtools/resultstore/v2": "rspb"
+        }
+        output, errors = transform_import_block(
+            input_lines, known_protos=test_protos
+        )
+        self.assertEqual(errors, [])
+        self.assertIsNotNone(output)
+
+    def test_comment_preservation(self) -> None:
+        """Tests that comments are preserved and move with their imports."""
+        input_lines = _to_go_lines(
+            [
+                "// Standard",
+                '"fmt"',
+                "// Aliased",
+                'tspb "google.golang.org/protobuf/types/known/timestamppb"',
+                "// Internal helper",
+                '"github.com/bazelbuild/rsclient/internal/pkg/netutil"',
+                "// TODO: Add more here",
+            ]
+        )
+        test_protos = {
+            "google.golang.org/protobuf/types/known/timestamppb": "tspb",
+        }
+        expected_output = _to_go_lines(
+            [
+                "// Standard",
+                '"fmt"',
+                "",
+                "// Internal helper",
+                '"github.com/bazelbuild/rsclient/internal/pkg/netutil"',
+                "",
+                "// Aliased",
+                'tspb "google.golang.org/protobuf/types/known/timestamppb"',
+                "",
+                "// TODO: Add more here",
+            ]
+        )
+        output, errors = transform_import_block(
+            input_lines, known_protos=test_protos
+        )
+        self.assertEqual(errors, [])
+        self.assertEqual(output, expected_output)
+
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/scripts/precommit.sh b/scripts/precommit.sh
index 16e9e5a..1b1f572 100755
--- a/scripts/precommit.sh
+++ b/scripts/precommit.sh
@@ -118,14 +118,25 @@
 fi
 
 LINTPASS=true
-echo Running gofmt...
-run_bazel_tool @io_bazel_rules_go//go -- fmt ./...
-
 echo "Checking mandatory test setup imports..."
 if ! "${SCRIPT_DIR}/check_test_setup_imports.sh"; then
   LINTPASS=false
 fi
 
+echo "Fixing and validating Go imports..."
+# Use git ls-files to find all tracked and untracked Go files, respecting .gitignore.
+# Filter out third_party and other excluded directories.
+GO_FILES=$(git ls-files --cached --others --exclude-standard -- "*.go" | grep -vE "^(third_party|for_context_only|.cipd)/" || true)
+if [ -n "$GO_FILES" ]; then
+  # Pass the list of files to the script. xargs handles large numbers of files safely.
+  if ! echo "$GO_FILES" | xargs python3 "${SCRIPT_DIR}/fix_go_imports.py" --write; then
+    LINTPASS=false
+  fi
+fi
+
+echo Running gofmt...
+run_bazel_tool @io_bazel_rules_go//go -- fmt ./...
+
 echo Running black...
 if [ -f "./prebuilt/black/black" ]; then
   # Run black only on specific directories.