Skip to content

test(cli): supabox-backed live test suite + cli-e2e-ci dispatch#5699

Merged
avallete merged 8 commits into
developfrom
claude/inspiring-einstein-twixh1
Jun 26, 2026
Merged

test(cli): supabox-backed live test suite + cli-e2e-ci dispatch#5699
avallete merged 8 commits into
developfrom
claude/inspiring-einstein-twixh1

Conversation

@avallete

@avallete avallete commented Jun 25, 2026

Copy link
Copy Markdown
Member

Adds a live test category that exercises the built CLI against a real Supabase platform — a fulls supabox stack stood up in CI by cli-e2e-ci — and the cli-side trigger that runs it for a PR.

What changed

  • live Vitest project (*.live.test.ts) + harness in apps/cli/tests/helpers/live.ts:
    • runSupabaseLive (drives the built binary via SUPABASE_PROFILE=supabase-local), describeLive (gated on SUPABASE_ACCESS_TOKEN), and describeLiveProject / requireLiveProjectRef (gated on SUPABASE_LIVE_PROJECT_REF for project-scoped suites).
    • tests/live-global-setup.ts fail-fast reachability probe.
    • nx test:live target (auto-derived from the project) + nx.json default; removed the recursive test:live package script (it shadowed the nx target and looped).
  • 8 live scenarios: orgs list (+JSON, +invalid-token negative), projects list (+JSON), functions list / branches list (project-scoped), and a functions list unknown-project (404) negative.
  • .github/workflows/dispatch-cli-e2e-ci.yml: on PRs labeled run-live-e2e-ci, fires a repository_dispatch to cli-e2e-ci with the PR head SHA; cli-e2e-ci builds that SHA, runs the suite, and reports a cli-e2e-ci / live commit status back. Distinct from the staging live-e2e.yml.

Why

There was no backend-hitting live coverage — existing *.e2e.test.ts use fake tokens. This validates real Management-API flows end-to-end against supabox. Refs CLI-1825 / CLI-1834 / CLI-1831.

Reviewer notes

  • The live project is inert by default — it only runs when SUPABASE_ACCESS_TOKEN is set (the cli-e2e-ci runner provides supabox's seeded PAT), so it does not touch the normal unit/integration/e2e loop.
  • Validated green in cli-e2e-ci on Blacksmith: 8 passed, 0 skipped, including the project-scoped suites (the runner provisions a project and sets SUPABASE_LIVE_PROJECT_REF).
  • The dispatch loop needs, on the infra side: a run-live-e2e-ci label on this repo, the App's contents: write on cli-e2e-ci (to dispatch) and statuses: write here (for the back-status). The build/test half is proven without them.

claude and others added 6 commits June 23, 2026 18:10
Introduce a `live` Vitest project (`*.live.test.ts`) for black-box tests
that run the built CLI against a real platform — a supabox stack in CI
(supabase/cli-e2e-ci) — exercising real Management API, functions,
database, and storage flows.

- `tests/helpers/live.ts`: `runSupabaseLive` (retargets via
  SUPABASE_PROFILE=supabase-local), `describeLive` gate, readiness helpers.
- `tests/live-global-setup.ts`: fail fast if the platform is unreachable
  when the live env is configured; no-op otherwise.
- vitest `live` project + nx `test:live` target (auto-derived from the
  project name), `pnpm test:live` script, knip entry, coverage exclude.
- Gated by SUPABASE_ACCESS_TOKEN so the suite is inert in the normal
  unit/integration/e2e loop.
- Seed the canonical example: `orgs list` authenticated read-only smoke.

Refs CLI-1834 (parent CLI-1825).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RNpmVr6SxaFQHbJSBYLUCj
Two defects surfaced running the live suite against a real supabox stack:

- The `test:live` package script (`nx run-many -t test:live`) shadowed the
  nx-plugin `test:live` target and recursed into itself forever. Remove it;
  the nx target (auto-derived from the `live` Vitest project, `dependsOn:
  build`) is the single source of truth, invoked via nx like
  test:unit/integration/e2e, which have no package scripts either.

- The global-setup readiness probe required a 2xx from `/v1/health`, but
  supabox's mgmt-api has no public health route (`/v1/health` 404s; an
  unauthenticated request is rejected by the auth middleware with 401). Make
  it a pure reachability gate: any HTTP response from `/v1/organizations`
  proves the API is up and routing; functional/auth coverage stays in the
  live tests.

Validated end-to-end: the `orgs list` live smoke passes against a real
supabox control plane.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds a sender workflow that, on PRs labeled `run-live-e2e-ci`, fires a
repository_dispatch (type: cli-pr) to supabase/cli-e2e-ci carrying this PR's
head SHA, so the supabox-backed `test:live` suite runs against the PR's cli.
Opt-in by label to keep the expensive full-stack run off every PR; cli-e2e-ci
reports a `cli-e2e-ci / live` commit status back onto the head SHA.

Distinct from live-e2e.yml (the staging cli-e2e package suite). Part of CLI-1831
(epic CLI-1825).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
CLI-1834 follow-up:

- `projects list` live scenario (account-level, read-only) plus a JSON-output
  assertion. Validated green against a real supabox control plane.
- `describeLiveProject` / `liveProjectRef` / `requireLiveProjectRef` harness
  gate for project-scoped suites: skip unless SUPABASE_LIVE_PROJECT_REF is set
  (a provisioned project), so a control-plane-only stack (e.g. local macOS)
  skips rather than fails them.
- `functions list` and `branches list` project-scoped scenarios behind that
  gate — the entry points for the edge-functions and branching lifecycle
  coverage, which need a provisioned project on the full stack.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…zed)

A bad token must round-trip to the real Management API, come back 401, and
surface as a non-zero exit carrying the upstream "Unauthorized" message —
exercising the cli's auth + error mapping against the live stack, not just the
golden path. Validated green against a real supabox control plane.

Refs CLI-1834.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
More live coverage validatable on a control-plane-only stack:

- `orgs list --output-format json`: stdout is payload-only parseable JSON
  (machine-output parity with `projects list`).
- `functions list --project-ref <unknown>`: a well-formed but nonexistent ref
  round-trips to the live Management API, returns 404, and surfaces as a
  non-zero exit (not a crash, not "Unauthorized") — exercises the
  `--project-ref` request path + error mapping without a provisioned project,
  so it runs under `describeLive` rather than `describeLiveProject`.

Validated green against a real supabox control plane (6 passed, 2 skipped).

Refs CLI-1834.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@avallete avallete requested a review from a team as a code owner June 25, 2026 16:25
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

Supabase CLI preview

npx --yes https://pkg.pr.new/supabase/cli/supabase@2e84e5ec686fad7e7ee5b624120278af6c5a6b58

Preview package for commit 2e84e5e.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f3ef0579de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/dispatch-cli-e2e-ci.yml Outdated
Comment thread apps/cli/tests/helpers/live.ts
- dispatch-cli-e2e-ci.yml: guard the dispatch job on head.repo == base repo so
  a labeled fork PR (which doesn't receive secrets) skips cleanly instead of
  red-checking on the App-token step.
- runSupabaseLive: default exitTimeoutMs to 240s (LIVE_EXIT_TIMEOUT_MS) so a
  slow-but-valid supabox call isn't killed by runSupabase's 60s default before
  the live tests' own (60–120s) timeouts fire; callers can still override.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b55d0018a7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/cli/tests/live-global-setup.ts Outdated
Split the env-only live helpers (isLiveConfigured, liveApiBaseUrl, project-ref
accessors, profile/timeout constants) into tests/helpers/live-env.ts, which
imports no Vitest test APIs. globalSetup now imports from there instead of
helpers/live.ts (which pulls in `describe`), avoiding evaluating Vitest test
APIs in the globalSetup context. live.ts re-exports the env helpers so
*.live.test.ts keep a single import site.

Validated against a real supabox stack: 8 passed, 0 skipped.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@avallete avallete added this pull request to the merge queue Jun 26, 2026
Merged via the queue into develop with commit a4a2530 Jun 26, 2026
28 checks passed
@avallete avallete deleted the claude/inspiring-einstein-twixh1 branch June 26, 2026 10: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.

3 participants