Skip to content

Synthetic fixtures and a LOCAL_SEED loader - #1

Open
Ethan-Arrowood wants to merge 1 commit into
mainfrom
fixtures-seed
Open

Ethan-Arrowood wants to merge 1 commit into
mainfrom
fixtures-seed

Conversation

@Ethan-Arrowood

Copy link
Copy Markdown
Collaborator

First of three PRs laying the groundwork for the platform work: fixtures + seed → dev sign-in + guard → API tests in CI.

What

  • fixtures/: a synthetic data set. No real event data.
    • 19 tasks covering every status: open, claimed (self-serve and assigned by an organizer), completed, flagged, removed. Three themes, every difficulty, and both import shapes (app shape and the curated detail/tier shape).
    • One guide per theme.
    • Six users: fx_ada (admin), fx_alice, fx_bob and fx_erin (attendees), fx_carol (banned), fx_dave (timed out).
    • The announcement and pool settings.
    • The states are consistent with each other.
    • Every login contains an underscore, which GitHub usernames can't, so a fixture account can never match a real user.
  • LOCAL_SEED=<dir>: loads a fixture set with each task's state intact (unlike LOCAL_DATA_FILE, which opens every task), plus users and settings.
    • Like the existing loaders, it never overwrites an existing record.
    • It runs only on a local instance: OAUTH_REDIRECT_URI unset or a loopback host (resources/shared/local.ts). Anywhere else it logs why it skipped.
  • LOCAL_DATA_FILE and LOCAL_GUIDES_FILE are unchanged.
  • Docs: fixtures/README.md, plus LOCAL_SEED in the README and .env.example.

Nothing changes in production: the new code only runs when LOCAL_SEED is set on a local instance.

Verified on a local Harper 5.2 (4 threads)

  • Fresh database: all 19 tasks, 3 guides, 6 users and 2 settings load with their state. Claims, completions with evidence, the flagged and removed tasks, the ban, the timeout and the organizer assignment all show through the API. Curated-shape tasks fold into the app shape, and guide markdown renders with code blocks.
  • Restart after editing (unassigned a task, changed the announcement): added 0 … (30 already present), and both edits survive.
  • OAUTH_REDIRECT_URI=https://example.com/oauth/callback: LOCAL_SEED ignored: … is not a local origin, and nothing is seeded.

🤖 Generated with Claude Code

Local development and tests need data in every state without any real
event data in the repo. fixtures/ holds a synthetic set: 19 tasks covering
every status (open, claimed self-serve and by an organizer, completed,
flagged, removed), three themes, every difficulty, and both import shapes;
one guide per theme; six users (an admin, attendees, a banned and a
timed-out user); and the announcement and pool settings. The states are
consistent with each other. Every login contains an underscore, which
GitHub usernames can't, so a fixture account never matches a real user.

LOCAL_SEED=<dir> loads such a set with each task's state intact (unlike
LOCAL_DATA_FILE, which opens every task) plus users and settings. Like the
other loaders it never overwrites an existing record, so restarts keep
local edits. It runs only on a local instance (shared/local.ts:
OAUTH_REDIRECT_URI unset or a loopback host) and logs why it skipped
otherwise. LOCAL_DATA_FILE and LOCAL_GUIDES_FILE are unchanged.

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

This branch has not been deployed

No deployments
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