Repository navigation
ci(preview): harden the branch-reset scripts (PR #255 follow-ups) - #258
Merged
Merged
Conversation
- normalize-preview-ownership.ts gets the same local-misuse tripwire as the reset script (refuse unless CI or RESET_PREVIEW_CONFIRM=1) — bun auto-loads .env and mise loads .env.local, so a stray real DATABASE_URL in a dev shell must not silently rewrite ownership. - reset-preview-branch.ts emptiness verification now also counts routines and standalone enum/domain types: a survivor of those classes previously sailed past the check and hit duplicate_object at migrate replay, where no recreate fallback exists. - RESET_PRESERVE_SCHEMAS (comma-separated) exempts named schemas from the extra-schema drop — the ops lever for a future postgres-owned PlanetScale vendor schema. - electric-pr-branch.ts: resolve sourceId via `?? fail(...)` so it is typed string outright, and drop the dead `if (sourceId)` wrapper and re-checks that guarded already-fatal states. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Your Pullfrog Router balance is exhausted. You have a card on file but auto-reload is disabled, so runs paused once your balance went past the overdraft buffer. Top up balance → · Enable auto-reload →
|
JeremyFunk
added a commit
that referenced
this pull request
Jul 24, 2026
#258's `AND n.nspname != ALL(${preservedSchemas})` is the actual root cause of the recurring `malformed array literal: ""` reset failures: with fetch_types:false, postgres.js serializes the empty array as '' (diagnostic: parameters ["pg\_%", ""]), and pull_request runs execute the MERGE with main — which is why every run after #258 merged (09:17) failed while the 09:12 run reset cleanly, and why it never reproduced locally against the branch code. Resolution keeps #258's RESET_PRESERVE_SCHEMAS feature but applies the exemption client-side, and keeps the catalog queries bind-parameter-free (LIKE pattern inlined as a literal). Verified locally: preserved schema kept, non-preserved dropped, reset to empty. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This branch was previously deployed
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.

The four non-blocking follow-ups from the #255 review:
normalize-preview-ownership.ts— sameCI || RESET_PREVIEW_CONFIRM=1guard as the reset script. Ownership reassignment is low-harm, but bun auto-loads.envand mise loads.env.local, so a dev shell can silently carry a realDATABASE_URL; the script now refuses outside CI without explicit confirmation.reset-preview-branch.ts— the post-drop check now counts routines and standalone enum/domain types alongsidepg_classrelations. Previously a surviving enum (e.g. an owner the reset couldn't assume) passed verification and only failed later asduplicate_objectat migrate replay — past the point where the delete → recreate fallback exists.RESET_PRESERVE_SCHEMASescape hatch — comma-separated schema names exempted from the extra-schema drop, so a futurepostgres-owned PlanetScale vendor schema can be protected without a code change.electric-pr-branch.ts—sourceIdresolves via?? fail(...)so it's typedstringoutright; the deadif (sourceId)wrapper and downstream re-checks are gone.Verification: the four scripts pass
tsc --strict(they're excluded from CI typecheck as bun runtime scripts), and both tripwires + the usage guard were smoke-run locally (refuse with exit 1 before any connection is made).🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.