From 2b6f3317d62462eaac2224b4af30799e831b6138 Mon Sep 17 00:00:00 2001 From: erio Date: Sat, 7 Mar 2026 05:31:01 +0800 Subject: [PATCH] fix: resolve pre-existing CI failures (sora test mock, staticcheck) - Add missing CountByStorageType method to stubSoraGenRepo test mock - Suppress SA1019 for WithCredentialsJSON (admin-controlled source) Co-Authored-By: Claude Opus 4.6 --- backend/internal/handler/sora_client_handler_test.go | 3 +++ backend/internal/service/sora_gdrive_storage.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/internal/handler/sora_client_handler_test.go b/backend/internal/handler/sora_client_handler_test.go index c8b7a5ff6e..947836178d 100644 --- a/backend/internal/handler/sora_client_handler_test.go +++ b/backend/internal/handler/sora_client_handler_test.go @@ -124,6 +124,9 @@ func (r *stubSoraGenRepo) CountByUserAndStatus(_ context.Context, _ int64, _ []s } return r.countValue, nil } +func (r *stubSoraGenRepo) CountByStorageType(_ context.Context, _ string, _ []string) (int64, error) { + return 0, nil +} // ==================== 辅助函数 ==================== diff --git a/backend/internal/service/sora_gdrive_storage.go b/backend/internal/service/sora_gdrive_storage.go index 56d745a177..10db5afc44 100644 --- a/backend/internal/service/sora_gdrive_storage.go +++ b/backend/internal/service/sora_gdrive_storage.go @@ -153,7 +153,7 @@ func (s *SoraGDriveStorage) buildOAuth2Service(ctx context.Context, profile *Sor } func (s *SoraGDriveStorage) buildServiceAccountService(ctx context.Context, profile *SoraS3Profile) (*drive.Service, error) { - srv, err := drive.NewService(ctx, option.WithCredentialsJSON([]byte(profile.ServiceAccountJSON))) + srv, err := drive.NewService(ctx, option.WithCredentialsJSON([]byte(profile.ServiceAccountJSON))) //nolint:staticcheck // SA1019: admin-controlled service account JSON, safe to use if err != nil { return nil, fmt.Errorf("create gdrive service account service: %w", err) }