Skip to content

chore: add opt-in non-production database auto-seeding #214

@adrunkhuman

Description

@adrunkhuman

Goal

Add an explicit non-production auto-seed option so preview/manual-test deployments can boot with a small dummy database without running the seed script manually.

This belongs in v3 because invite-based multi-server work needs repeatable preview environments for testing first-run setup, seasons, and scoring rules.

Proposed behavior

  • only works when ENVIRONMENT != production
  • disabled by default
  • requires an explicit opt-in env var, for example SEED_TEST_DATA=true
  • requires a guild/server ID env var, for example TEST_GUILD_ID
  • optionally accepts a test user ID env var, for example TEST_USER_ID
  • only seeds when the target database is empty
  • must not reset or overwrite an existing database automatically
  • must never run in production, even if env vars are accidentally set

Why

typer_bot.dev.seed_test_data is useful for manual Discord testing, but preview deployments currently need a manual shell step before the bot starts. An opt-in auto-seed path would make disposable test deployments easier while keeping production safe.

Likely areas

  • typer_bot/bot.py startup/setup hook
  • typer_bot/dev/seed_test_data.py
  • typer_bot/utils/config.py
  • README manual testing/deployment notes
  • tests around empty DB vs existing DB behavior

Testing notes

  • cover that auto-seed is skipped in production
  • cover that auto-seed is skipped unless explicitly enabled
  • cover that missing TEST_GUILD_ID fails clearly or skips with a clear log
  • cover that a non-empty DB is not reset
  • cover that an empty non-production DB gets seeded when all required env vars are present

Non-goals

  • no production seed behavior
  • no automatic DB reset
  • no Discord API calls from the seed path
  • no general fixture factory/config framework

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions