test: secret list command - #312
Merged
Merged
Conversation
soedirgo
approved these changes
Jul 25, 2022
Contributor
|
🎉 This PR is included in version 0.32.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
TFSebben
pushed a commit
to TFSebben/supabase_cli
that referenced
this pull request
Jul 3, 2026
supabase#5714) Fixes `supabase db schema declarative sync --experimental` (and other pg-delta flows) hanging indefinitely at 0% CPU after the shadow-database work completes. Closes supabase/pg-toolbelt#312 There are two independent causes, both needed to unblock the command: ## 1. The Edge Runtime worker never exits The pg-delta scripts run in a one-shot Edge Runtime container and rely on the event loop draining for the worker to be destroyed and the container to stop. The catalog-export script opens a real connection pool (`createManagedPool`); when a keepalive handle stays registered after `close()` resolves, the worker never exits, so the container never stops. Only the error path force-closed the loop (`throw new Error("")`); the success path did not. Fix: force-close the event loop on the **success** path of every pg-delta script once its output is flushed, so the worker is torn down deterministically: - `templates/pgdelta_catalog_export.ts` — catalog snapshot (the path reported in supabase#312) - `templates/pgdelta.ts` — diff SOURCE→TARGET - `templates/pgdelta_declarative_export.ts` — declarative file export - `templates/pgdelta_declarative_apply.ts` — apply declarative schema - the inline catalog-export script in `internal/db/pgcache/cache.go` — the `db start` / `db push` migrations-catalog cache path The byte-for-byte embedded copies in `legacy-pgdelta.deno-templates.ts` are kept in sync. ## 2. Following the container log stream hangs under podman With the worker now exiting, the container stops — but the parent still hung for podman users. A goroutine dump on the stuck `__catalog` subprocess showed the block in `stdcopy.StdCopy` reading the `Follow:true` Docker log stream (`DockerStreamLogs`): podman's `/containers/<id>/logs?follow` endpoint does not close when the container stops, so the read never gets EOF and blocks forever. Docker closes it, which is why this only reproduced on podman. Fix: run the bounded edge-runtime scripts via a new `DockerRunOnceWaitWithConfig`, which detects completion by polling `ContainerInspect` (reliable on podman) and then reads the buffered logs **without following**. The shared `DockerStreamLogs` (live streaming for `functions serve`) and `DockerRunOnceWithConfig` (large streaming output for `db dump`) are intentionally left unchanged, so only the bounded pg-delta/edge-runtime path changes behaviour. Regression coverage is added for both: guard tests asserting each script's success path force-closes, and a test pinning that the runner reads captured output and maps the inspected exit code without following the log stream. https://claude.ai/code/session_01XbxecW4DVmwgQB1YX321K3 --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
unit test, refactor
What is the current behavior?
Please link any relevant issues here.
What is the new behavior?
utilspackageAdditional context
Add any other context or screenshots.