Files
room_glitch/tests/room_network/test_feedback.py
T
Jeff Luke c1b2195834 Expand Glitch operations hub, cabinet authoring, deployment, and RFID support
Operator hub
- Introduce Escape Gallery branding and Glitch: the Dark Machine room views
- Add cabinet illustrations, Pac-Man marquee/gameplay artwork, and waiting states
- Add device feedback panels with RFID readings, input/output states, and stale status
- Add logged operator hardware interventions with request deduplication

Room and cabinet authoring
- Add a visual custom-PCB connection editor with per-cabinet device inventory
- Support device IDs, bindings, wiring notes, input polarity, and validation
- Add physical-room label/dimension toggles and editable doorway annotations
- Preserve doorway changes through undo, save, and revert
- Expand cabinet profiles, room layout, and Glitch scenario resources

Scenarios and gameplay
- Add per-assignment game configuration and runtime feature validation
- Add timed test wins and Frogger individual-home objectives
- Add the three-cabinet timed/score/Frogger test scenario
- Add Cabinet 1 Pac-Man RFID credits, credit sound, and CREDIT 0/1 display
- Require physical Start after an accepted scan and prevent duplicate credits

Pi hardware and deployment
- Add GPIO feedback sampling and a separate multiplexed RFID helper
- Validate reader pin ownership and input/output conflicts
- Add SSH cabinet startup and Pi desktop-session service support
- Add master packaging, site setup, SSH enrollment, and staged cabinet releases
- Verify deployment manifests and support explicit activation/status/log commands

Documentation and verification
- Consolidate the root README around the current architecture and setup workflow
- Add the complete master/Pi/RFID export and deployment walkthrough
- Document network isolation, credentials, card identification, and rollback
- Add PCB, room-editor, feedback, credit, deployment, and controller tests
- Isolate protocol tests from designer-edited cabinet configurations

Known limitations
- RFID helper compilation and physical Pi commissioning remain unverified
- Fleet provisioning does not yet configure RFID-only installations completely
- Broader Pac-Man tests retain a ghost-capture assertion failure
- Staged exports must be rebuilt and checked before deploying runtime 2.3
2026-10-17 14:53:54 -07:00

25 lines
1.3 KiB
Python

import unittest
from test_room import server
class FeedbackTests(unittest.TestCase):
def test_authenticated_poll_feedback_dedup_and_stale(self):
now=[100]
room=server.Room(':memory:',lambda:now[0])
packet=dict(cabinet='cabinet_01',protocol=2,boot='test',gpio='real',reports=[],feedback=dict(fresh=True,devices=[dict(id='reader',kind='rfid',port='J1',value='12345678',age_ms=0)],events=[dict(id='boot:1',device='reader',value='12345678')]))
room.poll(packet);room.poll(packet)
self.assertTrue(room.snapshot()['feedback']['fresh'])
self.assertEqual(sum('Device reader' in x['message'] for x in room.state['history']),1)
now[0]+=5
self.assertFalse(room.snapshot()['feedback']['fresh'])
packet['feedback']['fresh']=False
room.poll(packet)
self.assertFalse(room.snapshot()['feedback']['fresh'])
room.db.close()
def test_invalid_feedback_is_bounded(self):
room=server.Room(':memory:',lambda:100)
room.receive_feedback(dict(devices=[{}]*33,events=[]))
self.assertEqual(room.feedback,{})
room.receive_feedback(dict(devices=[dict(id='bad',kind='input',value=[],age_ms=0)],fresh=True))
self.assertEqual(room.feedback['devices'],[])
self.assertFalse(room.feedback['fresh'])
room.db.close()