feat(hint): unify the vs_ai idle hint online + offline (server-enforced, monotonic) #209
Reference in New Issue
Block a user
Delete Branch "feature/online-vsai-hint"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes the broken online vs_ai hint and delivers the unified model you asked for.
The breakage: #207 made the vs_ai hint button always-enabled + wallet-free (assuming all vs_ai = the offline idle-gate), but the backend still served online vs_ai from the allowance/wallet — so over-clicking hit
ErrNoHintsLeft-> a generic error toast. Now online vs_ai uses the same idle-gate as offline.Design (your calls):
hint_locked) from its own clock (tamper-proof); the client pre-gates + handles the backstop.hint_unlock_left_seconds(not an absolute time — your call, to dodge client clock skew); the client counts down on a MONOTONIC clock (performance.now()) anchored when it lands (on load from the view; to the full window when the robot moves). Immune to a live client clock change; a relaunch re-reads a fresh value.Shape: backend
Hint/GameState+hintUnlockLeftSecondshelper (unit-tested); FlatBuffershint_unlock_left_seconds(additive) through pkg/wire + gateway (round-trip test); client gate reworked from #207 absolutehintUnlockAtMsto the seconds-left + monotonic anchor (offline record keeps the absolute for persistence).Verified: go build/vet + game/server/transcode tests (+ new); ui check 0 / unit 490 / e2e 198 (one pre-existing webkit offline flake, CI retries) / app entry 114.2/115 KB.