billboard Most Recent Scroll: fix SQLite NULL drop on SIG_READY exclude; pronouns flow FT; Blades middle reversal Nervous → Fickle — TDD
- billboard/views.py _billboard_context: `.exclude(verb=SIG_READY, data__retracted=True)` was silently dropping every SIG_READY event whose data had no `retracted` key — `WHERE NOT (NULL AND verb='sig_ready')` evaluates to NULL via JSON_EXTRACT, which the SQL engine treats as "row not satisfying WHERE", so the row was excluded. Fix: pull a 100-row buffer w. only the SIG_UNREADY exclude at the SQL level, then post-filter retracted SIG_READY in Python before slicing to 36; PostgreSQL handles the lookup correctly so this is a SQLite-only manifestation that explained intermittent "No events yet" in Most Recent Scroll
- CLAUDE.md gotchas: new entry warning that `.exclude(data__key=value)` / `.filter(data__key=value)` on SQLite JSONField bites on missing keys; if the predicate must require key existence, post-filter in Python
- functional_tests/test_game_kit.py PronounsAppletFlowTest: end-to-end profile-wide pronoun flip — start on per-room billscroll seeing "their" cognates, navigate to Game Kit, click bawlmorese card, assert guard portal active w. "yo/yo/yos" preview, click OK, navigate to billboard + see Most Recent Scroll re-rendered w. "yos", navigate back to billscroll + see same flip; covers the whole render-time-pronoun-resolution path on real DOM
- epic/0008_blades_reversal_fickle.py: rename Middle Arcana Blades reversal_qualifier "Nervous" → "Fickle" (RunPython forward+reverse on arcana=MIDDLE, suit=BLADES, number ∈ {11,12,13,14}); SigSelectSpec.js hardcoded "Nervous" updated to "Fickle" + collected static
Code architected by Disco DeDisco <discodedisco@outlook.com>
Git commit message Co-Authored-By:
Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -41,16 +41,26 @@ def _billboard_context(user):
|
||||
.distinct()
|
||||
.first()
|
||||
)
|
||||
recent_events = (
|
||||
list(
|
||||
# SIG_READY+retracted exclusion is done in Python because SQLite's NULL
|
||||
# semantics drop ALL SIG_READY events whose data has no `retracted` key:
|
||||
# `data__retracted=True` resolves to NULL via JSON_EXTRACT for missing keys,
|
||||
# and `WHERE NOT (NULL AND verb='sig_ready')` evaluates to NULL → row
|
||||
# filtered out. We pull a buffer (100) to absorb any retracted prefix and
|
||||
# then slice to 36 after Python filtering.
|
||||
if recent_room:
|
||||
candidates = list(
|
||||
recent_room.events
|
||||
.select_related("actor")
|
||||
.exclude(verb=GameEvent.SIG_UNREADY)
|
||||
.exclude(verb=GameEvent.SIG_READY, data__retracted=True)
|
||||
.order_by("-timestamp")[:36]
|
||||
)[::-1]
|
||||
if recent_room else []
|
||||
)
|
||||
.order_by("-timestamp")[:100]
|
||||
)
|
||||
visible = [
|
||||
e for e in candidates
|
||||
if not (e.verb == GameEvent.SIG_READY and e.data.get("retracted"))
|
||||
]
|
||||
recent_events = visible[:36][::-1]
|
||||
else:
|
||||
recent_events = []
|
||||
|
||||
return {
|
||||
"my_rooms": my_rooms,
|
||||
|
||||
Reference in New Issue
Block a user