Skip to content

[trymerge] Test that lower stacked PRs skip the same checks as the top PR - #205625

Closed
izaitsevfb wants to merge 3 commits into
mainfrom
iz/trymerge-stacked-gate-flags
Closed

izaitsevfb wants to merge 3 commits into
mainfrom
iz/trymerge-stacked-gate-flags

Conversation

@izaitsevfb

@izaitsevfb izaitsevfb commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

✴️ iz2: merge_into runs check_stacked_pr_merge_rule on each lower stacked PR, but no test checked that it forwards skip_mandatory_checks and skip_internal_checks. Hardcoding either to False in that loop left test_trymerge.py green. The -i waivers in the same call were already covered by test_gates_lower_prs_before_landing.

This adds test_lower_prs_skip_the_same_checks_as_the_top_pr, which sets each flag alone and both together, and checks the internal-skip answer comes from the top PR's merge comment. It also rewords the docstring of test_merge_ghstack_into_gates_lower_prs_with_the_waivers: that test covers merge_ghstack_into's own gate, which production skips (every caller passes skip_all_rule_checks=True since #203462).

Follow-up to #203140's review. Test-only.

Test plan: python -m unittest test_trymerge: the new test passes; it fails with either flag hardcoded to False in merge_into's loop, with the two flags swapped, with the internal skip dropped only when both are set, or with can_skip_internal_checks called per lower PR. lintrunner (FLAKE8, PYFMT) clean.

@pytorch-bot

pytorch-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

PR Status: Approved 🚀

Please fix all CI failures and trigger merge by commenting "@pytorchbot merge".

⚪ AUTOMATED REVIEW - Review did not complete:

reason: model_error

Reviewed commit: a30b173

Review run

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/205625

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit a30b173 with merge base 10ae82b (image):
💚 Looks good so far! There are no failures yet. 💚

🟢 GREEN LIGHT - PR approved to be merged without human review:

  • Triviality
    • Test changes: diff touches only .github/scripts/test_trymerge.py, adding one test and rewording one test docstring
    • trymerge.py mentions test_trymerge.py only in a comment and never imports it, so the merge-authorization stop does not reach it
  • Test correctness
    • merge_into computes can_skip_internal_checks(self, comment_id) once and forwards both flags to check_stacked_pr_merge_rule for lower PRs
    • check_stacked_pr_merge_rule passes both flags to the patched find_matching_merge_rule, which is what the new test asserts on for [self.top, self.lower]
  • Scope
    • setUp only binds the existing can_skip_internal_checks patch to self.skip_internal; no assertion or production code removed

reason: clean
Reviewed commit: a30b173

Inference job

🐛 Report a wrong verdict

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorchgreenlight pytorchgreenlight Bot added the GL/approved Approved by GreenLight label Nov 19, 2026
@pytorchbot pytorchbot added the in progress PR is being worked on by the author, until the automated review accepts it label Nov 19, 2026
github-actions[bot]

This comment was marked as outdated.

Swapping skip_mandatory_checks and skip_internal_checks in merge_into's
lower-PR loop passed the old test, which set both True. Also assert the
internal-skip answer comes from the top PR's merge comment.
@izaitsevfb izaitsevfb changed the title [trymerge] Test that a forced merge skips the same checks on lower stacked PRs [trymerge] Test that lower stacked PRs skip the same checks as the top PR Nov 19, 2026

@github-actions github-actions Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⏳ Automated review in progress for a30b173 (run); its result will replace this review.

Previous automated review of 8652186

Automated review of 8652186: nothing blocking; ready for human review.

The PR adds test_lower_prs_skip_the_same_checks_as_the_top_pr, which checks that merge_into passes the top PR's skip_mandatory_checks and skip_internal_checks through to the rule check on each lower stacked PR, and it rewords one docstring. Recommendation: Approve. Nothing blocks; the only remaining point is a non-blocking test gap.

⚪ 1 non-blocking finding

for mandatory, internal in ((True, False), (False, True)):

Non-blocking: the rewrite dropped the case where both flags are True. The earlier version ran only (True, True); the new loop runs (True, False) and (False, True), and test_gates_lower_prs_before_landing covers (False, False). No test in the file now checks (True, True) on merge_into's lower-PR call (trymerge.py:1711-1720). A mutation like changing trymerge.py:1717 to skip_internal_checks=skip_internal_checks and not skip_mandatory_checks matches today's behaviour in the three tested combinations, differs only at (True, True), and the whole file still passes. test_merge_into_hands_the_guard_the_gate_it_just_ran sets both flags True but merges a single PR, so the lower-PR loop never runs; the end-to-end classes return False from can_skip_internal_checks and never pass skip_mandatory_checks. Production impact: in a forced merge whose comment also qualifies for the internal skip, the lower PRs would lose the internal skip. Fix: use ((True, False), (False, True), (True, True)).

This review is AI-generated and advisory. Each new automated review replaces the previous one. Report a bad review

@izaitsevfb

Copy link
Copy Markdown
Contributor Author

✴️ iz2: (AI-generated) Merging on Ivan's behalf.
@pytorchbot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 19, 2026
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request GL/approved Approved by GreenLight in progress PR is being worked on by the author, until the automated review accepts it Merged topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants