Skip to content

docs: numeric-string REST API contract and switch-dimension pre-agg matching - #11422

Open
keydunov wants to merge 2 commits into
masterfrom
claude/gallant-ramanujan-c0p33b
Open

docs: numeric-string REST API contract and switch-dimension pre-agg matching#11422
keydunov wants to merge 2 commits into
masterfrom
claude/gallant-ramanujan-c0p33b

Conversation

@keydunov

@keydunov keydunov commented Jul 30, 2026

Copy link
Copy Markdown
Member

Check List

  • Tests have been run in packages where changes have been made if available
  • Linter has been run for changed code
  • Tests for the changes have been added if not covered yet
  • Docs have been added / updated if required

Description of Changes Made

This is a docs-only PR closing gaps found while cross-checking recent cube-js/cube changes against /docs-mintlify.

  1. reference/core-data-apis/rest-api/reference.mdx — the /v1/load response Warning still described the pre-feat(cubeorchestrator): Use Arrow format for CubeStore response format #10949 behavior ("most drivers return numerical values as strings"). Since #10949 (breaking change, merged into v1.7.0), all numeric values are always serialized as JSON strings regardless of driver. Updated the warning to state the new guaranteed contract and link to the castNumerics recipe.

  2. reference/data-modeling/pre-aggregations.mdx — added a note under the dimensions parameter that switch-type dimensions no longer need to be listed in a rollup's dimensions for pre-aggregation matching to succeed, per #11346. Previously this required materializing the dimension into the rollup (cross-joining its value enumeration) purely to satisfy the matcher; that requirement is now gone, and rollups that omit the dimension still match and execute correctly.

  3. reference/cli.mdx — added a short note to the existing "Data model Git workflow" section clarifying that --dev-mode forks and prints a personal dev-* branch, and that put/delete/rename only accept writes to the active dev-mode branch, per #11351.

No code changes.

Test plan

  • Not applicable — docs content only, verified against the referenced PRs' descriptions and diffs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LkeKoVdBbUe8eVBRhr7BHJ

…atching

- reference/core-data-apis/rest-api/reference.mdx: update the /v1/load
  response Warning to reflect that all numeric values are now always
  serialized as JSON strings across every driver (#10949),
  replacing the old "most drivers" wording, and link to castNumerics.
- reference/data-modeling/pre-aggregations.mdx: document that `switch`-type
  dimensions no longer need to be listed in a rollup's `dimensions` for
  pre-aggregation matching to succeed (#11346).
@claude

claude Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Claude finished @keydunov's task in 3m 33s —— View job


Review complete — 1 medium, 3 low. Both documented behaviors verified against source; one out-of-scope edit to the metadata example looks wrong.

Full review

Todos

  • Read the diff
  • Verify link targets resolve (castNumerics recipe, switch dimension anchor)
  • Verify the numeric-string claim
  • Verify the switch pre-agg matching claim against source
  • Check undescribed changes in the diff (member_references, table separator)
  • Post review

What checks out

  • [ref-cast-numerics]/recipes/core-data-api/cast-numerics — page exists (docs-mintlify/recipes/core-data-api/cast-numerics.mdx), and its content already states the REST (JSON) API returns numerics as strings, so the new warning is consistent rather than contradictory.
  • [ref-switch-dim]/reference/data-modeling/dimensions#type — anchor exists; switch is documented in the type table at dimensions.mdx:930.
  • The switch pre-agg matching claim is real, not just taken from the PR description. rust/cube/cubesqlplanner/cubesqlplanner/src/logical_plan/optimizers/pre_aggregation/dimension_matcher.rs:201-207 short-circuits calc-group (switch) dimensions to MatchState::Full before the owned_by_cube()NotMatched branch, so a rollup that omits the dimension still matches.
  • Placement of both callouts is right — the pre-agg <Note> lands inside the dimensions parameter section, before ### time_dimension.
  • Style follows docs-mintlify/CLAUDE.md: reference-style links defined at file bottom, <Note>/<Warning> with blank lines inside, root-relative internal links, concise.

Findings

# Sev File Issue
1 Medium rest-api/reference.mdx:1007 member_references for the cube-level orders.status changed from [] to [{cube: orders, member: status}]. Its sql is ${CUBE}.status — a column reference. Sibling orders.id (line 990) and orders.total_amount (line 971) both use ${CUBE}.x and keep []; the populated form belongs to the orders_view block below (${orders.status}, lines 1062–1066). As written the dimension references itself, undercutting the cube-vs-view contrast the example exists to show. Also not mentioned in the PR description.
2 Low pre-aggregations.mdx:583 "the pre-aggregation's built-in dimension enumeration" implies the rollup carries the enumeration — the opposite of the note's point. The enumeration comes from the dimension's own definition and is cross-joined over the rollup scan.
3 Low pre-aggregations.mdx:580 Worth stating the Tesseract-only constraint explicitly, mirroring the <Warning> at dimensions.mdx:933.
4 Low rest-api/reference.mdx:533 Unrelated whitespace-only widening of a table separator row; source columns no longer align.

Also considered and not flagged: the "regardless of the data source driver" guarantee — I could not locate the always-stringify enforcement point in the JS packages in this tree (it appears to happen below the gateway), but the claim matches what cast-numerics.mdx has documented independently, so I'm treating it as correct. A version marker for the v1.7.0 breaking change is suggested inline (finding on lines 101–106).

Nothing security-, performance-, or test-relevant here; docs-only, no code paths touched.

• branch `claude/gallant-ramanujan-c0p33b`

@mintlify

mintlify Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
cubed3 🟢 Ready View Preview Jul 30, 2026, 12:27 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

…eference

Cube CLI's create-branch/dev-mode now fork and print a personal dev-*
branch, and put/delete/rename only accept writes to the active dev-mode
branch (#11351). Add a short note to the existing Data model
Git workflow section.
@claude

claude Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Claude finished @keydunov's task in 2m 53s —— View job


Docs review — 1 medium, 3 low, 1 nit · 4 prior threads still apply

Full review — click to expand

Verification results

Link targets — both resolve.

  • [ref-cast-numerics]: /recipes/core-data-api/cast-numericsrecipes/core-data-api/cast-numerics.mdx exists and is registered in docs.json:699.
  • [ref-switch-dim]: /reference/data-modeling/dimensions#type### \type`heading exists atreference/data-modeling/dimensions.mdx:919, and switch` is documented in its table at line 930.

Numeric-string claim — accurate. Consistent with recipes/core-data-api/cast-numerics.mdx:7 ("The REST (JSON) API returns numeric measure and dimension values as strings") and with the "users.count": "700" example directly above the warning.

switch pre-agg matching claim — accurate. CubeEvaluator.ts:787 sets ownedByCube = false for type === 'switch', which is the mechanism that takes the dimension out of the rollup's materialization requirement. Directionally correct; wording nits in the existing thread.

New in this push: cli.mdx

The second commit (3cf83d5) adds an <Info> block to reference/cli.mdx that isn't mentioned in the PR description (which still says two files / two changes). One substantive issue, filed inline: the new note contradicts the bash sample immediately above it — the sample passes --branch my-branch to put, which the note says is rejected. A reader copying the sample gets an error.

I could not verify the cli.mdx claims against source: the Cube Cloud CLI implementing data-model create-branch / dev-mode is not in this repo (packages/cubejs-cli/src has no such commands), so the content rests entirely on #11351 as cited in the commit message. Worth a maintainer confirming.

Also flagged as a nit: the example branch name dev-pavel-ab12cd34 embeds a real teammate's first name in public docs.

Re-affirmed prior threads (not re-posted)

Four unresolved threads from the earlier pass still apply verbatim — the corresponding lines are unchanged in this push:

File Line Concern
rest-api/reference.mdx 1009 member_references populated with a self-reference; contradicts id/total_amount siblings and the single-entity example of the same cube at line 898
rest-api/reference.mdx 533 Unrelated whitespace-only table-separator change
pre-aggregations.mdx 585 "the pre-aggregation's built-in dimension enumeration" attributes the enumeration to the rollup; Tesseract-only constraint unstated
rest-api/reference.mdx 106 Breaking change — consider naming v1.7.0 so readers on older deployments aren't misled

The member_references one is the most worth acting on: reference.mdx:821 defines the field as "Upstream members the member is derived from", and the same orders.status dimension in the single-entity example above (line 898) still shows []. The all-entities example now contradicts a payload the docs explicitly describe as "the same format as the single-entity response above."

Not applicable

No code changes, so security, performance, error handling, and test coverage have nothing to assess here. Linting and tests weren't run — .mdx content only, and there is no docs linter wired into yarn lint for docs-mintlify.

· [Branch](https://github.com/cube-js/cube/tree/claude/gallant-ramanujan-c0p33b)

Comment on lines +1007 to +1009
"member_references": [
{ "cube": "orders", "member": "status" }
],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This edit looks incorrect, and it's outside the PR's stated scope (the description says the only changes are the numeric warning and the pre-agg note).

In this part of the /v1/meta?extended=true example, orders is the cube, and status's sql is ${CUBE}.status — a column reference, not a member reference. Compare the two siblings that were left untouched:

  • orders.id, sql: "${CUBE}.id""member_references": [] (line 990)
  • orders.total_amount, sql: "${CUBE}.amount""member_references": [] (line 971)

The populated form belongs to the orders_view section further down, where sql is ${orders.status} and the reference is genuine (lines 1062–1066). As written, the cube-level dimension now claims to reference itself, which contradicts the neighbouring entries and the view/cube distinction the example is built to illustrate.

Suggested change
"member_references": [
{ "cube": "orders", "member": "status" }
],
"member_references": [],

Fix this →


| Parameter | Description | Required |
| -------------------------- | -------------------------------------------------------------- | -------- |
| -------------------------- | ---------------------------------------------------------------- | -------- |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated whitespace-only change — the separator row is now 2 chars wider than every other row in the table, so the source no longer lines up (rendering is unaffected). Worth reverting to keep the diff to the two intended edits.

Suggested change
| -------------------------- | ---------------------------------------------------------------- | -------- |
| -------------------------- | -------------------------------------------------------------- | -------- |

Comment on lines +580 to +585
[`switch`-type dimensions][ref-switch-dim] don't need to be listed here for a
query to match this pre-aggregation. Since a `switch` dimension represents a
predefined set of values rather than stored data, Cube can resolve it from the
query filter (or the pre-aggregation's built-in dimension enumeration) even
when it's omitted from the rollup — you no longer need to include it just to
satisfy matching.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior claim checks out against dimension_matcher.rs:201-207, where a calc-group (switch) dimension short-circuits to MatchState::Full regardless of the rollup's dimensions. Two wording nits:

  1. "the pre-aggregation's built-in dimension enumeration" reads as though the rollup carries the enumeration — the opposite of the point the note is making. Per the code comment, the value is either pinned by a filter (rendered as a literal) or the enumeration (which comes from the dimension's own case/when definition) is re-cross-joined over the rollup scan.
  2. switch dimensions are Tesseract-only (see the <Warning> at reference/data-modeling/dimensions.mdx:933), so it's worth stating that this matching behavior follows the same constraint rather than leaving the reader to infer it.
Suggested change
[`switch`-type dimensions][ref-switch-dim] don't need to be listed here for a
query to match this pre-aggregation. Since a `switch` dimension represents a
predefined set of values rather than stored data, Cube can resolve it from the
query filter (or the pre-aggregation's built-in dimension enumeration) even
when it's omitted from the rollup — you no longer need to include it just to
satisfy matching.
[`switch`-type dimensions][ref-switch-dim] don't need to be listed here for a
query to match this pre-aggregation. Since a `switch` dimension represents a
predefined set of values rather than stored data, any rollup can serve it: the
value is either pinned by a query filter and rendered as a literal, or the
dimension's value enumeration is cross-joined over the rollup scan. Like
`switch` dimensions themselves, this requires Tesseract.

Comment on lines +101 to +106
All numeric values in the response (e.g., `"700"` in the example above) are
serialized as JSON strings, regardless of the data source driver. This
guarantees a consistent response contract across all drivers and avoids loss
of significance for large numbers. Client code should parse numeric strings
into the appropriate type; the `castNumerics` option in the
[JavaScript SDKs][ref-cast-numerics] does this automatically.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Content is accurate and consistent with recipes/core-data-api/cast-numerics.mdx (which already describes strings-always), and [ref-cast-numerics] resolves to a real page. One suggestion: since #10949 was a breaking change, consider naming the version so readers on older deployments aren't misled — the switch dimension <Warning> in reference/data-modeling/dimensions.mdx:935-937 sets the precedent ("In versions before v1.7.0, …").

Something like: "Since v1.7.0, all numeric values … Before v1.7.0, the format depended on the data source driver."

Comment on lines +181 to +187
<Info>

`--dev-mode` (on `create-branch` and `dev-mode`) forks a personal `dev-*`
branch for you rather than writing directly to the named branch, and prints
the actual forked branch name (e.g. `dev-pavel-ab12cd34`) to pass via
`--branch` on subsequent commands — or omit `--branch` to use your currently
active dev-mode session. `put`, `delete`, and `rename` only accept writes to

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This note contradicts the code sample it sits under (lines 174–176), and the sample is the part most readers will copy.

The sample does:

cube data-model create-branch DEPLOYMENT_ID my-branch --dev-mode
cube data-model put DEPLOYMENT_ID model/cubes/orders.yml --file orders.yml --branch my-branch
cube data-model merge-to-default DEPLOYMENT_ID --branch my-branch -m "add orders cube"

But per this note, --dev-mode does not create my-branch — it forks dev-<user>-<hash>, and put "only accept[s] writes to the active dev-mode branch; targeting any other branch is rejected." So put ... --branch my-branch in the sample is exactly the case the new paragraph says is rejected. A reader following the sample verbatim gets an error, then has to read the <Info> to find out why.

Since the note already says --branch can be omitted to use the active session, the cleanest fix is to make the sample the working flow and let the note explain the mechanism rather than correct the example:

cube data-model create-branch DEPLOYMENT_ID my-branch --dev-mode
# prints the forked branch, e.g. dev-alice-ab12cd34
cube data-model put DEPLOYMENT_ID model/cubes/orders.yml --file orders.yml
cube data-model merge-to-default DEPLOYMENT_ID -m "add orders cube"

(Separately: dev-pavel-ab12cd34 bakes a real teammate's name into a public docs example — a neutral placeholder like dev-alice-ab12cd34 or dev-<user>-<hash> reads better.)

I couldn't verify the underlying claims against source — the Cube Cloud CLI that implements data-model create-branch/dev-mode isn't in this repo (packages/cubejs-cli/src has no dev-mode command), so this rests on #11351 as cited in the commit message. Worth a maintainer confirming whether --branch is rejected outright or silently redirected, and whether the restriction applies to commit/pull too.

Fix this →

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