[pull] master from cube-js:master - #677
Merged
Merged
Conversation
…ck (#11595) * feat(cube-cli): reintroduce `cube validate` as a Cloud data-model check The old `cubejs validate` compiled the model locally, which meant it could only ever check what a local checkout plus a local install could express — not the environment variables, drivers or dependencies the model actually runs against. `cube validate <deployment>` instead asks the branch's own Cube runtime for `GET /cubejs-api/v1/meta`, the same call the console makes in dev mode, via the new `GET /build/api/v1/deployments/{id}/data-model/validate` endpoint. So the verdict is by construction the one that branch's API would give, and naming the branch is what picks the runtime: cube validate 42 # the deploy branch (production) cube validate 42 --branch my-branch # a specific branch cube validate 42 --dev-mode # the active dev-mode working copy It exits non-zero with the compiler's errors, per file, so it works as a CI gate; `--json` gives the same report machine-readably. Ref CUB-3782 * fix(cube-cli): never print a validation failure with nothing to act on Review of the paired PR. All three are the same shape: the response contract lives in cubedevinc/cubejs-enterprise and this command ships separately, so an entry that doesn't match what it expects still has to print as something. A blank line is the one output `validate` must never produce — printing the errors IS the command. - `format_error` renders a bare-string entry as itself and a half-filled object as whichever half it has, falling back to the entry's own JSON rather than the empty string `output::field` would give for both lookups. - A response without `branchName` no longer yields "Data model on is valid": it falls back to the branch the caller asked for, or a generic label for `--dev-mode`, where the personal `dev-…` name only exists server-side. - `valid: false` with no errors said "failed to compile:" and then listed nothing, followed by "has 0 compilation error(s)". It now says the model could not be validated, which points at the runtime — where the answer is. Still fails closed: a report this command can't read is not evidence the model compiles. Adds a `validate` row to the README's command table, and unit tests for the new pure functions. * fix(cube-cli): don't report an unlistable validation failure twice The empty-errors path printed a stderr line and then a bail! saying the same thing, unlike the error-list case where the stderr line heads a list. Keeping only the bail! leaves one line, and it's the more informative one — it says the API reported a failure without compilation errors, which is what points the operator at the runtime rather than the model. --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )