Skip to content

fix(seeds): seed-prod-safe was not reference-only - #612

Merged
thinkclay merged 1 commit into
mainfrom
claude/fix-seed-prod-safe
Aug 12, 2026
Merged

thinkclay merged 1 commit into
mainfrom
claude/fix-seed-prod-safe

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Found while checking what "seed all environments" would actually do, before running anything against production.

The rail did not hold

scripts/seed-prod-safe.sh says:

ONLY runs idempotent reference data seeds — never demo users, orgs, or posts.
NEVER included for prod: 002_seed-users.sql, 003_seed-organizations.sql, 004-008 demo data, 009 community posts

Its second step runs pnpm --filter @scf/supabase seed — which is the exact command behind supa:seed:prod:full — and seed-all.ts unconditionally called seedWorkerTradeSkills(). That writes core.user_skills rows for three hardcoded demo worker UUIDs (22222222-…-222222220{2,3,4}).

On production those ids do not exist, so the write fails rather than corrupting anything. That is luck, not design. A script whose entire purpose is to be the safe path should not attempt user-table writes at all, and anyone reading that header would reasonably run it against prod believing it cannot.

The fix

Demo data is opt-in: --with-demo or SEED_WITH_DEMO=true. The default is reference-only, so a caller has to ask for demo data rather than remember to exclude it — anything new that calls seed-all is safe by default. supa:seed:prod:full passes the flag so its name stays honest.

seedJobs stays in the reference path deliberately: it writes external_job_feeds / external_jobs, which is ingestion config, and the script's own header already lists job feeds as prod-safe.

Context

All three remote environments already hold the full reference set — 8,955 CSI codes, 4 industries on dev, preview and prod alike. So nothing actually needed seeding; the CSI seed I added in #602 fixed local environments, which is how #583 was framed. But the rail was worth repairing before someone trusts it.

CI checks will show red without running — Actions billing block, #375.

🤖 Generated with Claude Code

scripts/seed-prod-safe.sh advertises itself as "ONLY idempotent reference data
seeds — never demo users, orgs, or posts", and lists 002-009 under "NEVER
included for prod". Its second step then runs `pnpm --filter @scf/supabase seed`
— the exact command behind supa:seed:prod:full — and seed-all.ts unconditionally
called seedWorkerTradeSkills, which writes core.user_skills rows for three
hardcoded demo worker UUIDs (22222222-…-2222022/03/04).

On production those ids do not exist, so the write fails rather than corrupting
anything. That is luck, not design: a script whose whole purpose is to be the
safe path should not attempt user-table writes at all, and anyone reading its
header would reasonably run it against prod believing it cannot.

Demo data is now opt-in — `--with-demo` or SEED_WITH_DEMO=true. Default is
reference-only, so a caller has to ask for demo data rather than remember to
exclude it, and anything new that calls seed-all is safe by default.
supa:seed:prod:full passes the flag so its name stays honest.

seedJobs is left in the reference path deliberately: it writes
external_job_feeds / external_jobs, which is ingestion config, and the script's
own header already lists job feeds as prod-safe.

Found while checking what "seed all environments" would actually do before
running it against prod. All three remote environments already hold the full
reference set (8,955 CSI codes, 4 industries), so nothing needed seeding — but
the rail was worth repairing before someone trusts it.

Co-Authored-By: Claude Opus 5 <[email protected]>
@thinkclay
thinkclay merged commit fd6a740 into main Aug 12, 2026
@thinkclay
thinkclay deleted the claude/fix-seed-prod-safe branch August 12, 2026 10:55
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