Skip to content

feat(cubejs): warn when update_window is set without incremental - #97

Merged
acmeguy merged 1 commit into
mainfrom
fix/warn-update-window-without-incremental
Oct 13, 2026
Merged

acmeguy merged 1 commit into
mainfrom
fix/warn-update-window-without-incremental

Conversation

@acmeguy

@acmeguy acmeguy commented Oct 13, 2026

Copy link
Copy Markdown

Why

Cube honours refresh_key.update_window only when incremental: true is also set (PreAggregationPartitionRangeLoader.js:96, BaseQuery.js:4089). Without it, every partition in the build range is rebuilt each time the refresh key fires, and Cube's compiler doesn't warn.

On dev, 20 of abler's BigQuery pre-aggregations had been written like this since April (18 in BQ Prod, 2 in BQ QA). In 11.5 h that came to 3,147 BigQuery builds over 661 partitions. Closed months from January 2026 were rebuilt every 30 minutes. Those models were fixed directly on 2026-10-13 (new versions c937249e and 4a152764). This PR stops the same mistake from being saved silently again.

What

  • utils/preAggregationWarnings.js: walks the compiled cubes and returns one warning per pre-aggregation that has updateWindow but no incremental. Each warning carries the cube's fileName and the line of its update_window, so the editor can place the marker.
  • /api/v1/validate (client-v2 editor, on save) and /api/v1/validate-in-branch (Model Management API / FraiOS) add these warnings when the model compiles cleanly.
  • Non-blocking: valid is unchanged, and FraiOS passes warnings through.

Test

  • src/utils/__tests__/preAggregationWarnings.test.js: warns once at the right line, and stays silent after incremental: true is added.
  • Route check: posting abler's dailyClubTotals shape to /api/v1/validate returns valid: true and the warning on transactions_daily.yml:14.
  • npm test: 705/707 pass. The 2 "production dependency hardening" failures fail on main too, against my local node_modules.

🤖 Generated with Claude Code

Cube honours refresh_key.update_window only with incremental: true.
Without it every partition in the build range is rebuilt on each refresh
tick. abler's BigQuery models had 20 such pre-aggregations since April
and rebuilt ~270 partitions an hour on dev, closed months included,
every 30 minutes for the busiest two.

Cube's compiler is silent about this, so /api/v1/validate (editor save)
and /api/v1/validate-in-branch (Model Management API, FraiOS) now return
a warning on the update_window line. Non-blocking: valid is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@acmeguy
acmeguy merged commit 0943709 into main Oct 13, 2026
3 checks passed
@acmeguy
acmeguy deleted the fix/warn-update-window-without-incremental branch October 13, 2026 11:09
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.

1 participant