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(ci): drop the stale depot timing workflow (#105211)

Raúl Negrón-Otero16f000f0dbf9
diff --git a/.depot/workflows/ci-backend-update-test-timing.yml b/.depot/workflows/ci-backend-update-test-timing.yml
deleted file mode 100644
index 4884ad3195f2..000000000000
--- a/.depot/workflows/ci-backend-update-test-timing.yml
+++ /dev/null
@@ -1,141 +0,0 @@
-# Depot CI mirror of .github/workflows/ci-backend-update-test-timing.yml. Refreshes the
-# .test_durations the shadow restores for sharding, saving it to Depot Cache (the GitHub Actions
-# Cache copy is a separate store the shadow can't read). Merges timing artifacts from the newest
-# master ci-backend run; no test execution. Needs GH_APP_POSTHOG_TESTS_* in `depot ci secrets`.
-name: Depot CI shadow - update test timing
-on:
- workflow_dispatch: {}
- schedule:
- - cron: '0 1,7,13,19 * * *'
-permissions:
- contents: read
- actions: read
-jobs:
- refresh-depot-test-durations:
- name: Refresh .test_durations in Depot Cache
- runs-on: depot-ubuntu-24.04
- timeout-minutes: 10
- steps:
- - name: Get app token
- id: app-token
- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
- with:
- client-id: ${{ secrets.GH_APP_POSTHOG_TESTS_APP_ID }}
- private-key: ${{ secrets.GH_APP_POSTHOG_TESTS_PRIVATE_KEY }}
-
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
-
- - name: Install uv
- uses: ./.depot/actions/setup-uv
- with:
- enable-cache: false
-
- - name: Find newest Backend CI run with timing artifacts
- id: find-backend-run
- env:
- GH_TOKEN: ${{ steps.app-token.outputs.token }}
- REPO: ${{ github.repository }}
- run: |
- cutoff_date=$(date -u -d '14 days ago' +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || date -u -v-14d +%Y-%m-%dT%H:%M:%SZ)
- primary=$(gh api "repos/$REPO/actions/workflows/ci-backend.yml/runs?status=success&branch=master&per_page=100&created=>=$cutoff_date" \
- --jq '.workflow_runs[] | select(
- (.updated_at | fromdateiso8601) - (.run_started_at | fromdateiso8601) > 300
- ) | .id' | head -25 | \
- while read -r id; do
- count=$(gh api "repos/$REPO/actions/runs/$id/artifacts?per_page=100" \
- --jq '[.artifacts[] | select(.name | startswith("timing_data-")) | select(.expired == false)] | length' 2>/dev/null)
- if [ "$count" -ge "38" ]; then echo "$id"; break; fi
- done)
- if [ -z "$primary" ]; then
- echo "::error::No suitable Backend CI run found with timing artifacts"
- exit 1
- fi
- echo "run_id=$primary" >> "$GITHUB_OUTPUT"
-
- - name: Restore the previous map for the drift fallback
- # The merge below takes product entries only from the products file
- # (--replace-prefix), so a Products slice that fails the drift check
- # needs a stand-in or every product loses its durations. The last
- # cached map is that stand-in. A miss leaves the checked-out file.
- uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
- continue-on-error: true
- with:
- path: .test_durations
- # run_id never matches — forces the prefix restore-key to the newest entry.
- key: posthog-test-durations-${{ github.run_id }}
- restore-keys: |
- posthog-test-durations-
-
- - name: Set the previous map aside
- # .test_durations is not tracked, so there is nothing to restore it from
- # and a cache miss leaves no file at all.
- run: |
- if [ -f .test_durations ]; then
- mv .test_durations /tmp/previous_durations
- else
- echo "::warning::No cached map restored; a drifting Products slice has no stand-in"
- fi
-
- - name: Download timing artifacts
- env:
- GH_TOKEN: ${{ steps.app-token.outputs.token }}
- BACKEND_RUN_ID: ${{ steps.find-backend-run.outputs.run_id }}
- run: |
- gh run download "$BACKEND_RUN_ID" \
- --pattern "timing_data-Core-*" \
- --pattern "timing_data-Temporal-*" \
- --pattern "timing_data-Products-*" \
- --dir timing_artifacts
- gh run download "$BACKEND_RUN_ID" \
- --pattern "junit-results-backend-core-*" \
- --pattern "junit-results-backend-temporal-*" \
- --pattern "product-junit-results-*" \
- --dir junit_artifacts || echo "::warning::No JUnit artifacts — statistical carrier detection"
-
- - name: Merge into .test_durations
- run: |
- uv run .github/scripts/optimize_test_durations.py timing_artifacts /tmp/core_durations \
- --segment Core --junit-dir junit_artifacts
- uv run .github/scripts/optimize_test_durations.py timing_artifacts /tmp/temporal_durations \
- --segment Temporal --junit-dir junit_artifacts
- # A products slice whose shape drifted from the JUnit clock must not
- # reach the cache; a missing slice is worse (the merge takes product
- # entries only from this file), so keep the previous slice instead.
- set +e
- uv run .github/scripts/optimize_test_durations.py timing_artifacts /tmp/products_durations \
- --segment Products --junit-dir junit_artifacts --fail-on-drift
- products_status=$?
- set -e
- if [ "$products_status" -ne 0 ]; then
- echo "::warning::Products durations refresh exited $products_status; keeping the previous products slice. Drift or an incomplete JUnit set are the expected causes, see the log above."
- if [ -f /tmp/previous_durations ]; then
- # Only entries the fresh slices do not carry: the outlier merge would
- # otherwise let a stale value here beat a fresh one for the same test.
- jq -s 'add' $(ls /tmp/core_durations /tmp/temporal_durations 2>/dev/null) > /tmp/fresh_durations
- jq --slurpfile fresh /tmp/fresh_durations \
- 'with_entries(select((.key | startswith("products/")) and ($fresh[0][.key] == null)))' \
- /tmp/previous_durations > /tmp/products_durations
- else
- # No cached slice to stand in and no fresh one. A map with no product
- # entries would still become the newest cache and the latest successful
- # artifact, so every consumer would fall back to the file-count estimate
- # and under-shard the fixture-heavy products. Leave the older map newest.
- echo "::error::Products slice failed with no previous map to stand in; refusing to publish a map without product entries"
- exit 1
- fi
- fi
- uv run .github/scripts/optimize_test_durations.py .test_durations \
- --merge-files /tmp/core_durations /tmp/temporal_durations /tmp/products_durations \
- --replace-prefix products/
- rm -rf timing_artifacts junit_artifacts /tmp/core_durations /tmp/temporal_durations /tmp/products_durations
-
- - name: Compute cache key
- id: durations-meta
- run: echo "cache_key=posthog-test-durations-$(date -u +%FT%H%M%SZ)" >> "$GITHUB_OUTPUT"
-
- - name: Save test durations to Depot Cache
- uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
- continue-on-error: true
- with:
- path: .test_durations
- key: ${{ steps.durations-meta.outputs.cache_key }}
diff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.yml
index ca17b2cb79b3..d0cd365fdc80 100644
--- a/.depot/workflows/ci-backend.yml
+++ b/.depot/workflows/ci-backend.yml
@@ -106,9 +106,10 @@
# - handle-snapshots sets up Node from .nvmrc for its CI report steps, which canonical runs on
# the node that ships with the GitHub-hosted image, and fails with a rebase hint when the PR
# head predates .depot/actions/commit-snapshots
-# - Test durations restored from Depot Cache (posthog-test-durations- prefix), refreshed by
-# .depot/workflows/ci-backend-update-test-timing.yml, so shard counts match GitHub Actions.
-# Committed .test_durations is the fallback.
+# - Test durations restored from Depot Cache (posthog-test-durations- prefix). Canonical's
+# .github/workflows/ci-backend-update-test-timing.yml runs on Depot runners and writes
+# that same cache, so shard counts match GitHub Actions. Committed .test_durations is the
+# fallback.
# - No push trigger: canonical primes the shared schema cache on master, and Depot Cache
# serves both engines. The `github.event_name != 'push'` guards stay to mirror canonical.
# Trunk merge-queue PRs are excluded because they would repeat a source PR's trial run.
@@ -118,7 +119,7 @@
# This workflow runs all of our backend django tests.
#
# Shards derive from .test_durations (Amdahl), restored from Depot Cache (else committed);
-# .depot/workflows/ci-backend-update-test-timing.yml keeps that cache fresh.
+# .github/workflows/ci-backend-update-test-timing.yml keeps that cache fresh.
name: Backend CI on Depot
# Depot CI copy of canonical Backend CI. Branch protection requires only canonical's
# `Django Tests Pass`, which relays this workflow's gate when the event ran here. Each event runs on