Files
thejayman77 a7fb8e5739 Daily Word: grow the hopeful answer pool + lock it with a validation test
Per Codex. Pool grown 51/44 → 115/104 hopeful answers (5/6 letter) via the
agreed workflow: LLM proposes themed candidates → code filters to the bundled
guess dictionary (length/alpha/dedup) → human spot-check prunes tone-drift
("growl", "plain", "color"…). ~3.5-month runway before repeats per variant.

test_wordpool.py locks the invariant in CI: every answer must be lowercase
alpha, correct length, unique, and present in words-5/6.json — so no future
addition can become an unguessable puzzle.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 17:34:44 -04:00

21 lines
1.0 KiB
Python

import json
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
def test_wordpool_answers_are_valid_and_guessable():
"""Every daily-word answer must be lowercase alpha, the right length, unique,
and present in the bundled guess dictionary — so no answer is ever unguessable.
Locks the 'code disposes' invariant against future pool additions."""
pool = json.loads((ROOT / "goodnews" / "data" / "wordpool.json").read_text())
for variant, n in (("5", 5), ("6", 6)):
dictwords = set(json.loads((ROOT / "frontend" / "static" / f"words-{n}.json").read_text()))
answers = pool[variant]
assert answers, f"{variant}-letter pool is empty"
assert len(answers) == len(set(answers)), f"{variant}-letter pool has duplicates"
for w in answers:
assert isinstance(w, str) and w.isalpha() and w.islower(), f"bad token: {w!r}"
assert len(w) == n, f"{w!r} is not {n} letters"
assert w in dictwords, f"{w!r} not in the guess dictionary → would be unguessable"