Skip to content

pr-flow: linux needs the full KUnit matrix at the head before arming or merging - #20

Open
RyanTheTide wants to merge 5 commits into
feat/pr-flowfrom
feat/pr-flow-kunit
Open

RyanTheTide wants to merge 5 commits into
feat/pr-flowfrom
feat/pr-flow-kunit

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Stacked on #14 (pr-flow). It goes with aurora-silicon/linux#3675, which runs only the touched Apple KUnit suites on unapproved PRs. Without this, a green narrow run plus an approval would let pr-flow's armed auto-merge land a linux PR that never ran the full matrix.

For linux PRs that touch apple-build-kunit.yml's pull_request_target paths, read from the workflow on the PR's base branch with GitHub's glob rules, can_arm() now also requires every one of the 16 KUnit suites to have a SUCCESS check run at the head. It's evaluated last, only when everything else holds, and cached per head for the run, so it adds API calls only for linux PRs that would otherwise be armed or merged. It fails closed: missing, queued, cancelled or failed suites, API errors, or a truncated file or check list keep the PR unarmed, and an already-armed PR is disarmed by the existing can_arm() check.

An approved PR that is otherwise ready but not yet proven gets the kunit-full label from pr-flow's maintainer token, which starts the full run (labels from the workflow token start nothing). Other repositories are unchanged.

Tested: live, against the current linux PRs:

  • kunit_proven gives #3483 not proven (6 suites queued), #3605 and #1489 proven, and #2103 not proven (apple-spmi-nvmem missing).
  • An unknown head or base branch gives unknown.
  • The path parser finds all 25 globs of the workflow on main.
  • can_arm() is False for unproven #3483, True for proven #3605, and True for a mesa PR with the same inputs.

No runtime change: automation only.
Risk: two-way door (revert removes the gate). Macs: none. Until the full run passes, linux PRs that touch the KUnit paths wait one extra full-matrix run before they merge.

…or merging

linux#3675 runs only the touched Apple KUnit suites on unapproved PRs.
A green narrow run must not let an approval auto-merge the PR, so for
linux PRs that touch apple-build-kunit.yml's pull_request_target paths
(read from the workflow on the PR's base branch), can_arm() now also
needs every one of the 16 suites to have a SUCCESS check run at the
head. The check runs last, only when everything else already holds,
and is cached per head for the run. It fails closed: missing, queued,
cancelled or failed suites, API errors, 3000+ files or 2000+ check runs
keep the PR unarmed, and an armed PR is disarmed by the existing
can_arm() check.

An approved PR that is otherwise ready but not yet proven gets the
kunit-full label from pr-flow's maintainer token, which starts the full
run (labels from the workflow token start nothing).

Checked live: #3483 not proven (6 suites queued), #3605 and #1489
proven, #2103 not proven (apple-spmi-nvmem missing); an unknown head
or base branch is unknown; can_arm() is False/True accordingly and
unchanged for other repositories.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: FINISH at 8bdf39cc.

Checked: Path-based applicability now blocks an in-scope PR with no checks. Both arm and merge consult the predicate.

Blocker: The predicate unions successes by check name across all returned runs. It can count a suite from an older full result even when a newer full attempt is cancelled or failed, and can combine suites from distinct workflow runs. Require evidence from the intended Apple KUnit workflow and one complete successful full attempt for the evaluated head. Apply the same rule to the manual train predicate. Add cases for mixed attempts and an earlier pass with a newer failed or cancelled full attempt. Before tiering goes live, deploy the gate and drain or disarm applicable pre-existing arms.

…e head

Review: the predicate unioned SUCCESS check runs by name across every
run at the head, so an older full pass could hide a newer cancelled or
failed full attempt, and suites from different runs could combine.

kunit_proven() now reads the KUnit workflow's runs for the head and
their latest-attempt jobs. The newest run that ran all 16 suites
decides: all success proves it; anything else (failed, cancelled,
queued) does not. Older runs never count, a newer narrow run with a
failed suite blocks, and skipped event twins are ignored. The train's
predicate (kunit-full-ok.py) uses the same function.

Deploying this disarms already-armed linux PRs that are not proven,
through the existing can_arm() check on the next run.

Checked live: #3483 not proven (newest full attempt queued), #3605 and
#1489 proven by named runs, #2103 not proven (no run covered all 16
suites); offline: older pass + newer cancelled or failed full attempt,
suites split across runs, narrow pass/fail after a full pass, running
attempt, skipped twin, no runs.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: FINISH at 4957739e.

The workflow-specific run and job lookup now prevents mixing old suites across runs. A newer full attempt cancelled before matrix creation produces fewer than 16 jobs and is still treated as narrow. An entirely queued attempt also has no jobs. The loop can then accept the previous full pass. Distinguish positively identified narrow/skipped attempts from incomplete attempts of unknown or full scope, and add queued and pre-matrix cancellation controls. Keep #3675 behind deployment of the corrected gate.

…ly narrow runs are passed over

Review: an attempt cancelled before its matrix existed, or still fully
queued, has fewer than 16 suite jobs and was passed over as narrow, so
an older full pass could stand behind it.

Walking the KUnit workflow's runs newest first, a run is passed over
only when it is positively narrow: completed (success or failure, not
cancelled), its 'KUnit plan' job succeeded, and all its KUnit jobs
finished; its failed suites still block. A queued or running run, a
cancelled run, or a short run without a successful plan job (unknown
scope) blocks. The train predicate uses the same function.

Offline (13 cases): queued attempt with no jobs, cancellation before
the matrix, narrow run without a plan job, build-only narrow run, and
the earlier cases. Live: #3483 not proven (newer attempt queued),

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
#2103 not proven (run 45719130829 ran 15 of 16 suites), #3605 and
#1489 proven.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: FINISH at 39c56270.

Checked: Queued and pre-matrix cancelled attempts now block correctly. The all-suites branch still returns success for a completed run whose workflow conclusion is cancelled or failed if the 16 suite jobs individually succeeded. Require a successful workflow conclusion before accepting a full attempt, and test a completed cancelled or failed workflow with green suite jobs. Apply the same rule in the manual predicate.

Review: a completed run whose 16 suite jobs passed but whose workflow
concluded cancelled or failed was accepted. The newest full attempt now
also needs conclusion success. Same rule in the train predicate. Tests:
green suites in a cancelled run, in a failed run, and behind an older
pass.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: MERGE at 2f51e440 after #14 and hosted validation.

Checked: Both the scheduler and manual predicate now require the full workflow to conclude successfully. Replayed green-suite attempts with success, cancellation and failure against both functions. Only success passed. Keep deployment ahead of Linux #3675, and clear applicable pre-existing auto-merge arms before activating tiering.

The 12-01 merge bar makes the fast gate build plus touched-area tests.
The newest complete KUnit run at the head whose plan job succeeded and
whose selected suites all passed now proves KUnit, as a full attempt
did before. A newer red or unfinished run still blocks. The kunit-full
label is added only when no KUnit run exists at the head, so approved
PRs no longer start the whole matrix.
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Pushed 85bbc22 under the 12-01 merge bar (fast gate = build + touched-area tests): the newest complete KUnit run at the head whose plan job passed and whose selected suites are all green now proves KUnit, same as a full attempt. A newer red or unfinished run still blocks. kunit-full is added only when no KUnit run exists at the head. Pairs with linux#3738 (per-PR suite plan). Deployed on the buildbox from deploy/pr-flow-20261130-kunit at b248f8e. pr-flow-test.py passes.

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.

1 participant