Skip to content

feat(scripts): seed v2 helpers and realistic-day scenario#1108

Open
NC1107 wants to merge 1 commit into
mainfrom
feat/seed-v2
Open

feat(scripts): seed v2 helpers and realistic-day scenario#1108
NC1107 wants to merge 1 commit into
mainfrom
feat/seed-v2

Conversation

@NC1107
Copy link
Copy Markdown
Owner

@NC1107 NC1107 commented May 22, 2026

Summary

Adds a seed-v2 library and two scenario scripts that exercise gaps the existing seeders miss. The existing seed_demo_data.sh, seed_full_demo.sh, and seed_stress_data.sh are unchanged.

What ships

  • scripts/seed_v2_lib.sh — sourceable helpers, REST + WS only (no DB access). Functions: seed_user, seed_login, seed_contact_accept, seed_group (with is_encrypted toggle), seed_group_invite_accept, seed_dm_message, seed_group_message (with reply_to_id), seed_reaction, seed_set_presence, weighted_choice, random_message_text, backdate_seconds, seed_log. Cloudflare-safe UA, set -euo pipefail, error trap that prints the failing line.
  • scripts/seed_realistic_day.sh — 6 users with varied bios/presence, all-to-all contacts, one plaintext + one encrypted group (is_encrypted=true), all members join both, pairwise DMs (4-10 msgs each), and a realistic-day group rhythm: 08:00 standup, 09:30 async chat with branching reply threads (replies hit several different parents instead of all chaining to the first message), 12:00 lunch lull, 14:00 decision thread with 4 replies, 17:30 EOD. Plus ~15 reactions sprinkled across group messages.
  • scripts/seed_dms_only.sh — minimal pure-DM fixture: 4 users, 6 pairwise DM threads of 8-15 messages each. No groups.
  • One-paragraph mention in CLAUDE.md's Build & Run section so the scripts are discoverable.

Scenarios covered

  • DMs (gap: existing seeders only do groups)
  • Encrypted groups with is_encrypted=true so the [Encrypted] placeholder + lock indicator render. Posts ~120-char random-base64 strings as ciphertext placeholders since the Signal Protocol can't be driven from bash (file comment explains this).
  • Conversation branching — replies hit multiple parents, not just one root.
  • Presence varietyonline, away, dnd, invisible (the server enum has no literal offline; the lib maps offline → invisible).
  • Realistic message rhythm across the simulated day instead of one firehose burst.
  • Idempotency-ish reruns via timestamp-prefixed usernames (riley_1716345678).

Gaps remaining

  • Multi-device — no programmatic way to provision a second device key bundle from bash. Future work.
  • Voice / video calls — LiveKit signaling is interactive and not covered.
  • Push tokens — no APNs/FCM seeding (requires real device tokens).
  • Backdated created_at — the server stamps messages.created_at itself; the lib's backdate_seconds is annotation-only. Truly historical history needs DB access.
  • Disappearing-message TTL variants — endpoint exists (PUT /api/conversations/:id/disappearing) but no scenario uses it yet. Easy follow-up.
  • @mentions / @here / @everyone — server stores them as message text + extracts via the parsing pass; the new scripts don't drive that yet. Easy follow-up.

The motivator was an audit of what the current seeders don't exercise — the gaps above are documented inline in the lib so the next pass knows where to extend.

Test plan

  • Local: cargo run -p echo-server then SEED_SERVER=http://localhost:8080 ./scripts/seed_realistic_day.sh — verify 6 users land in the sidebar with varied presence dots, plaintext group has the standup/async/decision/EOD rhythm, encrypted group shows the lock indicator + [Encrypted] placeholders.
  • Local: ./scripts/seed_dms_only.sh — verify 4 users, 6 DM threads, no groups.
  • bash -n on all three scripts passes (verified pre-merge).
  • Existing seeders still work: spot-check ./scripts/seed_demo_data.sh.

Adds a sourceable bash library (scripts/seed_v2_lib.sh) plus two
scenario scripts that drive only the public REST + WS API:

- seed_realistic_day.sh — 6 users, plaintext + encrypted groups,
  pairwise DMs, and a standup-to-EOD message rhythm with branching
  reply threads instead of chained replies-to-parent.
- seed_dms_only.sh — DM-focused fixture, no groups.

Usernames are timestamped so reruns don't collide. Existing seeders
(seed_demo_data, seed_full_demo, seed_stress_data) are unchanged.
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