Skip to content

Conversation

@deepsm007
Copy link
Contributor

When a PR is created from an outdated base branch commit, git diff-tree comparisons can be incorrect because they compare against the old base SHA instead of finding the actual merge point.

This fix uses git merge-base to find the common ancestor between the base SHA and HEAD, ensuring accurate change detection even when:

  • The base branch has moved forward significantly
  • The PR was created from an outdated commit
  • Merge commits exist in the PR history

This resolves the issue where pj-rehearse fails to detect changes until the PR is rebased onto the latest base branch.

/cc @danilo-gemoli @openshift/test-platform

/hold

@openshift-ci-robot
Copy link
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@openshift-ci openshift-ci bot requested review from a team and danilo-gemoli December 15, 2025 14:10
@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 15, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 15, 2025

Walkthrough

Compute and use a merge-base in getRevChanges (pkg/config/release.go) for diffs (with fallback), tighten error reporting in prepareCandidate to return the rebase error, and expand the empty-job message in getJobsTableLines (cmd/pj-rehearse/server.go).

Changes

Cohort / File(s) Summary
Merge-base calculation for diff refinement
pkg/config/release.go
getRevChanges now computes a merge-base between base and HEAD, trims it, and uses mergeBase:path as the left-hand side for git diff-tree; on merge-base failure it falls back to the original base. Existing ignore/filtering and post-processing remain.
Rebase error propagation
cmd/pj-rehearse/server.go
prepareCandidate returns the actual rebaseErr when rebasing fails instead of a generic err, improving error specificity.
Empty jobs message expansion
cmd/pj-rehearse/server.go
getJobsTableLines expands the returned message when there are no presubmits or periodics to include guidance about possible rebasing and step-registry changes, and adds extra line breaks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 15, 2025
@deepsm007
Copy link
Contributor Author

/test images

@danilo-gemoli
Copy link
Contributor

I'm not sure the code we are changing here is ever exercised by pj-rehearse. If my understanding is correct, this is the relevant part. What do you think?

When a PR is created from an outdated base branch commit, git diff-tree
comparisons can be incorrect because they compare against the old base
SHA instead of finding the actual merge point.

This fix uses git merge-base to find the common ancestor between the
base SHA and HEAD, ensuring accurate change detection even when:
- The base branch has moved forward significantly
- The PR was created from an outdated commit
- Merge commits exist in the PR history

This resolves the issue where pj-rehearse fails to detect changes
until the PR is rebased onto the latest base branch.

Related: Fixes issue where rehearsable tests are not detected when
PR base branch is outdated
@deepsm007 deepsm007 force-pushed the fix-pj-rehearse-merge-base-detection branch from 017e948 to 1d15dd1 Compare January 27, 2026 14:49
@deepsm007 deepsm007 changed the title fix: use merge-base for accurate change detection in pj-rehearse DPTP-4632: use merge-base for accurate change detection in pj-rehearse Jan 27, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jan 27, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Jan 27, 2026

@deepsm007: This pull request references DPTP-4632 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

When a PR is created from an outdated base branch commit, git diff-tree comparisons can be incorrect because they compare against the old base SHA instead of finding the actual merge point.

This fix uses git merge-base to find the common ancestor between the base SHA and HEAD, ensuring accurate change detection even when:

  • The base branch has moved forward significantly
  • The PR was created from an outdated commit
  • Merge commits exist in the PR history

This resolves the issue where pj-rehearse fails to detect changes until the PR is rebased onto the latest base branch.

/cc @danilo-gemoli @openshift/test-platform

/hold

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 27, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 27, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deepsm007, Prucek

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepsm007
Copy link
Contributor Author

/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 27, 2026
@deepsm007
Copy link
Contributor Author

/test images

@openshift-ci-robot
Copy link
Contributor

Scheduling required tests:
/test e2e

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test integration-optional-test

@deepsm007
Copy link
Contributor Author

/override ci/prow/integration-optional-test

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 27, 2026

@deepsm007: Overrode contexts on behalf of deepsm007: ci/prow/integration-optional-test

Details

In response to this:

/override ci/prow/integration-optional-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 27, 2026

@deepsm007: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/breaking-changes 1d15dd1 link false /test breaking-changes

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit 4728410 into openshift:main Jan 27, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants