Closed Bug 1963406 Opened 6 months ago Closed 3 months ago

Automatically reopened revisions are getting reverted & associated with different repo after merge

Categories

(Conduit :: Phabricator, defect, P2)

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: zeid, Assigned: zeid)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

54 bytes, text/x-github-pull-request
Details | Review

E.g., https://phabricator.services.mozilla.com/D246494, https://phabricator.services.mozilla.com/D246494, https://phabricator.services.mozilla.com/D246242, https://phabricator.services.mozilla.com/D246679.

This may also be related to an issue that moz-phab is encountering while submitting revised patches, which is:

Phabricator Error: array_walk_recursive() expects parameter 1 to be array, null given

Workaround: manually change the repository field on affected revisions from firefox-autoland to mozilla-central. Or, in the case of beta firefox-beta to mozilla-beta, etc...

Priority: P2 → --
See Also: → 1963801

I don't know if it's related, but something strange seems to have happened to https://phabricator.services.mozilla.com/D246494 on May 26. It's now associated with rFIREFOXBETA firefox-beta when previously it was rMOZILLACENTRAL mozilla-central. If you look in Phabricator, thee only activity is "This revision was automatically updated to reflect the committed changes." There isn't any new commit though so it's not clear what caused that update.

Severity: -- → S2
Priority: -- → P2
Duplicate of this bug: 1968641
Component: Lando → Phabricator
Blocks: hg-to-git

The revision contents history is also strange. For example in https://phabricator.services.mozilla.com/D246494

Diff	ID	Base	Description						Created
Diff 10	1026270									Thu, May 1, 4:51 PM
Diff 11	1042956	2118795	rFIREFOXBETA11b70498842daafd5b6f10aa472e6200c26217fc	Mon, Apr 28, 10:17 AM

The latest diff, which seems like the one that updated the repo, actually has an earlier date than the previous diff.

The Base link on that diff goes to a commit on firefox-autoland not firefox-beta.

This bug also has the side effect of creating unnecessary beta-uplift requests
Example https://bugzilla.mozilla.org/show_bug.cgi?id=1844878#a58418056_600971

When I encountered this issue, I thought that it was just changing the repo, and it is easy enough to change it back via the Phabricator UI.
But it is worse! When an attempt to reland with Lando failed, I took a look at the patch and was surprised that the patch was reverted to a previous state:

I updated the patch to what I had locally. This bug is however surprising, and can result in people landing something other than what they intended!

See Also: → 1959490

This issue is similar to the one fixed in bug 1959490, but that bug only prevented closing revisions. They are still getting updated.

I think you want to move the mustCloseRevision logic from DiffusionUpdateObjectAfterCommitWorker.php to closeRevisions in PhabricatorRepositoryCommitPublishWorker.php.

Something like this:

    $revision = id(new DifferentialRevisionQuery())
      ->setViewer($actor)
      ->withIDs(array($revision_id))
      ->executeOne();
    if (!$revision) {
      return;
    }

    $revisionRepositoryCallsign = $revision->getRepository()->getCallsign();
    $commitRepositoryCallsign = $commit->getRepository()->getCallsign();

    $mustCloseRevision = false;
    if ($revisionRepositoryCallsign === $commitRepositoryCallsign) {
      $mustCloseRevision = true;
    } else {
      $config = PhabricatorEnv::getEnvConfig('diffusion.legacy-repos-mapping');
      if (array_key_exists($revisionRepositoryCallsign, $config)) {
        if ($config[$revisionRepositoryCallsign] === $commitRepositoryCallsign) {
          $mustCloseRevision = true;
        }
      }
    }

    if (!$mustCloseRevision) {
      return;
    }
See Also: 1963373
Duplicate of this bug: 1970312
See Also: → 1974313
Duplicate of this bug: 1974313
See Also: 1974313

This bug appears to still affect most revisions that were backed out in autoland, and were merged today into beta. Those revisions had their target repo changed and the actual diff reverted as well. Manual steps are needed to revert the patch back to what is expected, and to fix the repository on the revision itself.

RE: Comment 7, this approach seems to prevent Phabricator from attaching a "revert" action to the revision when there is a repository mismatch, and instead adds a "mention" in the timeline.

I have not been able to reproduce this issue in a controllable situation unfortunately (i.e., in my local environment) despite using the same steps that trigger this issue in production. I could try implementing this and ensuring it has no undesired side effects, to see if it helps with this bug next time there is a merge.

Summary: Automatically reopened revisions are getting associated with different repo → Automatically reopened revisions are getting reverted & associated with different repo after merge
Attached file GitHub Pull Request
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
No longer blocks: new-lando-cleanup
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: