Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3e40b4b
chore(api): sync Management API OpenAPI spec (#7636)
supabase-cli-releaser[bot] Nov 16, 2026
a4f54ba
fix(cli): stop repeated keychain password prompts (CLI-3135) (#7610)
7ttp Nov 16, 2026
35edf72
fix(cli): prefill the `bootstrap` directory prompt (CLI-3137) (#7613)
7ttp Nov 16, 2026
168a064
chore(stack): bump studio to 2026.11.16-sha-51bd16d-r0 (#7634)
supabase-cli-releaser[bot] Nov 16, 2026
bd6b742
test(cli): cover multiline function env across restarts (CLI-3131) (#…
7ttp Nov 16, 2026
ee6807b
chore(stack): bump storage to v1.96.0-r0 (#7639)
supabase-cli-releaser[bot] Nov 16, 2026
b868a45
feat(cli): add `stack prune` for orphaned stacks (CLI-2548) (#7624)
7ttp Nov 16, 2026
1b7825e
ci(stack): keep pushed commits on slim bump branches (#7638)
jgoux Nov 16, 2026
0f36916
fix(cli): ensure db dump and push pin CA (#7616)
staaldraad Nov 16, 2026
5a42965
chore(stack): bump realtime to v2.167.0-r0 (#7641)
supabase-cli-releaser[bot] Nov 16, 2026
464a39e
fix(cli): wait for concurrent docker prunes by elapsed time (#7550)
avallete Nov 16, 2026
ed07132
test(repo): fix 3 flaky tests in stack and cli live suites (#7623)
avallete Nov 16, 2026
4e2b1ed
test(stack): add diagnostics to 2 flaky owner and Mail tests (#7611)
avallete Nov 16, 2026
c3c7a58
chore(stack): bump auth to v2.198.0-r0 (#7642)
supabase-cli-releaser[bot] Nov 16, 2026
4606333
feat(cli): build the Swift generator from source with @supabase/typeg…
grdsdev Nov 16, 2026
ff05ee9
chore(stack): bump storage to v1.96.2-r0 (#7651)
supabase-cli-releaser[bot] Nov 16, 2026
5ca67cb
chore(stack): bump realtime to v2.168.0-r0 (#7654)
supabase-cli-releaser[bot] Nov 17, 2026
f934fcb
feat(cli): read the plan-gate envelope on raw API calls (#7632)
pamelachia Nov 17, 2026
a77514d
test(cli): retry platform 403s in gateway CORS live test (#7658)
Prashansa-K Nov 17, 2026
317ea77
chore(stack): bump postgrest to v16.6-r0 (#7659)
supabase-cli-releaser[bot] Nov 17, 2026
5c4c7e8
test(stack): fix 1 flaky test in the HttpProxy routed-peer probe (#7656)
avallete Nov 17, 2026
d2d2b7a
Merge remote-tracking branch 'origin/next' into sync/develop-into-next
github-actions[bot] Nov 17, 2026
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
43 changes: 37 additions & 6 deletions .github/workflows/slim-release-published.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ jobs:
exit 1
fi

manual_steps="run manually: ${manual_prefix} ${release}, regenerate the Dockerfile with \`bun apps/cli/scripts/render-service-dockerfile.ts\`, then open a pull request by hand."

git checkout -B "$branch" "$BASE_SHA"

env -u APP_TOKEN bun .github/scripts/sync-artifacts-catalog.ts --service "$SERVICE" --release "$release"
Expand All @@ -160,13 +162,45 @@ jobs:
git add -- "${generated_files[@]}"
git commit -m "$title"

if ! push_output="$(git push --force "$push_url" "HEAD:refs/heads/${branch}" 2>&1)"; then
# `--head` matches by branch name only and ignores the owner, so a fork PR with the
# same head branch name would otherwise match too; `isCrossRepository` excludes it.
existing="$(GH_TOKEN="$APP_TOKEN" gh pr list --head "$branch" --base "$DEFAULT_BRANCH" --state open --json number,isCrossRepository --jq 'map(select(.isCrossRepository | not)) | .[0].number // empty')"

# Commits someone else pushed to the open PR are replayed onto the fresh bump with git
# alone, so no code from the branch runs while the app token is in this shell.
if ! remote_sha="$(git ls-remote "$push_url" "refs/heads/${branch}" | awk -v ref="refs/heads/${branch}" '$2 == ref { print $1 }')"; then
echo "::error ::Failed to read ${branch}; ${manual_steps}"
exit 1
fi
if [ -n "$existing" ] && [ -n "$remote_sha" ]; then
if ! replay="$(GH_TOKEN="$APP_TOKEN" gh api "repos/${GITHUB_REPOSITORY}/compare/${BASE_SHA}...${remote_sha}" \
--jq '"\(.ahead_by) " + ([.commits[] | select((.parents | length) == 1 and .commit.author.email != "41898282+github-actions[bot]@users.noreply.github.com") | .sha] | join(" "))')"; then
echo "::error ::Failed to list the commits on ${branch}; ${manual_steps}"
exit 1
fi
read -r ahead_by others <<<"$replay"
if [ -n "${others:-}" ]; then
read -r -a others <<<"$others"
echo "${branch} has ${#others[@]} commit(s) from others; replaying them onto ${release}."
if ! git fetch --no-tags --depth="$((ahead_by + 1))" "$push_url" "$remote_sha" ||
! git -c core.hooksPath=/dev/null cherry-pick --keep-redundant-commits "${others[@]}"; then
git cherry-pick --abort 2>/dev/null || true
echo "::error ::Could not replay the commits others pushed to ${branch} onto ${release}. Rebuild ${branch} from ${DEFAULT_BRANCH} with ${manual_prefix} ${release}, regenerate the Dockerfile with \`bun apps/cli/scripts/render-service-dockerfile.ts\`, then cherry-pick those commits by hand."
exit 1
fi
fi
fi

if ! push_output="$(git push "--force-with-lease=refs/heads/${branch}:${remote_sha}" "$push_url" "HEAD:refs/heads/${branch}" 2>&1)"; then
echo "$push_output"
if grep -q "(stale info)" <<<"$push_output"; then
echo "::error ::${branch} changed while this run was updating it. Re-run this job to replay the new commits onto ${release}."
exit 1
fi
if ! grep -q "queued for merging cannot be updated" <<<"$push_output"; then
echo "::error ::Failed to push ${branch}. Run manually: ${manual_prefix} ${release}, regenerate the Dockerfile with \`bun apps/cli/scripts/render-service-dockerfile.ts\`, then open a pull request by hand."
exit 1
fi
manual_steps="run manually: ${manual_prefix} ${release}, regenerate the Dockerfile with \`bun apps/cli/scripts/render-service-dockerfile.ts\`, then open a pull request by hand."
queued_steps="Once ${branch} leaves the merge queue, ${manual_steps}"
# The app token minted just before this step expires after one hour; capping the wait at
# 50 minutes into the step leaves room for the lookups and the dispatch that follow it.
Expand Down Expand Up @@ -222,12 +256,9 @@ jobs:
fi
# Names the release this PR actually pins, not necessarily RELEASE_VERSION: postgres
# can plan a hotfix on one line and an unrelated upgrade on another in one dispatch.
body="$(printf 'This %s.\n\nhttps://github.com/supabase/slim-services/releases/tag/%s-%s\n\nPlanned after supabase/slim-services published %s. This branch is rewritten from %s whenever a newer relevant release arrives.\n' \
body="$(printf 'This %s.\n\nhttps://github.com/supabase/slim-services/releases/tag/%s-%s\n\nPlanned after supabase/slim-services published %s. A newer relevant release rewrites this branch from %s and replays any commits others pushed to it.\n' \
"$change" "$SERVICE" "$release" "$RELEASE_VERSION" "$DEFAULT_BRANCH")"

# `--head` matches by branch name only and ignores the owner, so a fork PR with the
# same head branch name would otherwise match too; `isCrossRepository` excludes it.
existing="$(GH_TOKEN="$APP_TOKEN" gh pr list --head "$branch" --base "$DEFAULT_BRANCH" --state open --json number,isCrossRepository --jq 'map(select(.isCrossRepository | not)) | .[0].number // empty')"
if [ -n "$existing" ]; then
if ! GH_TOKEN="$APP_TOKEN" gh pr edit "$existing" --title "$title" --body "$body"; then
echo "::error ::Pushed ${branch} but failed to edit pull request #${existing}. Run manually: ${manual_prefix} ${release}, then edit the pull request from ${branch} by hand."
Expand Down
11 changes: 6 additions & 5 deletions apps/cli/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,12 @@ layer to move spinners; that would change text output globally. Handlers check `
use established encoders before the `output.format` branch.

Plan-gated denials carry an optional `entitlement: { feature, upgrade_url }` on the error.
`mapHttpError` attaches it from the Management API's `entitlement_required` body. The json and
stream-json error object carries it, the text layer's `fail` prints the upgrade hint from it, and
`withCommandTelemetry` fires `cli_upgrade_suggested` from it, so a handler that rebuilds a mapped
status error must forward it. `suggestUpgrade` prints and fires only on its entitlements-lookup
fallback.
`mapHttpError` attaches it from the Management API's `entitlement_required` body, and an
`executeRaw` caller that builds its own status error attaches it with `planGateFromResponse`. The
json and stream-json error object carries it, the text layer's `fail` prints the upgrade hint from
it, and `withCommandTelemetry` fires `cli_upgrade_suggested` from it, so a handler that rebuilds a
mapped status error must forward it. `suggestUpgrade` prints and fires only on its
entitlements-lookup fallback.

## Targets and hosted consent

Expand Down
5 changes: 5 additions & 0 deletions apps/cli/docs/stack-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ default `max_worker_processes` to 17 to leave room for those workers; `postgresq
| ------------------------- | --------------------------------------------------------------------------------- |
| `supabase stack destroy` | Permanently delete stacks and their data. |
| `supabase stack list` | List persisted managed local stacks. |
| `supabase stack prune` | Destroy stacks whose project directory no longer exists. |
| `supabase stack install` | Resolve and lock service versions, then download artifacts without a stack. |
| `supabase stack update` | Re-resolve locked service versions and rewrite `supabase/supabase.lock`. |
| `supabase stack outdated` | Report which locked service versions `stack update` would change. |
Expand Down Expand Up @@ -452,6 +453,10 @@ uploads (`stacks/<stack-id>/uploads`) after confirmation. Use `--yes` for unatte
after one confirmation; every id must resolve before anything is destroyed, and a stack that fails
to be destroyed does not stop the rest, though the command still fails.

`supabase stack prune` destroys, after one confirmation, the stacks whose project directory no
longer exists, such as those of deleted worktrees or moved directories; `--dry-run` only lists
them. A directory on an unmounted drive counts as missing, so check with `--dry-run` first.

## Storage and bucket seeding

The `experimental.stack` flag (with the usual `SUPABASE_EXPERIMENTAL_STACK=1|0` env
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@supabase/pg-topo": "1.0.0-alpha.8",
"@supabase/stack": "workspace:*",
"@supabase/supabase-js": "catalog:",
"@supabase/typegen": "0.3.4",
"@supabase/typegen": "0.4.0",
"@tsconfig/bun": "catalog:",
"@types/bun": "catalog:",
"@types/pg": "^8.23.1",
Expand Down
71 changes: 50 additions & 21 deletions apps/cli/src/auth/command-credentials.layer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
Config,
ConfigProvider,
Duration,
Effect,
FileSystem,
Layer,
Expand Down Expand Up @@ -335,30 +336,45 @@ const loadKeyringModule = (
: yield* Effect.tryPromise(() => import("@napi-rs/keyring")).pipe(Effect.option);
});

interface KeyringToken {
readonly value: string;
readonly account: "profile" | "legacy";
}

// Keyring chain for a given profile account: profile key first, then the legacy `access-token`
// key. Callers must pass the already-reconciled profile name.
const readKeyringForAccount = (
const lookupKeyringForAccount = (
keyringModule: Option.Option<KeyringModule>,
profileAccount: string,
platform: RuntimePlatform,
debugLogger: DebugLoggerShape,
): Effect.Effect<Option.Option<string>> =>
): Effect.Effect<Option.Option<KeyringToken>> =>
Effect.gen(function* () {
if (Option.isNone(keyringModule)) return Option.none<string>();
if (Option.isNone(keyringModule)) return Option.none<KeyringToken>();
const profileResult = yield* tryKeyringRead(keyringModule.value, profileAccount, platform);
if (Option.isSome(profileResult)) {
yield* debugLogger.debug(`Using access token for profile: ${profileAccount}`);
return profileResult;
return Option.some({ value: profileResult.value, account: "profile" });
}
const legacyResult = yield* tryKeyringRead(
keyringModule.value,
LEGACY_KEYRING_ACCOUNT,
platform,
);
if (Option.isSome(legacyResult)) {
yield* debugLogger.debug("Using access token from credentials store...");
}
return legacyResult;
return Option.map(legacyResult, (value) => ({ value, account: "legacy" }));
});

const logKeyringSource = (
token: Option.Option<KeyringToken>,
profileAccount: string,
debugLogger: DebugLoggerShape,
): Effect.Effect<Option.Option<string>> =>
Effect.gen(function* () {
if (Option.isNone(token)) return Option.none<string>();
yield* debugLogger.debug(
token.value.account === "profile"
? `Using access token for profile: ${profileAccount}`
: "Using access token from credentials store...",
);
return Option.some(token.value.value);
});

const readFallbackFile = (
Expand Down Expand Up @@ -403,10 +419,9 @@ export const accessTokenForProfile = Effect.fn("CommandCredentials.accessTokenFo
configProvider,
);
const keyringModule = yield* loadKeyringModule(fs, noKeyring);
const keyringValue = yield* readKeyringForAccount(
keyringModule,
const keyringValue = yield* logKeyringSource(
yield* lookupKeyringForAccount(keyringModule, profileAccount, runtimeInfo.platform),
profileAccount,
runtimeInfo.platform,
debugLogger,
);
if (Option.isSome(keyringValue)) {
Expand Down Expand Up @@ -445,11 +460,23 @@ const makeCommandCredentials = Effect.gen(function* () {
const keyringModule = yield* loadKeyringModule(fs, noKeyring);
yield* Effect.annotateCurrentSpan({ "keyring.enabled": Option.isSome(keyringModule) });

const readKeyring = readKeyringForAccount(
keyringModule,
profileAccount,
runtimeInfo.platform,
debugLogger,
/* Read the keychain once per command: on macOS each read by an untrusted binary prompts. */
const [lookupKeyring, invalidateKeyring] = yield* Effect.cachedInvalidateWithTTL(
lookupKeyringForAccount(keyringModule, profileAccount, runtimeInfo.platform).pipe(
Effect.tap((token) =>
Effect.annotateCurrentSpan({
"keyring.entry": Option.match(token, {
onNone: () => "none",
onSome: ({ account }) => account,
}),
}),
),
Effect.withSpan("CommandCredentials.readKeyring"),
),
Duration.infinity,
);
const readKeyring = lookupKeyring.pipe(
Effect.flatMap((token) => logKeyringSource(token, profileAccount, debugLogger)),
);

const readFile = readFallbackFile(fs, fallbackPath);
Expand Down Expand Up @@ -491,7 +518,7 @@ const makeCommandCredentials = Effect.gen(function* () {
profileAccount,
token,
runtimeInfo.platform,
);
).pipe(Effect.ensuring(invalidateKeyring));
if (ok) {
yield* Effect.annotateCurrentSpan({ "credential.destination": "keyring" });
return;
Expand Down Expand Up @@ -534,15 +561,17 @@ const makeCommandCredentials = Effect.gen(function* () {
keyringModule.value,
profileAccount,
runtimeInfo.platform,
);
).pipe(Effect.ensuring(invalidateKeyring));
if (outcome === "notFound") {
return yield* new NotLoggedInError({ message: NOT_LOGGED_IN_MESSAGE });
}
}).pipe(Effect.withSpan("CommandCredentials.deleteAccessToken")),

deleteAllProjectCredentials: Effect.gen(function* () {
if (Option.isNone(keyringModule)) return;
yield* deleteAllKeyringEntries(keyringModule.value, runtimeInfo.platform);
yield* deleteAllKeyringEntries(keyringModule.value, runtimeInfo.platform).pipe(
Effect.ensuring(invalidateKeyring),
);
}).pipe(Effect.withSpan("CommandCredentials.deleteAllProjectCredentials")),

deleteProjectCredential: Effect.fn("CommandCredentials.deleteProjectCredential")(function* (
Expand Down
47 changes: 47 additions & 0 deletions apps/cli/src/auth/command-credentials.layer.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
PlatformError,
Redacted,
Schema,
Tracer,
} from "effect";
import { beforeEach, vi } from "vitest";

Expand All @@ -32,6 +33,7 @@ const throwOnGetPasswordAccounts = new Set<string>();
const throwOnDeleteAccounts = new Set<string>();
const failDeleteAccounts = new Set<string>();
const withTargetCalls: string[] = [];
const getPasswordCalls: string[] = [];
const opaqueAccounts = new Set<string>();
let throwOnFindCredentials = false;

Expand Down Expand Up @@ -75,6 +77,7 @@ vi.mock("@napi-rs/keyring", () => ({
}
getPassword(): string | null {
const key = this.key();
getPasswordCalls.push(key);
if (throwOnGetPasswordAccounts.has(key)) {
throw new Error("Keyring unavailable");
}
Expand Down Expand Up @@ -145,6 +148,7 @@ beforeEach(() => {
throwOnGetPasswordAccounts.clear();
throwOnDeleteAccounts.clear();
withTargetCalls.length = 0;
getPasswordCalls.length = 0;
opaqueAccounts.clear();
failDeleteAccounts.clear();
throwOnFindCredentials = false;
Expand Down Expand Up @@ -233,6 +237,49 @@ describe("commandCredentialsLayer.getAccessToken", () => {
}).pipe(Effect.provide(makeLayer()));
});

it.effect("reads the keychain once per command until the stored token changes", () => {
passwords.set("Supabase CLI/supabase", VALID_TOKEN);
const stderr = captureStderr();
return Effect.gen(function* () {
const { getAccessToken, saveAccessToken, deleteAccessToken, deleteAllProjectCredentials } =
yield* CommandCredentials;
expectSomeToken(yield* getAccessToken, VALID_TOKEN);
expectSomeToken(yield* getAccessToken, VALID_TOKEN);
expect(getPasswordCalls).toEqual(["Supabase CLI/supabase"]);
const stderrText = stderr.mock.calls.map(([chunk]) => String(chunk)).join("");
expect(stderrText.match(/Using access token for profile: supabase\n/g)).toHaveLength(2);

yield* deleteAllProjectCredentials;
expect(Option.isNone(yield* getAccessToken)).toBe(true);
yield* saveAccessToken(VALID_OAUTH_TOKEN);
expectSomeToken(yield* getAccessToken, VALID_OAUTH_TOKEN);
yield* deleteAccessToken;
expect(Option.isNone(yield* getAccessToken)).toBe(true);
}).pipe(
Effect.ensuring(Effect.sync(() => stderr.mockRestore())),
Effect.provide(makeLayer({ debug: true })),
);
});

it.effect("traces one keychain read for repeated token lookups", () => {
passwords.set("Supabase CLI/supabase", VALID_TOKEN);
const spans: Array<Tracer.NativeSpan> = [];
const tracer = Tracer.make({
span(options) {
const span = new Tracer.NativeSpan(options);
spans.push(span);
return span;
},
});
return Effect.gen(function* () {
const { getAccessToken } = yield* CommandCredentials;
yield* getAccessToken;
yield* getAccessToken;
const reads = spans.filter((span) => span.name === "CommandCredentials.readKeyring");
expect(reads.map((span) => span.attributes.get("keyring.entry"))).toEqual(["profile"]);
}).pipe(Effect.withTracer(tracer), Effect.withTracerEnabled(true), Effect.provide(makeLayer()));
});

it.effect("debug logs the access token source", () => {
passwords.set("Supabase CLI/supabase", VALID_TOKEN);
const stderr = captureStderr();
Expand Down
7 changes: 7 additions & 0 deletions apps/cli/src/command-internal/connect-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ export const SUGGEST_ENV_VAR =
export const SUGGEST_CA_VERIFICATION =
"The server certificate did not verify against the trusted CA (the bundled Supabase CA on a hosted project). Behind a TLS-inspecting proxy, set PGSSLROOTCERT to a CA bundle that trusts it, or set PGSSLMODE=require to skip certificate verification.";

/** The suggestion for a `pg_dump` that exited non-zero, classified from its stderr. */
export function pgDumpFailureSuggestion(stderr: string): string | undefined {
if (isIPv6ConnectivityError(stderr)) return ipv6Suggestion();
if (stderr.includes("certificate verify failed")) return SUGGEST_CA_VERIFICATION;
return undefined;
}

/**
* Shown instead of the remote-only "Network Restrictions" hint when `ctx.isLocal` is true — a
* refused `--local` connection (Docker/Postgres not running) needs a different fix than an
Expand Down
45 changes: 45 additions & 0 deletions apps/cli/src/command-internal/db-config.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,51 @@ describe("dbConfigResolver (local + db-url)", () => {
);
});

it.effect.each([
{
name: "direct database host",
url: "postgres://postgres:pw@db.abcdefghijklmnopqrst.supabase.co:5432/postgres",
},
{
name: "pooler host",
url: "postgres://postgres.ref:pw@aws-0-us-east-1.pooler.supabase.com:6543/postgres",
},
])("db-url mode: pins the Supabase CA for a $name", ({ url }) =>
Effect.gen(function* () {
const dir = yield* withWorkdir();
const r = yield* resolveConnection(dir, inputFor(dbUrlTarget(url)));
expect(r.isLocal).toBe(false);
expect(r.conn.sslmode).toBe("require");
expect(r.conn.sslrootcertInline).toBe(rootCaBundle());
}).pipe(Effect.scoped, Effect.provide([BunServices.layer, BunCrypto.layer])),
);

it.effect.each([
{
name: "an explicit sslmode on a Supabase host",
url: "postgres://postgres:pw@db.abcdefghijklmnopqrst.supabase.co:5432/postgres?sslmode=disable",
sslmode: "disable",
},
{
name: "a non-Supabase host",
url: "postgres://postgres:pw@db.example.net:5432/postgres",
sslmode: undefined,
},
{
name: "a local target on a Supabase host name",
url: "postgres://postgres:pw@db.abcdefghijklmnopqrst.supabase.co:54322/postgres",
sslmode: undefined,
configEnv: { SUPABASE_SERVICES_HOSTNAME: "db.abcdefghijklmnopqrst.supabase.co" },
},
])("db-url mode: leaves TLS untouched for $name", ({ url, sslmode, configEnv }) =>
Effect.gen(function* () {
const dir = yield* withWorkdir();
const r = yield* resolveConnection(dir, inputFor(dbUrlTarget(url)), { configEnv });
expect(r.conn.sslmode).toBe(sslmode);
expect(r.conn.sslrootcertInline).toBeUndefined();
}).pipe(Effect.scoped, Effect.provide([BunServices.layer, BunCrypto.layer])),
);

it.effect("db-url mode: accepts a libpq keyword/value DSN", () =>
Effect.gen(function* () {
const dir = yield* withWorkdir();
Expand Down
Loading
Loading