From 7a2b595fb172d63fd5f3ddaafd5d6b152b7df439 Mon Sep 17 00:00:00 2001 From: abettigole Date: Wed, 15 Jul 2026 00:08:29 +0000 Subject: [PATCH] refactor(gateway): add StatusResult type alias for consistent naming Add StatusResult as a type alias for request.CurrentState in the gateway controller, matching the naming convention used by LandResult and other controller return types. Co-Authored-By: Claude Opus 4.6 (1M context) --- submitqueue/gateway/controller/status.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/submitqueue/gateway/controller/status.go b/submitqueue/gateway/controller/status.go index a1070a04..ea6c04d4 100644 --- a/submitqueue/gateway/controller/status.go +++ b/submitqueue/gateway/controller/status.go @@ -63,8 +63,13 @@ func NewStatusController(logger *zap.SugaredLogger, scope tally.Scope, requestLo } } +// StatusResult is the outcome of a status query. It is a type alias for +// request.CurrentState so that the controller's return type follows the +// same Result naming convention as LandResult and other controller outputs. +type StatusResult = request.CurrentState + // Status returns the current reconciled status of a request identified by its sqid. -func (c *StatusController) Status(ctx context.Context, req entity.StatusRequest) (request.CurrentState, error) { +func (c *StatusController) Status(ctx context.Context, req entity.StatusRequest) (StatusResult, error) { start := time.Now() defer func() { c.metricsScope.Timer("status_latency").Record(time.Since(start)) @@ -73,15 +78,15 @@ func (c *StatusController) Status(ctx context.Context, req entity.StatusRequest) c.metricsScope.Counter("status_count").Inc(1) if req.ID == "" { - return request.CurrentState{}, fmt.Errorf("StatusController requires the request to have a sqid specified: %w", ErrInvalidRequest) + return StatusResult{}, fmt.Errorf("StatusController requires the request to have a sqid specified: %w", ErrInvalidRequest) } state, err := request.GetCurrentStateFromRequestLog(ctx, c.requestLogStore, req.ID) if err != nil { if storage.IsNotFound(err) { - return request.CurrentState{}, errs.NewUserError(&RequestNotFoundError{Sqid: req.ID}) + return StatusResult{}, errs.NewUserError(&RequestNotFoundError{Sqid: req.ID}) } - return request.CurrentState{}, fmt.Errorf("StatusController failed to get current state for sqid=%s: %w", req.ID, err) + return StatusResult{}, fmt.Errorf("StatusController failed to get current state for sqid=%s: %w", req.ID, err) } c.logger.Debugw("request status retrieved",