Skip to content

Fix deploy checklist including cherry-picked PRs already in production - #94903

Draft
mountiny wants to merge 3 commits into
mainfrom
fix/deploy-checklist-stale-cherry-pick-prs
Draft

Fix deploy checklist including cherry-picked PRs already in production#94903
mountiny wants to merge 3 commits into
mainfrom
fix/deploy-checklist-stale-cherry-pick-prs

Conversation

@mountiny

@mountiny mountiny commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

When a PR (or a Mobile-Expensify submodule update) is cherry-picked to staging and deployed to production, its original merge commit re-enters the staging range via a post-deploy sync. Because that original commit predates the previous staging tag, neither the duplicate-detection filter nor the previous-checklist filter removes it — so it incorrectly appears in the next cycle's deploy checklist even though it is already in production.

Root cause signal: Any commit appearing in compareCommits(previousStagingTag, newStagingTag) whose committer date is before the base tag's own commit date was brought into the range by a post-deploy sync, not by a genuine merge in the current cycle.

Fix:

  • GithubUtils.getCommitHistoryBetweenTags now returns {commits, baseCommitDate}, capturing base_commit.commit.committer.date from the first compareCommits page at no extra API cost.
  • GitUtils.getMergedPRsDeployedBetween propagates baseCommitDate through MergedPRsResult.
  • createOrUpdateDeployChecklist.ts filters both mergedPREntries and submoduleUpdates (the reviewer caught that submodule bumps had the same problem) using the baseCommitDate signal before building the chronological section and the main PR list.
  • All compiled GitHub Actions index.js bundles rebuilt via npm run gh-actions-build.

Fixed Issues

$ #94901
PROPOSAL:

Tests

  1. Run the updated unit tests: npx jest tests/unit/GithubUtilsTest.ts tests/unit/createOrUpdateDeployChecklistTest.ts
  2. Verify all tests pass (57 total), including:
    • 'filters out stale PRs whose commit date predates the previous staging tag (cherry-picked in a prior cycle)'
    • 'filters out stale Mobile-Expensify submodule updates predating the previous staging tag'
    • 'should return empty baseCommitDate when base_commit is missing from API response' (graceful fallback)
  3. To validate end-to-end: cherry-pick a PR to staging, deploy it to production, trigger a new staging deploy, and verify the cherry-picked PR does not appear in the new StagingDeployCash checklist's chronological section.
  • Verify that no errors appear in the JS console

Offline tests

N/A — this change is a CI/CD script, not a user-facing feature.

QA Steps

N/A — this change affects the deploy checklist generation script only, not app behavior. Validation is done via the unit tests above and by observing the next staging deploy checklist after a cherry-pick.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

This PR only modifies CI/CD scripts and has no visual UI changes.

Android: Native

N/A — no UI changes

Android: mWeb Chrome

N/A — no UI changes

iOS: Native

N/A — no UI changes

iOS: mWeb Safari

N/A — no UI changes

MacOS: Chrome / Safari

N/A — no UI changes

When a PR is cherry-picked directly to the staging branch and deployed to
production, its original merge commit can re-enter the staging range after
the post-deploy sync. Because that original commit predates the previous
staging tag (it was merged to main before the previous cycle started), the
existing duplicate-detection and previous-checklist filters both miss it,
causing the PR to appear in the next cycle's deploy checklist even though
it is already in production.

Fix by capturing the committer date of the base tag's commit from the
compareCommits API response (available at no extra cost as base_commit on
the first page). Any PR whose commit date predates this baseline was
brought into the range by a post-deploy sync, not by a genuine merge in
the current cycle, and is filtered out.

Fixes #94901

Co-authored-by: Cursor <cursoragent@cursor.com>
@mountiny

Copy link
Copy Markdown
Contributor Author

@codex review
@MelvinBot review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 13050a0f1c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

//
// We use this as the filter signal: any PR whose commit date is before the previous staging
// tag's commit date was already deployed to production via cherry-pick and must be excluded.
const staleEntries = baseCommitDate ? mergedPREntries.filter((pr) => pr.date < baseCommitDate) : [];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Filter stale submodule updates too

When the stale cherry-pick is an App commit that updates the Mobile-Expensify submodule, the compare range still includes the old Update Mobile-Expensify submodule... commit dated before baseCommitDate, but this filter only derives stale entries from mergedPREntries. Because the unfiltered submoduleUpdates array is later passed into buildChronologicalSection, that cherry-picked submodule-bump scenario still renders an already-deployed Mobile-Expensify update in the next checklist even though stale PRs were removed.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch — fixed in 500cc78. is now filtered through the same baseCommitDate staleness check before being passed to buildChronologicalSection, and a dedicated test was added to cover this scenario.

mountiny and others added 2 commits June 30, 2026 20:10
…us staging tag

Addresses reviewer feedback: submoduleUpdates was passed unfiltered into
buildChronologicalSection, so a Mobile-Expensify submodule bump that was
cherry-picked and already deployed to production could still appear in the
new checklist's chronological section.

Apply the same baseCommitDate staleness filter to submoduleUpdates so that
commits predating the previous staging tag are excluded.

Co-authored-by: Cursor <cursoragent@cursor.com>
Recompiled all compiled index.js action bundles to reflect the updated
return type of getCommitHistoryBetweenTags ({commits, baseCommitDate}).

Co-authored-by: Cursor <cursoragent@cursor.com>
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