Skip to content

Conversation

soehms
Copy link
Member

@soehms soehms commented Sep 17, 2025

This PR fixes #40758.

The action https://github.com/sagemath/sage/blob/develop/.github/sync_labels.py should not change "needs work" (maybe "needs info" too, but we don't use that as much so I'm not sure if it has different behaviour currently) to "needs review" when the commit message matches the default message for a merge commit.
Alternatives Considered

This is achieved by ignoring merge commits when the latest commit date is determined in case a s: needs_work label exists. Since s: needs_work persists if there is a more recent review requesting changes this should solve the problem.

Merging develop should still trigger a new CI run. I don't imagine that this change would effect that though.

This remains unchanged.

Check whether merging from the command line with git and merging from the GitHub web interface generate the same default merge commit messages.

In both cases, the predefined message begins with Merge and contains the word develop. I just check that this is valid. However, note that the user (at least in the in the command line) has the option of changing the messages. Therefore, we generally cannot detect merge commits exactly.

This PR also implements a new method test_method just for test purposes. This allows to run arbitrary methods of the class from the command line.

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

@soehms soehms added the github_actions Pull requests that update GitHub Actions code label Sep 17, 2025
@soehms
Copy link
Member Author

soehms commented Sep 17, 2025

Testcase

As a first testcase I use #39881, since this has two merge commits and s: needs_work label set.

pr39881-labels

Since one of the merge commits (1d726b686c97eea0b4ad3bffe3e365ed9c7926f7) is the last commit ({'authoredDate': '2025-04-05T08:03:07Z') the self._commit_date should be set to an earlier date with the fix.

pr39881-commits

Using the new test_method one gets:

sage$ python .github/sync_labels.py https://github.com/sagemath/sage/pull/39881 soehms get_commits {} -t
INFO:root:cmdline_args (4) ['https://github.com/sagemath/sage/pull/39881', 'soehms', 'get_commits', '{}']
...
DEBUG:root:call get_commits with args () and kwds {}
DEBUG:root:================================================================================
DEBUG:root:Execute command: gh pr view https://github.com/sagemath/sage/pull/39881 --json commits
DEBUG:root:Execute command: gh pr view https://github.com/sagemath/sage/pull/39881 --json labels
INFO:root:List of labels for pull request #39881: ['s: needs work', 'c: finite rings']

DEBUG:root:Ignore merge commit 0c56dbebf51d6603b00b4a064944c26ae930462c for commit_date
DEBUG:root:Ignore merge commit 1d726b686c97eea0b4ad3bffe3e365ed9c7926f7 for commit_date

INFO:root:Commits until 2025-04-05T07:59:06Z for pull request #39881: [{'authoredDate': '2025-03-27T22:39:59Z', 'authors': [{'email': 'release@sagemath.org', 'id': '', 'login': '', 'name': 'Release Manager'}], 'committedDate': '2025-03-27T22:39:59Z', 'messageBody': '', 'messageHeadline': 'Updated SageMath version to 10.6.rc1', 'oid': '8a8453f35f3850c74d151a9f1c41778aac1f9e88'}, {'authoredDate': '2025-04-01T07:30:34Z', 'authors': [{'email': 'xavier@caruso.ovh', 'id': '', 'login': '', 'name': 'Xavier Caruso'}], 'committedDate': '2025-04-01T07:30:34Z', 'messageBody': '', 'messageHeadline': "Merge branch 'develop' of https://github.com/sagemath/sage into develop", 'oid': '0c56dbebf51d6603b00b4a064944c26ae930462c'}, {'authoredDate': '2025-04-04T18:16:08Z', 'authors': [{'email': 'xavier@caruso.ovh', 'id': '', 'login': '', 'name': 'Xavier Caruso'}], 'committedDate': '2025-04-04T18:16:46Z', 'messageBody': '', 'messageHeadline': 'improve Frobenius endomorphisms over extensions of finite fields', 'oid': '52b8e19639f7dc03bed605b7528239a9433c540c'}, {'authoredDate': '2025-04-05T06:31:33Z', 'authors': [{'email': 'xavier@caruso.ovh', 'id': '', 'login': '', 'name': 'Xavier Caruso'}], 'committedDate': '2025-04-05T07:33:28Z', 'messageBody': '', 'messageHeadline': 'check finite field in the category', 'oid': '26ff7f192c4905747002aec87f2600abb59015ed'}, {'authoredDate': '2025-04-05T07:59:06Z', 'authors': [{'email': 'xavier@caruso.ovh', 'id': '', 'login': '', 'name': 'Xavier Caruso'}], 'committedDate': '2025-04-05T07:59:06Z', 'messageBody': '', 'messageHeadline': 'add a doctest', 'oid': 'd31a1decaceec003140293c37ad16763454347a8'}, {'authoredDate': '2025-04-05T08:03:07Z', 'authors': [{'email': 'xcaruso@users.noreply.github.com', 'id': 'MDQ6VXNlcjY1MTYwOTg=', 'login': 'xcaruso', 'name': 'Xavier Caruso'}], 'committedDate': '2025-04-05T08:03:07Z', 'messageBody': '', 'messageHeadline': "Merge branch 'develop' into ore_over_extension", 'oid': '1d726b686c97eea0b4ad3bffe3e365ed9c7926f7'}]

INFO:root:result of get_commits with args () and kwds {} is [{'authoredDate': '2025-03-27T22:39:59Z', 'authors': [{'email': 'release@sagemath.org', 'id': '', 'login': '', 'name': 'Release Manager'}], 'committedDate': '2025-03-27T22:39:59Z', 'messageBody': '', 'messageHeadline': 'Updated SageMath version to 10.6.rc1', 'oid': '8a8453f35f3850c74d151a9f1c41778aac1f9e88'}, {'authoredDate': '2025-04-01T07:30:34Z', 'authors': [{'email': 'xavier@caruso.ovh', 'id': '', 'login': '', 'name': 'Xavier Caruso'}], 'committedDate': '2025-04-01T07:30:34Z', 'messageBody': '', 'messageHeadline': "Merge branch 'develop' of https://github.com/sagemath/sage into develop", 'oid': '0c56dbebf51d6603b00b4a064944c26ae930462c'}, {'authoredDate': '2025-04-04T18:16:08Z', 'authors': [{'email': 'xavier@caruso.ovh', 'id': '', 'login': '', 'name': 'Xavier Caruso'}], 'committedDate': '2025-04-04T18:16:46Z', 'messageBody': '', 'messageHeadline': 'improve Frobenius endomorphisms over extensions of finite fields', 'oid': '52b8e19639f7dc03bed605b7528239a9433c540c'}, {'authoredDate': '2025-04-05T06:31:33Z', 'authors': [{'email': 'xavier@caruso.ovh', 'id': '', 'login': '', 'name': 'Xavier Caruso'}], 'committedDate': '2025-04-05T07:33:28Z', 'messageBody': '', 'messageHeadline': 'check finite field in the category', 'oid': '26ff7f192c4905747002aec87f2600abb59015ed'}, {'authoredDate': '2025-04-05T07:59:06Z', 'authors': [{'email': 'xavier@caruso.ovh', 'id': '', 'login': '', 'name': 'Xavier Caruso'}], 'committedDate': '2025-04-05T07:59:06Z', 'messageBody': '', 'messageHeadline': 'add a doctest', 'oid': 'd31a1decaceec003140293c37ad16763454347a8'}, {'authoredDate': '2025-04-05T08:03:07Z', 'authors': [{'email': 'xcaruso@users.noreply.github.com', 'id': 'MDQ6VXNlcjY1MTYwOTg=', 'login': 'xcaruso', 'name': 'Xavier Caruso'}], 'committedDate': '2025-04-05T08:03:07Z', 'messageBody': '', 'messageHeadline': "Merge branch 'develop' into ore_over_extension", 'oid': '1d726b686c97eea0b4ad3bffe3e365ed9c7926f7'}]

INFO:root:================================================================================

DEBUG:root:state of self: {'_url': 'https://github.com/sagemath/sage/pull/39881', '_actor': 'soehms', '_warning_prefix': 'Label Sync Warning:', '_hint_prefix': 'Label Sync Hint:', '_labels': ['s: needs work', 'c: finite rings'], '_author': None, '_draft': None, '_open': None, '_review_decision': None, '_reviews': None, '_reviews_from_rest_api': None, '_review_requests': None, '_commits': [{'authoredDate': '2025-03-27T22:39:59Z', 'authors': [{'email': 'release@sagemath.org', 'id': '', 'login': '', 'name': 'Release Manager'}], 'committedDate': '2025-03-27T22:39:59Z', 'messageBody': '', 'messageHeadline': 'Updated SageMath version to 10.6.rc1', 'oid': '8a8453f35f3850c74d151a9f1c41778aac1f9e88'}, {'authoredDate': '2025-04-01T07:30:34Z', 'authors': [{'email': 'xavier@caruso.ovh', 'id': '', 'login': '', 'name': 'Xavier Caruso'}], 'committedDate': '2025-04-01T07:30:34Z', 'messageBody': '', 'messageHeadline': "Merge branch 'develop' of https://github.com/sagemath/sage into develop", 'oid': '0c56dbebf51d6603b00b4a064944c26ae930462c'}, {'authoredDate': '2025-04-04T18:16:08Z', 'authors': [{'email': 'xavier@caruso.ovh', 'id': '', 'login': '', 'name': 'Xavier Caruso'}], 'committedDate': '2025-04-04T18:16:46Z', 'messageBody': '', 'messageHeadline': 'improve Frobenius endomorphisms over extensions of finite fields', 'oid': '52b8e19639f7dc03bed605b7528239a9433c540c'}, {'authoredDate': '2025-04-05T06:31:33Z', 'authors': [{'email': 'xavier@caruso.ovh', 'id': '', 'login': '', 'name': 'Xavier Caruso'}], 'committedDate': '2025-04-05T07:33:28Z', 'messageBody': '', 'messageHeadline': 'check finite field in the category', 'oid': '26ff7f192c4905747002aec87f2600abb59015ed'}, {'authoredDate': '2025-04-05T07:59:06Z', 'authors': [{'email': 'xavier@caruso.ovh', 'id': '', 'login': '', 'name': 'Xavier Caruso'}], 'committedDate': '2025-04-05T07:59:06Z', 'messageBody': '', 'messageHeadline': 'add a doctest', 'oid': 'd31a1decaceec003140293c37ad16763454347a8'}, {'authoredDate': '2025-04-05T08:03:07Z', 'authors': [{'email': 'xcaruso@users.noreply.github.com', 'id': 'MDQ6VXNlcjY1MTYwOTg=', 'login': 'xcaruso', 'name': 'Xavier Caruso'}], 'committedDate': '2025-04-05T08:03:07Z', 'messageBody': '', 'messageHeadline': "Merge branch 'develop' into ore_over_extension", 'oid': '1d726b686c97eea0b4ad3bffe3e365ed9c7926f7'}], '_commit_date': '2025-04-05T07:59:06Z', '_bot_login': 'soehms', '_gh_version': "b'gh version 2.74.0-19-gea8fc856e (2025-06-09)", '_owner': 'sagemath', '_repo': 'sage', '_number': '39881', '_pr': True, '_issue': 'pull request #39881'}

The assertion is confirmed in the last line: '_commit_date': '2025-04-05T07:59:06Z'! Also note that self._commits still contains the full list of commits, ensuring that the change shouldn't cause a regression with this.

Copy link

github-actions bot commented Sep 17, 2025

Documentation preview for this PR (built with commit 0a3cfe2; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@soehms soehms marked this pull request as ready for review September 17, 2025 17:48
@soehms soehms requested a review from vincentmacri September 17, 2025 17:49
Copy link
Member

@vincentmacri vincentmacri left a comment

Choose a reason for hiding this comment

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

A question and a suggestion.

Also, how can we test this before I approve it?

if Status.needs_work.value in self.get_labels():
for com in date_commits:
message = com['messageHeadline']
if message.startswith('Merge') and message.find('develop') > 0:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if message.startswith('Merge') and message.find('develop') > 0:
if message.startswith("Merge branch 'develop' into "):

Would this work? Since it's more specific it's less likely to have a false positive.

Copy link
Member

Choose a reason for hiding this comment

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

Never mind, I see you already mentioned this. You can ignore this suggestion if you think people changing the merge commit message could be an issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

There are also default messages that wouldn't match, for example in #40448: Merge remote-tracking branch 'upstream/develop' into remove-incremental


# ignore merge commits with the develop branch for commit_date if needs_work is set
date_commits = list(self._commits)
if Status.needs_work.value in self.get_labels():
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason not to include the needs info tag as well here?

Copy link
Member Author

Choose a reason for hiding this comment

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

No! I will include it in the next commit.

@soehms
Copy link
Member Author

soehms commented Sep 18, 2025

Also, how can we test this before I approve it?

This is a bit complicated. I've created a dummy PR (soehms#16) in my fork relative to the branch of this PR. I've declared the latter as the default branch so that GH-Action uses the changes in get_commits.

You should request changes on this PR. Afterwards I will merge the change concerning s: needs info into this PR.

Copy link
Member

@vincentmacri vincentmacri left a comment

Choose a reason for hiding this comment

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

Or is the PR you wanted me to request changes on?

I think that the behaviour being changed here should be agnostic to if changes were requested through the "review changes" interface or someone manually setting the "needs work" label.

@soehms
Copy link
Member Author

soehms commented Sep 19, 2025

Or is the PR you wanted me to request changes on?

We cannot test the new changes with this PR because GH-Actions inherits the code from the base branch of the PR, which is develop.

I think that the behaviour being changed here should be agnostic to if changes were requested through the "review changes" interface or someone manually setting the "needs work" label.

That's right! This is the case when all of the bot's triggers are activated, meaning synchronization is bidirectional, meaning a change in the GH states translates into a change in the labels and vice versa. Currently, the direction from states to labels isn't even fully activated (changes in the review state are missing). For the return path, the activation of label changes is missing. You can see the current activation status in the header of #35927:

image

If all triggers are enabled, your scenario works like this:

  1. A reviewer sets the label s: needs review. The bot adds a review requesting changes. Since this feature is not currently enabled, the reviewer must do this manually.
  2. The author merges the branch into develop. The bot does not change the label because there is no significant commit after the requested changes.
  3. The author pushes a commit with significant changes. The bot changes the label to s: needs review.

Co-authored-by: Vincent Macri <vincent.macri@ucalgary.ca>
@soehms
Copy link
Member Author

soehms commented Sep 19, 2025

Sorry, time is over for the moment. I'll do the s: needs info change later on!

@tobiasdiez
Copy link
Contributor

tobiasdiez commented Sep 19, 2025

I'm wondering (loud) if it makes sense to never change needs work to needs review. Take for example this PR: Vincent had a few remarks, some but not all of them were addressed in a new commit - and the bot put it now onto needs review, although it is still in needs work.

This would also align it a bit better with the github interface: Vincent's review still shows as "requested changes" although there was a commit afterwards.

But I'm probably missing something essential here, in that case, sorry for the noise.


Btw, what's blocking the activation of

submitting a review to a PR, bot reaction: #35172 (comment), #36292

This would be quite convenient to have, and looks very similar to the already active "marking a draft PR as ready for review"

@vincentmacri
Copy link
Member

I'm wondering (loud) if it makes sense to never change needs work to needs review. Take for example this PR: Vincent had a few remarks, some but not all of them were addressed in a new commit - and the bot put it now onto needs review, although it is still in needs work.

I think this came up on sage-devel.

The problem is that changing labels requires certain GitHub permissions that not all contributors (particularly new contributors) have. So if a reviewer requests changes, the changes are made, and the reviewer doesn't look at the changes then the PR will be stuck marked as "needs work" and will probably get ignored. If that happened to one of my PRs I could change the label. If it happens to a new contributor they wouldn't have any way of bringing attention to their PR (besides tagging people, and they probably wouldn't know who to tag and might not be comfortable tagging random people they've never interacted with).

I think the main issue with the bot changing the labels to needs review when it doesn't need a review is that it makes it harder to find PRs that actually need a review. This PR should cut down on that noise a lot, even if there may still be some situations where the bot changes the label too early.

@soehms
Copy link
Member Author

soehms commented Sep 20, 2025

I'm wondering (loud) if it makes sense to never change needs work to needs review. Take for example this PR: Vincent had a few remarks, some but not all of them were addressed in a new commit - and the bot put it now onto needs review, although it is still in needs work.

This would also align it a bit better with the github interface: Vincent's review still shows as "requested changes" although there was a commit afterwards.

But I'm probably missing something essential here, in that case, sorry for the noise.

I also had Vincent's point in mind. On the other hand, a developer who can't set labels has two more options for setting s: needs review after making the requested changes.

  1. The GH-way: Re-request a review from the reviewer who requested the changes. The bot should already be able to set the label. Possible restrictions:

    • I'm not sure if a re-request will trigger the bot in the same way as an initial review request
    • I'm not sure if this feature is commonly known
  2. The brute-force way: Convert the PR to a draft and then back to ready for review after making the requested changes. Possible restrictions:

    • I don't know if this would clear the review status of the PR

In the sage-devel thread, you stated that our s: labels are becoming obsolete:

I second that "needs review" and "needs work" are mostly obsolete and should be better handled by native github tools.

I agree that we shouldn't use these labels directly if possible. However, they may still be necessary to reflect the status of the PR and facilitate searching within PRs. A re-review request attracts less attention than a s: needs review label.

Therefore, we should now focus on one-way synchronization from GH tools to labels. I agree that the more accurately the labels reflect the GH status, the better. From this perspective, I support your suggestion.

Btw, what's blocking the activation of

submitting a review to a PR, bot reaction: #35172 (comment), #36292

This would be quite convenient to have, and looks very similar to the already active "marking a draft PR as ready for review"

I really don't know the answer. I think it just disappeared from the screen.

This would be quite convenient to have, and looks very similar to the already active "marking a draft PR as ready for review"

I agree! If you'd like to activate it, please let me know the date. I'll make the announcement then.

When this is done, the one-way sync mentioned above will be completed. I think this will be enough if the labels will only be set manually when there is no other option!

@user202729
Copy link
Contributor

We cannot test the new changes with this PR because GH-Actions inherits the code from the base branch of the PR, which is develop.

It's possible to test it, which involves forking Sage, enabling GitHub actions on the fork, then merge the PR into the develop branch of the fork, and open a pull request on the fork.

@vincentmacri
Copy link
Member

1. The GH-way: Re-request a review from the reviewer who requested the changes. The bot should already be able to set the label. Possible restrictions:
   
   [...]

   * I'm not sure if this feature is commonly known

We should make things easy for first-time contributors, so we can't expect them to know about this. Especially as many Sage contributors are mathematicians who may have little (if any) familiarity with git/GitHub.

2. The brute-force way: Convert the PR to a draft and then back to _ready for review_ after making the requested changes. Possible restrictions:
   
   * I don't know if this would clear the review status of the PR

Same comment applies, new contributors may not know this.

Ultimately I think the point of this PR is to decrease the noise of unnecessary "needs review" tags with our current workflow.

@vincentmacri
Copy link
Member

We cannot test the new changes with this PR because GH-Actions inherits the code from the base branch of the PR, which is develop.

It's possible to test it, which involves forking Sage, enabling GitHub actions on the fork, then merge the PR into the develop branch of the fork, and open a pull request on the fork.

I think that's what soehms#16 is for.

@soehms
Copy link
Member Author

soehms commented Sep 22, 2025

We should make things easy for first-time contributors, so we can't expect them to know about this.ly

I agree! But we probably need to change the developer guide regarding the use of status labels and focus more on the use of GH tools. I think that's implicit in Tobias's suggestion.

@soehms
Copy link
Member Author

soehms commented Sep 22, 2025

I don't know if this would clear the review status of the PR

I checked this at soehms#16. The GH review status remained.

image

After Re-reqesting changes it looks like this:

image

@soehms
Copy link
Member Author

soehms commented Sep 22, 2025

The bot should already be able to set the label

This assumption was wrong (see soehms#16 (comment)).

@vincentmacri
Copy link
Member

The bot should already be able to set the label

This assumption was wrong (see soehms#16 (comment)).

Setting to needs work then (unless you meant to fix it in a follow-up. I think not changing the status to "needs review" after merging develop is enough for this PR if you'd prefer to keep this small so it can be merged sooner).

@soehms
Copy link
Member Author

soehms commented Sep 22, 2025

I think not changing the status to "needs review" after merging develop is enough for this PR if you'd prefer to keep this small so it can be merged sooner).

That's ok for me!

@vincentmacri
Copy link
Member

I think not changing the status to "needs review" after merging develop is enough for this PR if you'd prefer to keep this small so it can be merged sooner).

That's ok for me!

Is there anything else that needs to be done here then? It seemed to work on soehms#16.

Copy link
Member

@vincentmacri vincentmacri left a comment

Choose a reason for hiding this comment

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

Small changes

Co-authored-by: Vincent Macri <vincent.macri@ucalgary.ca>
@soehms
Copy link
Member Author

soehms commented Sep 22, 2025

Is there anything else that needs to be done here then?

I don't think so!

It seemed to work on soehms#16.

Yes!

@vincentmacri
Copy link
Member

vincentmacri commented Sep 22, 2025

Great! Approved. Thanks for the contribution!

@tobiasdiez
Copy link
Contributor

The problem is that changing labels requires certain GitHub permissions that not all contributors (particularly new contributors) have. So if a reviewer requests changes, the changes are made, and the reviewer doesn't look at the changes then the PR will be stuck marked as "needs work" and will probably get ignored.

This is a good point, and we should indeed make it easy for new contributors to get their PR reviewed. Would it be possible though to restrict this mechanism of resetting the "needs work" label to PRs from people not in the sagemath-triage team? Everyone in that team can change the label themselves.

In the sage-devel thread, you stated that our s: labels are becoming obsolete:

I second that "needs review" and "needs work" are mostly obsolete and should be better handled by native github tools.

I agree that we shouldn't use these labels directly if possible. However, they may still be necessary to reflect the status of the PR and facilitate searching within PRs. A re-review request attracts less attention than a s: needs review label.

GH actually has built-in tools to search for PRs that need review / have changes requested. https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/filtering-and-searching-issues-and-pull-requests#filtering-pull-requests-by-review-status The problem is that those tools are not very useful at the moment in the sage repo since GH reviews are not used consistently but instead people just manipulate the "needs review" label. For newcomers that are familiar with GH, this is another sage-specific thing they would have to learn.

The only real difference is that our labels are a bit more flashy than how GH represents the status - compare "s: needs work" to "Changes requested":
image

Therefore, we should now focus on one-way synchronization from GH tools to labels. I agree that the more accurately the labels reflect the GH status, the better. From this perspective, I support your suggestion.

I hope at some point the "s: needs work" and "s: needs review" could become read only, and are exclusively set by the bot.

Btw, what's blocking the activation of

submitting a review to a PR, bot reaction: #35172 (comment), #36292

This would be quite convenient to have, and looks very similar to the already active "marking a draft PR as ready for review"

I really don't know the answer. I think it just disappeared from the screen.

This would be quite convenient to have, and looks very similar to the already active "marking a draft PR as ready for review"

I agree! If you'd like to activate it, please let me know the date. I'll make the announcement then.

This has to be done by someone in @sagemath/core

@soehms
Copy link
Member Author

soehms commented Sep 23, 2025

Great! Approved. Thanks for the contribution!

Thanks for the review!

@soehms
Copy link
Member Author

soehms commented Sep 23, 2025

Would it be possible though to restrict this mechanism of resetting the "needs work" label to PRs from people not in the sagemath-triage team?

If the bot would login as an organization member (as I explained here) this should be possible.

GH actually has built-in tools to search for PRs that need review / have changes requested.

Thanks! Good link. I never used that.

I hope at some point the "s: needs work" and "s: needs review" could become read only, and are exclusively set by the bot.

I hope so too. But a lot of convincing work certainly still needs to be done.

This has to be done by someone in @sagemath/core

Ah! I remember that you did that in the past, didn't you.

@soehms soehms mentioned this pull request Sep 23, 2025
10 tasks
vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 24, 2025
sagemathgh-40839: Fix in label synchronization bot according to issue sagemath#40758
    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

This PR fixes sagemath#40758.

> The action
https://github.com/sagemath/sage/blob/develop/.github/sync_labels.py
should not change "needs work" (maybe "needs info" too, but we don't use
that as much so I'm not sure if it has different behaviour currently) to
"needs review" when the commit message matches the default message for a
merge commit.
Alternatives Considered

This is achieved by ignoring merge commits when the latest commit date
is determined in case a `s: needs_work` label exists. Since `s:
needs_work` persists if there is a more recent review requesting changes
this should solve the problem.

> Merging develop should still trigger a new CI run. I don't imagine
that this change would effect that though.

This remains unchanged.

> Check whether merging from the command line with git and merging from
the GitHub web interface generate the same default merge commit
messages.

In both cases, the predefined message begins with `Merge` and contains
the word `develop`. I just check that this is valid. However, note that
the user (at least in the in the command line) has the option of
changing the messages. Therefore, we generally cannot detect merge
commits exactly.

This PR also implements a new method `test_method` just for test
purposes. This allows to run arbitrary methods of the class from the
command line.


### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#40839
Reported by: Sebastian Oehms
Reviewer(s): Sebastian Oehms, Vincent Macri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
github_actions Pull requests that update GitHub Actions code s: positive review t: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not change PR from "needs work" to "needs review" after merge commit
4 participants