Repository navigation
fix(seeds): seed-prod-safe was not reference-only - #612
Merged
Merged
Conversation
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]>
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.
Found while checking what "seed all environments" would actually do, before running anything against production.
The rail did not hold
scripts/seed-prod-safe.shsays:Its second step runs
pnpm --filter @scf/supabase seed— which is the exact command behindsupa:seed:prod:full— andseed-all.tsunconditionally calledseedWorkerTradeSkills(). That writescore.user_skillsrows 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-demoorSEED_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 callsseed-allis safe by default.supa:seed:prod:fullpasses the flag so its name stays honest.seedJobsstays in the reference path deliberately: it writesexternal_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