Skip to content

: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.

fix(ci): run the full backend matrices when the selector has no durations (#122407)

Georges-Antoine Assi1d85d92e31bc
diff --git a/.github/scripts/turbo-discover-selection.test.js b/.github/scripts/turbo-discover-selection.test.js
index 8c052ad6baf1..ea09ea3d0d1c 100644
--- a/.github/scripts/turbo-discover-selection.test.js
+++ b/.github/scripts/turbo-discover-selection.test.js
@@ -19,6 +19,7 @@ const selectionFixture = (extra) => ({
segments: segments({ core: ['posthog/models/test_a.py'] }),
},
durations: {
+ total_seconds: 90000,
selected_seconds: 120,
skipped_seconds: 4500,
selected_seconds_by_segment: { core: 0, poe: 0, temporal: 0 },
@@ -62,6 +63,8 @@ test('each distrusted input has its own reason, so telemetry can tell them apart
[{ selection: null }, 'selector_error'],
[{ selection: selectionFixture({ ast: { full_run_reasons: ['posthog/settings/base.py'] } }) }, 'full_run_requested'],
[{ selection: selectionFixture({ combined: { count: 0, products: [], segments: segments() } }) }, 'empty_selection'],
+ [{ selection: selectionFixture({ durations: { total_seconds: 0, selected_seconds: 0, skipped_seconds: 0 } }) }, 'no_durations'],
+ [{ selection: selectionFixture({ durations: undefined }) }, 'no_durations'],
]
for (const [overrides, reason] of cases) {
const decision = decide(overrides)
@@ -101,7 +104,7 @@ test('a selected run hands each matrix leg its own file list', () => {
compat: ['posthog/clickhouse/test_b.py'],
},
},
- durations: { selected_seconds_by_segment: { core: 5000, poe: 0, temporal: 900 } },
+ durations: { total_seconds: 90000, selected_seconds_by_segment: { core: 5000, poe: 0, temporal: 900 } },
}),
})
diff --git a/.github/scripts/turbo-discover.js b/.github/scripts/turbo-discover.js
index 9adf4a93660c..8120eaeaa3ae 100644
--- a/.github/scripts/turbo-discover.js
+++ b/.github/scripts/turbo-discover.js
@@ -1243,6 +1243,9 @@ function decideSelection({ applies, disabled, draft, legacyChanged, runLegacy, r
console.error(`Selector requested a full run:\n ${fullRunReasons.join('\n ')}`)
return fallbackSelection(fallbackMode, 'full_run_requested', selection)
}
+ if (!(Number(selection.durations?.total_seconds) > 0)) {
+ return fallbackSelection(fallbackMode, 'no_durations', selection)
+ }
const segments = selection.combined?.segments ?? {}
const core = segments.core ?? []
const poe = segments.poe ?? []