Repository navigation
Anchor the Build profile diff master baseline windows on the run's own event - #115007
Conversation
…n event `Build profile diff` failed closed with "No master baseline with build profile data found - cannot compare" whenever CI was re-run some days after it was first triggered, even though the baseline rows were present. `find_baseline` intersected two sets measured from different origins. The candidate set is the PR's anchored master chain, frozen at the head's `HEAD^1` (`master_track_commits_sha`), so it is chain relative. The row filter was `date >= today() - BASE_DAYS`, where `date` is the upload date, so it was wall-clock relative. A GitHub Actions re-run replays the frozen event payload: the chain stays anchored on the old merge base while `today()` moves on, and once the gap exceeds BASE_DAYS the intersection is empty by construction rather than for lack of data. On the run that prompted this the workflow's created_at was 2026-08-06T13:03:49Z while run_started_at was 2026-08-16T01:28:41Z, a ten-day gap against a seven-day window. `extend_master_shas` carried a second instance of the same mismatch: it walks from a chain commit but stopped on a wall-clock date. Every master-side window is now derived from `info.event_time`, which is stamped with the event and therefore frozen across a re-run, as a closed interval [anchor - N, min(anchor + UPLOAD_DELAY_DAYS, today)], and the first-parent walk takes the same anchor so it yields exactly the commits those windows accept. The interval is closed rather than half-open because `date` leads the primary key of all three profile tables: a bounded range prunes on it, and the width stays fixed at N + UPLOAD_DELAY_DAYS however old the event is, so it slides instead of growing. A half-open form would make the oldest pull requests issue the heaviest queries against a cluster that already has a recorded per-user memory ceiling. UPLOAD_DELAY_DAYS covers the gap between a master commit and the last upload of its profile, measured over 673 master arm_release commits at 4 hours p99 and 85 hours maximum. PR-side windows keep `today() - PR_DAYS`: those rows are uploaded by this run, so they are always fresh, and widening them would only admit an older attempt of the same commit. An anchor at today reproduces the previous behaviour exactly, and an absent event_time (only LocalInfo, where --base-sha is mandatory and short-circuits the baseline lookup) keeps the wall-clock windows. Both fail-closes are unchanged: an empty result after anchoring is still a genuine absence of data.
The first-parent walk and the per-TU SQL window share an anchor, but the window admits rows the walk could not supply. The window's lower bound is a calendar day, so it accepts uploads from that day's midnight, while the walk stopped at the anchor's time of day: commits earlier on the boundary day were absent. The window also deliberately admits a profile uploaded up to UPLOAD_DELAY_DAYS after its commit, and those commits are older than the bound, so the walk never reached them either. The tail the upper bound exists to admit was therefore the tail whose shas were missing. A missing sha is not a silent narrowing. The per-TU query intersects on `commit_sha IN (...)`, so a translation unit whose only baseline lives on an absent commit loses its rows and falls into the new-TU branch, which is significant and reports "N new translation units without a master baseline" against the pull request. Under-reaching the walk turns a delayed upload on master into a finding about somebody's change. The walk now stops at midnight UTC of the window's lower bound minus UPLOAD_DELAY_DAYS, so the chain it returns is a superset of the commits the window can return a row for. The horizon widens from TU_BASE_DAYS to TU_BASE_DAYS + UPLOAD_DELAY_DAYS; measured against master, that costs 21 listing fetches for 1247 first-parent commits, well inside EXTEND_MAX_PAGES.
Internal second-model reviewAn independent model reviewed this change cold against the repository's review
On 1. The walk now stops at midnight of On 2. Replaced by the invariant as a relation over event ages of 0, 1, 10 and On 3. It yields a superset, not an equality. Corrected before publishing, On 4. Refuted twice over. The query travels in the POST body rather than the On 5. The premise is right in kind and wrong in direction: the warmup build On 6. The new helpers follow this file's established convention for stating One residual, disclosed and not chased: the closed upper bound can miss a master |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-review-slot-10:20260816-131400 |
|
Workflow [PR], commit [e16427c] Summary: ✅ AI ReviewSummaryThis PR fixes Final Verdict✅ No new review findings. |
|
cc @maxknv, could you review this? |
CI finish ledger - e16427cCI is fully finished on this head and there are no failures to own: 177 leaves, 6 OK and 171 SKIPPED, 0 dropped, praktika top-level
The high skip count is expected for a Note the two earlier runs at this same head (13:52Z, 15:51Z) were voided by the Session id: cron:our-pr-ci-monitor:20260816-220000 |
076ea56
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Build profile difffails closed withNo master baseline with build profile data found - cannot comparewhen CI is re-run days after it was triggered, eventhough the baseline rows are present. Failing run:
PR #113672 @
494760825.find_baselineintersects two sets measured from different origins: thecandidates are the frozen first-parent chain of the head's master parent
(
master_track_commits_sha, chain relative), while the row filter wasdate >= today() - BASE_DAYS(wall-clock relative). A re-run replays the frozenevent payload, so the chain stays anchored on the old merge base while
today()moves on, and once the gap exceeds
BASE_DAYSthe intersection is empty byconstruction. On the run above,
created_atis2026-08-06T13:03:49Zagainst arun_started_atof2026-08-16T01:28:41Z: ten days, seven-day window. Eightmore sites share the mismatch, so fixing only
find_baselinerelocates theerror.
Every master-side window now derives from
info.event_time, frozen with theevent, as a closed interval
[anchor - N, min(anchor + 4 days, today)]. Thefirst-parent walk takes the same anchor and stops a whole upload day further
back, so the chain it returns is a superset of what those windows can match.
Closed rather than half-open because
dateleads the primary key of the profiletables: the width is then fixed however old the event is, so the window slides
rather than grows. The upper bound allows for profiles uploaded after their
commit, measured at 4 hours p99 and 85 hours max over 673 master
arm_releasebuilds.
Pull request side windows keep
today() - PR_DAYS: those rows are uploaded bythe run itself. An anchor at today emits the same windows as before, a local run
keeps the wall-clock ones, and both fail-closes stand.
Driving the job with that run's real values reproduces the error on the current
module and resolves the baseline here.
Version info
26.8.1.1528(included in26.8and later)