Skip to content

internal(pytest-mergify): honour an empty and a refused test selection - #140

Open
AlexandreGaubert wants to merge 1 commit into
mainfrom
devs/alexandregaubert/devs/alexandregaubert/pytest-empty-and-refused-selection/honour-empty-refused-test-selection--f86da8d1
Open

internal(pytest-mergify): honour an empty and a refused test selection#140
AlexandreGaubert wants to merge 1 commit into
mainfrom
devs/alexandregaubert/devs/alexandregaubert/pytest-empty-and-refused-selection/honour-empty-refused-test-selection--f86da8d1

Conversation

@AlexandreGaubert

@AlexandreGaubert AlexandreGaubert commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

The engine is gaining two answers on the test-selection endpoint that no
published client knows: empty -- the predecessor's attempt of this job
already ran these tests and they passed, so run none of them -- and
refused -- several sessions share this job's name and collected the
same tests, so Mergify will not guess which one this run succeeds. Both
fall through the plugin's forward-compatibility guard today and quietly
run the full suite, which would make the feature's most visible outcome
never happen, and would leave an ambiguous job answered wrongly forever
with no symptom to notice.

Teach the plugin both. An empty answer empties the collection through
pytest's own deselection hook, so the session still finishes and still
uploads -- a job that legitimately ran nothing is the one a developer
comes asking about, and a shorter exit during collection would make it
the only one missing from Mergify's reporting -- and the run exits 0
instead of pytest's "no tests ran" code 5. A refused answer raises
pytest.UsageError, showing the server's own explanation of what it saw and
what to change -- the copy belongs there so it can be corrected without
publishing a client -- and marks the uploaded session errored so it cannot be
read as a clean empty one. Every other value
keeps degrading to a full run, which is what lets the engine grow
answers without breaking clients already published; the crate-level test
pinning that now uses a variant nothing implements, empty having
stopped being one.

pytest only. Vitest and Playwright share the Rust decoder but normalise
in their own TypeScript and have test selection disabled for the pilot
(MRGFY-8906), so wiring them now would be work on a path nobody runs.
They keep degrading to a full run on both answers, deliberately.

Fixes MRGFY-8931

@mergify
mergify Bot had a problem deploying to Mergify Merge Protections September 1, 2026 15:22 Failure
@mergify

mergify Bot commented Sep 1, 2026

Copy link
Copy Markdown

Merge Protections

🔴 2 of 6 protections blocking · waiting on 👀 reviews

Protection Waiting on
🔴 👀 Review Requirements 👀 reviews
🔴 🔎 Reviews 👀 reviews
🟢 🤖 Continuous Integration
🟢 Enforce conventional commit
🟢 📕 PR description
🟢 🚦 Auto-queue

🔴 👀 Review Requirements

Waiting for

  • #approved-reviews-by>=2
This rule is failing.
  • any of:
    • #approved-reviews-by>=2
    • author = dependabot[bot]
    • author = mergify-ci-bot
    • author = renovate[bot]

🔴 🔎 Reviews

Waiting for

  • #review-requested = 0
This rule is failing.
  • #review-requested = 0
  • #changes-requested-reviews-by = 0
  • #review-threads-unresolved = 0

Show 4 satisfied protections

🟢 🤖 Continuous Integration

  • all of:
    • check-success=ci-gate

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|internal|docs|style|refactor|perf|test|build|ci|chore|revert|ui)(?:\(.+\))?!?:

🟢 📕 PR description

  • body ~= (?ms:.{48,})

🟢 🚦 Auto-queue

When all merge protections are satisfied, this pull request will be queued automatically.

@mergify
mergify Bot requested a review from a team September 1, 2026 15:25
@AlexandreGaubert
AlexandreGaubert force-pushed the devs/alexandregaubert/devs/alexandregaubert/pytest-empty-and-refused-selection/honour-empty-refused-test-selection--f86da8d1 branch from cadc7ca to 2d73fdd Compare September 1, 2026 15:49
@AlexandreGaubert

AlexandreGaubert commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Revision history

# Type Changes Reason Date
1 initial cadc7ca 2026-09-01 15:49 UTC
2 content cadc7ca → 2d73fdd (raw) show the engine's own refusal message (real contract from monorepo#39711) instead of a hard-coded string 2026-09-01 15:49 UTC
3 content 2d73fdd → 739f042 (raw) correct four comments the message-key delta made false (lens pass) 2026-09-01 15:59 UTC
4 content 739f042 → d7e6522 (raw) rewrite the refusal copy for a CI user (Alexandre's review): what happened first, then why, then the fix with its docs link 2026-09-02 07:05 UTC

@mergify
mergify Bot had a problem deploying to Mergify Merge Protections September 1, 2026 15:50 Failure
@AlexandreGaubert
AlexandreGaubert force-pushed the devs/alexandregaubert/devs/alexandregaubert/pytest-empty-and-refused-selection/honour-empty-refused-test-selection--f86da8d1 branch from 2d73fdd to 739f042 Compare September 1, 2026 15:59
@mergify
mergify Bot had a problem deploying to Mergify Merge Protections September 1, 2026 15:59 Failure
The engine is gaining two answers on the test-selection endpoint that no
published client knows: `empty` -- the predecessor's attempt of this job
already ran these tests and they passed, so run none of them -- and
`refused` -- several sessions share this job's name and collected the
same tests, so Mergify will not guess which one this run succeeds. Both
fall through the plugin's forward-compatibility guard today and quietly
run the full suite, which would make the feature's most visible outcome
never happen, and would leave an ambiguous job answered wrongly forever
with no symptom to notice.

Teach the plugin both. An `empty` answer empties the collection through
pytest's own deselection hook, so the session still finishes and still
uploads -- a job that legitimately ran nothing is the one a developer
comes asking about, and a shorter exit during collection would make it
the only one missing from Mergify's reporting -- and the run exits 0
instead of pytest's "no tests ran" code 5. A `refused` answer raises
`pytest.UsageError`, showing the server's own explanation of what it saw and
what to change -- the copy belongs there so it can be corrected without
publishing a client -- and marks the uploaded session errored so it cannot be
read as a clean empty one. Every other value
keeps degrading to a full run, which is what lets the engine grow
answers without breaking clients already published; the crate-level test
pinning that now uses a variant nothing implements, `empty` having
stopped being one.

pytest only. Vitest and Playwright share the Rust decoder but normalise
in their own TypeScript and have test selection disabled for the pilot
(MRGFY-8906), so wiring them now would be work on a path nobody runs.
They keep degrading to a full run on both answers, deliberately.

Fixes MRGFY-8931

Change-Id: If86da8d1092f9aff8643cddfa2f6f99d90873b69
@AlexandreGaubert
AlexandreGaubert force-pushed the devs/alexandregaubert/devs/alexandregaubert/pytest-empty-and-refused-selection/honour-empty-refused-test-selection--f86da8d1 branch from 739f042 to d7e6522 Compare September 2, 2026 07:05
@mergify
mergify Bot had a problem deploying to Mergify Merge Protections September 2, 2026 07:07 Failure
@AlexandreGaubert
AlexandreGaubert marked this pull request as ready for review September 2, 2026 08:23
@mergify
mergify Bot requested a review from a team September 2, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants