Skip to content

check_kernel_commits.py: Fix corner case around Fixes: commits (cve-bf)#74

Open
roxanan1996 wants to merge 1 commit into
mainlinefrom
{rnicolescu}_fixes_better_check
Open

check_kernel_commits.py: Fix corner case around Fixes: commits (cve-bf)#74
roxanan1996 wants to merge 1 commit into
mainlinefrom
{rnicolescu}_fixes_better_check

Conversation

@roxanan1996

Copy link
Copy Markdown
Contributor

Original issue: ctrliq/kernel-src-tree#1212 (comment)

In the above link, we had a weird case where commit X was reverted by commit Y, but then our cve tracker picked the X commit again (why is irrelevant to this story).

check_kernel_commits.py did not detect any issues locally, but it did flag it during the validate step when the PR was created. The discrepancy is due to the fact that, locally, the whole pr/local branch is fetched, but during Pr reviews, only the new commits are fetches, hence the history is way limited, which is more than enough considering that the 'fixes:' (cve-bf) commits should be applied after the commit of interest.

While the different results locally vs during Pr review make sense, we need to catch issues like this locally, during development as well.

Because locally we cannot fetch just the new commits (we need the whole history to make sure we cherry pick commits properly), check_kernel_commits now checks the interval of commits it has to check.

And since we ran into this weird case described at the beginning, flag a warnining in case a commit X has a cve-bf that was applied beforehand so that the developer sees it and acts accordingly and not be confused during Pr review.

Jira ticket https://ciqinc.atlassian.net/browse/KERNEL-970

Copilot AI review requested due to automatic review settings June 8, 2026 13:51

Copilot AI 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.

Pull request overview

This PR updates the kernel commit checking/cherry-pick helpers to better handle a corner case where Fixes: (cve-bf) commits may appear “already applied” locally (full history) but “unapplied” in PR validation (limited fetched history), and adds local warning output to highlight that situation.

Changes:

  • Add interval-limited commit existence checks (via base_commit_hash) to better emulate PR-validation’s limited history.
  • Split “find Fixes in mainline” from “filter unapplied in branch” to allow reuse and clearer composition.
  • Update check_kernel_commits.py to compare full-history vs limited-history results and emit a warning when Fixes: commits were applied before the fetched interval.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
kt/ktlib/ciq_helpers.py Adds interval support to commit lookup and introduces helpers to filter unapplied Fixes commits.
ciq-cherry-pick.py Switches Fixes discovery to the new “unapplied” helper.
check_kernel_commits.py Emulates PR-validation’s limited history locally and warns on the “Fixes applied before interval” corner case.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread kt/ktlib/ciq_helpers.py
Comment thread kt/ktlib/ciq_helpers.py Outdated
Comment thread check_kernel_commits.py Outdated
@roxanan1996 roxanan1996 force-pushed the {rnicolescu}_fixes_better_check branch from bb6097c to 3c4feb2 Compare June 8, 2026 14:24
@PlaidCat PlaidCat requested a review from Copilot June 8, 2026 14:46

Copilot AI 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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

Comment thread kt/ktlib/ciq_helpers.py
Comment thread kt/ktlib/ciq_helpers.py
Comment thread check_kernel_commits.py Outdated
Comment thread check_kernel_commits.py
Comment thread check_kernel_commits.py
Comment thread check_kernel_commits.py
PlaidCat
PlaidCat previously approved these changes Jun 8, 2026

@PlaidCat PlaidCat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

:shipit:

Thanks for addressing the comments and updating from base_commit_hash to interval ... I'm not sure why but it made more more sense with the lastest update.

Original issue: ctrliq/kernel-src-tree#1212 (comment)

In the above link, we had a weird case where commit X was reverted by commit Y,
but then our cve tracker picked the X commit again (why is irrelevant to this story).

check_kernel_commits.py did not detect any issues locally, but it did flag it
during the validate step when the PR was created. The discrepancy is due to
the fact that, locally, the whole pr/local branch is fetched, but during Pr
reviews, only the new commits are fetches, hence the history is way limited,
which is more than enough considering that the 'fixes:' (cve-bf) commits should
be applied after the commit of interest.

While the different results locally vs during Pr review make sense, we need
to catch issues like this locally, during development as well.

Because locally we cannot fetch just the new commits (we need the whole
history to make sure we cherry pick commits properly), check_kernel_commits
now checks the interval of commits it has to check.

And since we ran into this weird case described at the beginning, flag a
warnining in case a commit X has a cve-bf that was applied beforehand so that
the developer sees it and acts accordingly and not be confused during Pr
review.

Signed-off-by: Roxana Nicolescu <rnicolescu@ciq.com>
@roxanan1996

Copy link
Copy Markdown
Contributor Author

I just fixed a typo, the rest of the copilot feedback I found pedantic tbh.

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.

3 participants