Skip to content

Fix templates left unseeded after a failed deploy (#150) - #209

Open
dascalescuro wants to merge 3 commits into
mainfrom
fix/150-unseeded-templates
Open

dascalescuro wants to merge 3 commits into
mainfrom
fix/150-unseeded-templates

Conversation

@dascalescuro

@dascalescuro dascalescuro commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Stop treating a created-but-unseeded tpl-* branch as up-to-date forever. After create, seed failures delete the incomplete branch; a successful seed writes a COMMENT ON DATABASE marker; existing templates without that marker are repaired on the next deploy.

Closes #150

First deploy note

Templates that already have seed tables but no marker get the marker stamped in place (no full rebuild). Only empty unmarked branches are deleted and reseeded. Later deploys skip anything whose marker matches the seed hash.

Behavior walkthrough

  • (a) seed throws → deleteBranch runs, script exits non-zero; no incomplete template left behind
  • (b) re-run after (a) → name is absent (or empty unmarked), so create + seed runs again
  • (c) existing template with matching marker → (up-to-date), skipped
  • (d) existing with tables but no marker → marker stamped in place
  • (d2) existing empty with no marker → deleted, then create + seed
  • (e) marker check can't connect after retries → deploy fails; branch is not deleted

Test plan

  • Rebased onto current main; PR contains only scripts/prepare-templates.ts
  • GitHub Actions ci green
  • Marker round-trip on a Xata scratch branch (COMMENT ON DATABASE → shobj_description)
  • Fixed untyped $1 in format() (DO-block write); fail fast on already exists
  • Avoid full rebuild timeout: stamp markers on seeded templates; recreate empties only
  • Vercel preview green after stamp-in-place fix

@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
learn-postgres Ready Ready Preview Oct 14, 2026 1:42pm UTC

Request Review

Delete incomplete template branches on seed failure, write a success
marker on finish, and self-heal existing templates that lack the marker.

Co-authored-by: Cursor <cursoragent@cursor.com>
Parameterized format() failed at deploy with "could not determine data
type of parameter $1", leaving a half-seeded branch that then retried
into "already exists". Embed the hex marker in a DO block instead, and
fail fast on non-transient DDL conflicts.

Co-authored-by: Cursor <cursoragent@cursor.com>
Rebuilding every tpl-* on first deploy exceeded Vercel's build limit.
If a template has public tables but no success marker, write the marker
instead of delete+reseed; only empty unmarked branches are recreated.

Co-authored-by: Cursor <cursoragent@cursor.com>

This branch was successfully deployed

1 active deployment
Preview — 91ade20e Deployed Oct 14, 2026 by vercel[bot]
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.

Templates: failed seed left marked up-to-date forever

1 participant