Repository navigation
Conversation
`POST /api/admin/reset` accepted a `reseed` flag and always declined to act on it, because the seed script ran its own top-level IIFE with its own PrismaClient and could not be imported. Export `seed(prisma)` from the seed module and move the CLI bootstrap to `seed-cli.ts`, so importing the module no longer seeds anything by itself. The reset route now calls `seed(prisma)` with the client it already holds and reports `reseeded: true`. The seed runs after the reset transaction has committed: a failure there is reported and the reset stands. Co-Authored-By: Claude Code <noreply@anthropic.com>
The seed script was not Prettier-formatted before this branch, and the CI format check runs on every file a PR touches, so it would fail here. Formatting only; no behaviour change. Co-Authored-By: Claude Code <noreply@anthropic.com>
This branch has not been deployed
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.
Closes #205.
POST /api/admin/resetacceptedreseed: trueand then declined to act on it: the seed script was a top-level async IIFE with its own PrismaClient, so the route could not import it and answeredreseeded: falsewith a note asking for a manualnpx prisma db seed.The seed module now exports
seed(prisma)and keeps only that function; the CLI bootstrap moved toseed-cli.ts(pnpm db:seedandprisma db seedpoint there), so importing the module never seeds anything by itself. The reset route callsseed(prisma)with the client it already holds and answersreseeded: true.The seed runs after the reset transaction has committed. If it fails, the route logs the error and answers
reseeded: falsewith a note, because the reset itself already happened and must not be rolled back.One thing worth flagging: the seed writes the demo dataset, including demo team members that share the
outpost-devpassword, soreseedis a development affordance. Say the word if you would rather it refuse outside development.Tests:
vitest run src/__tests__/admin-reset-api.test.ts— 4/4 passed: a requested reseed runs the seed, an absent reseed does not, and a failed seed is reported without discarding the resetvitest runinapps/web— 1216 passed, 26 skippedtsx db/src/seed-cli.tsseeds the demo dataset, andseed(prisma)with a caller-supplied client creates the same rows after a truncateapps/webtypecheck,next linton the changed files,packages/outpostdb typecheck and lint, Prettier,git diff --checkpassedcopilotkit-internal:cr-loopreview was not available in this environment, so the diff was reviewed by hand; the Prettier-only changes are their own commit🤖 Generated with Claude Code