Skip to content

[build-tools] Add eas/posthog_wait_for_query workflow function#3949

Open
gwdp wants to merge 1 commit into
gwdp/eng-21551-posthog-annotationfrom
gwdp/eng-21551-posthog-wait-for-query
Open

[build-tools] Add eas/posthog_wait_for_query workflow function#3949
gwdp wants to merge 1 commit into
gwdp/eng-21551-posthog-annotationfrom
gwdp/eng-21551-posthog-wait-for-query

Conversation

@gwdp

@gwdp gwdp commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Why

Gate an EAS workflow on any PostHog condition you can express in HogQL, not just a numeric threshold. Wait until a query is true before continuing. Sibling to wait_for_metric for when the condition is a string match, a compound expression, or anything operator/threshold can't say.

How

Adds eas/posthog_wait_for_query. Polls a HogQL query that returns a single boolean, until it's true, every interval_seconds (default 30) for up to timeout_seconds (default 600). The query is the condition, so PostHog does the comparison instead of us reimplementing it.

Same shape as the metric gate: no ignore_error (timing out fails the step), network/429/5xx retry until the deadline, auth and query errors fail right away. Shares the query transport with wait_for_metric.

Test Plan

CI passes. Ran it live against coin-flip: query_true continues right away and query_timeout fails on timeout as intended. Test workflow below (true, timeout, and a string-condition job).

Test workflow
name: PostHog wait-for-query test

jobs:
  query_true:
    steps:
      - uses: eas/posthog_wait_for_query
        with:
          query: select count() >= 0 from events

  query_timeout:
    steps:
      - uses: eas/posthog_wait_for_query
        with:
          query: select count() < 0 from events
          interval_seconds: 5
          timeout_seconds: 20

  query_string_condition:
    steps:
      - uses: eas/posthog_wait_for_query
        with:
          query: select count() > 0 from events where event = 'coin_flipped'
          interval_seconds: 5
          timeout_seconds: 20
Screenshot 2026-07-03 at 2 33 56 PM Screenshot 2026-07-03 at 2 34 02 PM

@linear-code

linear-code Bot commented Jul 3, 2026

Copy link
Copy Markdown

ENG-21551

gwdp commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-wait-for-query branch from 1dbcac7 to eb42509 Compare July 3, 2026 20:47
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-annotation branch 2 times, most recently from 9ce8b59 to aa30fd2 Compare July 3, 2026 20:58
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-wait-for-query branch from eb42509 to cef86d5 Compare July 3, 2026 20:58
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.65%. Comparing base (a437436) to head (150dc15).

Additional details and impacted files
@@                          Coverage Diff                          @@
##           gwdp/eng-21551-posthog-annotation    #3949      +/-   ##
=====================================================================
+ Coverage                              59.62%   59.65%   +0.04%     
=====================================================================
  Files                                    943      944       +1     
  Lines                                  41467    41503      +36     
  Branches                                8729     8734       +5     
=====================================================================
+ Hits                                   24719    24755      +36     
  Misses                                 16654    16654              
  Partials                                  94       94              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-wait-for-query branch from cef86d5 to dcf0c4b Compare July 3, 2026 21:09
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-annotation branch from aa30fd2 to 9c65fdb Compare July 3, 2026 21:09
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-wait-for-query branch from dcf0c4b to c8039b5 Compare July 3, 2026 21:40
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-annotation branch from 9c65fdb to bccd6db Compare July 3, 2026 21:40
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-wait-for-query branch from c8039b5 to e9b2794 Compare July 6, 2026 19:51
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-annotation branch from bccd6db to a662e94 Compare July 6, 2026 19:51
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-wait-for-query branch from e9b2794 to f4b72c3 Compare July 6, 2026 20:40
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-annotation branch from a662e94 to 52dc644 Compare July 6, 2026 20:40
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-wait-for-query branch from f4b72c3 to 2c11c6e Compare July 6, 2026 21:59
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-annotation branch 2 times, most recently from 8407075 to d3e76bf Compare July 6, 2026 22:21
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-wait-for-query branch from 2c11c6e to 0327984 Compare July 6, 2026 22:21
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-annotation branch from d3e76bf to b52c51f Compare July 6, 2026 22:54
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-wait-for-query branch 2 times, most recently from 303bdc5 to c78323e Compare July 6, 2026 23:35
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-annotation branch from b52c51f to 27b3af6 Compare July 6, 2026 23:35
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-annotation branch from 27b3af6 to a437436 Compare July 6, 2026 23:50
@gwdp gwdp force-pushed the gwdp/eng-21551-posthog-wait-for-query branch from c78323e to 150dc15 Compare July 6, 2026 23:50
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

@gwdp gwdp requested a review from sjchmiela July 6, 2026 23:55
@gwdp gwdp marked this pull request as ready for review July 6, 2026 23:56
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Subscribed to pull request

File Patterns Mentions
**/* @douglowder

Generated by CodeMention

Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead.

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.

1 participant