Repository navigation
Conversation
test_registry_edits_do_not_schedule_a_run_without_profile_data asserted that a registry-only diff leaves Build (arm_release) skipped. That is not what the premise needs, and it is false on master since ClickHouse#113491 merged: Parser memory check lists ./ci/defs/defs.py and ./ci/defs/job_configs.py in its digest and requires CLICKHOUSE_EXAMPLES, which the arm_release build provides, so the rescue pass in _filter_unaffected_jobs keeps the build alive. It is the only job in the registry that digests those two files; the paths were added in 010deac, answering a review comment asking that the PR enabling the check would schedule the check itself. CI Tests is red on every PR whose base carries the test file, for a reason unrelated to the PR under test. A scheduled build is not the signal. The build's own digest excludes ci/defs, so a rescued build can still be a cache hit and upload no profile, while an edit to the build's declaration - timeout, runs_on, command, all of which live in job_configs.py - moves its config_digest (1e087300da7377c11505-de68 -> ...-9243), a cache miss that really does rebuild and really does produce a profile. So neither "skipped" nor is_affected_by expresses what the job needs, and ci/defs paths cannot satisfy BUILD_FREE_DIFFS' contract of not changing the profiled build's output. Drop the two registry params from that list, and drop the function, whose second assertion duplicated them verbatim. The one invariant they carried that nothing else covers is that this job's own digest must not track the registry: a job digesting the registry that declares every job becomes affected by every unrelated CI edit, and would then run with nothing to compare. Asserted directly, which makes no claim about the build. Mutation-checked against the real workflow: pasting the registry onto this job's digest and removing its digest both redden (the first only through the new test), while adding the registry to the build's digest stays green, because there the build genuinely rebuilds and the comparison it wants does exist. Narrowing Parser memory check's digest also stays green, so that cleanup is not blocked by a test.
The previous commit asserted only that the diff job's own digest does not track the registry. That misses a second way a registry edit can reach the job. _filter_unaffected_jobs keeps an unaffected job scheduled when an affected job requires it, by name or by artifact. That pass reads requires and provides and never consults the rescued job's digest_config, so an is_affected_by assertion is structurally blind to it. It is the same mechanism as the failure this test file describes, one hop further along: the rescue that reaches the profiled build reaching the diff job instead, which would run it with nothing to compare. Measured: making an affected job require the diff job by name left the suite green. The disjunction is what keeps the assertion honest in the other direction. The registry declares the build, so an edit to it can move the build's own cache key; there is then a fresh profile and the comparison is real, so the job legitimately runs. Asserting the job is always skipped would call that correct behaviour a regression. ci/workflows/pull_request.py is the same registry class as the two ci/defs files - it is where the job is added to the workflow, and Parser memory check digests it for that reason - but was not covered. Pasting it onto the job's own digest also left the suite green. Both mutations are detected now. Purely additive: no assertion is removed or weakened, and the file collects three more tests than before this PR.
Internal second-model review (2 rounds, all findings resolved)Reviewed cold against the code, then adjudicated with the implementation evidence. Two review
Verified independently rather than taken from the implementation notes:
|
Pre-PR validation gate
Collected tests 37 -> 40; the count is asserted, not just the exit code, because deleting a test always greens a file. |
|
Workflow [PR], commit [795e626] Summary: ✅ AI ReviewSummaryThis PR replaces a false registry-diff assertion in Missing context / blind spots
Findings
Final VerdictRequest changes: the new regression test is close, but the registry-path allowance is still checking the wrong invariant and can fire on correct future behavior. |
|
cc @leshikus, could you review this? It replaces a master-red assertion in the build profile diff scheduling test: the test claimed a registry-only diff leaves |
| outcome: the registry declares the build, so an edit to it can move the build's own | ||
| key, and then there is a fresh profile and the comparison is real. | ||
| """ | ||
| assert BPD in _schedule(changed_files) or _job(PROFILED_BUILD).is_affected_by( |
There was a problem hiding this comment.
This still uses the wrong signal for the "fresh profile exists" branch. _job(PROFILED_BUILD).is_affected_by(changed_files) only checks digest_config.include_paths / submodules in Job.Config.is_affected_by, while the build's actual cache key also includes serialized job-config fields in Digest.calc_job_digest such as timeout, runs_on, command, and run_after.
Concretely, Build (arm_release) returns False for both ci/defs/job_configs.py and ci/workflows/pull_request.py here, even though those declarations can re-key the build (calc_job_digest(replace(build, timeout=...)) != calc_job_digest(build), likewise for run_after). That means a future config-digest-aware scheduling fix would still look like a regression to this test even when a fresh profile really exists.
Could this compare against the build's real digest/key change signal instead of is_affected_by, or otherwise stay scoped to today's "the job remains skipped" behavior?
There was a problem hiding this comment.
Confirmed the premise, and it is the reason the registry params were removed from BUILD_FREE_DIFFS rather than kept: the config half of the key moves for timeout, runs_on, command and run_after (4/4 field edits change it) while is_affected_by stays False for all three registry paths. The PR description already records that gap as out of scope.
On the consequence, I measured both plausible shapes of a config-digest-aware fix against the committed assertion:
- fix inside
is_affected_by, so the build tracks the declarations that key it: assertion passes, because the test reads the same predicate the fix corrects. - fix in the scheduler only, leaving
is_affected_byas it is: assertion fails, as you describe.
So the concern is shape-dependent rather than unconditional. I am keeping the assertion, because both alternatives measure worse:
Staying scoped to "the job remains skipped" is strictly worse on your own axis. assert BPD in _schedule(changed_files) alone fails both shapes above, where the disjunction survives the first, and it is the form that was red on master.
Comparing against the real key is not writable at this layer. Digest.calc_job_digest takes no changed_files, so "did this diff re-key the build" needs the other head's tree, and the file half of the key walks 665994 paths per arm.
If the scheduler-side fix ever lands, that PR should move this assertion with it.
|
Closing: the feature this test covers is no longer on
The assertions themselves are not wrong - they just have no subject anymore. If #115221 is ever re-landed, this branch is worth reviving alongside it (or folding into it), because the scheduling condition it pins is exactly the part that got reverted. |
Related: #113491
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
CI Testsis red on master:test_registry_edits_do_not_schedule_a_run_without_profile_dataasserts a registry-only diff leaves
Build (arm_release)skipped, so every PRwhose base carries the test file inherits it.
The assertion is false, and asks the wrong question.
Parser memory checkdigestsboth registry files and requires
CLICKHOUSE_EXAMPLES, which thearm_releasebuild provides, so the rescue pass in
_filter_unaffected_jobskeeps the buildscheduled. But a scheduled build was never the signal either way: the build's own
digest excludes
ci/defs, so a rescued build can be a cache hit that uploads noprofile, while an edit to the build's own declaration (
timeout,runs_on,command) moves itsconfig_digest(...-de68->...-9243), a cache miss thatdoes rebuild and produce a profile. So
ci/defspaths cannot satisfyBUILD_FREE_DIFFS' contract of not changing the build's output. I drop those twoparams, and the function whose second assertion duplicated them.
What they carried is asserted directly instead, over all three registry files
(adding
ci/workflows/pull_request.py) and claiming nothing about the build: thisjob's own digest must not track the registry, and a registry edit must reach the
job only through the build. The registry declares every job, so digesting it makes
a job affected by every unrelated CI edit; and the rescue pass reads
requiresand
providesonly, so a rescue reaching this job is invisible to a digestassertion.
Not a weakening: the file asserts three cases more than before. Mutation-checked
against the real workflow - pasting the registry onto this job's digest, removing
its digest, and a rescue reaching it all redden. Adding the registry to the
build's digest stays green, correctly: the build rebuilds, so the comparison
exists. The old params called that a regression.
Out of scope: a registry edit moving the build's
config_digestproduces aprofile while this job stays filtered, needing config-digest-aware scheduling.
Workflow [PR]
Sync PR [sync-upstream/pr/115749]