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
11 changes: 3 additions & 8 deletions .oxlintrc.effect.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,15 @@
"!packages/config/**",
"!packages/stack/**",
"!apps/cli/src/**",
"!apps/cli/tests/**",
"!apps/cli/vitest.config.ts",
// Last match wins across the whole list: keep bare re-exclusions after every
// `!` entry that would otherwise re-include them.
"apps/cli/src/shared/cli/bin.ts",
"apps/cli/src/shared/compute/stacks/**",
"apps/cli/src/shared/feedback/database.types.ts",
"apps/cli/src/command-internal/db-bootstrap/local-db-running.integration.test.ts",
"apps/cli/src/command-internal/db-bootstrap/local-db-running.ts",
"packages/api/src/generated/contracts.ts",
"!apps/cli/tests/helpers/branches-live.ts",
"!apps/cli/tests/helpers/compute.ts",
"!apps/cli/tests/helpers/migration-live.ts",
"!apps/cli/tests/helpers/notebooks.ts",
"!apps/cli/tests/helpers/postgres-config-live.ts",
"!apps/cli/tests/helpers/secrets-live.ts",
"!apps/cli/tests/helpers/storage-live.ts"
"packages/api/src/generated/contracts.ts"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { BunServices } from "@effect/platform-bun";
import { Effect, FileSystem, Option, Path } from "effect";
import { afterEach, describe, expect, test } from "vitest";

import { makeTempHome, runSupabase } from "../../../tests/helpers/cli.ts";
import { createTempHome, runSupabase, type TempHome } from "../../../tests/helpers/cli.ts";

const CLEANUP_TIMEOUT_MS = 120_000;

Expand Down Expand Up @@ -97,7 +97,7 @@ const mtimeMs = Effect.fnUntraced(function* (filePath: string) {

describe("shadow baseline cache (e2e, local Docker stack)", () => {
let projectDir: string | undefined;
let home: ReturnType<typeof makeTempHome> | undefined;
let home: TempHome | undefined;

afterEach(() =>
Effect.runPromise(
Expand All @@ -116,7 +116,7 @@ describe("shadow baseline cache (e2e, local Docker stack)", () => {
yield* fs.remove(projectDir, { recursive: true, force: true }).pipe(Effect.ignore);
}
// Disposes the temp `SUPABASE_HOME`, and with it the ~90MB baseline tar this suite published.
home?.[Symbol.dispose]();
if (home !== undefined) yield* home.dispose;
projectDir = undefined;
home = undefined;
}).pipe(Effect.provide(BunServices.layer)),
Expand All @@ -140,7 +140,7 @@ describe("shadow baseline cache (e2e, local Docker stack)", () => {
projectDir = yield* fs.makeTempDirectory({ prefix: "sb-shadow-cache-e2e-" });
// One temp `SUPABASE_HOME` per test run so both `db diff` processes share the same cache
// directory; `runSupabase` otherwise mints a fresh home per invocation.
home = makeTempHome();
home = yield* createTempHome;
const homeDir = home.dir;
const cacheDir = path.join(home.dir, "cache", "shadow-baseline");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ describe("edgeRuntimeScriptLayer sentinel handling", () => {
),
),
);
seedLegacyStateDecoys(workdir);
yield* seedLegacyStateDecoys(workdir);

const { layer, docker } = setup(
{ exitCode: 1, stdout: "", stderr: "main worker has been destroyed\n" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ function setup(path: Path.Path, opts: SetupOpts = {}) {
dbConnectionLayer,
loginApi.layer,
loginCrypto.layer,
mockBrowser(),
mockBrowser,
mockStdin(opts.stdinIsTty ?? true),
Layer.succeed(OutputFlag, Option.none()),
Layer.succeed(WorkdirFlag, opts.workdir ?? Option.some(tempRoot.current)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function ambientStubs() {
isolatedHomeLayer(tempRoot.current, { SUPABASE_ACCESS_TOKEN: VALID_TOKEN }),
mockTty(),
mockProcessControl().layer,
mockBrowser(),
mockBrowser,
mockStdin(false),
analytics.layer,
mockTelemetryRuntime(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ describe("bootstrap linked-project cache location", () => {
dbConnectionLayer,
mockLoginApi({ gotrueId: "gotrue-user" }).layer,
mockLoginCrypto().layer,
mockBrowser(),
mockBrowser,
mockStdin(true),
flagsLayer,
debugLogger,
Expand Down
16 changes: 8 additions & 8 deletions apps/cli/src/commands/db/dump/dump.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1774,14 +1774,14 @@ describe("db dump target default warning", () => {
{ label: "--project-ref", over: { projectRef: Option.some("flagflagflagflagflag") } },
] as const;

const runWith = (linked: boolean) => (selector: (typeof selectors)[number] | undefined) => {
setLinkedRefFile(tmp.current, linked);
const { layer, out } = setup({ conn: REMOTE_CONN, isLocal: false, workdir: tmp.current });
return dbDump(flags({ dryRun: true, ...selector?.over })).pipe(
Effect.provide(layer),
Effect.map(() => ({ stdout: out.stdoutText, stderr: out.stderrText })),
);
};
const runWith = (linked: boolean) => (selector: (typeof selectors)[number] | undefined) =>
Effect.andThen(setLinkedRefFile(tmp.current, linked), () => {
const { layer, out } = setup({ conn: REMOTE_CONN, isLocal: false, workdir: tmp.current });
return dbDump(flags({ dryRun: true, ...selector?.over })).pipe(
Effect.provide(layer),
Effect.map(() => ({ stdout: out.stdoutText, stderr: out.stderrText })),
);
});

it.effect(
"warns on a bare run in a linked workdir and stays silent with every selector or when unlinked",
Expand Down
32 changes: 16 additions & 16 deletions apps/cli/src/commands/db/pull/pull.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2540,23 +2540,23 @@ describe("db pull target default warning", () => {
{ label: "--project-ref", over: { projectRef: Option.some("flagflagflagflagflag") } },
] as const;

const runWith = (linked: boolean) => (selector: (typeof selectors)[number] | undefined) => {
setLinkedRefFile(tmp.current, linked);
const s = setup(tmp.current, {
migrations: ["20240101000000"],
remoteVersions: ["20240101000000"],
edgeStdout: "",
projectId: Option.none(),
const runWith = (linked: boolean) => (selector: (typeof selectors)[number] | undefined) =>
Effect.andThen(setLinkedRefFile(tmp.current, linked), () => {
const s = setup(tmp.current, {
migrations: ["20240101000000"],
remoteVersions: ["20240101000000"],
edgeStdout: "",
projectId: Option.none(),
});
return dbPull(flags(selector?.over)).pipe(
Effect.exit,
Effect.provide(s.layer),
Effect.map(() => ({
stdout: streamText(s.out, "stdout"),
stderr: streamText(s.out, "stderr"),
})),
);
});
return dbPull(flags(selector?.over)).pipe(
Effect.exit,
Effect.provide(s.layer),
Effect.map(() => ({
stdout: streamText(s.out, "stdout"),
stderr: streamText(s.out, "stderr"),
})),
);
};

it.effect(
"warns on a bare run in a linked workdir and stays silent with every selector or when unlinked",
Expand Down
24 changes: 12 additions & 12 deletions apps/cli/src/commands/db/push/push.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1416,19 +1416,19 @@ describe("db push target default warning", () => {
},
] as const;

const runWith = (linked: boolean) => (selector: (typeof selectors)[number] | undefined) => {
setLinkedRefFile(tmp.current, linked);
const { layer, out } = setup(tmp.current, {
toml: 'project_id = "test"\n',
args: ["db", "push", ...(selector?.args ?? [])],
isLocal: false,
noProjectId: true,
const runWith = (linked: boolean) => (selector: (typeof selectors)[number] | undefined) =>
Effect.andThen(setLinkedRefFile(tmp.current, linked), () => {
const { layer, out } = setup(tmp.current, {
toml: 'project_id = "test"\n',
args: ["db", "push", ...(selector?.args ?? [])],
isLocal: false,
noProjectId: true,
});
return dbPush({ ...DEFAULT_FLAGS, ...selector?.over }).pipe(
Effect.provide(layer),
Effect.map(() => ({ stdout: out.stdoutText, stderr: out.stderrText })),
);
});
return dbPush({ ...DEFAULT_FLAGS, ...selector?.over }).pipe(
Effect.provide(layer),
Effect.map(() => ({ stdout: out.stdoutText, stderr: out.stderrText })),
);
};

it.effect(
"warns on a bare run in a linked workdir and stays silent with every selector or when unlinked",
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/commands/db/reset/reset.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1309,14 +1309,14 @@ describe("db reset", () => {
});

it.effect("a stack reset never reads or writes supabase/.temp", () => {
seedLegacyStateDecoys(tmp.current);
const { layer, accessed } = setup(tmp.current, {
toml: 'project_id = "test"\n',
args: ["db", "reset", "--local"],
isLocal: true,
stackBackend: true,
});
return Effect.gen(function* () {
yield* seedLegacyStateDecoys(tmp.current);
yield* dbReset(DEFAULT_FLAGS).pipe(Effect.provide(layer));
expect(accessed.some((entry) => entry.endsWith("config.toml"))).toBe(true);
expect(legacyStateAccesses(accessed)).toEqual([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1087,21 +1087,25 @@ describe("db schema declarative sync integration", () => {
stackBackend: true,
applyFails: true,
});
seedLegacyStateDecoys(tmp.current);
return Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
yield* seedDeclarative(tmp.current);
const error = yield* dbSchemaDeclarativeSync(flags({ apply: Option.some(true) })).pipe(
Effect.flip,
);
expect(error._tag).toBe("DeclarativeApplyError");
const pgdeltaRoot = path.join(tmp.current, ".supabase", "tmp", "pgdelta");
const projectRoots = yield* fs.readDirectory(pgdeltaRoot);
expect(projectRoots).toHaveLength(1);
expect(yield* fs.exists(path.join(pgdeltaRoot, projectRoots[0] ?? "", "debug"))).toBe(true);
expect(legacyStateAccesses(s.accessed)).toEqual([]);
}).pipe(Effect.provide(s.layer));
return Effect.andThen(
seedLegacyStateDecoys(tmp.current),
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
yield* seedDeclarative(tmp.current);
const error = yield* dbSchemaDeclarativeSync(flags({ apply: Option.some(true) })).pipe(
Effect.flip,
);
expect(error._tag).toBe("DeclarativeApplyError");
const pgdeltaRoot = path.join(tmp.current, ".supabase", "tmp", "pgdelta");
const projectRoots = yield* fs.readDirectory(pgdeltaRoot);
expect(projectRoots).toHaveLength(1);
expect(yield* fs.exists(path.join(pgdeltaRoot, projectRoots[0] ?? "", "debug"))).toBe(
true,
);
expect(legacyStateAccesses(s.accessed)).toEqual([]);
}).pipe(Effect.provide(s.layer)),
);
},
);

Expand Down
Loading
Loading