Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 77 additions & 59 deletions go/gen/compass/v1/compass.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions go/internal/board/issue_projection.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@ func protoToForgeFields(p *compassv1.Issue) store.IssueForgeFields {
if len(p.GetLabels()) > 0 {
out.Labels = append([]string(nil), p.GetLabels()...)
}
// The OQ-6(a) recency guard (RIG-2883 T4a): carry the forge's last-updated
// timestamp so the store's conditional upsert can skip a stale re-sink. An
// unset proto field leaves ForgeUpdatedAt zero, which stores NULL and keeps
// the write additive.
if ts := p.GetUpdatedAt(); ts != nil {
out.ForgeUpdatedAt = ts.AsTime()
}
return out
}

Expand Down
14 changes: 14 additions & 0 deletions go/internal/forge/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ package forge

import (
"math"
"time"

compassv1 "github.com/RigelBuild/compass/go/gen/compass/v1"
"google.golang.org/protobuf/types/known/timestamppb"
)

// narrowNumber narrows a forge's uint64 issue/PR number to the canonical
Expand All @@ -38,6 +40,17 @@ func nilIfEmpty[T any](s []T) []T {
return s
}

// updatedAtProto maps a forge last-updated time to the canonical proto
// timestamp, returning nil for the zero time so a not-yet-populated
// UpdatedAt leaves the proto field unset (the store-side recency guard's
// NULL arm then keeps the write additive).
func updatedAtProto(t time.Time) *timestamppb.Timestamp {
if t.IsZero() {
return nil
}
return timestamppb.New(t)
}

// TranslateIssue maps a raw forge Issue to the forge-subset canonical Issue,
// filling only forge-derived fields plus the passed-in agent attribution
// (nil ⇒ non-Compass author, left unset).
Expand All @@ -51,6 +64,7 @@ func TranslateIssue(in Issue, attr *compassv1.AgentAttribution) *compassv1.Issue
ForgeAccount: in.ForgeAccount,
Labels: nilIfEmpty(in.Labels),
Agent: attr,
UpdatedAt: updatedAtProto(in.UpdatedAt),
}
}

Expand Down
Loading
Loading