feat: add regenerated_at timestamp to PAT#1542
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 29 minutes and 15 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR adds a Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report for CI Build 24447500367Coverage increased (+0.003%) to 41.73%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
core/userpat/service.go (1)
206-209: Guard nullableRegeneratedAtbefore dereferencing.Line 206 dereferences a pointer (
*regenerated.RegeneratedAt) directly. SinceRegeneratedAtis defined as nullable at the model and schema level, a nil value would panic the request. While the postgresRegenerate()implementation currently sets this field totime.Now().UTC(), the interface contract doesn't mandate non-nil values. Defensive nil-checking is consistent with how the codebase handles this field elsewhere (seeinternal/api/v1beta1connect/organization_pats.go:84anduser_pat.go:307).Suggested hardening
- if err := s.createAuditRecord(ctx, pkgAuditRecord.PATRegeneratedEvent, regenerated, *regenerated.RegeneratedAt, map[string]any{ + occurredAt := time.Now().UTC() + if regenerated.RegeneratedAt != nil { + occurredAt = *regenerated.RegeneratedAt + } + if err := s.createAuditRecord(ctx, pkgAuditRecord.PATRegeneratedEvent, regenerated, occurredAt, map[string]any{ "expires_at": regenerated.ExpiresAt, "old_expires_at": oldExpiresAt, }); err != nil {
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d9093175-4e6c-4961-bd08-71f22b91b2e2
⛔ Files ignored due to path filters (2)
proto/v1beta1/admin.pb.gois excluded by!**/*.pb.go,!proto/**proto/v1beta1/models.pb.gois excluded by!**/*.pb.go,!proto/**
📒 Files selected for processing (12)
Makefilecore/aggregates/orgpats/service.gocore/userpat/models/pat.gocore/userpat/service.gocore/userpat/service_test.gointernal/api/v1beta1connect/organization_pats.gointernal/api/v1beta1connect/user_pat.gointernal/store/postgres/migrations/20260415100000_user_pats_regenerated_at.down.sqlinternal/store/postgres/migrations/20260415100000_user_pats_regenerated_at.up.sqlinternal/store/postgres/org_pats_repository.gointernal/store/postgres/userpat.gointernal/store/postgres/userpat_repository.go
Summary
Changes
Test plan