Repository navigation
ci: fix the merge queue check in the PostHog upgrade workflow - #1311
Conversation
There was a problem hiding this comment.
PostHog Review · Standard · reviewed 6bbeb0c: 1 Should fix.
New pushes to this pull request won't start an automatic review. Comment @posthog review to review new changes.
See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.
SDK performance: posthog-pythonBenchmarks completed. No changes flagged for review. Flags require at least a 5% change in the median and all six pairs agreeing on direction. This is a noise filter, not proof of a performance change or a CI gate. View all results
Values are medians of paired measurements. Not flagged does not mean unchanged. Unavailable means a measurement could not be provided, not zero. Estimated allocation measurements retain their instrumentation uncertainty. RSS measures the whole process, not just SDK allocations; observed peaks are sampled checkpoints. Paired ranges in the diagnostics describe variability, not confidence intervals. Each shard uses its own runner; compare Before PR against With PR within a row, not across shards. Compared 102 metric rows; 102 rows shown in all results. Omitted or shortened data remain in |
ioannisj
left a comment
There was a problem hiding this comment.
🤖 An AI agent wrote this on behalf of @ioannisj.
No findings. I checked that a gh api failure still lands in the unknown branch now that the filter is a separate jq, and that the fake gh rejects --slurp with --jq the way the real one does.
💡 Motivation and Context
The
PostHog Upgradeworkflow opens a PR in PostHog/posthog that bumpsposthoganalytics. Before it reuses an existing upgrade PR, it checks whether that PR is in Trunk's merge queue, because pushing to a queued PR restarts the queue's checks.That check never worked.
queue_status()calledgh api --paginate --slurp --jq ..., andghrejects--slurptogether with--jq. The command printedthe --slurp option is not supported with --jq or --templateplus the fullgh apihelp, then fell into the error branch. The workflow treated every existing upgrade PR as queued and pushed to a separate version-specific branch instead.All five most recent runs show this (45576648499, 45579919189, 45625355223, 45643612931 and 45796138623). Each logged
Could not read the queue status of PR #...; treating it as queued.and thenPR #... is in the merge queue; checking a separate branch instead.The bug came in with #1021.💚 How did you test it?
I extracted the edited
queue_status()function from the workflow and ran it withbash -eo pipefail, which is how GitHub runsshell: bashsteps.gh apifails and the function still logs the warning and returnsunknown. This keeps the safe fallback.Running tests on this pull requestorwaiting to start tests, the filter picks the latest Trunk comment and detects the queued state.per_page=1, the comments span 6 pages and the filter still reads every page.actionlintreports the same two pre-existing shellcheck notes as onmain, and nothing new.posthog/test/test_posthog_upgrade_workflow.pyruns the workflow script against a fakegh. The fake now rejects--slurpwith--jqlike the realghand returns raw pages otherwise. With it, all 40 tests pass on this branch, and 13 fail against the workflow onmain.📝 Checklist
Changes
queue_status()now pipes the paginated, slurped comments intojq -rinstead of passing--jqtogh api. The filter and the status matching are unchanged. Agh apifailure still triggers the existing warning branch, because the step runs bash withpipefail.The fake
ghin the workflow tests used to accept--slurptogether with--jq, which is why the tests did not catch the bug. It now behaves like the realgh.No changeset, because this only changes a CI workflow.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
gherror and tested the fix with the function extracted from the workflow against real PostHog/posthog PRs.