| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
chore(deps): upgrade effect to 4.0.2 (#6999) Bumps `effect`, `@effect/platform-bun`, `@effect/platform-node`, `@effect/platform-node-shared`, `@effect/sql-pg`, and `@effect/vitest` from `4.0.0-rc.112` to the stable `4.0.2` release. `@effect/tsgo` is unchanged. The goal is zero change to CLI behaviour. Every edit is either required by a removed or renamed API, or restores a behaviour whose upstream default moved. ## Commit layout The first three commits are the bump plus two scripted rewrites and can be skipped by reviewers: - `effect/unstable/*` import paths moved to `effect/*` (removed upstream in rc.118, [effect#8354](https://github.com/Effect-TS/effect/pull/8354)). - CLI and Config constructors renamed to PascalCase ([effect#7453](https://github.com/Effect-TS/effect/pull/7453), [effect#8121](https://github.com/Effect-TS/effect/pull/8121)). The remaining commits are hand migrations, one topic each. ## Hand migrations - **node-postgres pool bridge** — `@effect/sql-pg` 4.0 is a native client and dropped `PgClient.fromPool` ([effect#7426](https://github.com/Effect-TS/effect/pull/7426)). The remote database session keeps its own node-postgres pool for the zero idle timeout, the per-connection role step-down hook, and raw `COPY` connections, so `db-connection.pool-client.ts` is a small `SqlClient.make` adapter over that pool with the same statement execution, cancellation, and error classification the old bridge had. - **Stack RPC strictness** — parse-option annotations no longer affect decoding ([effect#8131](https://github.com/Effect-TS/effect/pull/8131)) and the RPC transport passes no parse options, so the initialization command and `runCommand` payload schemas now reject unknown keys through a `Record` filter ahead of the struct decode, with the same "Expected no excess property" wording. Encoding drops `undefined` entries first, so optional fields passed as explicit `undefined` (for example `pgProve.workingDir`) still cross the RPC JSON codec as they did with the plain struct. - **One statement per query** — the native `@effect/sql-pg` client sends everything through the extended protocol, which rejects multi-command strings. The realtime schema bootstrap runs as two statements, and the generated `ALTER ROLE` / `ALTER DATABASE` batches come back from Postgres as an array and run one at a time inside the same transaction. - **Socket addresses, file sizes, encoding, sockets** — server addresses are `NetAddress.SocketAddress` values, `File.seek` and `File.Info.size` use `bigint` and `ByteSize`, `Encoding` moved to `effect/encoding/Base64Url`, and the whole-stack WebSocket test helper uses the reader and writer pair. - **`Effect.partition`** returns `[passes, fails]`; the `stack destroy` handler destructures in that order. - **Management API contracts** — `packages/api` contracts are regenerated; the 4.0.2 schema codegen emits code-point length checks and Unicode-flagged patterns. - **Config package** — `SchemaAST.Union.mode` moved under `options`, `ToJsonSchemaOptions.additionalProperties` became `onExcessProperty`, and regex patterns need the Unicode flag to be exported into JSON Schema ([effect#8482](https://github.com/Effect-TS/effect/pull/8482)). Peer dependency ranges are untouched and already satisfy 4.0.2. ## Preserved defaults - The stack's `PgClient.layer` calls pin `idleTimeout: "10 seconds"`; the default since 4.0.1 is 60 seconds ([effect#8679](https://github.com/Effect-TS/effect/pull/8679)). - The published JSON Schema files (`@supabase/config` `schema.json` and `project-schema.json`, mirrored at `apps/docs/public/cli/*.schema.json`) are byte-identical to the develop build. `toCliConfigJsonSchema` passes `onExcessProperty: "error"` so structs keep `additionalProperties: false` ([effect#8147](https://github.com/Effect-TS/effect/pull/8147)); the shared document assembler leaves pattern-keyed records open, as the generator has no per-schema setting for that; and bucket tables are modelled so they render as the published object-or-array union. ## Behaviour changes reviewed and accepted These upstream changes have no configuration knob. Each was checked against the repo's call sites and judged not user-visible: - Child-process `kill` and scoped release now wait for the process group, bounded to one second without `forceKillAfter` ([effect#8018](https://github.com/Effect-TS/effect/pull/8018)). The stack host, bundled Postgres clients, and containers already set `forceKillAfter`; other spawn sites can only see up to one extra second of teardown when a descendant lingers. - `Effect.cached` treats interruption as abandonment ([effect#8719](https://github.com/Effect-TS/effect/pull/8719)). Every cached effect in the repo is awaited by a single fiber or forked into an owning scope, so the shared-interruption semantics do not apply. - Empty bucket tables under `storage.analytics.buckets` and `storage.vector.buckets` are modelled as an object-or-array union instead of `Schema.Struct({})`. Runtime decoding now rejects a primitive bucket value (`foo = "x"`), which the old schema accepted and ignored; objects and arrays decode as before. - HTTP client spans are named after the bare method (`GET` instead of `http.client GET`), following the OpenTelemetry convention. Nothing in the repo keys on the old name. - Generated Management API string length checks count code points instead of UTF-16 code units, which only differs for characters outside the Basic Multilingual Plane. ## Patches - Rebased: the `@effect/platform-node-shared` stdin EPIPE listener, now against 4.0.2. 4.0.2 still removes the stdin sink's error listener before the final `end()` flush, so a child that exits before reading its input raises an uncaught EPIPE on Linux; [effect#7712](https://github.com/Effect-TS/effect/pull/7712) and [effect#7714](https://github.com/Effect-TS/effect/pull/7714) do not cover that path. - Rewritten: the `@effect/vitest` `runTest` patch. Upstream's finalizer ordering fix ([effect#8154](https://github.com/Effect-TS/effect/pull/8154)) covers the abort hook, so the patch now only layers the two behaviours the stack's `effect-timeout` tests assert on top of it: rejecting with the pretty errors and reporting a finalizer failure after a timeout. ## Test-only changes - Stack integration and CLI `db reset` e2e fixtures that seeded data through `PgClient.layer` with semicolon-joined statements now issue one statement per call; fixtures that go through `psql` are unchanged. - The `db reset` e2e fixture reads `count(*)::int`, since the native client decodes `int8` as `bigint`. ## Follow-ups - Migrate the remote database session to the native `@effect/sql-pg` client and delete the pool adapter. That changes result decoding (int8, timestamps, bytea) across the SQL consumers and needs its own review. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: Julien Goux <hi@jgoux.dev> | 14 天前 | |
chore(deps): upgrade effect to 4.0.2 (#6999) Bumps `effect`, `@effect/platform-bun`, `@effect/platform-node`, `@effect/platform-node-shared`, `@effect/sql-pg`, and `@effect/vitest` from `4.0.0-rc.112` to the stable `4.0.2` release. `@effect/tsgo` is unchanged. The goal is zero change to CLI behaviour. Every edit is either required by a removed or renamed API, or restores a behaviour whose upstream default moved. ## Commit layout The first three commits are the bump plus two scripted rewrites and can be skipped by reviewers: - `effect/unstable/*` import paths moved to `effect/*` (removed upstream in rc.118, [effect#8354](https://github.com/Effect-TS/effect/pull/8354)). - CLI and Config constructors renamed to PascalCase ([effect#7453](https://github.com/Effect-TS/effect/pull/7453), [effect#8121](https://github.com/Effect-TS/effect/pull/8121)). The remaining commits are hand migrations, one topic each. ## Hand migrations - **node-postgres pool bridge** — `@effect/sql-pg` 4.0 is a native client and dropped `PgClient.fromPool` ([effect#7426](https://github.com/Effect-TS/effect/pull/7426)). The remote database session keeps its own node-postgres pool for the zero idle timeout, the per-connection role step-down hook, and raw `COPY` connections, so `db-connection.pool-client.ts` is a small `SqlClient.make` adapter over that pool with the same statement execution, cancellation, and error classification the old bridge had. - **Stack RPC strictness** — parse-option annotations no longer affect decoding ([effect#8131](https://github.com/Effect-TS/effect/pull/8131)) and the RPC transport passes no parse options, so the initialization command and `runCommand` payload schemas now reject unknown keys through a `Record` filter ahead of the struct decode, with the same "Expected no excess property" wording. Encoding drops `undefined` entries first, so optional fields passed as explicit `undefined` (for example `pgProve.workingDir`) still cross the RPC JSON codec as they did with the plain struct. - **One statement per query** — the native `@effect/sql-pg` client sends everything through the extended protocol, which rejects multi-command strings. The realtime schema bootstrap runs as two statements, and the generated `ALTER ROLE` / `ALTER DATABASE` batches come back from Postgres as an array and run one at a time inside the same transaction. - **Socket addresses, file sizes, encoding, sockets** — server addresses are `NetAddress.SocketAddress` values, `File.seek` and `File.Info.size` use `bigint` and `ByteSize`, `Encoding` moved to `effect/encoding/Base64Url`, and the whole-stack WebSocket test helper uses the reader and writer pair. - **`Effect.partition`** returns `[passes, fails]`; the `stack destroy` handler destructures in that order. - **Management API contracts** — `packages/api` contracts are regenerated; the 4.0.2 schema codegen emits code-point length checks and Unicode-flagged patterns. - **Config package** — `SchemaAST.Union.mode` moved under `options`, `ToJsonSchemaOptions.additionalProperties` became `onExcessProperty`, and regex patterns need the Unicode flag to be exported into JSON Schema ([effect#8482](https://github.com/Effect-TS/effect/pull/8482)). Peer dependency ranges are untouched and already satisfy 4.0.2. ## Preserved defaults - The stack's `PgClient.layer` calls pin `idleTimeout: "10 seconds"`; the default since 4.0.1 is 60 seconds ([effect#8679](https://github.com/Effect-TS/effect/pull/8679)). - The published JSON Schema files (`@supabase/config` `schema.json` and `project-schema.json`, mirrored at `apps/docs/public/cli/*.schema.json`) are byte-identical to the develop build. `toCliConfigJsonSchema` passes `onExcessProperty: "error"` so structs keep `additionalProperties: false` ([effect#8147](https://github.com/Effect-TS/effect/pull/8147)); the shared document assembler leaves pattern-keyed records open, as the generator has no per-schema setting for that; and bucket tables are modelled so they render as the published object-or-array union. ## Behaviour changes reviewed and accepted These upstream changes have no configuration knob. Each was checked against the repo's call sites and judged not user-visible: - Child-process `kill` and scoped release now wait for the process group, bounded to one second without `forceKillAfter` ([effect#8018](https://github.com/Effect-TS/effect/pull/8018)). The stack host, bundled Postgres clients, and containers already set `forceKillAfter`; other spawn sites can only see up to one extra second of teardown when a descendant lingers. - `Effect.cached` treats interruption as abandonment ([effect#8719](https://github.com/Effect-TS/effect/pull/8719)). Every cached effect in the repo is awaited by a single fiber or forked into an owning scope, so the shared-interruption semantics do not apply. - Empty bucket tables under `storage.analytics.buckets` and `storage.vector.buckets` are modelled as an object-or-array union instead of `Schema.Struct({})`. Runtime decoding now rejects a primitive bucket value (`foo = "x"`), which the old schema accepted and ignored; objects and arrays decode as before. - HTTP client spans are named after the bare method (`GET` instead of `http.client GET`), following the OpenTelemetry convention. Nothing in the repo keys on the old name. - Generated Management API string length checks count code points instead of UTF-16 code units, which only differs for characters outside the Basic Multilingual Plane. ## Patches - Rebased: the `@effect/platform-node-shared` stdin EPIPE listener, now against 4.0.2. 4.0.2 still removes the stdin sink's error listener before the final `end()` flush, so a child that exits before reading its input raises an uncaught EPIPE on Linux; [effect#7712](https://github.com/Effect-TS/effect/pull/7712) and [effect#7714](https://github.com/Effect-TS/effect/pull/7714) do not cover that path. - Rewritten: the `@effect/vitest` `runTest` patch. Upstream's finalizer ordering fix ([effect#8154](https://github.com/Effect-TS/effect/pull/8154)) covers the abort hook, so the patch now only layers the two behaviours the stack's `effect-timeout` tests assert on top of it: rejecting with the pretty errors and reporting a finalizer failure after a timeout. ## Test-only changes - Stack integration and CLI `db reset` e2e fixtures that seeded data through `PgClient.layer` with semicolon-joined statements now issue one statement per call; fixtures that go through `psql` are unchanged. - The `db reset` e2e fixture reads `count(*)::int`, since the native client decodes `int8` as `bigint`. ## Follow-ups - Migrate the remote database session to the native `@effect/sql-pg` client and delete the pool adapter. That changes result decoding (int8, timestamps, bytea) across the SQL consumers and needs its own review. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: Julien Goux <hi@jgoux.dev> | 14 天前 | |
feat(cli): default database workflows to the bundled pg-delta engine (#6102) Bundles `@supabase/pg-delta` and `@supabase/pg-topo` into the CLI and makes the in-process engine the default for pg-delta-backed `db diff`, `db pull`, and the declarative schema workflows (`db schema declarative generate|sync`). The legacy edge-runtime implementation remains available as an explicit `SUPABASE_USE_PG_DELTA_NEXT=false` opt-out; there is no automatic fallback or runtime package download — a next-engine failure propagates instead of silently switching implementations. This branch is reconciled with the TypeScript database-command port on `develop`: - shared database bootstrap owns shadow-database setup and receives the complete local configuration, including database webhooks - pgAdmin uses the native TypeScript differ-container path, while `db diff --use-pg-schema` remains the sole Go delegation - `--project-ref` resolution stays in the TypeScript command path and is rejected for delegated modes that cannot honor it - local diffs target the running local database, while migration and declarative baselines use isolated shadow databases - declarative flows repair missing extension prerequisites, scope schema filters, and warn when unsupported object kinds would be omitted - when a legacy declarative tree cannot converge on the next engine, sync offers a staged recovery flow: it generates a next-compatible export into a sibling `<declarative_schema_path>-next` directory (never inside the active tree — trailing separators in the configured path are normalized, and staging into or under the active directory is rejected) and prints adoption commands built from the configured path - both compatibility gates (shadow-load failure and plan-refuse) render one shared recovery template: diagnosis, evidence, an explicit do-not-apply hazard line, and the staged-upgrade commands carried as the error suggestion — so a deliberate gate prints actionable guidance instead of the generic "rerun with --debug" footer. Non-interactive runs get exactly one recommended recovery (the staged regenerate); interactive prompts keep in-place extension repair as an advanced choice with a "may surface another gap" hint - `db pull` when already in sync keeps Go's "No schema changes found" message and non-zero exit, but replaces the debug footer with an explanatory suggestion (recorded in `go-cli-divergences.md`) - migration files preserve pg-delta's `transaction=false` directive so later push, reset, and up operations keep those plans outside CLI-owned transactions - migrations that call `pg_net` while local webhooks are disabled now surface targeted guidance to enable `[experimental.webhooks]` Default-engine snapshots, plans, and diagnostics use an isolated v2 artifact layout. Extraction errors are refused; coverage gaps warn by default and can be promoted to failures with `--strict-coverage` on `db diff`, `db pull`, and the declarative commands (a TS-only flag, recorded in `docs/go-cli-divergences.md`). Generated SQL and file segmentation may differ from the legacy renderer — the compatibility contract is successful execution and convergence on a subsequent diff. The branch pins published `@supabase/pg-delta@1.0.0-alpha.41` and `@supabase/pg-topo@1.0.0-alpha.5` from the npm registry, and patches the libpg-query parser packaging so the WASM asset is embedded in compiled Bun binaries (with an integration test verifying the patched asset survives compilation). A live local-convergence suite (`legacy-pgdelta-next.live.test.ts`) exercises the next engine against a real Docker stack. It is gated on the configured live environment plus a Docker probe (`describeDockerLive`), so it runs only under the cli-e2e-ci harness — machines that merely expose Docker stay inert. The earlier dogfooding playbook, ADR, and glossary documents were trimmed out of this PR to keep it scoped to the engine change. Linked-project, TLS-required, and pooler/SNI acceptance still needs a provisioned data-plane environment because the shared live harness does not create project Postgres. --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> | 2 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 14 天前 | ||
| 14 天前 | ||
| 2 个月前 |