console jobs: swallowed failures in shared helpers fail the run; a panicking pass is recovered; OPS-80 registered
Fix round 1 of the Tasks 7+7A review: - jobFailed beside the swallowed failures of the shared helpers tracked passes reach (lifetimes recovery and create/retire/migrate steps, MaterializeApps, store deny, lapse, mail resume, the empty-bucket tripwire, the serial bump, the run-end marker), each brought into jobPassFuncs. settleAllocation/settleRetirement/settleMigration take ctx. - Run recovers a panicking pass: logged with its stack, the run is Failed with "panic: ..." and its finish time, and the worker carries on. - The copy gate checks short texts as whole Go literals (operatorPagesShortGoText); OPS-80 "OK" is registered.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
14 files changed,
+215
−37
approved_operator_pages_copy_test.go+44 −6internal/console/apirunsfollow.go+1 −0internal/console/jobs.go+18 −2internal/console/jobs_test.go+77 −12internal/console/lifetimes_create.go+24 −5internal/console/lifetimes_migrate.go+20 −4internal/console/lifetimes_recovery.go+10 −5internal/console/lifetimes_retire.go+4 −3internal/console/mailcounts.go+1 −0internal/console/materialize.go+7 −0internal/console/planlapse.go+4 −0internal/console/planstorage.go+1 −0internal/console/serialbump.go+2 −0internal/console/settle.go+2 −0
CI cancelled — superseded by a newer push — run details
Intent
diff --git a/approved_operator_pages_copy_test.go b/approved_operator_pages_copy_test.go| index 8479bb6e2..ddcf5c125 100644 |
| --- a/approved_operator_pages_copy_test.go |
| +++ b/approved_operator_pages_copy_test.go |
| @@ -51,11 +51,8 @@ var operatorPagesCopyBuilt = []string{ |
| // Task 6: the stored Detail text of the account-level audit actions. |
| "OPS-131", "OPS-132", "OPS-133", "OPS-134", "OPS-135", "OPS-136", |
| // Task 7: the background jobs table, its status words and job labels. |
| - // OPS-80 ("OK") is written in jobs.go but not listed: the gate reads a |
| - // Go literal only when it holds three letters or more, so a two-letter |
| - // word cannot be checked here. TestJobNoteIsTheFirstLineCappedAndEscaped |
| - // pins it instead. |
| - "OPS-32", "OPS-77", "OPS-78", "OPS-79", "OPS-81", "OPS-82", |
| + // OPS-80 ("OK") is checked through operatorPagesShortGoText. |
| + "OPS-32", "OPS-77", "OPS-78", "OPS-79", "OPS-80", "OPS-81", "OPS-82", |
| "OPS-83", "OPS-84", "OPS-85", "OPS-86", "OPS-87", "OPS-88", "OPS-89", "OPS-90", |
| "OPS-91", "OPS-92", "OPS-93", "OPS-94", "OPS-95", "OPS-96", "OPS-97", "OPS-98", |
| "OPS-99", "OPS-100", "OPS-101", "OPS-102", |
| @@ -67,12 +64,48 @@ func operatorPagesBuiltRows(rows []copyRow, entries []string) ([]copyRow, []stri |
| return entryBuiltRows(rows, entries, "operatorPagesCopyBuilt") |
| } |
| +// operatorPagesShortGoText is the built rows whose text is too short for the |
| +// shared Go text check, which reads a pattern only when it holds three |
| +// letters or more (informative). Each must be the whole value of a string |
| +// literal in its Go file, exactly: a two-letter word is checked as a literal, |
| +// never as a fragment of a longer one. |
| +var operatorPagesShortGoText = map[string]bool{ |
| + "OPS-80": true, // "OK", jobs.go |
| +} |
| + |
| // checkOperatorPagesBuilt is every problem with the built entries: not |
| // approved, no row, named twice, or the text absent from the entry's file |
| // under root. |
| func checkOperatorPagesBuilt(rows []copyRow, entries []string, root string) []string { |
| built, problems := operatorPagesBuiltRows(rows, entries) |
| - return append(problems, checkRunApplied(built, root)...) |
| + var rest []copyRow |
| + for _, r := range built { |
| + if !operatorPagesShortGoText[r.ID] { |
| + rest = append(rest, r) |
| + continue |
| + } |
| + problems = append(problems, checkShortGoText(r, root)...) |
| + } |
| + return append(problems, checkRunApplied(rest, root)...) |
| +} |
| + |
| +// checkShortGoText is the check for an operatorPagesShortGoText row: an |
| +// approved row whose Go file has a string literal equal to its text. |
| +func checkShortGoText(r copyRow, root string) []string { |
| + if r.Status != "approved" { |
| + return nil // entryBuiltRows has already refused it |
| + } |
| + if !strings.HasSuffix(r.Path(), ".go") { |
| + return []string{r.ID + ": a short text is checked only in a Go file, not " + r.Path()} |
| + } |
| + body, err := os.ReadFile(filepath.Join(root, r.Path())) |
| + if err != nil { |
| + return []string{r.ID + ": " + err.Error()} |
| + } |
| + if !goLiteralMatches(body, func(v string) bool { return v == r.Text }) { |
| + return []string{r.ID + ": " + r.Path() + " has no string literal that is exactly " + strconv.Quote(r.Text)} |
| + } |
| + return nil |
| } |
| func mustParseOperatorPagesCopyRecord(t *testing.T) []copyRow { |
| @@ -115,10 +148,13 @@ func TestOperatorPagesCopyGateChecksTheRowsFile(t *testing.T) { |
| } |
| write("page.html", "<p>Nobody has signed up yet.</p>\n<p>2 things need attention</p>\n") |
| write("other.html", "<p>Something else entirely.</p>\n") |
| + write("short.go", "package p\n\nconst word = \"OK\"\n") |
| + write("long.go", "package p\n\nconst word = \"OKAY\" // OK\n") |
| rows := []copyRow{ |
| {ID: "OPS-1", File: "page.html (the empty state)", Text: "Nobody has signed up yet.", Status: "approved"}, |
| {ID: "OPS-2", File: "page.html", Text: "<n> things need attention", Status: "approved"}, |
| {ID: "OPS-3", File: "page.html", Text: "A pending sentence goes here.", Status: "pending"}, |
| + {ID: "OPS-80", File: "short.go (status word)", Text: "OK", Status: "approved"}, |
| } |
| cases := []struct { |
| name string |
| @@ -131,6 +167,8 @@ func TestOperatorPagesCopyGateChecksTheRowsFile(t *testing.T) { |
| {"a pending row", []string{"OPS-3"}, "OPS-3 is built but pending"}, |
| {"an id with no row", []string{"OPS-9"}, "no row for"}, |
| {"an entry named twice", []string{"OPS-1", "OPS-1"}, "twice"}, |
| + {"a short text is a whole literal", []string{"OPS-80"}, ""}, |
| + {"a short text inside a longer literal or a comment", []string{"OPS-80@long.go"}, "no string literal that is exactly"}, |
| } |
| for _, c := range cases { |
| t.Run(c.name, func(t *testing.T) { |
diff --git a/internal/console/apirunsfollow.go b/internal/console/apirunsfollow.go| index e94c0f2ab..c3908b778 100644 |
| --- a/internal/console/apirunsfollow.go |
| +++ b/internal/console/apirunsfollow.go |
| @@ -393,6 +393,7 @@ func (s *Server) auditRunEnd(ctx context.Context, acct *Account, app, host, id, |
| if _, err := s.cfg.Releases.Put(ctx, runs.AuditedKey(acct.Sqid, app, id), []byte(outcome), ""); err != nil { |
| if !errors.Is(err, release.ErrCASConflict) { |
| log.Printf("console: api run %s/%s/%s %s: audit marker: %v", acct.Sqid, app, host, id, err) |
| + jobFailed(ctx, fmt.Errorf("api run %s/%s/%s %s: audit marker: %w", acct.Sqid, app, host, id, err)) |
| } |
| return // written already, or the bucket refused: either way not twice |
| } |
diff --git a/internal/console/jobs.go b/internal/console/jobs.go| index a3df39e59..cecaf99b5 100644 |
| --- a/internal/console/jobs.go |
| +++ b/internal/console/jobs.go |
| @@ -2,6 +2,9 @@ package console |
| import ( |
| "context" |
| + "fmt" |
| + "log" |
| + "runtime/debug" |
| "sort" |
| "strings" |
| "sync" |
| @@ -110,7 +113,9 @@ type jobRunKey struct{} |
| // An undeclared name is recorded too: a typo must never panic, since a |
| // panic in a pass goroutine would take the console down |
| // (TestEveryWorkerReportsItsRuns keeps the names right). A pass that panics |
| -// is not recovered here: it behaves as it did before the registry. |
| +// is recovered here: the panic is logged with its stack, the run is Failed |
| +// with "panic: <value>" and that error is returned, so the worker carries on |
| +// to its next run and the console keeps serving. |
| func (j *jobRegistry) Run(ctx context.Context, name string, pass func(context.Context) error) error { |
| j.mu.Lock() |
| e := j.entry(name) |
| @@ -120,7 +125,7 @@ func (j *jobRegistry) Run(ctx context.Context, name string, pass func(context.Co |
| j.mu.Unlock() |
| run := &jobRun{} |
| - err := pass(context.WithValue(ctx, jobRunKey{}, run)) |
| + err := runRecovered(context.WithValue(ctx, jobRunKey{}, run), name, pass) |
| recorded := err |
| if recorded == nil { |
| @@ -144,6 +149,17 @@ func (j *jobRegistry) Run(ctx context.Context, name string, pass func(context.Co |
| return err |
| } |
| +// runRecovered runs pass, turning a panic into an error. |
| +func runRecovered(ctx context.Context, name string, pass func(context.Context) error) (err error) { |
| + defer func() { |
| + if p := recover(); p != nil { |
| + log.Printf("console: job %s: panic: %v\n%s", name, p, debug.Stack()) |
| + err = fmt.Errorf("panic: %v", p) |
| + } |
| + }() |
| + return pass(ctx) |
| +} |
| + |
| // jobFailed records err on the run ctx carries, if it is the run's first |
| // failure. It is a no-op with no run on ctx (a door calling a pass's helper |
| // directly) or a nil error. |
diff --git a/internal/console/jobs_test.go b/internal/console/jobs_test.go| index febfb977a..68566733c 100644 |
| --- a/internal/console/jobs_test.go |
| +++ b/internal/console/jobs_test.go |
| @@ -16,14 +16,19 @@ import ( |
| "testing" |
| "time" |
| "unicode/utf8" |
| + |
| + "github.com/carlosframework/platform/internal/release" |
| ) |
| // jobPassFuncs is, for each claim worker, the functions whose bodies run |
| // inside its s.jobs.Run and may log a failure they step over. Each listed |
| // function's logged errors must also fail the job |
| -// (TestPassFailureLogsAlsoFailTheJob). Shared helpers the passes reach (the |
| -// audit writer, the lifetimes allocation steps, outbound delivery) are not |
| -// listed: request handlers call them too, and their failures surface there. |
| +// (TestPassFailureLogsAlsoFailTheJob). Shared helpers are listed too |
| +// (jobFailed is a no-op off a run, so their request-path callers are |
| +// unchanged). Not listed: deliver, which returns every failure it logs |
| +// (its fallback lines are not failures); audit and auditActivity, which take |
| +// no ctx and are called from some 180 sites; domainHostPolicy's account |
| +// lookup, which fails closed and takes no ctx. |
| var jobPassFuncs = map[string][]string{ |
| "StartHostReports": {"localHostReport", "putHostReport"}, |
| "StartAlertWatcher": {"alertPass", "alertRule", "alertDueFor", "alertDue", "recordAlertSeenFor", "recordAlertSeen"}, |
| @@ -36,17 +41,21 @@ var jobPassFuncs = map[string][]string{ |
| "StartScanPass": {"scanPass"}, |
| "StartScanDrain": {"scanDrainStep", "rebuildScanQueue", "scanDrainTick", "drainScanApp", "collectScanResults"}, |
| "StartExpiryPass": {"expiryPass", "settleAndReport", "expireOne", "purgeOne", "trashSweep", |
| - "sweepTrashedApp"}, |
| - "StartPlanLimitsPass": {"planLimitsPass"}, |
| - "StartPlanGracePass": {"planGracePass", "planGraceAccountLocked", "notifyPlanOwners"}, |
| - "StartBillingSyncPass": {"billingSyncPass", "billingDiscoveryPass", "discoverCustomer"}, |
| + "sweepTrashedApp", "listEvidence", "bumpSerial"}, |
| + "StartPlanLimitsPass": {"planLimitsPass"}, |
| + "StartPlanGracePass": {"planGracePass", "planGraceAccountLocked", "notifyPlanOwners", |
| + "convergeStoreDeny", "dropStaleLapseItem", "resumeStaleCapPause"}, |
| + "StartBillingSyncPass": {"billingSyncPass", "billingDiscoveryPass", "discoverCustomer", "transitionAccountPlan"}, |
| "PublishPlansMarker": {"publishPlansMarkerOnce"}, |
| "StartRunSweep": {"runSweepPass", "sweepExpireQueued", "sweepLostRun", "sweepTerminalRun", "sweepOrphanRuns", |
| - "orphanCandidates", "orphanConfirmed", "orphanRunEnd"}, |
| - "StartSeedsPass": {"seedsPass", "abandonSeed"}, |
| - "StartLifetimesCutoverWatch": {"lifetimesWatchOnce", "lifetimesFloorWatch", "materializeAppsOnce", "materializeAppsJudged"}, |
| - "StartLifetimeRecoveryPass": {"recoverLifetimes"}, |
| - "StartIncarnationMigrationPass": {"migratePreLifetimeRecords"}, |
| + "orphanCandidates", "orphanConfirmed", "orphanRunEnd", "auditRunEnd"}, |
| + "StartSeedsPass": {"seedsPass", "abandonSeed"}, |
| + "StartLifetimesCutoverWatch": {"lifetimesWatchOnce", "lifetimesFloorWatch", "materializeAppsOnce", "materializeAppsJudged", |
| + "MaterializeApps"}, |
| + "StartLifetimeRecoveryPass": {"recoverLifetimes", "recoverOrphanLocked", "recoverAllocationLocked", "recoverRetirementLocked", |
| + "recoverMigrationLocked", "settleAllocation", "allocSlotLocked", "allocCleanLocked", "allocRecordLocked", |
| + "orphanStepsLocked", "settleRetirement", "deleteUnderRetiredSlot", "terminateFenced", "retireRecordWithLifetimeLocked"}, |
| + "StartIncarnationMigrationPass": {"migratePreLifetimeRecords", "migrationStepsLocked", "migrationFinishLocked", "settleMigration"}, |
| "StartRelay": {"relayReconcile", "relayListRecords", "relayPublishAggregate"}, |
| "StartMailEventPush": {"mailPushPass", "deliverAppMailEvents", "deliverAppMailEventsHeld"}, |
| "StartDoorKeyResign": {"resignDoorKeys", "resignAppPolicies"}, |
| @@ -150,6 +159,62 @@ func TestJobRegistryRecordsRuns(t *testing.T) { |
| } |
| } |
| +// TestPanickingPassIsRecordedAndTheJobRunsAgain: a pass that panics does not |
| +// take the console down. The run is Failed with the panic and a finish time, |
| +// Run returns the panic as an error, and the next run of the same job works. |
| +// The pass runs on its own goroutine, as a worker's does, so an unrecovered |
| +// panic would end the test binary. |
| +func TestPanickingPassIsRecordedAndTheJobRunsAgain(t *testing.T) { |
| + fx := newConsoleFixture(t) |
| + errc := make(chan error, 1) |
| + go func() { |
| + errc <- fx.srv.jobs.Run(context.Background(), "StartAlertWatcher", func(context.Context) error { |
| + var m map[string]int |
| + m["boom"]++ // a nil map write: a runtime panic |
| + return nil |
| + }) |
| + }() |
| + if err := <-errc; err == nil || !strings.HasPrefix(err.Error(), "panic: ") { |
| + t.Fatalf("Run returned %v, want the panic as an error", err) |
| + } |
| + st, _ := jobStatusOf(fx.srv, "StartAlertWatcher") |
| + if st.State != JobFailed || !strings.HasPrefix(st.Err, "panic: ") || st.LastRan.IsZero() { |
| + t.Fatalf("after a panicking run: %+v, want Failed with the panic and a finish time", st) |
| + } |
| + if err := fx.srv.jobs.Run(context.Background(), "StartAlertWatcher", fx.srv.alertPass); err != nil { |
| + t.Fatal(err) |
| + } |
| + if st, _ := jobStatusOf(fx.srv, "StartAlertWatcher"); st.State != JobOK { |
| + t.Fatalf("the run after the panic = %+v, want OK", st) |
| + } |
| +} |
| + |
| +// TestSwallowedFailureInASharedHelperFailsTheRun: a failure logged and |
| +// stepped over deep in a helper that request handlers share |
| +// (MaterializeApps, reached by the lifetimes watch) fails the run it happens |
| +// in, and changes nothing when there is no run. |
| +func TestSwallowedFailureInASharedHelperFailsTheRun(t *testing.T) { |
| + fx := newConsoleFixture(t) |
| + // A trash marker that does not validate: MaterializeApps logs "leaving |
| + // <sqid>/kass alone" and steps over it. |
| + if _, err := fx.rel.Put(context.Background(), release.AppTombstoneKey(fx.sqid, "kass"), []byte("{not json"), ""); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := MaterializeApps(context.Background(), fx.rel, fx.st); err != nil { |
| + t.Fatalf("MaterializeApps off a run returned %v; its behaviour must not change", err) |
| + } |
| + err := fx.srv.jobs.Run(context.Background(), "StartLifetimesCutoverWatch", func(ctx context.Context) error { |
| + return MaterializeApps(ctx, fx.rel, fx.st) |
| + }) |
| + if err != nil { |
| + t.Fatalf("Run returned %v, want the pass's own nil", err) |
| + } |
| + st, _ := jobStatusOf(fx.srv, "StartLifetimesCutoverWatch") |
| + if st.State != JobFailed || !strings.Contains(st.Err, "leaving "+fx.sqid+"/kass alone") { |
| + t.Fatalf("the run = %+v, want Failed naming the app left alone", st) |
| + } |
| +} |
| + |
| // TestJobNoteIsTheFirstLineCappedAndEscaped is Review Focus 3: a job's |
| // error that is multi-line, very long, or carries markup shows as its first |
| // line, capped, escaped. |
diff --git a/internal/console/lifetimes_create.go b/internal/console/lifetimes_create.go| index b615a7f0d..98ae7842c 100644 |
| --- a/internal/console/lifetimes_create.go |
| +++ b/internal/console/lifetimes_create.go |
| @@ -222,6 +222,7 @@ func (s *Server) planCreateLocked(ctx context.Context, acct *Account, rec provis |
| return createPlan{}, err |
| default: |
| log.Printf("console: lifetimes: create %s: clean up the body under its live slot: %v (pending)", host, err) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: create %s: clean up the body under its live slot: %w (pending)", host, err)) |
| return createPlan{}, errLifetimePending |
| } |
| continue |
| @@ -284,9 +285,10 @@ func allocationSuperseded(slot *provision.HostIncarnation, a Allocation) bool { |
| // settleAllocation moves a to a terminal state and answers what the caller |
| // returns: done when the state is written, errLifetimePending when it could |
| // not be (recovery re-derives it). |
| -func (s *Server) settleAllocation(a Allocation, state string, done error) error { |
| +func (s *Server) settleAllocation(ctx context.Context, a Allocation, state string, done error) error { |
| if err := s.store.SetAllocationState(a.OpID, state); err != nil { |
| log.Printf("console: lifetimes: allocation %s of %s: mark %s: %v", a.OpID, a.Host, state, err) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: allocation %s of %s: mark %s: %w", a.OpID, a.Host, state, err)) |
| return errLifetimePending |
| } |
| return done |
| @@ -300,17 +302,19 @@ func (s *Server) allocSlotLocked(ctx context.Context, a Allocation) error { |
| } |
| if !errors.Is(err, release.ErrCASConflict) { |
| log.Printf("console: lifetimes: allocation %s of %s: write the slot: %v (pending)", a.OpID, a.Host, err) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: allocation %s of %s: write the slot: %w (pending)", a.OpID, a.Host, err)) |
| return errLifetimePending |
| } |
| slot, _, rerr := provision.ReadHostIncarnation(ctx, s.cfg.Releases, a.Host) |
| switch { |
| case rerr != nil: |
| log.Printf("console: lifetimes: allocation %s of %s: re-read the slot: %v (pending)", a.OpID, a.Host, rerr) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: allocation %s of %s: re-read the slot: %w (pending)", a.OpID, a.Host, rerr)) |
| return errLifetimePending |
| case allocationOwnsSlot(slot, a): |
| return nil |
| case allocationSuperseded(slot, a): |
| - return s.settleAllocation(a, lifetimeSuperseded, errLifetimeSettling) |
| + return s.settleAllocation(ctx, a, lifetimeSuperseded, errLifetimeSettling) |
| } |
| // The predecessor again, or anything else: leave it to recovery. |
| return errLifetimePending |
| @@ -323,6 +327,7 @@ func (s *Server) allocCleanLocked(ctx context.Context, a Allocation, staleETag s |
| if staleETag != "" { |
| if err := s.deleteRecordIfMatch(ctx, a.Account, a.App, provision.RecordKey(a.Account, a.App, a.Host), staleETag); err != nil { |
| log.Printf("console: lifetimes: allocation %s of %s: remove the stale record: %v (pending)", a.OpID, a.Host, err) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: allocation %s of %s: remove the stale record: %w (pending)", a.OpID, a.Host, err)) |
| return errLifetimePending |
| } |
| } |
| @@ -331,6 +336,8 @@ func (s *Server) allocCleanLocked(ctx context.Context, a Allocation, staleETag s |
| if err := s.deleteRecordIfMatch(ctx, plan.ownerAccount, plan.ownerApp, key, plan.ownerStaleETag); err != nil { |
| log.Printf("console: lifetimes: allocation %s of %s: remove the stale record under %s/%s: %v (pending)", |
| a.OpID, a.Host, plan.ownerAccount, plan.ownerApp, err) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: allocation %s of %s: remove the stale record under %s/%s: %w (pending)", |
| + a.OpID, a.Host, plan.ownerAccount, plan.ownerApp, err)) |
| return errLifetimePending |
| } |
| } |
| @@ -358,6 +365,7 @@ func (s *Server) allocPrevOwnerCleanLocked(ctx context.Context, a Allocation) er |
| prev, err := s.classifyLocked(ctx, acct, app, host) |
| if err != nil { |
| s.lifetimeLogHourly(logKey, "console: lifetime recovery: allocation %s of %s: observe the previous owner's record %s: %v (pending)", a.OpID, a.Host, a.PrevOwnerKey, err) |
| + jobFailed(ctx, fmt.Errorf("lifetime recovery: allocation %s of %s: observe the previous owner's record %s: %w (pending)", a.OpID, a.Host, a.PrevOwnerKey, err)) |
| return errLifetimePending |
| } |
| if !prev.Present || prev.Verdict != provision.LifetimeStale { |
| @@ -369,6 +377,7 @@ func (s *Server) allocPrevOwnerCleanLocked(ctx context.Context, a Allocation) er |
| } |
| if err := s.deleteRecordIfMatch(ctx, acct, app, a.PrevOwnerKey, prev.ETag); err != nil { |
| s.lifetimeLogHourly(logKey, "console: lifetime recovery: allocation %s of %s: remove the stale record %s: %v (pending)", a.OpID, a.Host, a.PrevOwnerKey, err) |
| + jobFailed(ctx, fmt.Errorf("lifetime recovery: allocation %s of %s: remove the stale record %s: %w (pending)", a.OpID, a.Host, a.PrevOwnerKey, err)) |
| return errLifetimePending |
| } |
| return nil |
| @@ -382,6 +391,7 @@ func (s *Server) allocRecordLocked(ctx context.Context, a Allocation) (*provisio |
| if err != nil { |
| if !errors.Is(err, release.ErrCASConflict) { |
| log.Printf("console: lifetimes: allocation %s of %s: write the record: %v (pending)", a.OpID, a.Host, err) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: allocation %s of %s: write the record: %w (pending)", a.OpID, a.Host, err)) |
| return nil, errLifetimePending |
| } |
| landed, _, rerr := s.readRecord(ctx, a.Account, a.App, a.Host) |
| @@ -389,6 +399,7 @@ func (s *Server) allocRecordLocked(ctx context.Context, a Allocation) (*provisio |
| // as absent): only this allocation's own lifetime counts as landed. |
| if rerr != nil || landed.Incarnation != a.Incarnation { |
| log.Printf("console: lifetimes: allocation %s of %s: the record write lost to another body (%v; pending)", a.OpID, a.Host, rerr) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: allocation %s of %s: the record write lost to another body (%w; pending)", a.OpID, a.Host, rerr)) |
| return nil, errLifetimePending |
| } |
| seq = landed.RecordSeq // a replay of this allocation landed |
| @@ -396,6 +407,7 @@ func (s *Server) allocRecordLocked(ctx context.Context, a Allocation) (*provisio |
| var rec provision.Record |
| if err := json.Unmarshal(a.Body, &rec); err != nil { |
| log.Printf("console: lifetimes: allocation %s of %s: decode its body: %v (pending)", a.OpID, a.Host, err) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: allocation %s of %s: decode its body: %w (pending)", a.OpID, a.Host, err)) |
| return nil, errLifetimePending |
| } |
| rec.RecordSeq = seq |
| @@ -407,6 +419,7 @@ func (s *Server) allocRecordLocked(ctx context.Context, a Allocation) (*provisio |
| return landed, nil |
| } |
| log.Printf("console: lifetimes: allocation %s of %s: commit: %v (pending)", a.OpID, a.Host, err) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: allocation %s of %s: commit: %w (pending)", a.OpID, a.Host, err)) |
| return nil, errLifetimePending |
| } |
| return &rec, nil |
| @@ -472,22 +485,25 @@ func (s *Server) retireSlotOrphanLocked(ctx context.Context, host string, slot * |
| func (s *Server) orphanStepsLocked(ctx context.Context, r Retirement) error { |
| switch disp, err := s.retireSlotLocked(ctx, r); disp { |
| case slotSuperseded: |
| - return s.settleRetirement(r, lifetimeVoid, errLifetimeSettling) |
| + return s.settleRetirement(ctx, r, lifetimeVoid, errLifetimeSettling) |
| case slotUnreadable: |
| log.Printf("console: lifetimes: orphan retirement %s of %s: retire the slot: %v (pending)", r.OpID, r.Host, err) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: orphan retirement %s of %s: retire the slot: %w (pending)", r.OpID, r.Host, err)) |
| return errLifetimePending |
| } |
| if err := s.deleteUnderRetiredSlot(ctx, r, false); err != nil { |
| log.Printf("console: lifetimes: orphan retirement %s of %s: remove the body: %v (pending)", r.OpID, r.Host, err) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: orphan retirement %s of %s: remove the body: %w (pending)", r.OpID, r.Host, err)) |
| return errLifetimePending |
| } |
| - return s.settleRetirement(r, lifetimeCommitted, nil) |
| + return s.settleRetirement(ctx, r, lifetimeCommitted, nil) |
| } |
| // settleRetirement is settleAllocation for a retirement row. |
| -func (s *Server) settleRetirement(r Retirement, state string, done error) error { |
| +func (s *Server) settleRetirement(ctx context.Context, r Retirement, state string, done error) error { |
| if err := s.store.SetRetirementState(r.OpID, state); err != nil { |
| log.Printf("console: lifetimes: retirement %s of %s: mark %s: %v", r.OpID, r.Host, state, err) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: retirement %s of %s: mark %s: %w", r.OpID, r.Host, state, err)) |
| return errLifetimePending |
| } |
| return done |
| @@ -550,6 +566,7 @@ func (s *Server) deleteUnderRetiredSlot(ctx context.Context, r Retirement, again |
| return err |
| case !again: |
| log.Printf("console: lifetimes: retirement %s of %s: a body landed under the retired slot; it is stale and the next create of the hostname removes it: %v", r.OpID, r.Host, err) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: retirement %s of %s: a body landed under the retired slot; it is stale and the next create of the hostname removes it: %w", r.OpID, r.Host, err)) |
| return nil |
| case round > 0: |
| return err |
| @@ -648,6 +665,7 @@ func (s *Server) terminateFenced(ctx context.Context, acct, app, host string, op |
| res, obs, err := s.fenceRecord(ctx, acct, app, host, op) |
| if err != nil { |
| log.Printf("console: lifetimes: %s/%s/%s: %v (pending)", acct, app, host, err) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: %s/%s/%s: %w (pending)", acct, app, host, err)) |
| return obs, false, errLifetimePending |
| } |
| if res != fenced { |
| @@ -655,6 +673,7 @@ func (s *Server) terminateFenced(ctx context.Context, acct, app, host string, op |
| } |
| if err := terminate(); err != nil { |
| log.Printf("console: lifetimes: %s/%s/%s: terminate after the fence: %v (pending)", acct, app, host, err) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: %s/%s/%s: terminate after the fence: %w (pending)", acct, app, host, err)) |
| return obs, false, errLifetimePending |
| } |
| return obs, false, nil |
diff --git a/internal/console/lifetimes_migrate.go b/internal/console/lifetimes_migrate.go| index 3dae7b4c4..9caab4eaa 100644 |
| --- a/internal/console/lifetimes_migrate.go |
| +++ b/internal/console/lifetimes_migrate.go |
| @@ -151,20 +151,34 @@ func migrationPending() (*provision.Record, []byte, string, string, error) { |
| // settleMigration moves m to a terminal state: done when written, |
| // errLifetimePending when not. |
| -func (s *Server) settleMigration(m Migration, state string, done error) (*provision.Record, []byte, string, string, error) { |
| +func (s *Server) settleMigration(ctx context.Context, m Migration, state string, done error) (*provision.Record, []byte, string, string, error) { |
| if err := s.store.SetMigrationState(m.OpID, state); err != nil { |
| log.Printf("console: lifetimes: migration %s of %s: mark %s: %v (pending)", m.OpID, m.Host, state, err) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: migration %s of %s: mark %s: %w (pending)", m.OpID, m.Host, state, err)) |
| return migrationPending() |
| } |
| return nil, nil, "", state, done |
| } |
| +// migrationJobFailed fails the run ctx carries (jobFailed) when a |
| +// migration step's log line carries an error. A line with no error (the |
| +// record is unreadable, or superseded) is a state, not a failure. |
| +func migrationJobFailed(ctx context.Context, m Migration, args []any) { |
| + for _, a := range args { |
| + if err, ok := a.(error); ok && err != nil { |
| + jobFailed(ctx, fmt.Errorf("lifetimes: migration %s of %s: %w", m.OpID, m.Host, err)) |
| + return |
| + } |
| + } |
| +} |
| + |
| // migrationStepsLocked is the dispatcher loop: classify, dispatch, act, and |
| // classify again after every step that may have changed what is there. |
| func (s *Server) migrationStepsLocked(ctx context.Context, m Migration) (*provision.Record, []byte, string, string, error) { |
| key := provision.RecordKey(m.Account, m.App, m.Host) |
| logf := func(format string, args ...any) { |
| log.Printf("console: lifetimes: migration %s of %s: "+format, append([]any{m.OpID, m.Host}, args...)...) |
| + migrationJobFailed(ctx, m, args) |
| } |
| marks := 0 |
| for round := 0; round < migrationRounds; round++ { |
| @@ -229,13 +243,14 @@ func (s *Server) migrationStepsLocked(ctx context.Context, m Migration) (*provis |
| logf("remove the corrupt body: %v (pending)", err) |
| return migrationPending() |
| } |
| - return s.settleMigration(m, lifetimeSuperseded, nil) |
| + return s.settleMigration(ctx, m, lifetimeSuperseded, nil) |
| case migrateSupersede: |
| if !obs.Present { |
| - return s.settleMigration(m, lifetimeSuperseded, nil) |
| + return s.settleMigration(ctx, m, lifetimeSuperseded, nil) |
| } |
| if obs.Verdict == provision.LifetimeCorrupt { |
| s.lifetimeLogHourly("migration-corrupt "+m.OpID, "console: lifetimes: migration %s: the body at %s is corrupt under a slot and needs operator attention", m.OpID, key) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: migration %s: the body at %s is corrupt under a slot and needs operator attention", m.OpID, key)) |
| } |
| _, redispatch, err := s.terminateFenced(ctx, m.Account, m.App, m.Host, fenceOwner{MarkerID: m.OpID}, func() error { |
| return s.store.SetMigrationState(m.OpID, lifetimeSuperseded) |
| @@ -281,6 +296,7 @@ func (s *Server) migrationFinishLocked(ctx context.Context, m Migration, obs pro |
| key := provision.RecordKey(m.Account, m.App, m.Host) |
| logf := func(format string, args ...any) { |
| log.Printf("console: lifetimes: migration %s of %s: "+format, append([]any{m.OpID, m.Host}, args...)...) |
| + migrationJobFailed(ctx, m, args) |
| } |
| if m.MarkedETag != obs.ETag { |
| if err := s.store.SetMigrationMarkedETag(m.OpID, obs.ETag); err != nil { |
| @@ -306,7 +322,7 @@ func (s *Server) migrationFinishLocked(ctx context.Context, m Migration, obs pro |
| // Another lifetime took the hostname: under its slot the |
| // marked record is stale, and no write of ours is left. |
| logf("the slot is %+v, not this migration's (superseded)", slot) |
| - return s.settleMigration(m, lifetimeSuperseded, nil) |
| + return s.settleMigration(ctx, m, lifetimeSuperseded, nil) |
| } |
| } else if err != nil { |
| logf("write the slot: %v (pending)", err) |
diff --git a/internal/console/lifetimes_recovery.go b/internal/console/lifetimes_recovery.go| index 2ebef91b8..0626256b1 100644 |
| --- a/internal/console/lifetimes_recovery.go |
| +++ b/internal/console/lifetimes_recovery.go |
| @@ -107,6 +107,7 @@ func (s *Server) recoverOrphanLocked(ctx context.Context, r Retirement) { |
| obs, err := s.classifyLocked(ctx, r.Account, r.App, r.Host) |
| if err != nil { |
| s.lifetimeLogHourly("retirement "+r.OpID, "console: lifetime recovery: retirement %s of %s stays pending: %v", r.OpID, r.Host, err) |
| + jobFailed(ctx, fmt.Errorf("lifetime recovery: retirement %s of %s stays pending: %w", r.OpID, r.Host, err)) |
| return |
| } |
| slot := obs.Slot |
| @@ -116,13 +117,14 @@ func (s *Server) recoverOrphanLocked(ctx context.Context, r Retirement) { |
| retired := owned && slot.Incarnation == r.Incarnation && slot.State == provision.SlotRetired |
| switch { |
| case succ: |
| - _ = s.settleRetirement(r, lifetimeVoid, nil) |
| + _ = s.settleRetirement(ctx, r, lifetimeVoid, nil) |
| case retired: |
| if err := s.deleteUnderRetiredSlot(ctx, r, true); err != nil { |
| s.lifetimeLogHourly("retirement "+r.OpID, "console: lifetime recovery: retirement %s of %s: remove the body under the retired slot: %v (pending)", r.OpID, r.Host, err) |
| + jobFailed(ctx, fmt.Errorf("lifetime recovery: retirement %s of %s: remove the body under the retired slot: %w (pending)", r.OpID, r.Host, err)) |
| return |
| } |
| - _ = s.settleRetirement(r, lifetimeCommitted, nil) |
| + _ = s.settleRetirement(ctx, r, lifetimeCommitted, nil) |
| case pred: |
| _ = s.orphanStepsLocked(ctx, r) |
| default: |
| @@ -162,16 +164,18 @@ func (s *Server) recoverAllocationLocked(ctx context.Context, a Allocation) { |
| obs, err := s.classifyLocked(ctx, a.Account, a.App, a.Host) |
| if err != nil { |
| s.lifetimeLogHourly(logKey, "console: lifetime recovery: allocation %s of %s stays pending: %v", a.OpID, a.Host, err) |
| + jobFailed(ctx, fmt.Errorf("lifetime recovery: allocation %s of %s stays pending: %w", a.OpID, a.Host, err)) |
| return |
| } |
| slot := obs.Slot |
| if allocationSuperseded(slot, a) { |
| - _ = s.settleAllocation(a, lifetimeSuperseded, nil) |
| + _ = s.settleAllocation(ctx, a, lifetimeSuperseded, nil) |
| return |
| } |
| alive, err := s.allocationAppAlive(ctx, a) |
| if err != nil { |
| s.lifetimeLogHourly(logKey, "console: lifetime recovery: allocation %s of %s: read the app: %v (pending)", a.OpID, a.Host, err) |
| + jobFailed(ctx, fmt.Errorf("lifetime recovery: allocation %s of %s: read the app: %w (pending)", a.OpID, a.Host, err)) |
| return |
| } |
| ours := allocationOwnsSlot(slot, a) |
| @@ -179,10 +183,11 @@ func (s *Server) recoverAllocationLocked(ctx context.Context, a Allocation) { |
| if ours { |
| if err := s.retireSlotOrphanLocked(ctx, a.Host, slot, obs.SlotETag, a.OpID); err != nil && !errors.Is(err, errLifetimeSettling) { |
| s.lifetimeLogHourly(logKey, "console: lifetime recovery: allocation %s of %s: cancel it: %v", a.OpID, a.Host, err) |
| + jobFailed(ctx, fmt.Errorf("lifetime recovery: allocation %s of %s: cancel it: %w", a.OpID, a.Host, err)) |
| } |
| return |
| } |
| - _ = s.settleAllocation(a, lifetimeVoid, nil) |
| + _ = s.settleAllocation(ctx, a, lifetimeVoid, nil) |
| return |
| } |
| switch { |
| @@ -190,7 +195,7 @@ func (s *Server) recoverAllocationLocked(ctx context.Context, a Allocation) { |
| if err := s.allocPrevOwnerCleanLocked(ctx, a); err != nil { |
| return |
| } |
| - _ = s.settleAllocation(a, lifetimeCommitted, nil) |
| + _ = s.settleAllocation(ctx, a, lifetimeCommitted, nil) |
| return |
| case ours && obs.Present: |
| if err := s.allocCleanLocked(ctx, a, obs.ETag, createPlan{}); err != nil { |
diff --git a/internal/console/lifetimes_retire.go b/internal/console/lifetimes_retire.go| index d8399e549..153b0e753 100644 |
| --- a/internal/console/lifetimes_retire.go |
| +++ b/internal/console/lifetimes_retire.go |
| @@ -147,6 +147,7 @@ func (s *Server) retireRecordWithLifetimeLocked(ctx context.Context, acct, app, |
| case state != lifetimeCommitted: |
| if err != nil && !errors.Is(err, errLifetimePending) && !errors.Is(err, errLifetimeSettling) { |
| log.Printf("console: lifetimes: retire %s: migrate it first: %v", key, err) |
| + jobFailed(ctx, fmt.Errorf("lifetimes: retire %s: migrate it first: %w", key, err)) |
| } |
| return errLifetimeSettling |
| } |
| @@ -249,7 +250,7 @@ func (s *Server) retirementStepsLocked(ctx context.Context, r Retirement) error |
| retired := slot != nil && owned && slot.Incarnation == r.Incarnation && slot.State == provision.SlotRetired |
| switch { |
| case succ: |
| - return s.settleRetirement(r, lifetimeVoid, nil) |
| + return s.settleRetirement(ctx, r, lifetimeVoid, nil) |
| case retired: |
| if obs.Present { |
| if err := s.deleteUnderRetiredSlot(ctx, r, true); err != nil { |
| @@ -257,7 +258,7 @@ func (s *Server) retirementStepsLocked(ctx context.Context, r Retirement) error |
| return errLifetimePending |
| } |
| } |
| - return s.settleRetirement(r, lifetimeCommitted, nil) |
| + return s.settleRetirement(ctx, r, lifetimeCommitted, nil) |
| case !pred: |
| s.lifetimeLogHourly("retirement "+r.OpID, "console: lifetimes: retirement %s of %s: the slot is neither its own nor a successor (%+v); it stays pending", r.OpID, r.Host, slot) |
| return errLifetimePending |
| @@ -340,7 +341,7 @@ func (s *Server) retirementStepsLocked(ctx context.Context, r Retirement) error |
| func (s *Server) retireSlotStep(ctx context.Context, r Retirement, logf func(string, ...any)) (bool, error) { |
| switch disp, err := s.retireSlotLocked(ctx, r); disp { |
| case slotSuperseded: |
| - return true, s.settleRetirement(r, lifetimeVoid, nil) |
| + return true, s.settleRetirement(ctx, r, lifetimeVoid, nil) |
| case slotUnreadable: |
| logf("retire the slot: %v (pending)", err) |
| return true, errLifetimePending |
diff --git a/internal/console/mailcounts.go b/internal/console/mailcounts.go| index cd81069f7..0f723ea2b 100644 |
| --- a/internal/console/mailcounts.go |
| +++ b/internal/console/mailcounts.go |
| @@ -208,6 +208,7 @@ func (s *Server) resumeStaleCapPause(ctx context.Context, acct, app, sender stri |
| } |
| if a, err := s.store.AccountBySqid(acct); err != nil { |
| log.Printf("console: mail resume audit: resolving account %s: %v", acct, err) |
| + jobFailed(ctx, fmt.Errorf("mail resume audit: resolving account %s: %w", acct, err)) |
| } else if a != nil { |
| s.audit(a, app, "ses", "mail.resumed", fmt.Sprintf("%s: daily cap pause cleared on the UTC day roll", mailAuditSubject(app, sender))) |
| } |
diff --git a/internal/console/materialize.go b/internal/console/materialize.go| index dd3020ca7..1e9dca1fc 100644 |
| --- a/internal/console/materialize.go |
| +++ b/internal/console/materialize.go |
| @@ -3,6 +3,7 @@ package console |
| import ( |
| "context" |
| "encoding/json" |
| + "fmt" |
| "log" |
| "strings" |
| "time" |
| @@ -363,6 +364,7 @@ func MaterializeApps(ctx context.Context, s release.Store, st *Store, claimEnabl |
| handled, claimErr := materializeClaimApp(ctx, s, st, r.AccountID, r.Sqid, r.App, time.Now()) |
| if claimErr != nil { |
| log.Printf("console: hold app materialization %s/%s: %v", r.Sqid, r.App, claimErr) |
| + jobFailed(ctx, fmt.Errorf("hold app materialization %s/%s: %w", r.Sqid, r.App, claimErr)) |
| } |
| if handled { |
| continue |
| @@ -378,6 +380,7 @@ func MaterializeApps(ctx context.Context, s release.Store, st *Store, claimEnabl |
| tomb, err := release.ReadAppTombstone(ctx, s, r.Sqid, r.App) |
| if err != nil { |
| log.Printf("console: leaving %s/%s alone: %v", r.Sqid, r.App, err) |
| + jobFailed(ctx, fmt.Errorf("leaving %s/%s alone: %w", r.Sqid, r.App, err)) |
| continue |
| } |
| if tomb == nil { |
| @@ -389,6 +392,7 @@ func MaterializeApps(ctx context.Context, s release.Store, st *Store, claimEnabl |
| if r.Restoring { |
| if _, err := st.SetRestoringContext(ctx, r.AccountID, r.App, false); err != nil { |
| log.Printf("console: clear restoring on %s/%s: %v", r.Sqid, r.App, err) |
| + jobFailed(ctx, fmt.Errorf("clear restoring on %s/%s: %w", r.Sqid, r.App, err)) |
| } |
| } |
| continue |
| @@ -397,6 +401,7 @@ func MaterializeApps(ctx context.Context, s release.Store, st *Store, claimEnabl |
| // 3-day window when the row is temporary (spec §5 "Materialize"). |
| if err := st.TrashAppRowContext(ctx, r.AccountID, r.App, tomb.DeletedAt); err != nil { |
| log.Printf("console: mark %s/%s trashed: %v", r.Sqid, r.App, err) |
| + jobFailed(ctx, fmt.Errorf("mark %s/%s trashed: %w", r.Sqid, r.App, err)) |
| continue |
| } |
| log.Printf("console: %s/%s is in the trash in the bucket — marking it trashed here", r.Sqid, r.App) |
| @@ -410,6 +415,7 @@ func MaterializeApps(ctx context.Context, s release.Store, st *Store, claimEnabl |
| // here too (spec §6). |
| if err := st.FinishRestoreRow(r.AccountID, r.App, time.Now()); err != nil { |
| log.Printf("console: restore %s/%s: %v", r.Sqid, r.App, err) |
| + jobFailed(ctx, fmt.Errorf("restore %s/%s: %w", r.Sqid, r.App, err)) |
| continue |
| } |
| log.Printf("console: %s/%s has no trash marker and still has objects — restoring it here", r.Sqid, r.App) |
| @@ -424,6 +430,7 @@ func MaterializeApps(ctx context.Context, s release.Store, st *Store, claimEnabl |
| } |
| if err := st.PurgeAppRow(r.AccountID, r.App); err != nil { |
| log.Printf("console: purge %s/%s: %v", r.Sqid, r.App, err) |
| + jobFailed(ctx, fmt.Errorf("purge %s/%s: %w", r.Sqid, r.App, err)) |
| continue |
| } |
| log.Printf("console: %s/%s is gone from the bucket — releasing the name here", r.Sqid, r.App) |
diff --git a/internal/console/planlapse.go b/internal/console/planlapse.go| index ca06169c8..edff4f435 100644 |
| --- a/internal/console/planlapse.go |
| +++ b/internal/console/planlapse.go |
| @@ -135,15 +135,18 @@ func (s *Server) transitionAccountPlan(ctx context.Context, acct *Account, now t |
| // Re-converge now, so paying again turns things back on in this call. |
| if err := s.planGraceAccountLocked(ctx, acct, now); err != nil { |
| log.Printf("console: plan %s: grace: %v", acct.Sqid, err) |
| + jobFailed(ctx, fmt.Errorf("plan %s: grace: %w", acct.Sqid, err)) |
| } |
| row, err := s.store.AccountPlan(acct.ID) |
| if err != nil { |
| log.Printf("console: plan %s: reread: %v", acct.Sqid, err) |
| + jobFailed(ctx, fmt.Errorf("plan %s: reread: %w", acct.Sqid, err)) |
| return nil |
| } |
| if row != nil { |
| if err := s.publishAccountLimits(ctx, *row, now); err != nil { |
| log.Printf("console: plan %s: publish: %v", acct.Sqid, err) |
| + jobFailed(ctx, fmt.Errorf("plan %s: publish: %w", acct.Sqid, err)) |
| } |
| } |
| return nil |
| @@ -255,6 +258,7 @@ func (s *Server) convergeLapse(ctx context.Context, acct *Account, row *AccountP |
| func (s *Server) dropStaleLapseItem(ctx context.Context, acct *Account, it lapseItem) { |
| if err := s.store.DeleteLapseItem(ctx, acct.ID, it.App, it.Kind, it.Ref); err != nil { |
| log.Printf("console: plan lapse %s: stale item %s %s of %s left: %v", acct.Sqid, it.Kind, it.Ref, it.App, err) |
| + jobFailed(ctx, fmt.Errorf("plan lapse %s: stale item %s %s of %s left: %w", acct.Sqid, it.Kind, it.Ref, it.App, err)) |
| } |
| } |
diff --git a/internal/console/planstorage.go b/internal/console/planstorage.go| index 81ca30891..3fb8dcf49 100644 |
| --- a/internal/console/planstorage.go |
| +++ b/internal/console/planstorage.go |
| @@ -85,6 +85,7 @@ func (s *Server) convergeStoreDeny(ctx context.Context, acct *Account, app, env |
| pub, err := appconfig.ParsePublicKey(s.cfg.SecretsPub, "CARLOS_SECRETS_PUBKEY") |
| if err != nil { |
| log.Printf("console: plan storage %s: no secrets key, store policies left as they are: %v", acct.Sqid, err) |
| + jobFailed(ctx, fmt.Errorf("plan storage %s: no secrets key, store policies left as they are: %w", acct.Sqid, err)) |
| return nil |
| } |
| action, detail := "store.writes_allowed", fmt.Sprintf("plan storage: %d of %d bytes; new uploads allowed again", st.Used, st.Limit) |
diff --git a/internal/console/serialbump.go b/internal/console/serialbump.go| index c6be80555..9a03c3b2d 100644 |
| --- a/internal/console/serialbump.go |
| +++ b/internal/console/serialbump.go |
| @@ -2,6 +2,7 @@ package console |
| import ( |
| "context" |
| + "fmt" |
| "log" |
| "time" |
| @@ -36,5 +37,6 @@ func (s *Server) bumpSerial(ctx context.Context) { |
| defer cancel() |
| if err := release.BumpSerial(ctx, s.cfg.Releases, time.Now()); err != nil { |
| log.Printf("console: serial bump: %v (boxes fall back to the hourly pass)", err) |
| + jobFailed(ctx, fmt.Errorf("serial bump: %w (boxes fall back to the hourly pass)", err)) |
| } |
| } |
diff --git a/internal/console/settle.go b/internal/console/settle.go| index a708b4081..1a1603588 100644 |
| --- a/internal/console/settle.go |
| +++ b/internal/console/settle.go |
| @@ -2,6 +2,7 @@ package console |
| import ( |
| "context" |
| + "fmt" |
| "log" |
| "strings" |
| "time" |
| @@ -44,6 +45,7 @@ func (s *Server) listEvidence(ctx context.Context) (keys []string, listed, evide |
| keys, err := s.cfg.Releases.List(ctx, "apps/") |
| if err != nil { |
| log.Printf("console: list apps/ for the empty-bucket tripwire: %v", err) |
| + jobFailed(ctx, fmt.Errorf("list apps/ for the empty-bucket tripwire: %w", err)) |
| return nil, false, false |
| } |
| return keys, true, bucketEvidence(keys) |