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.

chore(devex): skip test reporting when no test ran (#89833)

Julian Bezf292f19440b7
diff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.yml
index d6514c66dad3..e89e5c17f591 100644
--- a/.depot/workflows/ci-backend.yml
+++ b/.depot/workflows/ci-backend.yml
@@ -19,7 +19,8 @@
# auto-commit (handle-snapshots), posthog-github-action telemetry (including the
# capture-test-selection job — turbo-discover still emits its telemetry outputs to
# stay apples-to-apples, they just have no consumer here),
-# --store-durations write, test-selection verdict, Trunk flaky-test quarantine
+# --store-durations write, test-selection verdict (so the guard skipping it when both
+# test matrices were skipped has nothing to mirror), Trunk flaky-test quarantine
# gate (canonical runs per-shard analytics-uploader steps that post to the
# external Trunk service; the upload is best-effort and a local "Fail on test
# failure" step owns the pass/fail verdict. Canonical can stage or filter JUnit
@@ -42,7 +43,9 @@
# changes confined to it (script deps, the reporter's availability guard, emission secret
# plumbing such as dual-project tokens, the JUnit-artifact download pattern, re-run attempt
# handling — including the attempt-suffixed junit artifact names canonical uploads so the
-# reporter can pair re-run recoveries with attempt-1 failures) need no depot bump.
+# reporter can pair re-run recoveries with attempt-1 failures, and the guard that skips the
+# job when both test matrices were skipped, with the needs: entries that feed it) need no
+# depot bump.
# - mirror-schema-cache: canonical's master run copies the migrated schema dump out of the
# migrated-schema artifact into GitHub Actions Cache, so fork PRs (which run without
# secrets and cannot authenticate to Depot Cache) prime instead of migrating from scratch.
diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.yml
index cf4f6bc23ddb..abdb10d7d4d6 100644
--- a/.github/workflows/ci-backend.yml
+++ b/.github/workflows/ci-backend.yml
@@ -3888,8 +3888,15 @@ jobs:
test-selection-verdict:
needs: [django, turbo-tests, changes, turbo-discover]
name: Test selection verdict
- # changes is skipped on no-ci drafts — no tests ran, nothing to verdict.
- if: ${{ !cancelled() && github.event_name == 'pull_request' && needs.changes.result != 'skipped' }}
+ # The verdict scores the selection against the JUnit a run produced, so it needs
+ # a test job to have run. changes is skipped on no-ci drafts. Both matrices are
+ # skipped on a draft whose selection was untrusted, which defers to the ready run
+ # — there is no selection to score and no JUnit to score it against. The decision
+ # itself is still recorded, by capture-test-selection.
+ if: >-
+ !cancelled() && github.event_name == 'pull_request' &&
+ needs.changes.result != 'skipped' &&
+ (needs.django.result != 'skipped' || needs.turbo-tests.result != 'skipped')
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
@@ -4053,7 +4060,9 @@ jobs:
report-test-timings:
name: Report per-test traces
- needs: [django_tests]
+ # django and turbo-tests are here for their results only; django_tests already
+ # waits for both, so this adds no wall time.
+ needs: [django_tests, django, turbo-tests]
runs-on: ubuntu-latest
continue-on-error: true
timeout-minutes: 10
@@ -4061,9 +4070,13 @@ jobs:
# flake proof the test-health queue reads, and the shards a re-run re-executed upload under
# attempt-suffixed artifact names so only they are emitted for the new attempt.
# Master pushes and all in-repo PRs. Skip forks (no secrets access).
+ # Both matrices skipped means no JUnit was uploaded, so there are no traces to
+ # emit. This job sits on the tail of the run, so skipping it takes its whole
+ # duration off the wall of a draft that ran no tests.
if: >-
!cancelled() &&
github.repository == 'PostHog/posthog' &&
+ (needs.django.result != 'skipped' || needs.turbo-tests.result != 'skipped') &&
(
(github.event_name != 'pull_request' && github.ref == 'refs/heads/master') ||
(github.event_name == 'pull_request' &&