From 4ce4b46977b169aff4894b154db4465e55827bb7 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Thu, 24 Sep 2026 02:41:34 +1000 Subject: [PATCH] style(postgres,gateway): adopt task fmt rewrites from the lane merge --- internal/gateway/session_store_postgres.go | 5 +- internal/infrastructure/postgres/store.go | 66 +++++++++++----------- 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/internal/gateway/session_store_postgres.go b/internal/gateway/session_store_postgres.go index c131a6d4c..27ada0d2a 100644 --- a/internal/gateway/session_store_postgres.go +++ b/internal/gateway/session_store_postgres.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "slices" "strings" "time" @@ -645,8 +646,8 @@ func (s *postgresSessionStore) RecentTurns(ctx context.Context, sessionID string } // RecentTurns orders newest-first; the contract returns oldest-first. out := make([]TurnRecord, 0, len(rows)) - for i := len(rows) - 1; i >= 0; i-- { - record, err := turnFromRow(rows[i]) + for _, row := range slices.Backward(rows) { + record, err := turnFromRow(row) if err != nil { return nil, err } diff --git a/internal/infrastructure/postgres/store.go b/internal/infrastructure/postgres/store.go index afeabeaf0..e6e5faf10 100644 --- a/internal/infrastructure/postgres/store.go +++ b/internal/infrastructure/postgres/store.go @@ -49,39 +49,39 @@ const syntheticIssueNumberBase = 1_000_000_000_000_000 // webui consume. func taskFromRow(t postgresdb.Task) *workflow.Task { return &workflow.Task{ - ID: t.ID, - Owner: t.Owner, - Repo: t.Repo, - IssueNumber: int(t.IssueNumber), - Title: t.Title, - Body: t.Body, - Labels: t.Labels, - Status: t.Status, - Workflow: t.Workflow, - WorkflowDefinitionVersion: t.WorkflowDefinitionVersion, - WorkflowDefinitionDigest: t.WorkflowDefinitionDigest, - WorkflowDefinitionYAML: t.WorkflowDefinitionYaml, - Stage: t.Stage, - Branch: t.Branch, - Plan: t.Plan, - Notes: t.Notes, - PRNumber: int(t.PrNumber), - TokensUsed: int(t.TokensUsed), - Iterations: int(t.Iterations), - Attempt: int(t.Attempt), - ParkReason: t.ParkReason, - RetryCount: int(t.RetryCount), - WatchCommentID: t.WatchCommentID, - ReviewCursor: t.ReviewCursor, - Source: t.Source, - Identity: t.Identity, - BindingID: t.BindingID, - BindingVersion: int(t.BindingVersion), - ReviewPayload: t.ReviewPayload, - ParkClass: t.ParkClass, - RemediationRounds: int(t.RemediationRounds), - CreatedAt: t.CreatedAt, - UpdatedAt: t.UpdatedAt, + ID: t.ID, + Owner: t.Owner, + Repo: t.Repo, + IssueNumber: int(t.IssueNumber), + Title: t.Title, + Body: t.Body, + Labels: t.Labels, + Status: t.Status, + Workflow: t.Workflow, + WorkflowDefinitionVersion: t.WorkflowDefinitionVersion, + WorkflowDefinitionDigest: t.WorkflowDefinitionDigest, + WorkflowDefinitionYAML: t.WorkflowDefinitionYaml, + Stage: t.Stage, + Branch: t.Branch, + Plan: t.Plan, + Notes: t.Notes, + PRNumber: int(t.PrNumber), + TokensUsed: int(t.TokensUsed), + Iterations: int(t.Iterations), + Attempt: int(t.Attempt), + ParkReason: t.ParkReason, + RetryCount: int(t.RetryCount), + WatchCommentID: t.WatchCommentID, + ReviewCursor: t.ReviewCursor, + Source: t.Source, + Identity: t.Identity, + BindingID: t.BindingID, + BindingVersion: int(t.BindingVersion), + ReviewPayload: t.ReviewPayload, + ParkClass: t.ParkClass, + RemediationRounds: int(t.RemediationRounds), + CreatedAt: t.CreatedAt, + UpdatedAt: t.UpdatedAt, } }