Repository navigation
Make the toYYYYMM documentation example independent of the current date - #117459
Algunenano merged 1 commit into
Conversation
The example paired a query that reads the clock with a hardcoded expected output:
SELECT toYYYYMM(now(), 'US/Eastern') -> 202608
`tests/docs_examples/runner.py` compares the documented response to the server's
output verbatim, after nothing but `str.strip`, and an `output` mismatch with no
entry in `tests/docs_examples/known_failures.txt` is verdict `unexpected`, which
fails the job. `202608` was true only while the current month in `US/Eastern` was
August 2026, so the example broke the instant that timezone rolled into September
at 2026-09-01 04:00 UTC. It had entered the baseline as passing on 2026-08-02
because it was correct that day, which is why nothing caught it earlier: a latent
time bomb rather than flakiness. Bumping the literal to `202609` would only move
the failure to 2026-10-01.
The replacement uses the idiom the immediate siblings already use, a fixed
`toDateTime` literal. `toYYYYMMDD`, `toYYYYMMDDhhmmss`, `toYear`, `toMonth`,
`toQuarter` and `toDayOfMonth` are all written that way.
SELECT toYYYYMM(toDateTime('2026-01-01 03:04:05', 'UTC'), 'US/Eastern') -> 202512
That instant is `2025-12-31 22:04:05` in `US/Eastern`, so the timezone argument
moves the answer down a month and a year, which makes its effect visible; with
`now` the two spellings of the query agreed on all but one day a month. Both
timezones are pinned in the query, so the value does not depend on the server or
the session timezone either.
The generated pages under `docs/` carry the same stale value and are deliberately
untouched: they lie inside autogenerated regions, and
`ci/jobs/docs_autogen_nightly.py` regenerates them from this registration.
An `unstable` entry in `known_failures.txt` was rejected as the alternative. It
accepts any outcome, so it would permanently retire the check for this example
and leave the published page showing a value that is wrong for readers eleven
months out of twelve. That treatment is right for `today` and `yesterday`, whose
subject is the clock; here the clock is incidental to what the example teaches.
Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review - no findings; 2 nits noted, not blocking (click to expand)The change was re-reviewed cold by an independent reviewer (no access to the author's evidence during Independent cold review. Enumerated the carriers of the invariant from source before reading the The documented value was checked without running anything, against a currently-passing sibling rather Oracle liveness traced rather than assumed: the example is not skipped by any of the runner's Leaving the generated 💡 nit, noted not blocking - the changelog category could be 💡 nit, noted not blocking - line 18 of the same file writes Session id: cron:clickhouse-review-slot-8:20260901-063200 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20260901-054600 |
|
Workflow [PR], commit [26de122] Summary: ❌
AI ReviewSummaryThis PR replaces the Final VerdictStatus: ✅ Approve LLVM Coverage ReportMeasured on commit 26de122.
Changed lines: Changed C/C++ lines covered: 11/11 (100.00%) · Uncovered code |
|
cc @Ergus @antaljanosbenjamin, could you review this? The |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 6 s compile time in total, 7 of them have a recent master baseline. |
CI finish ledger - 26de122Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The shard died before any test could be attributed, so the 2520 other rows on that job are Session id: cron:our-pr-ci-monitor:20260901-123000 |
8627fa2
Picks up three merged fixes that post-date this branch's previous master merge and that its CI run was red on: ClickHouse#117580 Bugfix validation master-build lookup for the new S3 prefix ClickHouse#117459 date-dependent toYYYYMM documentation example ClickHouse#117412 integration tests' nested-container memory budget Co-Authored-By: Claude Opus 5 <[email protected]>
The branch was 25480 commits behind `master`. The merge is clean: `MergeTask.cpp` changed a lot on `master` since the fork point, but not in the two regions this branch edits - the `TTLDrop` short-circuit in `ExecuteAndFinalizeHorizontalPart::prepare` and the segment selection in `MergeTextIndexStage::prepare`. Refreshing also picks up ClickHouse#117459, which fixes the `Docs examples` failure on the previous head: the `toYYYYMM` documentation example pinned its output to the month it was written in. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The documented example of
toYYYYMMno longer depends on the current date.Description
Docs exampleshas been red on every PR since 2026-09-01 04:00 UTC.src/Functions/toYYYYMM.cppdocumented an example whose query reads the clock while its expectedoutput is a hardcoded literal:
tests/docs_examples/runner.pycompares the documented response to the server output verbatim, so202608held only while the current month inUS/Easternwas August 2026. At 2026-09-01 04:00 UTCthat timezone rolled into September, the query began returning
202609, and the comparison hasfailed on every run since: in CIDB the
Documentation examplessub-result went from 400 OK / 6 FAILin the preceding 24 hours to 0 OK / 12 FAIL afterwards, across 12 unrelated PRs. It entered the
baseline as passing on 2026-08-02 because it was true that day, so this is a latent time bomb:
bumping the number would only move the failure to 2026-10-01.
The fix makes the example clock-independent with the idiom its siblings already use (
toYYYYMMDD,toYYYYMMDDhhmmss,toYear,toMonth,toQuarterandtoDayOfMonthall pin a fixedtoDateTimeliteral):That input is
2025-12-31 22:04:05inUS/Eastern, so the timezone argument now visibly moves theresult down a month and a year; with
nowits effect was invisible on all but one day a month. Theexpected output is a byte-exact capture from a real run.
I left the generated
docs/**pages carrying the same stale value alone: they sit insideautogenerated regions that
ci/jobs/docs_autogen_nightly.pyregenerates from this source.The example fails 3/3 runs without this change and passes 6/6 with it, and altering one digit of the
new expected value turns it red again. Of all 2223 documented examples this was the only one pairing
a clock-reading query with a hardcoded response and no known-failures entry.
Failing report:
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=117427&sha=a27d7145482ec43f1f88038913acc7398113e78e&name_0=PR&name_1=Docs%20examples
Workflow [PR]
Sync PR [sync-upstream/pr/117459]
Version info
26.9.1.487(included in26.9and later)