Files
miti99bot/internal/modules/twentyq/seeds.go
T
tiennm99 31f4e22c4d refactor: audit-driven hygiene pass across modules and infra
Concurrency
- lolschedule: serialize subscriber Get→mutate→Put via state.subscribersMu;
  the single-slot list was previously losing writes under concurrent
  /lolschedule_subscribe.
- trading: PriceClient memoises its default *http.Client so /trade_stats
  reuses TLS connections across held tickers.

Observability
- server/log_middleware: defer the req log line and recover panics so a
  panicking cron handler still emits the structured req entry CloudWatch
  filters on for 5xx alerting.
- server/router (cron): inner recover with cron-name context captures the
  panicking job before the middleware's safety net does.
- telegram/webhook: rune-safe truncation in dispatch logs — Vietnamese,
  Korean, and emoji previews no longer ship as garbled bytes.
- lolschedule/api_client: same rune-safe fix for error-body log truncation.
- telegram/webhook: gate the post-recover WriteHeader(200) so a panicking
  handler that already touched w doesn't trigger superfluous-WriteHeader.

Correctness
- twentyq: clearGame error during solved-relaunch is logged instead of
  silently swallowed (was a permanent deadlock vector on KV failure).
- misc /mstats: KV read failure replies "Could not load stats. Try again
  later." to the user instead of returning into the dispatcher; matches the
  pattern other modules use.
- migrate_cf_data trading-audit-dump: surface f.Close error so a truncated
  JSONL never passes silently as a complete audit dump.

Operator ergonomics
- migrate_cf_data (all 4 subcommands): signal.NotifyContext for SIGINT /
  SIGTERM. Ctrl-C mid-Scan now propagates cleanly instead of leaving a
  half-converted DynamoDB table.
- ai/ratelimit: doc the Lambda-recycle memory bound to match keylock.Map
  so a future reviewer doesn't re-flag the unbounded map.

I/O-changing (user-approved)
- lolschedule daily push auto-prunes subscribers whose Telegram error
  matches a terminal marker (blocked / deactivated / chat gone). Transient
  errors keep the chat on the list. Subscribe message updated to mention
  the auto-cleanup.
- twentyq seed pool grown 50 → 178; repeat-collision threshold moves from
  ~9 plays to ~17 (birthday paradox).
- util /info flipped Public → Protected — chat/thread/sender IDs are no
  longer enumerable by every group member.
- cmd/server WriteTimeout 6min → 75s (cron 60s + 15s slack). No-op on
  Lambda; matters only for local non-Lambda runs.
- webhook + cron rejection paths drop response bodies (no fingerprintable
  text for internet scanners hitting the public Function URL). Status
  codes preserved for CloudWatch metrics; structured log lines carry the
  rejection reason for operator triage.

Tests added: TestTruncateRunes, TestRunDailyPush_PrunesDeadSubscribers,
TestIsTerminalSendError, TestInfo_DeniedToNonOwner,
TestInfo_DeniedToChannelMessageNoFrom, plus owner-allowed counterparts.
2026-05-16 13:35:00 +07:00

58 lines
2.8 KiB
Go

package twentyq
// seeds is the seed pool. The LLM derives category + initial hint per round
// so no metadata table is needed. Keep entries:
// - single concrete nouns (no abstractions, no proper nouns, no plurals)
// - distinguishable to a player with general knowledge
// - ASCII-only so prompt-engineered locale traps don't bias the model
//
// Pool size matters because random selection is uniform without exclusion —
// at N=50 a power user sees a repeat within ~9 plays (birthday paradox); at
// N=200 the same threshold moves to ~17. This list is deliberately wide
// across categories to reduce thematic clustering when the model picks hints.
var seeds = []string{
// instruments
"guitar", "piano", "drum", "violin", "flute", "trumpet", "organ", "harmonica",
"saxophone", "cello", "accordion", "banjo", "xylophone", "clarinet", "tambourine",
"harp", "ukulele", "bagpipes",
// animals — land
"elephant", "kangaroo", "tiger", "horse", "snake", "owl", "wolf", "rabbit",
"giraffe", "hedgehog", "rhinoceros", "panda", "cheetah", "gorilla", "raccoon",
"squirrel", "platypus", "bat", "armadillo", "sloth",
// animals — sea + air
"dolphin", "eagle", "octopus", "penguin", "shark", "whale", "starfish", "crab",
"jellyfish", "lobster", "parrot", "hummingbird", "flamingo", "ostrich", "seahorse",
// food
"pizza", "sushi", "burger", "ramen", "taco", "pho", "curry", "salad",
"chocolate", "cheese", "pancake", "waffle", "donut", "croissant", "dumpling",
"sandwich", "lasagna", "popcorn", "kimchi", "biryani",
// fruits + vegetables
"banana", "pineapple", "watermelon", "strawberry", "mango", "avocado", "coconut",
"pomegranate", "broccoli", "carrot", "cucumber", "pumpkin", "garlic", "onion",
// vehicles
"bicycle", "car", "airplane", "boat", "train", "motorcycle", "helicopter",
"submarine", "tractor", "skateboard", "scooter", "rocket", "ambulance", "bulldozer",
// sports + games
"soccer", "basketball", "tennis", "swimming", "boxing", "golf", "chess", "skiing",
"badminton", "cricket", "rugby", "bowling", "surfing", "archery", "fencing",
// household items
"refrigerator", "microwave", "vacuum", "toaster", "kettle", "blender", "lamp",
"sofa", "mirror", "broom", "umbrella", "scissors", "telephone", "clock",
"hammer", "screwdriver", "ladder", "candle", "flashlight",
// nature + places
"mountain", "volcano", "desert", "glacier", "waterfall", "island", "forest",
"beach", "cave", "river",
// space
"telescope", "asteroid", "comet", "satellite", "galaxy",
// occupations
"firefighter", "astronaut", "chef", "carpenter", "librarian", "dentist",
"photographer", "scientist", "lifeguard", "magician",
// tools + tech
"camera", "compass", "binoculars", "keyboard", "headphones",
"microscope", "printer", "stapler",
// clothing
"sweater", "sneakers", "scarf", "helmet", "gloves", "raincoat",
// drinks
"coffee", "tea", "lemonade", "smoothie",
}