Skip to content

fix(tree-compare): default Base to the older revision - #2139

Merged
felipebergamin merged 4 commits into
kernelci:mainfrom
profusion:fix/2130/swap-default-compare-revisions
Oct 5, 2026
Merged

felipebergamin merged 4 commits into
kernelci:mainfrom
profusion:fix/2130/swap-default-compare-revisions

Conversation

@felipebergamin

@felipebergamin felipebergamin commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

What it is

Tree compare treated A as "from" and B as "to", but defaulted A to the branch head and B to the previous revision. A failure on the newest checkout was therefore labelled fixed instead of a regression.

Defaults are now chronological. Base is the previous revision and Compare is the current or latest checkout. Opening compare from tree details pre-fills the viewed commit as Compare and the page fills Base with the revision before it. The selector, tables, grouped tests table, and details drawer say Base and Compare instead of Side A and Side B, matching GitHub's naming.

The URL now carries one git-style param, range=<base>..<compare>, instead of hashA and hashB. Either side may be empty; the page fills the missing side and rewrites the URL once both are known. Once both hashes are set they are not reordered by timestamp. Only the swap button exchanges them. Change types (regression, fixed, and so on) follow Base to Compare. The API request params (hash_a, hash_b) are unchanged.

Closes #2130

How to test

  1. Open the tree listing with a wide window (/tree?i=300), pick a tree's latest checkout, and click "Compare revisions". The URL should read compare?range=..<hash> and then change to range=<previous>..<hash> once commits load.
  2. Confirm Compare is the current head and Base is the previous revision. A PASS to FAIL from previous to head shows as a regression.
  3. Change Base and Compare in the dropdowns, including a newer Base and an older Compare. Reload. The order stays as selected and the summary and row change types follow Base to Compare.
  4. Click swap. The range in the URL, the columns, and the change types invert together.
  5. Use "Previous commit" and "Branch head" on one card. Only that side of the range changes.
  6. Optional: open compare from the oldest commit in the history graph. Base may stay empty (known, non-critical; the listing and latest-checkout path is unaffected).

Visual reference

image

@felipebergamin
felipebergamin marked this pull request as ready for review September 25, 2026 18:24
<SortableHead
className="text-center"
intlKey="treeCompare.sideB"
intlKey="treeCompare.target"

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.

since we are renaming from sideA/sideB, I believe we could use nomenclature closer to what github does with base/compare, instead of base/target

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.

Also, if we are already changing nomenclature, might be worth to change url params as well.
I would go with the proposal from @mentonin of using two dots ...

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.

Those comments are not blockers. But suggestions.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@alanpeixinho I agree with the changes to the URL params. But I changed only on frontend, I'm afraid that changing the API params now can break other API consumers (I don't know if someone is already consuming the comparison api)

also renamed Target to Compare

@felipebergamin
felipebergamin force-pushed the fix/2130/swap-default-compare-revisions branch from 2f6dc14 to ae9a94a Compare October 2, 2026 19:47
@felipebergamin

Copy link
Copy Markdown
Member Author

@alanpeixinho requesting a new review because I changed the URL params and renamed the Base/Target to Base/Compare.

Also requesting review from @tales-aparecida

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

Looks great

Comment thread dashboard/src/utils/treeCompareDiff.ts Outdated
}

/** Mirror backend _CHANGE_COUNT_SELECT categories for A→B transitions. */
/** Mirror backend _CHANGE_COUNT_SELECT categories for base→target transitions. */

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.

change base -> compare

)}
>
{side}
{side === 'base' ? 'B' : 'C'}

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.

nit: Do we still need those labels? They were more important when we named sides A and B

felipebergamin and others added 4 commits October 5, 2026 19:04
The compare page defaulted side A to the branch head and side B to the
previous revision, while deriveCompareChange reads A as the 'from' side.
A test that started failing on the newest revision was therefore
classified as 'fixed' instead of a regression.

Default side B to the branch head and side A to the revision before it,
and pre-fill the current revision as side B when opening compare from
Tree Details, so the default A -> B direction is oldest -> newest.

Closes kernelci#2130
Side A/B hid the comparison direction. Use Base (from) and Target (to) in
the selector, tables, and drawer; URL params stay hashA/hashB.
Replace the hashA/hashB search params with a single git-style `range`
param, `<base>..<compare>`, so the URL reads the same way the page is
labelled. Either side may be empty; the page still fills the missing
side (compare defaults to the branch head, base to the revision before
it) and rewrites the URL once both are known.

The API request params (hash_a/hash_b) are unchanged.

Part of kernelci#2130

Signed-off-by: Felipe Bergamin <felipebergamin@profusion.mobi>
Co-authored-by: Cursor <cursoragent@cursor.com>
Main's grouped tests table and tree-compare kci-dev button still
referenced the old side names after the Base/Compare rename, so the
frontend typecheck failed on the merge with main.

Signed-off-by: Felipe Bergamin <felipebergamin@profusion.mobi>
Co-authored-by: Cursor <cursoragent@cursor.com>
@felipebergamin
felipebergamin force-pushed the fix/2130/swap-default-compare-revisions branch from 6ce3a54 to e6b3ab7 Compare October 5, 2026 22:04
@felipebergamin
felipebergamin added this pull request to the merge queue Oct 5, 2026
Merged via the queue into kernelci:main with commit d1d04f2 Oct 5, 2026
7 checks passed
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.

[AB Comparison] Swap default revisions in A-B comparison

3 participants