feat: expand companion platform, device controls, and memoir workflows
ci / verify (push) Canceled after 0s
ci / verify (push) Canceled after 0s
Add customer and operator login, BLE provisioning, device fleet controls, call memory, memoir generation, and refreshed family and maintenance portals. Include API contracts, migrations, firmware sources, tests, assets, and deployment documentation.
This commit is contained in:
@@ -58,7 +58,7 @@ func TestVikingErrorsDoNotLeakServerBodyOrKey(t *testing.T) {
|
||||
if err == nil || strings.Contains(err.Error(), "secret") || strings.Contains(err.Error(), "transcript") {
|
||||
t.Fatalf("unsafe error %v", err)
|
||||
}
|
||||
if outbox.IsRetryable(err) != (status != 401) {
|
||||
if outbox.IsRetryable(err) != (status == 429 || status >= 500) {
|
||||
t.Fatalf("retry classification %v", err)
|
||||
}
|
||||
})
|
||||
@@ -92,3 +92,40 @@ func TestDeleteUsesExactUserForBothMemoryTypes(t *testing.T) {
|
||||
t.Fatal(err, calls)
|
||||
}
|
||||
}
|
||||
|
||||
func TestVikingDeletionRateLimitPreservesCooldownAndFailure(t *testing.T) {
|
||||
for _, status := range []int{http.StatusTooManyRequests, http.StatusOK} {
|
||||
t.Run(fmt.Sprint(status), func(t *testing.T) {
|
||||
calls := 0
|
||||
c := testClient(t, func(w http.ResponseWriter, r *http.Request) {
|
||||
calls++
|
||||
w.Header().Set("Retry-After", "120")
|
||||
w.WriteHeader(status)
|
||||
fmt.Fprint(w, `{"code":1000029,"message":"private provider body"}`)
|
||||
})
|
||||
err := c.DeleteUser(context.Background(), "alice")
|
||||
if err == nil || !outbox.IsRetryable(err) || outbox.RetryDelay(err) != 2*time.Minute || calls != 1 {
|
||||
t.Fatalf("rate limit must remain an incomplete deletion: calls=%d delay=%s err=%v", calls, outbox.RetryDelay(err), err)
|
||||
}
|
||||
if strings.Contains(err.Error(), "private") {
|
||||
t.Fatal("provider body leaked into retained error")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestVikingRetryDelayParsesSecondsAndDates(t *testing.T) {
|
||||
now := time.Date(2026, 10, 4, 14, 0, 0, 0, time.UTC)
|
||||
for _, tt := range []struct {
|
||||
header string
|
||||
want time.Duration
|
||||
}{
|
||||
{"", time.Minute}, {"invalid", time.Minute}, {"-1", time.Minute},
|
||||
{"120", 2 * time.Minute}, {now.Add(90 * time.Second).Format(http.TimeFormat), 90 * time.Second},
|
||||
{now.Add(-time.Minute).Format(http.TimeFormat), time.Minute}, {"9223372036854775807", 24 * time.Hour},
|
||||
} {
|
||||
if got := vikingRetryDelay(tt.header, now); got != tt.want {
|
||||
t.Errorf("Retry-After %q = %s, want %s", tt.header, got, tt.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user