Skip to content

[trymerge] Revive test_merge_ghstack_into, delete dead test_gql_retrieve_checksuites - #203140

Closed
izaitsevfb wants to merge 7 commits into
mainfrom
iz2/trymerge-revive-ghstack-test
Closed

izaitsevfb wants to merge 7 commits into
mainfrom
iz2/trymerge-revive-ghstack-test

Conversation

@izaitsevfb

@izaitsevfb izaitsevfb commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

✴️ iz2: Both tests have been @skip-ped for over a year, so they cover nothing.

test_merge_ghstack_into is revived. It is the only test of how merge_ghstack_into lands a ghstack: merged PRs are skipped but listed as dependencies, each open PR is cherry-picked and then its message amended, bottom-up, and only the open PRs are returned. It broke because the stack in its fixtures has since merged, so all four PRs read as closed and nothing was cherry-picked. The test now mocks is_closed to the state it describes, and mocks find_matching_merge_rule and the lower PR's check runs (the real ones need check-run pages the fixtures lack) while asserting the arguments the lower PR is checked with; the waivers test now asserts its whole rule-check call. Expected messages match the fixtures' current text. Sixteen mutations of merge_ghstack_into each make the ghstack tests fail.

test_gql_retrieve_checksuites is deleted. GitHub no longer returns check suites for its PR (the fixture has none), and the bug it was added for in #95333 is still caught: reverting that fix makes test_get_classifications_similar_failures and test_get_classifications_wrong_workflow_name fail.

Meta's internal CI runs this file too and has had both tests stuck as disabled since the target briefly failed to import in October: a test that only skips never passes enough to be re-enabled.

Test plan: python -m unittest test_trymerge passes (277 tests); internal trymerge_test (fbcode and xplat) goes from 275 pass, 2 skip to 276 pass, 0 skip.

…eve_checksuites

✴️ iz2: Both tests have been `@skip`-ped for over a year, so they cover nothing.

`test_merge_ghstack_into` is revived. It is the only test of how `merge_ghstack_into` lands a ghstack: merged PRs are skipped but listed as dependencies, open PRs are cherry-picked bottom-up with amended messages, and only the open PRs are returned. It broke because the stack in its fixtures has since merged, so all four PRs read as closed and nothing was cherry-picked. The test now mocks `is_closed` to the state it describes, and mocks `find_matching_merge_rule`, whose real check needs check-run pages the fixtures lack (the three tests after it cover that gate). Expected messages match the fixtures' current text. Eight mutations of `merge_ghstack_into` each make it fail.

`test_gql_retrieve_checksuites` is deleted. GitHub no longer returns check suites for its PR (the fixture has none), and the bug it was added for in #95333 is still caught: reverting that fix makes `test_get_classifications_similar_failures` and `test_get_classifications_wrong_workflow_name` fail.

Meta's internal CI runs this file too and has had both tests stuck as disabled since the target briefly failed to import in October: a test that only skips never passes enough to be re-enabled.

Test plan: `python -m unittest test_trymerge.TestGitHubPRGhstackDependencies` passes; internal `trymerge_test` (fbcode and xplat) goes from 275 pass, 2 skip to 276 pass, 0 skip.
@izaitsevfb
izaitsevfb requested a review from a team as a code owner November 3, 2026 01:10
@pytorch-bot pytorch-bot Bot added the topic: not user facing topic category label Nov 3, 2026
@pytorch-bot

pytorch-bot Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

PR Status: Approved 🚀

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

✅ AUTOMATED REVIEW - Ready for human review:

The PR brings back the skipped `test_merge_ghstack_into`, mocks the lower PR's
check runs, pins `classification_wait=None`, and deletes the skipped
`test_gql_retrieve_checksuites`. Recommendation: Approve. Only a non-blocking
wording point on the new comment remains.

Findings (1):

[minor] .github/scripts/test_trymerge.py:1546
Non-blocking: the new comment says "the tests below cover how their errors and
waivers are handled". The tests below it in this class do cover merge-rule
errors, waiver forwarding and a failing job. They do not cover the
startup-failure branch, which is the only branch that reads the
`get_checkrun_conclusions` mocked here. Its test is
`test_a_startup_failure_refuses_even_when_dr_ci_excuses_it` in
`TestStackedPrChecks` (around line 4232). They also do not cover the pending-job
branch, whose test is `test_a_pending_ciflow_job_waits` (around line 4225) in
the same class. Consider pointing the comment at `TestStackedPrChecks` for those
two cases.

Reviewed commit: 9e47ae9

Review run

🐛 Report a bad review

🔗 Helpful Links

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

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

✅ You can merge normally! (1 Unrelated Failure)

As of commit 9e47ae9 with merge base b2f99f7 (image):

🟡 GREEN LIGHT - OUTDATED (earlier commit) - PR requires human review:

  • Test deleted without a source change
    • Removes test_gql_retrieve_checksuites from .github/scripts/test_trymerge.py with no trymerge.py change behind it
    • Never trivial covers a deleted test, and Explained test changes only covers adding skips or updating expected messages
  • Existing test rewritten, not added
    • test_merge_ghstack_into swaps the read_merge_rules mock for mocks of is_closed, find_matching_merge_rule and can_skip_internal_checks
    • It now calls merge_ghstack_into(mock_repo, False, comment_id=7) and rewrites the expected messages, so it is not an Additive test
  • Open review question on merge plumbing coverage
    • The automated review's major finding says the waivers test pins skip_mandatory_checks=True with waivers, a combination merge() never passes
    • The author has disputed it in-thread, so a human should settle what the test should pin

reason: not_trivial
Reviewed commit: 8734c20 (NOT the current head 9e47ae9)

Inference job

🐛 Report a wrong verdict

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

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

This comment was marked as outdated.

github-actions[bot]

This comment was marked as outdated.

github-actions[bot]

This comment was marked as outdated.

github-actions[bot]

This comment was marked as outdated.

@izaitsevfb

Copy link
Copy Markdown
Contributor Author

✴️ iz2: Replied in-thread to the latest blocking finding (the waivers test pins what merge_ghstack_into forwards; the True + waivers call predates this PR, and the previous round asked to pin True). Re-running the review without a push.
@pytorchbot review

@pytorch-bot pytorch-bot Bot added in progress PR is being worked on by the author, until the automated review accepts it and removed in progress PR is being worked on by the author, until the automated review accepts it labels Nov 3, 2026
github-actions[bot]

This comment was marked as outdated.

…hstack-test

# Conflicts:
#	.github/scripts/test_trymerge.py
github-actions[bot]

This comment was marked as outdated.

@jeanschmidt jeanschmidt 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.

lgtm

#203691 routes merge_ghstack_into's lower-PR gate through
check_stacked_pr_merge_rule, which unpacks the rule check's 4-tuple,
forwards classification_wait and reads the lower PR's checks unless
skip_mandatory_checks. Return a 4-tuple from the mocked rule check, pin
classification_wait=None in both full-call assertions, and stub
get_checkrun_conclusions in test_merge_ghstack_into as main's sibling
test does.
@pytorchgreenlight pytorchgreenlight Bot added GL/superseded GreenLight review is superseded by changes and removed GL/human GreenLight marked as needing human review labels Nov 18, 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 of 9e47ae9: nothing blocking; ready for human review.

The PR brings back the skipped test_merge_ghstack_into, mocks the lower PR's check runs, pins classification_wait=None, and deletes the skipped test_gql_retrieve_checksuites. Recommendation: Approve. Only a non-blocking wording point on the new comment remains.

⚪ 1 non-blocking finding

# merge-rule check and the lower PR's checks are mocked; the tests below cover

Non-blocking: the new comment says "the tests below cover how their errors and waivers are handled". The tests below it in this class do cover merge-rule errors, waiver forwarding and a failing job. They do not cover the startup-failure branch, which is the only branch that reads the get_checkrun_conclusions mocked here. Its test is test_a_startup_failure_refuses_even_when_dr_ci_excuses_it in TestStackedPrChecks (around line 4232). They also do not cover the pending-job branch, whose test is test_a_pending_ciflow_job_waits (around line 4225) in the same class. Consider pointing the comment at TestStackedPrChecks for those two cases.

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

@github-actions
github-actions Bot dismissed stale reviews from themself November 18, 2026 18:17

Withdrawn: the automated review of 9e47ae9 found nothing blocking.

@github-actions
github-actions Bot dismissed stale reviews from themself November 18, 2026 18:17

Withdrawn: the automated review of 9e47ae9 found nothing blocking.

@huydhn huydhn 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.

LGTM!

@izaitsevfb

Copy link
Copy Markdown
Contributor Author

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

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 18, 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

pytorchmergebot pushed a commit that referenced this pull request Nov 19, 2026
…p PR (#205625)

✴️ 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.
Pull Request resolved: #205625
Approved by: https://github.com/pytorchgreenlight, https://github.com/jeanschmidt
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/superseded GreenLight review is superseded by changes 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.

5 participants