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): let Trunk quarantine warehouse-sources flakes (#93197)

Georges-Antoine Assi30df34f02775
diff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.yml
index fe476fc6cb2c..e794c27de57b 100644
--- a/.depot/workflows/ci-backend.yml
+++ b/.depot/workflows/ci-backend.yml
@@ -23,8 +23,9 @@
# 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
-# before this upload. The shadow strips all of it because a non-blocking timing
+# failure" step owns the pass/fail verdict. Canonical stages JUnit under per-product
+# filenames before this upload, and can hold a product back from quarantine by naming
+# its report as an exclusion. The shadow strips all of it because a non-blocking timing
# trial must not post to Trunk, and so it also omits the test
# steps' continue-on-error and that verdict step, letting each shard's test
# exit code be the verdict directly. Canonical gates each quarantine gate on the
diff --git a/.github/scripts/prepare-product-junit-for-trunk.sh b/.github/scripts/prepare-product-junit-for-trunk.sh
index 55fcf14a5554..8607345d2bd4 100644
--- a/.github/scripts/prepare-product-junit-for-trunk.sh
+++ b/.github/scripts/prepare-product-junit-for-trunk.sh
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
-if [ "$#" -lt 3 ]; then
- echo "usage: $0 OUTPUT_DIR MATRIX_FILTERS EXCLUDED_JUNIT_PATH..." >&2
+if [ "$#" -lt 2 ]; then
+ echo "usage: $0 OUTPUT_DIR MATRIX_FILTERS [EXCLUDED_JUNIT_PATH...]" >&2
exit 2
fi
diff --git a/.github/scripts/prepare-product-junit-for-trunk.test.sh b/.github/scripts/prepare-product-junit-for-trunk.test.sh
index cbf69067350d..3ce3e0e01cbb 100644
--- a/.github/scripts/prepare-product-junit-for-trunk.test.sh
+++ b/.github/scripts/prepare-product-junit-for-trunk.test.sh
@@ -16,7 +16,7 @@ create_product() {
run_case() {
local name="$1" filters="$2" expected_status="$3" warehouse_report="$4" other_report="$5"
- local excluded_paths="${6:-products/warehouse_sources/junit-product.xml}"
+ local excluded_paths="${6-products/warehouse_sources/junit-product.xml}"
local root="$workdir/$name" output status excluded_path product
read -r -a exclusions <<<"$excluded_paths"
mkdir -p "$root"
@@ -25,7 +25,7 @@ run_case() {
create_product "$root" other @posthog/products-other "$other_report"
set +e
- output=$(cd "$root" && bash "$script" trunk-junit "$filters" "${exclusions[@]}" 2>&1)
+ output=$(cd "$root" && bash "$script" trunk-junit "$filters" ${exclusions[@]+"${exclusions[@]}"} 2>&1)
status=$?
set -e
@@ -34,13 +34,17 @@ run_case() {
printf '%s\n' "$output"
exit 1
fi
- for excluded_path in "${exclusions[@]}"; do
+ for excluded_path in ${exclusions[@]+"${exclusions[@]}"}; do
product="$(basename "$(dirname "$excluded_path")")"
if [ -e "$root/trunk-junit/junit-product-$product.xml" ]; then
echo "FAIL: $name staged excluded report $excluded_path"
exit 1
fi
done
+ if [ "${#exclusions[@]}" -eq 0 ] && [ ! -e "$root/trunk-junit/junit-product-warehouse_sources.xml" ]; then
+ echo "FAIL: $name did not stage a report that nothing excludes"
+ exit 1
+ fi
if [ ! -e "$root/trunk-junit/junit-product-warehouse_sources_queue.xml" ]; then
echo "FAIL: $name did not stage an included report"
exit 1
@@ -53,5 +57,6 @@ run_case selected-report-missing '--filter=@posthog/products-warehouse-sources'
run_case selected-report-passes '--filter=@posthog/products-warehouse-sources' 0 '<testsuite tests="1" failures="0" />' '<testsuite tests="1" failures="0" />'
run_case selected-report-fails '--filter=@posthog/products-warehouse-sources' 1 '<testsuite tests="1" failures="1"><testcase><failure /></testcase></testsuite>' '<testsuite tests="1" failures="0" />'
run_case multiple-exclusions '--filter=@posthog/products-other' 0 '<testsuite tests="1" failures="0" />' '<testsuite tests="1" failures="0" />' 'products/warehouse_sources/junit-product.xml products/other/junit-product.xml'
+run_case no-exclusions-stages-a-failed-report '--filter=@posthog/products-warehouse-sources' 0 '<testsuite tests="1" failures="1"><testcase><failure /></testcase></testsuite>' '<testsuite tests="1" failures="0" />' ''
echo "Product JUnit preparation regression cases passed."
diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.yml
index 6a8026077027..c8db541df79d 100644
--- a/.github/workflows/ci-backend.yml
+++ b/.github/workflows/ci-backend.yml
@@ -1064,7 +1064,8 @@ jobs:
set -e
exit $overall
- # Excluded reports bypass Trunk quarantine, so this step owns their verdict.
+ # Stages every product's report under a per-product filename. Pass a report path to
+ # exclude a product from Trunk quarantine; this step then owns that product's verdict.
- name: Prepare product JUnit for Trunk
id: prepare_product_junit
if: always()
@@ -1074,8 +1075,7 @@ jobs:
run: |
bash .github/scripts/prepare-product-junit-for-trunk.sh \
trunk-junit \
- "$PRODUCT_FILTERS" \
- products/warehouse_sources/junit-product.xml
+ "$PRODUCT_FILTERS"
# Best-effort Trunk upload (continue-on-error); the "Fail on test failure" step below is
# the verdict, so a Trunk outage can't red a passing shard. Internal PRs only (needs the