Skip to content

ci: reuse Python SDK upgrade PRs unless queued - #1021

Merged
dustinbyrne merged 2 commits into
mainfrom
ci/reuse-python-upgrade-pr
Oct 7, 2026
Merged

dustinbyrne merged 2 commits into
mainfrom
ci/reuse-python-upgrade-pr

Conversation

@dustinbyrne

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Python SDK releases currently open a new downstream PostHog dependency PR for every version, leaving superseded updates open.

Match the JS updater's queue-aware reuse behavior:

  • Reuse the newest matching open PostHog/posthog Python upgrade PR, including existing version-named branches.
  • Use posthoganalytics-upgrade when no matching PR exists.
  • Use a version-specific branch when the existing PR is running or waiting in Trunk's merge queue, or its queue status cannot be read. Updating a queued branch can restart checks for the PRs behind it.
  • Refresh the reused PR's title and body for the new version.

PR discovery filters by title before applying the result limit, and the queue check reads all comment pages so it does not use a stale first-page status.

This changes only the downstream upgrade workflow. Package publishing and SDK runtime behavior are unchanged; no package release is needed. Existing superseded PRs are not closed by this change.

💚 How did you test it?

  • Parsed the workflow YAML and ran actionlint v1.7.7.
  • Checked the branch-selection shell with bash -n and ShellCheck at warning severity.
  • Executed the actual branch-selection script with mocked gh responses in 14 scenarios: first PR, legacy/stable branch reuse, running/waiting queue, failed queue lookup, cleared queue status, unrelated comments, fork/unrelated-package exclusion, multiple matches, queue-status transitions beyond the first comment page, and failed PR lookup. All passed, along with title/body output wiring assertions.
  • A read-only live PR lookup found all three existing Python upgrade PRs in newest-first order.
  • git diff --check passed.

No live upgrade workflow was dispatched; branch pushes and PR updates performed by the workflow remain unverified end to end.

📝 Checklist

  • I reviewed the submitted code.
  • No breaking change or entry added to the changelog.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Implemented with Pi, using Git/GitHub CLI for source inspection and local shell/YAML validation. The workflow follows the current JS updater's reuse and queue-protection pattern. A fresh read-only reviewer inspected the change before submission.

@dustinbyrne
dustinbyrne requested a review from a team as a code owner October 6, 2026 21:18
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

posthog-python Compliance Report

Date: 2026-10-06T21:58:30.739299+00:00
Duration: 259160ms

✅ All Tests Passed!

121/121 tests passed


Capture_V1 Tests

✅ 95/95 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint ✅ 513ms
Endpoint And Method.Does Not Use Legacy Endpoints ✅ 508ms
Required Headers.Has Authorization Bearer Header ✅ 507ms
Required Headers.Has Content Type Json ✅ 508ms
Required Headers.Has Posthog Sdk Info Format ✅ 508ms
Required Headers.Has Posthog Attempt Header ✅ 508ms
Required Headers.Has Posthog Request Id ✅ 507ms
Required Headers.Has Posthog Request Timestamp ✅ 507ms
Required Headers.Has User Agent ✅ 508ms
Body Format.Body Has Created At And Batch ✅ 507ms
Body Format.No Api Key In Body ✅ 507ms
Body Format.No Sent At In Body ✅ 508ms
Event Format.Event Has Required Root Fields ✅ 507ms
Event Format.Event Uuid Is Valid ✅ 508ms
Event Format.Event Timestamp Is Rfc3339 ✅ 507ms
Event Format.Non Utc Event Timestamp Is Converted To Utc ✅ 511ms
Event Format.Distinct Id Is String ✅ 508ms
Event Format.Distinct Id At Root Not Properties ✅ 507ms
Event Format.Custom Properties Preserved ✅ 508ms
Event Format.Set Properties Preserved ✅ 508ms
Event Format.Set Once Properties Preserved ✅ 507ms
Event Format.Groups Properties Preserved ✅ 507ms
Event Format.Sdk Generates Uuid If Not Provided ✅ 510ms
Event Format.Event Has Required Root Fields Batch ✅ 515ms
Event Format.Event Uuid Is Valid Batch ✅ 510ms
Event Format.Event Timestamp Is Rfc3339 Batch ✅ 509ms
Event Format.Distinct Id Is String Batch ✅ 510ms
Event Format.Distinct Id At Root Not Properties Batch ✅ 509ms
Event Format.Custom Properties Preserved Batch ✅ 510ms
Event Format.Set Properties Preserved Batch ✅ 510ms
Event Format.Set Once Properties Preserved Batch ✅ 509ms
Event Format.Groups Properties Preserved Batch ✅ 510ms
Event Format.Sdk Generates Uuid If Not Provided Batch ✅ 510ms
Batch Behavior.Multiple Events In Single Batch ✅ 512ms
Batch Behavior.Batch Envelope Smoke ✅ 510ms
Batch Behavior.Flush With No Events Sends Nothing ✅ 505ms
Batch Behavior.Flush At Triggers Batch ✅ 1008ms
Batch Behavior.Created At Reflects Batch Creation Time ✅ 508ms
Deduplication.Generates Unique Uuids ✅ 512ms
Deduplication.Different Events Same Content Different Uuids ✅ 509ms
Deduplication.Preserves Uuid On Retry ✅ 6516ms
Deduplication.Preserves Timestamp On Retry ✅ 6516ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 6515ms
Deduplication.No Duplicate Events In Batch ✅ 513ms
Header Behavior On Retry.Attempt Header Starts At One ✅ 508ms
Header Behavior On Retry.Attempt Header Increments On Retry ✅ 13524ms
Header Behavior On Retry.Request Id Preserved On Retry ✅ 6516ms
Header Behavior On Retry.Different Requests Have Different Request Ids ✅ 3016ms
Header Behavior On Retry.Request Timestamp Changes On Retry ✅ 6513ms
Response Format Validation.Success Response Has Uuid Keyed Results ✅ 508ms
Response Format Validation.Success Response Has Ok For Each Event ✅ 510ms
Response Format Validation.Success No Retry After When All Ok ✅ 509ms
Response Format Validation.Success Retry After Present When Retry Events ✅ 1511ms
Response Format Validation.Success No Retry After When Drop Only ✅ 510ms
Response Format Validation.Response Echoes Request Id ✅ 507ms
Retry Behavior.Retries On 408 ✅ 6516ms
Retry Behavior.Retries On 500 ✅ 6512ms
Retry Behavior.Retries On 503 ✅ 8522ms
Retry Behavior.Retries On 504 ✅ 6516ms
Retry Behavior.Retryable Errors Have Retry After ✅ 3512ms
Retry Behavior.Respects Retry After On Retryable Error ✅ 11518ms
Retry Behavior.Does Not Retry On 400 ✅ 2513ms
Retry Behavior.Does Not Retry On 401 ✅ 2510ms
Retry Behavior.Does Not Retry On 402 ✅ 2512ms
Retry Behavior.Does Not Retry On 413 ✅ 2510ms
Retry Behavior.Does Not Retry On 415 ✅ 2511ms
Retry Behavior.Non Retryable Errors Have No Retry After ✅ 2510ms
Retry Behavior.Implements Backoff ✅ 22532ms
Retry Behavior.Max Retries Respected ✅ 22528ms
Partial Batch Handling.Handles 200 Full Success ✅ 2510ms
Partial Batch Handling.Handles 200 With All Ok ✅ 3512ms
Partial Batch Handling.Does Not Retry Dropped Events ✅ 3510ms
Partial Batch Handling.Does Not Retry Limited Events ✅ 3513ms
Partial Batch Handling.Prunes Ok Events On Partial Retry ✅ 6513ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry ✅ 6518ms
Partial Batch Handling.Retries Only Retry Events From Partial ✅ 6515ms
Partial Batch Handling.Partial Retry Preserves Uuids ✅ 6517ms
Partial Batch Handling.Partial Retry Attempt Header Increments ✅ 6517ms
Partial Batch Handling.Partial Retry Request Id Preserved ✅ 6515ms
Partial Batch Handling.Respects Retry After On Partial ✅ 8515ms
Partial Batch Handling.Unknown Result Treated As Terminal ✅ 3513ms
Partial Batch Handling.Mixed Ok Drop Limited No Retry ✅ 3514ms
Compression.Sends Gzip Content Encoding ✅ 508ms
Compression.No Content Encoding When Disabled ✅ 508ms
Compression.Compressed Body Is Decompressible ✅ 507ms
Error Handling.Does Not Retry On Unknown 4Xx ✅ 2510ms
Event Options.Cookieless Mode Override ✅ 508ms
Event Options.Disable Skew Correction Override ✅ 508ms
Event Options.Process Person Profile Override ✅ 507ms
Event Options.Product Tour Id Override ✅ 507ms
Event Options.Unset Options Omitted ✅ 507ms
Event Options.Options Override In Batch ✅ 509ms
Geoip And Historical Migration.Geoip Disable Injected Into Properties ✅ 508ms
Geoip And Historical Migration.Historical Migration Set In Body ✅ 507ms
Geoip And Historical Migration.Historical Migration Absent By Default ✅ 507ms

Capture_Ai Tests

✅ 5/5 tests passed

View Details
Test Status Duration
Routing.Capture Ai Posts To Ai Endpoint ✅ 507ms
Routing.Capture Does Not Reroute Ai Named Events ✅ 508ms
Identity.Capture Ai Event Has Uuid ✅ 507ms
Identity.Capture Ai Keeps Supplied Uuid ✅ 507ms
Timestamp Format.Non Utc Event Timestamp Is Converted To Utc ✅ 508ms

Feature_Flags Tests

✅ 17/17 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id ✅ 8ms
Request Payload.Flags Request Uses V2 Query Param ✅ 6ms
Request Payload.Flags Request Hits Flags Path Not Decide ✅ 6ms
Request Payload.Flags Request Omits Authorization Header ✅ 6ms
Request Payload.Token In Flags Body Matches Init ✅ 5ms
Request Payload.Groups Round Trip ✅ 6ms
Request Payload.Groups Default To Empty Object ✅ 6ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False ✅ 6ms
Request Payload.Disable Geoip Omitted Defaults To False ✅ 6ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key ✅ 5ms
Request Lifecycle.No Flags Request On Init Alone ✅ 3ms
Request Lifecycle.No Flags Request On Normal Capture ✅ 506ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests ✅ 9ms
Request Lifecycle.Mock Response Value Is Returned To Caller ✅ 6ms
Retry Behavior.Retries Flags On 502 ✅ 309ms
Retry Behavior.Retries Flags On 504 ✅ 309ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event ✅ 508ms

Feature_Flags_Local_Evaluation Tests

✅ 4/4 tests passed

View Details
Test Status Duration
Versioned Boolean Matching.Matching Version Missing ✅ 46ms
Versioned Boolean Matching.Matching Version 1 ✅ 41ms
Versioned Boolean Matching.Matching Version 2 ✅ 42ms
Versioned Boolean Matching.Version Only Reload 1 2 1 2 Missing ✅ 23ms

@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Retrigger

[High risk] Changes CI workflow for dependency upgrade automation.

Protect shared branches from overlapping runs and queued fallback collisions before merging.

Reviews (1) · Last reviewed commit: "ci: reuse Python SDK upgrade PRs unless ..."

Comment thread .github/workflows/posthog-upgrade.yml
Comment thread .github/workflows/posthog-upgrade.yml
@dustinbyrne
dustinbyrne merged commit 945bbbc into main Oct 7, 2026
43 checks passed
@dustinbyrne
dustinbyrne deleted the ci/reuse-python-upgrade-pr branch October 7, 2026 14:16
eli-r-ph pushed a commit that referenced this pull request Oct 10, 2026
* ci: reuse Python SDK upgrade PRs unless queued

* ci: protect reused upgrade PRs from stale and queued writes

(cherry picked from commit 945bbbc)
eli-r-ph pushed a commit that referenced this pull request Oct 10, 2026
* ci: reuse Python SDK upgrade PRs unless queued

* ci: protect reused upgrade PRs from stale and queued writes

(cherry picked from commit 945bbbc)
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