xataio / xataio/learn-postgres

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

Open Beginner friendly
#150 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug ready-for-agent
Dominant language
MDX
Stars
7
Forks
1
Avg merge
1d 2h
Merged PRs (30d)
36

Description

Symptom

scripts/prepare-templates.ts creates a tpl-* branch, then seeds it. If create succeeds and a later step fails (awaitConnectionString, resolveBranchDsn, or seedTemplate), the next deploy/run sees the branch name in listBranches() and logs it as up-to-date, skipping recreate/re-seed.

Learners who fork that template get an empty or broken sandbox for that lesson.

Red loop (logic already exercised)

  1. Create template name not in existing → createBranch succeeds → add name to Xata.
  2. Seed (or DSN) throws → script exits non-zero.
  3. Re-run: existing.has(name) → skip with (up-to-date).

Where

  • scripts/prepare-templates.ts (~lines 219–237) — existence check only; no “seeded successfully” marker / delete-on-failure

Suggested direction

On failure after create: delete the branch (or mark incomplete). On success-only: treat as up-to-date. Alternatively re-seed / verify seed before skipping.

Notes

Diagnosed with /diagnosing-bugs. Deploy impact if template prep fails mid-lesson after the branch already exists.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read scripts/prepare-templates.ts around lines 219–237 and trace the create, DSN, and seed steps. Verify the failure path after branch creation, then ensure a failed preparation is not treated as up-to-date on the next run. Done means a failed seed can be retried and a successfully prepared template remains safely skipped.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.