Skip to content

Add GitHub Action to measure latency difference on PR label#13189

Draft
amk-stripe wants to merge 2 commits into
masterfrom
amk/github-action-measure-latency
Draft

Add GitHub Action to measure latency difference on PR label#13189
amk-stripe wants to merge 2 commits into
masterfrom
amk/github-action-measure-latency

Conversation

@amk-stripe

Copy link
Copy Markdown
Collaborator

When a PR is labeled with 'measure-latency-difference', this workflow:

  1. Determines the commit (HEAD of the branch) and base commit (merge-base with master)
  2. Triggers the new 'run-paymentsheet-latency-difference' Bitrise workflow with those two commits as parameters
  3. Polls until the Bitrise build completes (up to 2 hours)
  4. Fetches the build log, extracts the latency delta report and raw measurements, and posts them as a comment on the PR

Also adds the 'run-paymentsheet-latency-difference' Bitrise workflow that runs the measure_latency_difference.rb script using the BASE_COMMIT and COMMIT environment variables.

Committed-By-Agent: goose

Summary

Motivation

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Before After
before screenshot after screenshot

Changelog

When a PR is labeled with 'measure-latency-difference', this workflow:
1. Determines the commit (HEAD of the branch) and base commit (merge-base with master)
2. Triggers the new 'run-paymentsheet-latency-difference' Bitrise workflow
   with those two commits as parameters
3. Polls until the Bitrise build completes (up to 2 hours)
4. Fetches the build log, extracts the latency delta report and raw
   measurements, and posts them as a comment on the PR

Also adds the 'run-paymentsheet-latency-difference' Bitrise workflow that
runs the measure_latency_difference.rb script using the BASE_COMMIT and
COMMIT environment variables.

Committed-By-Agent: goose
@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Latency Difference Measurement

⏳ Measuring latency difference between commits...

  • Commit: 4208e170f2199947bdceff0c2f90278c3fcddc21
  • Base commit: 76a32c270bbfc2a2a68865ce4306815e9a2b6d46
  • Bitrise build:

This comment will be updated once the measurement is complete.

Two bugs:

1. In the trigger step, `$(curl --silent --fail ...)` inside a variable
   assignment does not trigger bash's set -e when curl gets an error
   response, so the step silently continued with an empty build_slug.
   Fixed by: building the request body separately (so jq errors are
   visible), using --fail-with-body so error responses are logged, and
   explicitly checking that build_slug is non-empty before continuing.

2. In the poll step, `$(echo "$RESPONSE" | jq ...)` inside a variable
   assignment would crash with a jq parse error when RESPONSE was empty
   (e.g. due to a transient network error or an empty build_slug in the
   URL). Fixed by: removing --fail from the poll curl so transient errors
   retry instead of crashing, using jq's // empty filter so missing fields
   produce "" rather than "null", and adding || STATUS="" so a jq parse
   error on a bad response retries rather than crashing the whole step.

Committed-By-Agent: goose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant