Uh oh!
There was an error while loading. Please reload this page.
db/seed-staging: idempotent demo seed for the new schema (#258) - #276
Conversation
…ma (#258) Self-contained, idempotent staging-only seed that lays a small fake demo dataset on top of migrations 0019-0027 so the live app renders the knowledge graph, gradebook, and courses-with-term against a real DB. Runs via `python -m db.seed_staging`; safe to re-run. - 1 demo school, 3 abstract courses, 4 offerings (CS101 in 2 terms — graph mastery is cumulative across terms since it's keyed on the abstract course). - 1 slim user + user_profiles (encrypted name fields), 4 enrollments (incl. CS101 in both terms), 9 graph_nodes / 4 graph_edges / 6 node_mastery_events. - Gradebook (4 categories w/ drop_lowest, 6 assignments w/ encrypted points), plus a document + note on an offering for study endpoints. - Idempotent via deterministic seed-… ids + upsert-on-UNIQUE / insert-if-absent; re-runs add nothing. All 🔒 columns go through encrypt_if_present; enum values read straight off the migration CHECK sets (no guesses). Reuses pre-seeded terms (read-only) — never touches the real catalog. - Hermetic tests patch db.seed_staging.table to a recording FakeTable and assert insertion coverage, FK consistency, enum validity, multi-term, encryption, and idempotency (2nd run adds no rows). Checklist Step 6 references the new command. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Deploying with |
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs | frontend-staging | 0234ca3 | Commit Preview URL Branch Preview URL | Jun 24 2026, 08:43 PM |
Self-contained, idempotent
seed_staging.pyso the live app renders graph + gradebook + courses-with-term against the migrated staging DB. Code only — does not run against any DB; a human runs it with staging env.Seeds (all FK-valid,
seed-…ids): 1 school · 3 abstract courses · 4 offerings (CS101 in two terms) · 1 user + profile · 4 enrollments · 9 graph_nodes + 4 edges + 6 node_mastery_events · 4 gradebook_categories (onedrop_lowest=1) + 6 assignments · 1 document + 1 note.termsread-only (no collision with 0019, no dependency on the real 8192-row catalog).encrypt_if_present(uses staging'sENCRYPTION_KEYat run time).services/academics.py.tests/test_seed_staging.py(hermetic, recording mock) — coverage, FK consistency, enum validity, encryption round-trip, 2nd-run idempotency. 788 passed, zero new failures; ruff clean.Run (from
backend/, staging env):python -m db.seed_staging. Checklist Step 6 updated.Plan:
docs/superpowers/plans/2026-06-24-db-seed-staging.md. Closes#258.