Repository navigation
Revert "Fix propagation of settings in accurateCastOrDefault" - #114911
alexey-milovidov merged 1 commit into
Conversation
|
The ReproducerCREATE TABLE t (s String, ip IPv6 MATERIALIZED toIPv6OrDefault(s)) ENGINE = MergeTree ORDER BY tuple();
INSERT INTO t (s) VALUES ('::1');
-- Code: 49. DB::Exception: Context has expired: while executing function toIPv6OrDefaultAny stored expression using Affected versions (verified by running the reproducer on CI builds):
No published release carries the bug yet. The next Next step: revert backport #114689 on the CC introducer author: @Avogar Analysis metadata
|
The `-- MATERIALIZED default whose cast overflows` arm took its expected value from `toDateTimeOrDefault`, so it asserted that a `to<Type>OrDefault` function honours `date_time_overflow_behavior`. That only holds while ClickHouse#109946 is in the tree. It is reverted on master by ClickHouse#114911, where `FunctionCastOrDefault` goes back to `castColumnAccurateOrNull` with a null context and therefore always saturates. The arm passes on this pull request's base, which predates the revert, and fails against master: 2149-06-06 2013-04-29 17:31:44 expected, wrap-around 2149-06-06 2106-02-06 00:00:00 actual, saturating That is why the private sync reported this test as the only new failure, in every stateless job it ran in, while the public checks stayed green. Spelling the conversion as an explicit `CAST` pins the arm to `CastOverloadResolverImpl`, which is what this change is about, and makes it read the same before and after the revert. Verified against three binaries - master `d59f2be34ed3` with the revert in effect, this pull request's head, and the private sync build - all of which reproduce the reference byte for byte. The reference file is unchanged. Related: ClickHouse#109946 Related: ClickHouse#114911 Related: ClickHouse#114912 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Edited following .claude/skills/edit-changelog/SKILL.md, by hand on a workstation: the editing step of the NightlyChangelog job has been failing its own verification since 2026-08-12, so three raw blocks had accumulated (47 + 84 + 628 entries). Of the 759 raw entries, 482 are integrated into the in-progress 26.8 section and 277 are dropped: - Section 3: the 300 `NOT FOR CHANGELOG / INSIGNIFICANT` entries are dropped, except 41 that describe a user-visible change and are promoted into a real category, among them a server abort on a corrupt `ORC` stripe footer (#114924), `EXPLAIN ANALYZE` for streaming queries (#112445), `SELECT` from `TimeSeries` (#115622), streaming watermarks (#106169), and the `clickhouse-local` CORS overrides (#115129). - Section 2: every revert in the range cancels out inside it, so neither side appears. Two are re-applications: #114912 re-applies the `accurateCastOrDefault` fix, so #109946 keeps its entry with both links and the intervening revert #114911 is gone; #114409 re-applies the PromQL streaming plan, recorded on the #113656 entry. - Section 4: `Build/Testing/Packaging Improvement` keeps the seven entries a user, packager or from-source builder notices (musl `getaddrinfo` and `sched_getcpu`, signed macOS artifacts, Debian packages for release builds only, zstd-compressed Docker layers, `unit_tests_dbms` without the full library set, vendored Rust built with optimizations locally) and drops the CI plumbing. - Sections 5 and 6: bare pull request URLs converted to links, settings put in backticks, four entries rewritten from developer notes into user-visible descriptions, and three moved into `Performance Improvement`. No entry of a strict-retention category was deleted: the job's own `verify_edit` passes on this edit. Not done here, because the release manager does it at release time: the full significance sort, the aggressive merging of sibling pull requests, and the `FIXME` release date and presentation links.
Address review: `resolve_reverted_originals` granted deletion credit to every raw-block revert with a `Reverts owner/repo#N` marker, even when that revert was itself reverted later in the same range — so an edit dropping `#109946` (reverted by `#114911`, which `#114912` reverted in turn) still passed verification while the fix ships in the release. Now the resolved reverts are walked in descending PR-number order (a revert always has a higher number than its target): an uncancelled revert cancels the reverts it targets and only uncancelled reverts contribute deletion credit. Because a revert of a revert made through the web UI can lack the body marker (`#114912` has none), the target is also resolved from the nested title — `Revert "Revert "X""` binds to the earlier range revert titled `Revert "X"`. PR: #116221 Co-Authored-By: Claude Fable 5 <[email protected]>
`verify_edit` was only net-effect aware inside one raw block, while the job edits a release cycle in ~30 nightly increments and a revert chain routinely spans them: 1. run N integrates `#109946`; 2. run N+1 sees `#114911` and deletes `#109946`; 3. run N+2 sees only raw `#114912`. On run N+2 nothing disappears in the edit — `#109946` went away the previous day — so verification passed with a shipped fix missing from `CHANGELOG.md`, and the editing agent had no way to know the entry ever existed: it is gone from the file, and the intervening revert is gone from the raw blocks. The branch now carries that memory itself, in trailers on its own edit commits, the same way `Changelog-generated-up-to:` carries the generation point: Changelog-revert: <revert> <reverted> <title of the revert> Changelog-deleted-entry: <pull request> <its bullet as it was deleted> `analyze_reverts` resolves each run's reverts against that ledger and reduces the *cumulative* graph, so a chain spread over several runs behaves exactly like one arriving in a single raw block, at any depth: - the reduction is what decides deletion credit, so a cancelled revert licenses nothing; - an entry recorded as deleted whose revert is no longer uncancelled has to be back in `CHANGELOG.md` — `verify_edit` fails the run while it is not, and the prompt asks for it by name, quoting the bullet from the ledger; - the recorded titles also let a web-UI `Revert "Revert "X""` (which carries no `Reverts owner/repo#N` marker) bind to an earlier revert the job saw days ago. A branch whose edit commits predate the trailers has an empty ledger and keeps the previous behaviour. `ci/tests/test_changelog_nightly_revert_ledger.py` pins the timelines: the whole chain in one block, the revert alone, the revert of the revert arriving after the deletion, a revert of the re-apply, an empty ledger, and an unresolvable revert.
`reapplied_by` walked one level out from the direct remover, so it found the revert that first put a change back and stopped there. With `#109946` ← `#114911` ← `#114912` ← `#115500` ← `#116000` — out, back, out, back, all inside one cycle — it reported only `#114912`, which the recorded bullet already carried from the first restoration. The re-apply check was therefore satisfied by the stale line and `#116000` was lost for good: a revert of a revert has no bullet of its own, so the link on the entry is its only trace in the release. `revert_chain` now walks the whole chain above the entry, and the uncancelled reverts of that chain are the ones that ship, so they are the ones that belong on the bullet. `removed_by` is the complement — the cancelled ones — which also makes the prompt name both removals of a repeated cycle instead of the first. The three-pull-request case is unchanged: one remover, one re-applier. The prompt asks for the links of every re-applier, noting that some may already be on the recorded line from an earlier restoration. `test_a_longer_chain_records_every_reapply` walks the five-pull-request timeline and asserts `removed_by == ['114911', '115500']`, `reapplied_by == ['114912', '116000']`, that replaying the recorded line is rejected for missing `#116000`, and that appending it passes. It fails with the one-level walk.
…llow them Two fail-open paths, both from the verifier only ever checking one direction. **`credits` allowed a deletion but never required it.** An uncancelled revert made the disappearance of an entry acceptable; leaving the entry in place was acceptable too, so a change that is out of the release could be published. The `withheld` check now covers all of `credits`, not only the entries an earlier run had already deleted: a revert arriving today licenses a deletion the agent still has to make. With the fix and its revert in one raw block, keeping the entry now fails with `Entries whose revert still stands are in the in-progress section (['#109946 (reverted by #114911)'])`. **The re-apply link was only required of entries being restored.** When the whole chain arrives in one raw block the entry never left the section, so `missing` is empty and the link went unchecked - the same loss as before, by a different route. The requirement is now stated for every entry that ships and was ever reverted, and checked wherever that entry sits. The prompt gets the matching "Entries to amend" list, so it asks for exactly what the verifier requires; the cancelled revert left visible next to such an entry is caught by the first fix. Two tests added, the ones the review asked for, plus the "cancelled revert still visible" variant. `changelog()` in the tests now builds a raw block with several `#### Category` sections, the shape the generator really emits, so the same-range case can put the fix under a strict category and its revert under `NO CL ENTRY`.
The editing step of the `NightlyChangelog` job has been failing its own
verification every night since 2026-08-12, always the same way:
Entries disappeared in the edit without a matching revert (['103182', '109946'])
`verify_edit` requires that every raw entry of a strict-retention category
keeps its pull request link - an entry may be rewritten, merged or moved, but
not dropped, because the generation point has already moved past it and no
later run will offer it again. The prompt never said so, and the skill stated
the rule only implicitly, so the agent pruned entries it judged
insignificant: `ClickHouse#103182` (`Lightweight Updates v2`, a `Backward Incompatible
Change`) was deleted outright.
The second half of the same failure is the revert handling. `ClickHouse#109946` fixed
the propagation of settings in `accurateCastOrDefault`, `ClickHouse#114911` reverted
it, and `ClickHouse#114912` reverted that revert - all three in one range. The skill
covers this in section 2.5, but the agent reached the "landed and then
reverted, so delete both" rule first and lost a fix that ships.
So:
- The prompt now lists the strict-retention categories (from
`STRICT_RETENTION_CATEGORIES`, so the two cannot drift apart), says which
entries may be deleted and why deleting anything else is unrecoverable, and
states the revert-of-revert rule.
- The skill gets a retention rule ahead of the individual edits, and the
walk over `NO CL ENTRY` checks whether a revert is itself reverted before
it concludes that a change was reverted. The `accurateCastOrDefault` chain
is written out there as the worked example.
- A retry now tells the agent why the previous attempt was rejected. Without
it, all three attempts of a run reproduced the same edit and the same
rejection - visible in every run from 2026-08-12 on.
A hand edit that followed these rules passed `verify_edit` on the first try,
which is how the 26.8 backlog (759 raw entries) was cleared in
ClickHouse#111720.
Related: ClickHouse#111720
Related: ClickHouse#116138
Reverts #109946
Version info
26.8.1.1450(included in26.8and later)