Skip to content

fix(ci): make the weekly flaky test report verifiable - #111972

Merged
trunk-io[bot] merged 12 commits into
masterfrom
rauln/flaky-report-verifiable-counts
Oct 6, 2026
Merged

trunk-io[bot] merged 12 commits into
masterfrom
rauln/flaky-report-verifiable-counts

Conversation

@rnegron

@rnegron rnegron commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Problem

  • Developers cannot trust the weekly report's counts, quarantine status, or log links.
  • Origin.

Changes

  • Endpoint counts drive ranking and displayed totals.
  • One Trunk lookup supplies repair deadlines; overdue quarantines remain masked.
  • Xfail-only tests, including file quarantines, are excluded.
  • Recent GitHub runs supply log links; cluster counts show lower bounds.
Data sources before and after

Before:

flowchart LR
    F[Flaky tests endpoint]:::api --> R[Weekly report]:::primary
    H[HogQL rescue counts, links and Trunk state]:::api --> R
    R --> S[Slack]:::output
    classDef api fill:#f54e00,stroke:#f54e00,color:#fff;
    classDef primary fill:#1d4aff,stroke:#1d4aff,color:#fff;
    classDef output fill:#f9bd2b,stroke:#f9bd2b,color:#000;
Loading

After:

flowchart LR
    F[Flaky tests endpoint counts]:::api --> R[Weekly report]:::primary
    T[Shared Trunk endpoint]:::api --> R
    H[HogQL log links]:::api --> R
    R --> S[Slack]:::output
    classDef api fill:#f54e00,stroke:#f54e00,color:#fff;
    classDef primary fill:#1d4aff,stroke:#1d4aff,color:#fff;
    classDef output fill:#f9bd2b,stroke:#f9bd2b,color:#000;
Loading

How did you test this code?

  • Node tests, workflow lint, actionlint, and preflight ran locally.
  • Test rationale: extend filtering and enrichment cases for Trunk master failures, omitted-xfail logging, and distinct run links.
  • Unchecked: live delivery and Slack rendering; Block Kit Builder requires sign-in. Previous dispatch failed at startup.

Release status

  • No feature flag controls this change

Docs update

  • No existing document covers this report.

🤖 Agent context

  • Autonomy: Human-driven (agent-assisted).
  • Agent: Claude Code, claude-opus-5-5; Codex, GPT-6.
  • Deep CodeRabbit: deadline wording fixed.
  • No other open PR found for this report. New fixture values are synthetic.
  • File-quarantine expiry suggestions are outside this Trunk-only report.
  • Skills: /code-review, /qa-team, /simplify, /authoring-ci-workflows, /writing-tests, /writing-code-comments, /writing-user-facing-copy, /writing-pr-descriptions, /running-ci-preflight, /reviewing-with-coderabbit, /shipping-a-pr, /merging-prs, /hogli, /chrome-devtools-mcp:chrome-devtools.

@rnegron rnegron self-assigned this Oct 5, 2026
@trunk-io

trunk-io Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🤖 CI report

✅ Trunk lane — non-backend lane (repo-automation)

This PR is assigned to the non-backend lane (repo-automation). It does not run backend Python tests and may merge in parallel with PRs in other lanes.

✅ Duplication (Python) — clean

New Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

✅ Duplication (TypeScript) — clean

New TypeScript code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

@greptile-apps

greptile-apps Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Retrigger

[Medium risk] Refactors the weekly test flakiness report logic and data sources.

The PR is not safe to merge until the master-burst filter retains tests that have both quarantined and hard-failed runs, and the explicit null-result requirement is met.

Reviews (2) · Last reviewed commit: "chore(ci): sync master"

Comment thread .github/scripts/weekly-flaky-report.mjs Resolved
Comment thread .github/scripts/weekly-flaky-report.mjs Resolved
Comment thread .github/scripts/weekly-flaky-report.mjs Resolved
@hosthog

hosthog Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

HostHog preview — posthog-desktop-web

The previews for this PR have been torn down and no longer serve.

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: PostHog/posthog/.coderabbit.yaml
  • Review profile: QUIET
  • Plan: Enterprise
  • Run ID: 40030cdf-b0c2-45ad-9de1-2536ffc0fc85
📥 Commits

Reviewing files that changed from the base of the PR and between 72458ea and 98e9162.

📒 Files selected for processing (2)
  • .github/scripts/weekly-flaky-report.mjs
  • .github/scripts/weekly-flaky-report.test.mjs

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The report uses endpoint counts and recent failing-job evidence instead of rescued-run counts. It retrieves Trunk quarantine state through a shared lookup and uses recovery and quarantine facts to filter candidates. Cluster counts use member maximums for failed runs and recoveries. Slack tables show quarantine status, failed PRs, failed runs, and recovered runs.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 98e91

The report’s quarantine guidance and endpoint handling do not present a remaining merge-blocking issue.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 98e91

The change primarily affects reporting, not CI permissions or quarantine policy. Existing credential and publishing boundaries remain in the inspected code. Repository-to-source selection and live endpoint behavior are not fully confirmed.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected path affects report integrity and disclosure of test names, counts and log links to the configured Slack channel and its thread. It uses existing PostHog and Slack credentials; no quarantine mutation or CI privilege escalation is present in this path. Actual credential grants and deployed repository-source mappings were not verified.

Trust Boundaries and Controls

  • observed — The quarantine route forwards the request's team, repository, source and user access context into the authorized-source facade. Curated query execution passes team and caller access context to the warehouse executor. The client relies on this producer boundary rather than checking the returned repository identity itself.
  • observed — Repository and test selectors remain bound HogQL values rather than query-source interpolation. Ownership resolution receives matched tracked paths over stdin with fixed subprocess arguments. These inspected paths keep test-derived strings separate from SQL syntax and executable command construction.

Resilience and Maintainability Implications

  • inferred — The shared promise is owned by one report invocation, with independent runner-filtered maps derived after completion. Disabled uploads, rejected requests, unavailable data and truncated inventories produce no authoritative quarantine lookup. Repetition starts with a fresh closure, and interruption cannot strand a durable quarantine transition because this lookup performs reads only.
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description covers the problem, user-visible changes, data-flow changes, tests and rationale, release status, docs, and agent context. It also states what was not tested and identifies synthetic f…
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments (2)
.github/scripts/weekly-flaky-report.mjs-499-499 (1)

499-499: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

The legend calls the fix-by date the date the quarantine ends. It is the TTL deadline.

trunkFixBy adds ttl_days to the start date. That gives the date the quarantine should end, not the date it ends. The legend also explains only two labels, fix by and overdue since. With masking on, an entry without a TTL renders since YYYY-MM-DD, and that date is when the quarantine started. With masking off, every Trunk entry renders flagged. The legend explains neither label, so readers can mistake a since date for an end date.

Proposed wording
-                '*Quarantine* shows the date the quarantine ends (fix by) or the date it ended (overdue since). A quarantine hides the failure for a limited time, so the test needs a fix by that date.',
+                '*Quarantine* shows the fix deadline (fix by), the deadline that has passed (overdue since), the start date when there is no deadline (since), or flagged when Trunk lists the test but does not mask CI.',
.github/scripts/weekly-flaky-report.mjs-313-339 (1)

313-339: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use the file quarantine’s expiry in the status.

When an active .test_quarantine.json entry has a matching candidate with same-commit recovery evidence, the report keeps that candidate. resolveFacts attaches only Trunk state, so the row shows - without a Trunk match, or a Trunk-derived status that ignores the file’s expires date. Load and match the file entry, then use its expiry before the Trunk-only guards.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: PostHog/posthog/.coderabbit.yaml
  • Review profile: QUIET
  • Plan: Enterprise
  • Run ID: 173d05c9-032f-474e-872b-6b71ae1a6bb3
📥 Commits

Reviewing files that changed from the base of the PR and between 287bcfe and fe7cfb6.

📒 Files selected for processing (3)
  • .github/scripts/weekly-flaky-report.mjs
  • .github/scripts/weekly-flaky-report.test.mjs
  • .github/workflows/weekly-flaky-report.yml

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 1 remain after this review.

@rnegron
rnegron marked this pull request as ready for review October 5, 2026 18:39
@rnegron rnegron added the stamphog Request AI approval (no full review) label Oct 5, 2026

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not approved yet — waiting on the conditions below.

Re-add the stamphog label to request another review once you have addressed this.

stamphog can't approve this pull request automatically, and a human reviewer will need to look at it. Two gates refused it. The deny-list gate matched the infra/CI-CD category because the change touches .github/workflows/weekly-flaky-report.yml and the scripts under .github/scripts/. The tier gate then classified the change as T2-never, a tier that is never auto-reviewed.

The size gate passed, so splitting the PR wouldn't change this outcome. The author should ask a human reviewer, such as someone on the team that owns CI workflows, to review it.

  • 👍 on the PR from greptile-apps[bot].
Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✗ matches: infra_cicd
size ✓ 318L, 2F substantive, 588L/3F incl. docs/generated/snapshots — within ceiling
tier ✗ classified as T2-never: T2-never (588L, 3F, single-area, fix)
stamphog 2.3.1 .stamphog/policy.yml @ unknown · reviewed head 72458ea

@stamphog stamphog Bot removed the stamphog Request AI approval (no full review) label Oct 5, 2026
@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team October 5, 2026 18:40
@parameterai

parameterai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Risk: No findings

This increment refines the weekly flaky-test report's filtering: the master-burst exclusion now keys off Trunk's knownFlake proof instead of same-commit recovery, and it moved from selectReportCandidates into buildRunnerReports where those facts are computed; trunkFixBy also returns null instead of undefined. I traced the filtering order (facts are resolved before isMasterBurst runs, so knownFlake is always set on the items it reads), the null-vs-undefined change (both falsy at every consumer, including quarantineStatusFor's if (trunk.fixBy) at line 326), and the test-only edits. No new inputs, endpoints, queries, or Slack surfaces are introduced by this increment, and the previously reviewed HogQL interpolation and URL construction are unchanged. No security issues found.

Sentinel reviewed 98e9162 · Review settings

@rnegron
rnegron removed the request for review from a team October 5, 2026 18:40
Comment thread .github/scripts/weekly-flaky-report.mjs Resolved
Comment thread .github/scripts/weekly-flaky-report.mjs Resolved
@rnegron
rnegron requested a review from a team October 5, 2026 19:38
@trunk-io
trunk-io Bot merged commit ac5178d into master Oct 6, 2026
@trunk-io
trunk-io Bot deleted the rauln/flaky-report-verifiable-counts branch October 6, 2026 12:35
@deployment-status-posthog

deployment-status-posthog Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-10-06 12:59 UTC Run
prod-us ✅ Deployed 2026-10-06 13:13 UTC Run
prod-eu ✅ Deployed 2026-10-06 13:14 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants