Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComposerLockDiff can overwrite a manually edited change in a PR description #317

Closed
deviantintegral opened this issue Oct 28, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@deviantintegral
Copy link
Member

The ComposerLockDiff job is subject to a race condition, where a user's changes can be reverted:

  1. A PR is opened and jobs start.
  2. As the job runs, the job downloads a copy of the pull request description.
  3. The author edits the PR description and saves it.
  4. After processing, the job pushes up its copy of the PR description, missing the changes from step 3.

This could also go the other way, where a manual edit removes the lock diff table.

Surprisingly, this is actually a limitation of GitHub. There's no way to pass in a version ID, timestamp, or anything to ensure an underlying field of a pull request hasn't changed. Last edit wins: https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#update-a-pull-request

Instead, the job should post a comment and place its information in it. That way, there's far less of an expectation that users need to manually edit the contents.

@davereid
Copy link
Member

davereid commented Jan 4, 2024

I just ran into this today where I was editing a PR body and had my changes lost without any recovery.

@davereid
Copy link
Member

davereid commented Jan 4, 2024

Anything that needs to be updated automatically should likely be done in a sticky pull request comment.

@davereid
Copy link
Member

davereid commented Jan 4, 2024

I've used https://github.com/marocchino/sticky-pull-request-comment for this in the past.

@justafish
Copy link
Member

Closing in favour of #332

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants