Skip to content

landing_checks: block commits with REPO- flag mismatch (bug 2032267)#1091

Open
shtrom wants to merge 3 commits intomainfrom
bug2032267/repo-blocker
Open

landing_checks: block commits with REPO- flag mismatch (bug 2032267)#1091
shtrom wants to merge 3 commits intomainfrom
bug2032267/repo-blocker

Conversation

@shtrom
Copy link
Copy Markdown
Member

@shtrom shtrom commented Apr 16, 2026

No description provided.

@github-actions
Copy link
Copy Markdown

View this pull request in Lando to land it once approved.

)
return

if match := REPO_FLAG_RE.search(firstline):
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Note: this is the simplest implementation, added to the existing CommitMessagesCheck. This means we won't be able to selectively disable only the REPO- check.

I think it should be sufficient for our purpose, though.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agreed, I think this is okay to move here. :)

@shtrom shtrom force-pushed the bug2032267/repo-blocker branch from d356116 to f3a45db Compare April 16, 2026 07:34
self.commit_message_issues.append(
f"Commit locked to another repo than {self.repo_name}: {commit_message}"
)
return
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Question: By returning early here, and in other checks below, we only give a single error at a time per commit message. Should we instead not return and present all errors at once?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we can detect and warn about more issues that sounds like a good idea. Since we return a single string as the result of each check, it becomes a question of how the string is displayed in the UI.

I'd say this is acceptable for now, and in the future we can improve the checks so something more dynamic is returned from each warning/blocker.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We return nothing here. We just add one error message with the commit message, and give up. We could add all the errors regarding every commit message in one go.

Given the way we currently render the errors, though, this would be trading off cognitive load for repeated partial fixes.

@shtrom shtrom marked this pull request as ready for review April 17, 2026 01:22
@shtrom shtrom requested a review from a team as a code owner April 17, 2026 01:22
self.commit_message_issues.append(
f"Commit locked to another repo than {self.repo_name}: {commit_message}"
)
return
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we can detect and warn about more issues that sounds like a good idea. Since we return a single string as the result of each check, it becomes a question of how the string is displayed in the UI.

I'd say this is acceptable for now, and in the future we can improve the checks so something more dynamic is returned from each warning/blocker.

),
"`git-format-patch` cruft should result in a failed check.",
),
(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we expand this to cover more of the test cases from the hg hook?

)
return

if match := REPO_FLAG_RE.search(firstline):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agreed, I think this is okay to move here. :)

if not self.skip_checks(job, new_commits) and repo.hooks_enabled:
patch_helpers = repo.scm.get_patch_helpers_for_commits(new_commits)
landing_checks = LandingChecks(job.requester_email)
landing_checks = LandingChecks(job.requester_email, repo.name)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Using repo.name here may be problematic, as the repo.name is the name in lando, e.g., firefox-autoland, which doesn't match the name that the VCT hook uses, e.g., autoland. This means either one or the other check will choke...

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.

2 participants