Skip to content

Investigate why some changes didn't make it to staging as expected #10214

Description

@roryabraham

Context

Problem

There is a very obscure edge case with our git CI that caused some changes on main to not be correctly propagated to staging during a staging deploy. There were a few affected files, but the one we've focused on as our case study is src/pages/settings/Payments/PaymentsPage/BasePaymentsPage.js. Here's my best attempt at summarizing the history of this file.

  1. The OfflineIndicator was added in cc59b0a (#9589).
  2. That change was deployed to staging in 1.1.86-0
  3. The change was reverted here. Note that this PR was meant to be a revert of Update Global Offline Indicator #9895, but also included an additional (potentially unrelated) change in BasePaymentsPage.
  4. The revert was cherry-picked to staging version 1.1.86-2 in ffd8581 (#10115)
  5. The OfflineIndicator was added back in f9cf909 (#10135)

At this point, main contained the OfflineIndicator in BasePaymentsPage, but staging did not. However, when main was merged into staging, the usage of OfflineIndicator was carried over to main but the import was not.

In order to reproduce this locally and see it in action:

git checkout main
git pull
git checkout staging
git pull
git checkout main
git reset e66fa20d689e704fe6cf30485bc45f1e5e1397d7
git checkout -b fake-main
git reset --hard HEAD
git checkout staging
git reset 751915e541bfad2352237ce9d6030413b23938f0
git checkout -b fake-staging
git reset --hard HEAD
git clean -fd
git checkout -b update-fake-staging-from-fake-main

Then look at the diff between update-fake-staging-from-fake-main:

image (3)

You would think both of these changes would be carried over, but then run:

git merge -Xtheirs fake-main

And you'll see that the import is missing.

Solution

TBD, but we have some additional observations/hypotheses:

  • When we cherry-picked the revert to staging, we somehow muddled the history such that git thinks that change (ffd8581) is newer than the change on main that added it back (f9cf909).
  • An examination of the git log shows that on main the commits from the revert PR are part of a linear history, while on staging the merge commit is included and is treated as a separate branch?

image

  • The next step to investigate how to prevent this from happening in the future is probably to try and reproduce it in a fresh repo (perhaps utilizing this existing test script), and fiddle with the cherry-pick command that's used to see if we can keep these histories in line and prevent this problem.

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions