Repository navigation
feat(sim): compare double admission before and after the hub race fix - #13
Conversation
|
Ben Carter · reviewer The before-fix run stops at the first double green. What if the race doesn't show within 200 tries? 修复前的那组在第一次两台都亮绿灯时就停下。如果 200 次内都没出现竞态呢? |
|
Noah Williams · author Then 那 |
|
Ingrid Larsen · reviewer
|
|
Mateo Rossi · author The scripts now run several Gatepost revisions in a row, before and after the race fix. Asking for the ref makes it explicit which one the controls check runs against. 现在脚本会先后运行竞态修复前后的多个 Gatepost 版本。要求显式给出版本,就能明确 controls 检查针对的是哪一个。 |
Why
Gatepost fixed a hub race in which two gates scanning the same ticket at the same moment could both admit it. The simulator should be able to show that race on a revision before the fix and show exactly one admission on a revision with the fix.
What changed
e2e/real-double-admission.spec.ts: withADMISSION_SCENARIO=before-fixit sendsTwo gates at oncewith fresh tickets fromGP-000000000100for up to 200 tries and stops at the first try where Gate 1 and Gate 2 both turn green; withfixedit runs 30 tries and requires exactly one green each time. Each try also waits for both network LEDs to be on. The spec saves thedouble-admission-before-fixordouble-admission-fixedpair.scripts/e2e-gatepost.shaddsdouble-admission-before-fixanddouble-admission-fixed;controlsrequiresGATEPOST_REFagain.scripts/screenshots.shrequiresDOUBLE_ADMISSION_BEFORE_REFandDOUBLE_ADMISSION_FIXED_REF, starts an entrance for each, and captures all four pairs.How to verify
With Docker and the two Gatepost revisions:
Each run ends with a
double-greencount: 1 before the fix, 0 after it.背景
Gatepost 修复了 hub 的一个竞态:两台闸机同时扫同一张票时,可能都会放行。模拟器应能在修复前的版本上重现这个竞态,并在修复后的版本上展示每次只有一台放行。
改动
e2e/real-double-admission.spec.ts:ADMISSION_SCENARIO=before-fix时,从GP-000000000100开始每次换一张新票点Two gates at once,最多尝试 200 次,一旦 Gate 1 和 Gate 2 同时亮绿灯就停止;fixed时尝试 30 次,要求每次恰好一个绿灯。每次尝试还会等两台闸机的网络灯都亮起。用例保存double-admission-before-fix或double-admission-fixed截图对。scripts/e2e-gatepost.sh新增double-admission-before-fix和double-admission-fixed两个模式;controls重新要求必须设置GATEPOST_REF。scripts/screenshots.sh新增必填的DOUBLE_ADMISSION_BEFORE_REF和DOUBLE_ADMISSION_FIXED_REF,分别启动入口,共拍摄四对截图。怎么验证
安装 Docker,准备好两个 Gatepost 版本:
每次运行最后都会输出
double-green计数:修复前为 1,修复后为 0。