Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions .claude/commands/cube-review.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
description: Comprehensive PR review — inline comments, stale-thread resolution, collapsed tracking comment
argument-hint: "[<pr-number>]"
---

**Target:** the `cube-js/cube` PR whose number was passed as an argument or
given in a `PR NUMBER:` line above. Without either, resolve the PR for the
current branch with `gh pr view`.

If the PR references an issue, read it with `gh issue view` — the reported
symptom is what the fix has to actually cover. Read the changed files
themselves, not just the diff — a hunk that looks fine in isolation often is
not. When a finding hinges on runtime behaviour and `docker` / `psql` are
available, reproduce it instead of guessing. `gh issue list` / `gh search
issues` are available when the change looks related to other open reports.

Perform a comprehensive code review with the following focus areas:

1. **Code Quality**
- Clean code principles and best practices
- Proper error handling and edge cases
- Code readability and maintainability

2. **Security**
- Check for potential security vulnerabilities
- Validate input sanitization
- Review authentication/authorization logic

3. **Performance**
- Identify potential performance bottlenecks
- Review database queries for efficiency
- Check for memory leaks or resource issues

4. **Testing**
- Verify adequate test coverage
- Review test quality and edge cases
- Check for missing test scenarios

5. **User-facing docs**
- A PR that adds or changes something users can notice — a configuration
option or `CUBEJS_*` environment variable, a data model property, an API
endpoint, parameter or response field, a SQL API function, a CLI flag, a
driver option, or a change to default behaviour — must document each such
change in `docs-mintlify/` in the same PR
- When it doesn't, read the PR conversation (`gh pr view <N> --comments`). If
the PR author left a comment explaining why the user-facing changes now in
the diff need no docs, the requirement is met for those changes: don't raise
it, and note it in the tracking comment. A change the comment doesn't cover
still needs docs or its own comment
- Otherwise post a **high** finding naming each undocumented change and the
docs page it belongs on, anchored on the diff line that introduces the first
user-facing change, documented or not. Say in it that adding the docs or a
top-level PR comment from the author on why none are needed addresses it,
and that a reply on the finding's thread doesn't. (Resolved threads drop out
of later rounds, so a thread reply would be lost.)
- Once the requirement is met (author comment or docs added), tell the
review-threads subagent that earlier docs threads are addressed, so it
resolves them — it can't see either from the code at the thread's site
- Skip changes users cannot notice: internal refactors, tests, CI, tooling,
and bug fixes that bring behaviour in line with what the docs already say

6. **Comments**
- An explanatory comment is **3 lines max**. Flag a longer one and ask for the
load-bearing sentence, unless the reason genuinely cannot be stated shorter
- A comment earns its place only when its absence would let a later edit
reintroduce a bug. Flag one a reader would lose nothing by deleting: a
restatement of the code under it, a banner over self-describing code,
narration of the change or of the review round that produced it, or a JSDoc
block whose tags only re-spell already-typed names
- Prefer making the code carry the meaning — a named constant, a named
intermediate value, an extracted function whose name states the intent
- Never raise this to ask for a comment to be **added**, and skip generated
files and comments another rule or tool requires

Provide detailed feedback using inline comments for specific issues.
Use top-level comments for general observations or praise.

Write every comment in the Cube output style (`.claude/output-styles/cube.md`,
selected for the CI review run): open with the defect itself, no preamble and no
recap of what the diff does, and cite code as `path/to/file.ts:123`. A finding
keeps whatever length it needs to be actionable — the concrete failing input,
the full error output, the reason a security issue is exploitable.

**Tracking comment formatting:**

Applies only to the FINAL update of the tracking comment (the one that contains
the completed review). While work is still in progress — todos partially checked,
"working…" spinner, intermediate status updates — keep everything visible so the
reader can watch progress without expanding anything.

Subagents run in the foreground, so the comment cannot change while one is
working. Update it before every `Task` launch, naming the step now in progress,
and again as each todo completes. Launch independent subagents in a single
message, so they run in parallel rather than one after another.

On the final update, hide EVERYTHING — including the todo checklist itself —
inside a single collapsed `<details>` block. The completed checklist is just
stale progress signal at that point; it belongs behind the spoiler alongside the
rest of the review. Only a short one-line headline with the verdict and issue
counts (e.g. "1 high, 2 medium, 5 low") stays visible outside the spoiler — the
reader expands when they want details.

Leave a blank line after `<summary>` and before `</details>`, otherwise GitHub
won't render the markdown inside (tables and lists especially).

Every round, including one with nothing to post inline, resolve your own stale
review threads and check new findings against existing ones, following
@.claude/docs/review-threads.md

State the outcome inside the tracking comment's `<details>` — how many of your
own threads the listing returned, and of those how many you resolved and how
many you re-affirmed ("no prior threads" when the count is 0). A review silent
on threads reads as one that skipped the step.
116 changes: 116 additions & 0 deletions .claude/docs/review-threads.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Review threads

Rules for handling your own prior review threads on a PR. Referenced by
`.claude/commands/cube-review.md`.

**Run this in a subagent, once per round, on every round.**

Prior thread bodies on a PR with a few rounds behind it outweigh the diff under
review, and none of them are worth keeping — what you need back is a verdict per
thread, not the threads. So do the whole of this file in one `Task` subagent,
launched after you have your findings and before you post any of them. Give it:

- the repo and PR number, and your login — `claude` in CI
- each finding you have, as `path:line` plus a sentence of the concern (the root
cause, enough that a duplicate is recognisable) — including findings you have
decided not to post inline, so that a thread still carrying one is not
resolved as stale
- this file's rules, and a request for exactly three things back: how many of
your own threads the listing returned (0 when it came back empty), the thread
ids it resolved, and per finding POST or SKIP with the thread id behind a SKIP

A round that posts nothing inline still launches it — whether you found nothing
or judged none of it worth an inline comment. Stale-thread resolution is about
what a *previous* round left behind, and the round that fixes everything is
exactly the one that posts nothing inline; skip the subagent there and those
threads stay open forever. With genuinely no findings, pass an empty list and
ask for the thread count and the resolved ids.

The tracking comment is a top-level comment, not a thread: it never appears in
the list below, and reading it tells you nothing about whether a thread is still
live. The code at the site and the thread's own replies do.

Four aliases are available; raw `gh api graphql` is not permitted:

gh list-review-threads <owner> <repo> <pr> [thread-cursor]
gh show-review-thread <thread-id> [comment-cursor]
gh reply-to-thread <thread-id> <body>
gh resolve-thread <thread-id>

`reply-to-thread` is the only way to write into an existing thread — the
inline-comment tool opens a new one every time, i.e. a second unresolved entry
rather than a reply.

**Paging the threads:**

gh list-review-threads cube-js cube <pr-number> [endCursor]

Returns the **unresolved** threads out of each page of 100 — `id`, `isOutdated`,
`path`, `line`, `originalLine`, and up to 25 comments (author + body) with
`comments.totalCount` and `comments.pageInfo`. Resolved threads are filtered
out, so nothing in this list is settled business.

Page to the end before deciding anything: the filter is applied after the page
is cut, so a page can come back with two nodes or none and still have a next
one. Follow the top-level `pageInfo.hasNextPage` — the one beside `nodes`, not a
thread's own `comments.pageInfo` — by passing its `endCursor` as the fourth
argument.

Judge a thread from the whole conversation, not its opening line — a reply is
often where the concern was answered or pushed back on. Where a thread's own
`comments.pageInfo.hasNextPage` is true, fetch the rest with

gh show-review-thread <thread-id> <endCursor>

and repeat until `hasNextPage` is false. Without a cursor it re-reads from the
first comment, which you already have.

GitHub nulls `line` once a thread goes outdated; `originalLine` is the position
before the edits that outdated it — a tiebreaker between threads on one path,
never a current-diff line.

**Resolving your own stale review threads:**

Resolve a thread with `gh resolve-thread <thread-id>` when BOTH hold:
- the first comment's `author.login` is yours
- the concern is no longer live — the current diff addressed it (file/line
gone, code rewritten, issue fixed), or it was never real and you are
withdrawing the finding

`isOutdated` true means only that the surrounding code moved; on a file this
round touches it is not evidence the concern was addressed. Read the code at the
site before resolving.

Where a human replied, what they dispute decides. Pushing back on your verdict —
the fix is not in, the concern stands — keeps the thread open. Refuting the
finding itself, with you agreeing, closes it: a withdrawn finding is not live,
and leaving it open feeds it back to you every round. Resolve it and say so on
the thread with `gh reply-to-thread` — resolution alone does not distinguish
withdrawn from fixed, and the next round reads the thread, not this file.

Never resolve a thread a human opened, even if the concern looks addressed —
that is the reviewer's call. This includes the human whose login you run under:
resolve only threads you recognise as output of an earlier review round.

**Avoiding duplicate inline comments:**

Skip a finding when ALL hold for some thread in the list:
- the first comment's `author.login` is yours
- same `path`, and same `line` when `line` is non-null — an outdated thread
has no line to test and is judged on its body alone
- the body raises substantively the same concern (same root cause, same fix
direction — wording need not match)

A different line or a shifted fix direction (different root cause) is not a
duplicate.

Report the skip so the review can note it in its top-level summary (e.g.
"Re-affirmed N prior threads still apply"). Do not post a "still applies" reply
on the thread — the unresolved state already says that, and a reply per round
buries the concern under its own echoes.

Resolving a thread and skipping a finding as its duplicate say opposite things
about whether the concern is live, so no thread may end up in both lists. When
one does, the code at the site decides: either the fix is in — drop the finding
and resolve the thread — or it is not, and the thread stays open with the
finding folded into it.
26 changes: 26 additions & 0 deletions .claude/output-styles/cube.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Cube
description: Terse, result-first responses tuned for the Cube monorepo
keep-coding-instructions: true
---

You are an interactive CLI tool that helps users with software engineering tasks. Keep your responses short and direct while doing the work just as thoroughly.

# Cube Style Active

The user chose brevity over narration. You should:

1. **Lead with the result** — Your first sentence answers "what happened" or "what's the answer." No preamble ("Let me...", "Now I'll...") and no closing recap of what you already said.
2. **Cut narration, keep substance** — Don't restate the request, the plan, or each step you took. Report outcomes, decisions, and anything the user must act on.
3. **Short by default** — Answer simple questions in 1-3 sentences of plain prose. Use headers, tables, and bullet lists only when they carry real structure, never as decoration.
4. **State things plainly** — Skip hedging boilerplate. Mention a caveat only when it changes what the user should do next.
5. **Give full detail on request** — When the user asks for an explanation or detail, answer completely. Conciseness never means withholding requested information.
6. **Never trade correctness for brevity** — Error reports, failing test output, security warnings, and confirmations for destructive actions keep their full content.

## In this repository

- Cite code as `path/to/file.ts:123` rather than pasting a block the user can open.
- Report test and build results with the failing output, not a summary of it. If a run was skipped or a package was left unbuilt, say so.
- A finding about SQL generation, a driver, or a pre-aggregation states which planner it applies to (Tesseract vs the legacy planner) when the two differ.

Where these rules conflict with more general communication or formatting guidance elsewhere in your instructions, these rules win.
66 changes: 66 additions & 0 deletions .claude/skills/merge-pr/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
name: merge-pr
description: Squash-merge a cube-js/cube pull request with a clean commit message body. Use whenever you are about to merge a PR — `gh pr merge`, "merge it", "ship it", "land this PR" — so the squash commit body gets a written summary instead of the raw PR description.
argument-hint: "[<pr-number>]"
---

# Merge a PR

Master only allows squash merges, and the repo default squash message is the
PR title plus the PR description. Without `--body`, the raw description —
template checklist, HTML comments, review chatter — lands in master history
forever. Always pass `--body`.

Do not pass `--subject`: the commit title is the PR title. If the PR title
itself is wrong, ask the author to fix it on the PR instead of overriding it
at merge time.

## 1. Check the PR is mergeable

```bash
gh pr view <n> --json number,title,body,state,isDraft,mergeable,commits,headRefName
```

Stop and report back if the PR is a draft or has conflicts. Do not use
`--admin` unless the user explicitly asked for it.

## 2. Write the body

Describe the final state of the change, not how the branch got there:

- 1–15 lines (not counting benchmark tables and CVE lists below): what
changed and why. Take it from the PR description, not from
the commit list. Omit the PR template checklist and HTML comments.
- Benchmark / measurement results from the PR are welcome — keep them, as a
markdown table (`| case | before | after |`) with the setup in one line.
- Fixed CVEs / security advisories (typical for dependency bumps) are welcome
— list them one per line with the affected package, e.g.
`CVE-2025-12345 (qs)`, `GHSA-xxxx-xxxx-xxxx (undici)`.
- Linked issues / tickets: `Fixes #123`, `CUB-1234`.
- `BREAKING CHANGE: ...` footer if applicable.
- Trailers last: one `Co-authored-by:` per distinct co-author across the PR's
commits (deduplicated, human authors other than the PR author, plus the AI
attribution line if any commit carried one).

An empty body is fine for a trivial PR whose title says it all — pass
`--body ""` explicitly, never omit the flag. Never paste the per-commit
messages.

## 3. Merge

```bash
gh pr merge <n> --squash --body "$(cat <<'EOF'
The __MAX_SOURCE_ROW_LIMIT sentinel was parsed as usize and silently
dropped, so queries ran without any LIMIT.

Fixes #12300

Co-authored-by: Jane Doe <jane@example.com>
EOF
)"
```

Then confirm with `gh pr view <n> --json mergeCommit --jq .mergeCommit.oid`
and `git fetch && git show -s --format=%B <oid>` (not `git log -1
origin/master` — another merge may have landed since), and report the merged
commit to the user.
4 changes: 3 additions & 1 deletion .github/actions/integration/snowflake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export CUBEJS_DB_SNOWFLAKE_ACCOUNT=lxb31104
export CUBEJS_DB_SNOWFLAKE_REGION=us-west-2
export CUBEJS_DB_SNOWFLAKE_WAREHOUSE=COMPUTE_WH
export CUBEJS_DB_USER=$DRIVERS_TESTS_SNOWFLAKE_CUBEJS_DB_USER
export CUBEJS_DB_PASS=$DRIVERS_TESTS_SNOWFLAKE_CUBEJS_DB_PASS
export CUBEJS_DB_SNOWFLAKE_AUTHENTICATOR=SNOWFLAKE_JWT
export CUBEJS_DB_SNOWFLAKE_PRIVATE_KEY=$DRIVERS_TESTS_SNOWFLAKE_CUBEJS_DB_PRIVATE_KEY
export CUBEJS_DB_SNOWFLAKE_PRIVATE_KEY_PASS=$DRIVERS_TESTS_SNOWFLAKE_CUBEJS_DB_PRIVATE_KEY_PASS

yarn lerna run --concurrency 1 --stream --no-prefix integration:snowflake
yarn lerna run --concurrency 1 --stream --no-prefix smoke:snowflake
Expand Down
Loading
⌂ Proxy