:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(signals): show report check soak in days and hours (#109546)
Andrew Maguire12c91cacf115
diff --git a/products/signals/frontend/inbox/components/detail/reportCheckPresentation.test.ts b/products/signals/frontend/inbox/components/detail/reportCheckPresentation.test.tsindex 0c8bb86fbfd2..0c6fb4842c7d 100644--- a/products/signals/frontend/inbox/components/detail/reportCheckPresentation.test.ts+++ b/products/signals/frontend/inbox/components/detail/reportCheckPresentation.test.ts@@ -231,19 +231,28 @@ describe('reportCheckPresentation', () => {})})- it('says a check on an unresolved report waits for the resolve rather than naming a date it cannot keep', () => {- expect(- checkScheduledEntry({- kind: 'metric_threshold',- next_run_at: '2026-09-27T09:00:00Z',- arms_on_resolve: true,- soak_minutes: 4320,+ it.each([+ [4320, '3 days'],+ [10076, '7 days'],+ [2160, '1 day 12 hours'],+ [95, '2 hours'],+ [45, '45 minutes'],+ ])(+ 'says a check on an unresolved report waits for the resolve, with a %i minute soak as %s',+ (soakMinutes, label) => {+ expect(+ checkScheduledEntry({+ kind: 'metric_threshold',+ next_run_at: '2026-09-27T09:00:00Z',+ arms_on_resolve: true,+ soak_minutes: soakMinutes,+ })+ ).toEqual({+ tag: { label: 'Waiting for resolve', type: 'muted' },+ detail: `Starts ${label} after this report is resolved`,})- ).toEqual({- tag: { label: 'Waiting for resolve', type: 'muted' },- detail: 'Starts 3 days after this report is resolved',- })- })+ }+ )it('separates a check that never ran from one that ran and never settled', () => {expect(checkExpiredEntry({}).tag.label).toEqual('Never ran')diff --git a/products/signals/frontend/inbox/components/detail/reportCheckPresentation.ts b/products/signals/frontend/inbox/components/detail/reportCheckPresentation.tsindex 1c129523d66c..fecf4c5b7793 100644--- a/products/signals/frontend/inbox/components/detail/reportCheckPresentation.ts+++ b/products/signals/frontend/inbox/components/detail/reportCheckPresentation.ts@@ -31,17 +31,20 @@ export interface ReportCheckRowData {cancellable: boolean}-/** A soak window in the words the copy needs: "7 days", "36 hours", "90 minutes". */+/** A soak window in the words the copy needs: "7 days", "1 day 12 hours", "2 hours", "45 minutes". */function soakLabel(minutes: number): string {- if (minutes % 1440 === 0) {- const days = minutes / 1440- return `${days} ${days === 1 ? 'day' : 'days'}`+ const plural = (n: number, unit: string): string => `${n} ${n === 1 ? unit : `${unit}s`}`+ if (minutes < 60) {+ return plural(minutes, 'minute')}- if (minutes % 60 === 0) {- const hours = minutes / 60- return `${hours} ${hours === 1 ? 'hour' : 'hours'}`+ // Soaks the scout proposes are rarely whole hours, and a raw minute count is hard to read.+ const totalHours = Math.round(minutes / 60)+ if (totalHours < 24) {+ return plural(totalHours, 'hour')}- return `${minutes} ${minutes === 1 ? 'minute' : 'minutes'}`+ const days = Math.floor(totalHours / 24)+ const hours = totalHours % 24+ return hours ? `${plural(days, 'day')} ${plural(hours, 'hour')}` : plural(days, 'day')}/** Which scout answers an `agent` check. A `metric_threshold` check has no lane: the coordinator measures it. */