ci: fix first CI run — tidy, gofmt, ordering test, govulncheck pin
Security / Vulnerability Check (push) Successful in 1m47s
Test / Build & Unit Tests (push) Successful in 5m4s
Test / Lint (push) Successful in 27s
Test / Integration Tests (push) Failing after 1m58s

- ids: TestIDsAreTimeOrdered asserted strict lexicographic ordering of
  back-to-back UUIDv7s, but the sub-ms tail is random and not required
  to be monotonic. Sleep between samples so each ID lands in a distinct
  millisecond — the property that actually gives Postgres index
  locality on (org_id, id desc).
- go.mod/go.sum: run go mod tidy. keyfunc/v3, prometheus/client_golang
  and testcontainers-go/modules/postgres are imported directly and
  should not be marked // indirect; also drops stale sum entries.
- gofmt -w across 12 files flagged by the lint job.
- security.yml: pin govulncheck to v1.2.0. @latest triggers a proxy
  lookup every run, which is the step that hung for 16m on the Gitea
  runner.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
57_WolveandClaude Opus 4.7 committed 2026-04-17 09:18:49 -05:00
1 parent ee52ae985d
commit 90ac4b169c
16 files changed
+85 -75

No files matched your search

+9 -4
View File
@@ -3,6 +3,7 @@ package ids_test
import (
"strings"
"testing"
"time"
"anchorage/internal/pkg/ids"
)
@@ -93,11 +94,15 @@ func TestIDsAreUniquePerCall(t *testing.T) {
}
func TestIDsAreTimeOrdered(t *testing.T) {
// UUIDv7 is time-ordered, so later-generated IDs should sort after
// earlier ones lexicographically. This is the property that gives
// Postgres index locality on (org_id, id desc).
// UUIDv7 is time-ordered at millisecond granularity; the sub-ms
// tail is random and not required to be monotonic, so back-to-back
// calls in the same millisecond can sort in either direction. The
// property we actually rely on for Postgres index locality on
// (org_id, id desc) is that IDs separated by >=1ms sort in
// generation order — so sleep between samples.
prev := ids.MustNewPin().String()
for i := 0; i < 32; i++ {
for i := 0; i < 8; i++ {
time.Sleep(2 * time.Millisecond)
next := ids.MustNewPin().String()
if next <= prev {
t.Fatalf("UUIDv7 ordering violated: %q followed %q", next, prev)