Skip to content

feat(demo): start every live boot from a fresh demo - #42

Merged
Vishwas1345 merged 2 commits into
mainfrom
feat/demo-reset-on-boot
Oct 16, 2026
Merged

Vishwas1345 merged 2 commits into
mainfrom
feat/demo-reset-on-boot

Conversation

@Vishwas1345

Copy link
Copy Markdown
Owner

Why

The live demo's data lives in Neon and persisted across boots. The first reviewer to approve resolved the 12-lab incident for everyone after them, and the seeded events would age out of the dashboard's 7-day window around 2026-10-23.

What

  • modules/demo/reset.ts: resetAllowed(env) (needs both DEMO_RESET_ON_BOOT=true and APP_ENV=production) and resetDemoDatabase(db):
    • a never-migrated database: left alone (empty)
    • any lab or event whose source is not simulated: refused, nothing touched
    • otherwise drops and recreates the schema. Dropping, not deleting, because the audit trail's triggers (correctly) block DELETE and TRUNCATE; acceptable only for a database that has held nothing but the demo.
  • reset-demo.ts entrypoint; deploy/render/start.sh runs it before migrating when the flag is set; render.yaml sets it. Nothing else sets it: local, compose and the VM stack never reset.
  • Docs: DEPLOYMENT §0 and INFRA §7.

Consequence: every boot of the live site (redeploy, or waking from sleep) wipes the Neon database and reseeds. Neon must never hold anything worth keeping.

Verified

  • Unit: 7 cases for the switch (each switch alone, near misses like 1/TRUE).
  • Integration on a throwaway database the test creates and drops: empty left alone; demo wiped including the audit trail and migrates again; non-simulated data refused and intact.
  • Mutation-checked: the data guard, each switch, and the empty-database path each fail a test when broken.
  • Container under 512 MB against throwaway Postgres/Redis: boot 1 empty → 8 incidents, 0 resolved; approve → 1 resolved; boot 2 reset → 8 incidents, 0 resolved, audit back to 90; with a planted provider lab the reset refused, the container exited 1, and all 41 labs and 90 audit entries were untouched.
  • lint, typecheck, unit (691 api, 141 web), integration 238 twice on a fresh DB, api coverage 98.4%.

🤖 Generated with Claude Code

Vishwas1345 and others added 2 commits October 16, 2026 11:44
A shared demo stays resolved after its first visitor and ages out of the
dashboard's windows. reset-demo drops the schema (the audit trail's triggers
block deleting rows, not dropping them) so the boot can migrate and seed it
fresh. It needs DEMO_RESET_ON_BOOT=true and APP_ENV=production, and refuses
any database holding a lab or event that is not simulated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Vishwas1345
Vishwas1345 merged commit 0108338 into main Oct 16, 2026
8 checks passed
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