Skip to content

ci(preview): harden the branch-reset scripts (PR #255 follow-ups) - #258

Merged
JeremyFunk merged 1 commit into
mainfrom
ci/preview-reset-followups
Jul 24, 2026
Merged

JeremyFunk merged 1 commit into
mainfrom
ci/preview-reset-followups

Conversation

@JeremyFunk

@JeremyFunk JeremyFunk commented Jul 24, 2026 •

Copy link
Copy Markdown
Collaborator

The four non-blocking follow-ups from the #255 review:

  1. Tripwire on normalize-preview-ownership.ts — same CI || RESET_PREVIEW_CONFIRM=1 guard as the reset script. Ownership reassignment is low-harm, but bun auto-loads .env and mise loads .env.local, so a dev shell can silently carry a real DATABASE_URL; the script now refuses outside CI without explicit confirmation.
  2. Wider emptiness verification in reset-preview-branch.ts — the post-drop check now counts routines and standalone enum/domain types alongside pg_class relations. Previously a surviving enum (e.g. an owner the reset couldn't assume) passed verification and only failed later as duplicate_object at migrate replay — past the point where the delete → recreate fallback exists.
  3. RESET_PRESERVE_SCHEMAS escape hatch — comma-separated schema names exempted from the extra-schema drop, so a future postgres-owned PlanetScale vendor schema can be protected without a code change.
  4. Dead-code cleanup in electric-pr-branch.ts — sourceId resolves via ?? fail(...) so it's typed string outright; the dead if (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


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

- 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>
@pullfrog

pullfrog Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
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 →

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Rerun failed job ➔ | View workflow run | via Pullfrog | Using Claude Opus | 𝕏

@JeremyFunk
JeremyFunk merged commit 353b6bd into main Jul 24, 2026
7 of 8 checks passed
@JeremyFunk
JeremyFunk deleted the ci/preview-reset-followups branch July 24, 2026 09:17
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

1 inactive deployment
pr-preview — 9cd13abf Deployed Jul 24, 2026 by JeremyFunk via deploy-pr-preview #1030
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant