Skip to content

chore(db): remove dead seed files and rewire consumers#464

Draft
BigGillyStyle wants to merge 5 commits into
devfrom
chore/remove-dead-seed-files
Draft

chore(db): remove dead seed files and rewire consumers#464
BigGillyStyle wants to merge 5 commits into
devfrom
chore/remove-dead-seed-files

Conversation

@BigGillyStyle

@BigGillyStyle BigGillyStyle commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

(moving this back to Draft for now, as I won't have time to address questions and ensure this PR is the right overall approach for a few days)

Closes #368

What

Removes two dead/vestigial seed files and rewires everything that referenced them.

  • Deleted packages/db/src/seed.ts — its seed() only re-synced Postgres id sequences (the rest of the file was commented out), and local-seed.ts (pnpm db:seed:local) has superseded it for real local seeding.
  • Deleted packages/shared/src/common/seed.tsfakeEnum/fakeEnums/fakeArray had zero importers. @faker-js/faker was used only here, so the dependency and its pnpm catalog entry are now removed too.

Rewiring

  • migrate.ts — dropped the seed import and the --seed flag handling.
  • reset-test-db.ts — removed the unreachable "project" seed branch and the seedType param; it now always calls testSeed when seeding (the sole caller already only passed seedType: "test").
  • run-reset-test-db.ts — dropped the now-invalid seedType: "test" argument.
  • Removed the db:seed scripts from the root and packages/db package.json.
  • Updated the command table in docs/LOCAL_DEV_SETUP.md to point at db:seed:local.

Kept (still actively wired)

  • packages/db/src/test-seed.ts — used by pnpm reset-test-db in test/CI.
  • packages/db/src/local-seed.ts — used by pnpm db:seed:local, scripts/local-setup.sh, and docs.

Verification

  • pnpm -F @acme/db typecheck / pnpm -F @acme/shared typecheck — clean
  • pnpm -F @acme/db lint — clean
  • pre-commit hooks (eslint, prettier, typecheck across all 24 packages, commitlint) — pass
  • grep for common/seed / @faker-js/faker / from "./seed" / db:seed — no residual references; faker count in lockfile is 0

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Updated local development setup guide with clarified database seeding command (pnpm db:seed:local).
  • Chores

    • Removed general database seeding script and consolidated into local development-specific command.
    • Removed faker library dependency from the codebase.
    • Simplified test database reset utilities.

Delete the vestigial packages/db/src/seed.ts (its seed() only reset id
sequences; local-seed.ts has superseded it) and the unused
packages/shared/src/common/seed.ts (fakeEnum/fakeEnums/fakeArray had zero
importers). Rewire migrate.ts (drop --seed) and reset-test-db.ts (drop the
unreachable "project" branch + seedType param). Remove the db:seed scripts
and the now-orphaned @faker-js/faker dependency/catalog entry. Keep
test-seed.ts and local-seed.ts, both still actively wired.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Removes the legacy packages/db/src/seed.ts (~540 lines containing hardcoded PII) and all references to it: the --seed CLI branch in migrate.ts, the db:seed root script, the seed script in packages/db/package.json, faker-based shared helpers in packages/shared/src/common/seed.ts, the @faker-js/faker workspace dependency, and the seedType discriminator in resetTestDb. Documentation is updated to reference db:seed:local.

Changes

Legacy Seed Removal

Layer / File(s) Summary
Delete seed.ts and remove --seed from migrate.ts
packages/db/src/seed.ts, packages/db/src/migrate.ts
Deletes the 540-line seed.ts module (including seed and insertUsers exports containing hardcoded PII) and removes the seed import plus --seed CLI branch from migrate.ts.
Simplify resetTestDb: drop seedType, always use testSeed
packages/db/src/utils/reset-test-db.ts, packages/db/src/utils/run-reset-test-db.ts
Removes the seedType?: "test" | "project" option from resetTestDb's parameter type, eliminates the conditional dynamic import of the project seed, and updates the call site to omit seedType.
Remove db:seed scripts, faker dependency, and update docs
package.json, packages/db/package.json, packages/shared/package.json, packages/shared/src/common/seed.ts, pnpm-workspace.yaml, docs/LOCAL_DEV_SETUP.md
Removes db:seed from root and package scripts, deletes faker-based fakeEnum/fakeEnums/fakeArray helpers, removes @faker-js/faker from devDependencies and workspace catalog, and updates the dev setup docs to reference pnpm db:seed:local.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • F3-Nation/f3-nation#317: Directly related — modifies the same packages/shared/src/common/seed.ts faker-based helpers (fakeEnum/fakeEnums/fakeArray) that this PR removes entirely.
  • F3-Nation/f3-nation#453: Closely related — fixes the db:seed:local / reset local seeding workflow (adds missing tsx dependency) that this PR's doc update now exclusively references.

Suggested reviewers

  • dnishiyama
  • pstaylor-patrick
  • evanpetzoldt
  • taterhead247

Poem

🐇 Hop hop, the seeds of old are gone,
No real emails shall linger on.
The faker helpers? Also away!
db:seed:local is here to stay.
Clean fields now, no PII found —
A safer garden, safe and sound! 🌱

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main objective: removing obsolete seed files and updating related consumers, which aligns with the core change across all modified files.
Linked Issues check ✅ Passed All acceptance criteria from issue #368 are met: real PII and privileged grants are removed via deletion of seed.ts, the legacy db:seed path is eliminated, and no admin-on-nation grants remain in code.
Out of Scope Changes check ✅ Passed All changes directly support the core objective of removing dead seed files and their consumers; no unrelated modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/remove-dead-seed-files

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@BigGillyStyle BigGillyStyle marked this pull request as ready for review June 16, 2026 14:35
@taterhead247

Copy link
Copy Markdown
Contributor

@BigGillyStyle thanks for jumping on this! In layman's terms, are you mainly removing the seeding we've had in there since day 1? because it's not used anymore?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes legacy/dead seed utilities (including a vestigial DB seed entrypoint containing real user data) and rewires the remaining tooling/docs to use the actively supported local/test seed paths.

Changes:

  • Deleted the legacy DB seed entrypoint and removed --seed handling from migrations plus db:seed scripts.
  • Simplified reset-test-db to always use testSeed and removed the unused seedType plumbing.
  • Removed unused shared seed helpers and dropped @faker-js/faker from the workspace/dependency graph; updated local dev docs accordingly.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pnpm-workspace.yaml Removes @faker-js/faker from the central pnpm catalog.
pnpm-lock.yaml Removes @faker-js/faker from lockfile catalogs/importers/packages/snapshots.
packages/shared/src/common/seed.ts Deletes unused faker-based seed helper utilities.
packages/shared/package.json Drops the unused @faker-js/faker dependency.
packages/db/src/utils/run-reset-test-db.ts Updates the reset-test-db runner to match the new resetTestDb signature.
packages/db/src/utils/reset-test-db.ts Removes seedType and the legacy project seed path; always uses testSeed.
packages/db/src/seed.ts Deletes the legacy seed script.
packages/db/src/migrate.ts Removes the legacy --seed flag behavior and seed import.
packages/db/package.json Removes the seed script entry.
package.json Removes the root db:seed script and keeps db:seed:local.
docs/LOCAL_DEV_SETUP.md Updates local dev docs to point to pnpm db:seed:local.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

Comment on lines 61 to 71
console.log("Migrating database", databaseName, {
shouldReset,
shouldSeed,
config,
});
await migrator(params?.db ?? getDb(), config);

if (shouldSeed) {
console.log("Seeding database...");
if (params?.seedType === "test") {
await testSeed(params?.db ?? getDb());
} else {
// Import and run project seed
const { seed } = await import("../seed");
await seed();
}
await testSeed(params?.db ?? getDb());
}
@github-actions

Copy link
Copy Markdown

Recently published dependencies

Found 1 package published in the last 3 days:

  • nodemailer@9.0.1 published 2026-06-17 in @acme/auth, @acme/mail, f3-auth, f3-map

Publish-time check health

All package publish-time checks completed successfully.

@BigGillyStyle BigGillyStyle marked this pull request as draft June 19, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

security(db): legacy seed.ts hardcodes real PII + grants admin@nation, no non-local guard

3 participants