Repository navigation
feat(sim): demonstrate offline admission at two gates - #12
Conversation
|
Ben Carter · reviewer The label comes from the network LED, not from the hub. Can a gate show 标签依据的是网络灯,而不是 hub 本身。闸机在本地做出的决策,会不会被标成 |
|
Mateo Rossi · author The label reports what the gate told us, not a confirmed hub round trip: 标签反映的是闸机自己报告的状态,并不代表确认过与 hub 的往返: |
|
Yuki Tanaka · reviewer Gate 2 is unplugged with the page button. Does the spec confirm Docker actually took it off the venue network? Gate 2 是用页面按钮拔的网线。这个用例有没有确认 Docker 真的把它从场馆网络上断开了? |
|
Noah Williams · author This spec waits for the snapshot to show 这个用例只等到快照显示 |
Why
Field staff need to see what happens when a gate loses the venue network: it keeps admitting from its local list, and the hub does not learn about those admissions. The page should label each decision as local or hub, and the documentation should show the case where one ticket gets in twice.
What changed
bridge/src/state.ts: when a gate reportsLIGHT GREENorLIGHT RED, log adecisioneventHUB ACCEPT|REJECTif the gate's last network LED report wasON, otherwiseLOCAL ACCEPT|REJECT. New testlabels admissions by the network LED reported with the decision.e2e/real-offline-double-admission.spec.ts: scanGP-000000000001at Gate 1 and wait for its network LED, unplug Gate 2 from the page, scanGP-000000000002at Gate 2 (LOCAL ACCEPT), then at Gate 1 (HUB ACCEPT), check both lights are green, and save theoffline-double-admissionpair with the ticket panel hidden.scripts/e2e-gatepost.sh offline-double-admissionruns it;scripts/screenshots.shrequiresOFFLINE_ADMISSION_REFand captures the pair after the Gate 3 pair.docs/screenshots/offline-double-admission.pngand.dark.png, describe the scene in both READMEs and both screenshot READMEs, and retake the Gate 3 and offline pairs with the current Gatepost checkout.How to verify
pnpm testWith Docker and a Gatepost revision that has the hub client and network LED:
The test prints
offline double admission: GP-000000000002; gate2 LOCAL ACCEPT, gate1 HUB ACCEPT.背景
现场工作人员需要看到闸机断开场馆网络后会发生什么:它会继续按本地票单放行,而 hub 对这些放行一无所知。页面应标出每个决策来自本地还是 hub,文档也应展示同一张票被放行两次的情形。
改动
bridge/src/state.ts:闸机报告LIGHT GREEN或LIGHT RED时记录一条decision事件;如果这台闸机最近一次报告的网络灯为ON,记为HUB ACCEPT|REJECT,否则记为LOCAL ACCEPT|REJECT。新增测试labels admissions by the network LED reported with the decision。e2e/real-offline-double-admission.spec.ts:先在 Gate 1 扫GP-000000000001并等它的网络灯亮起,在页面上拔掉 Gate 2 的网线,在 Gate 2 扫GP-000000000002(LOCAL ACCEPT),再到 Gate 1 扫同一张票(HUB ACCEPT),确认两台都亮绿灯,然后隐藏票据面板,保存offline-double-admission截图对。scripts/e2e-gatepost.sh offline-double-admission运行该用例;scripts/screenshots.sh新增必填的OFFLINE_ADMISSION_REF,在 Gate 3 截图对之后拍摄这一对。docs/screenshots/offline-double-admission.png和.dark.png,在两份 README 和两份截图说明中描述这个场景,并用当前的 Gatepost 检出重拍 Gate 3 和离线放行两对截图。怎么验证
pnpm test安装 Docker,并准备带 hub 客户端和网络灯的 Gatepost 版本:
测试会打印
offline double admission: GP-000000000002; gate2 LOCAL ACCEPT, gate1 HUB ACCEPT。