store: Fix: Scorebug tracker read-failure tolerance prevents false channel hiding

This commit is contained in:
Cal Corum 2026-02-20 14:30:07 -06:00
parent 38ba5bd101
commit 01d6f4af0c

View File

@ -0,0 +1,35 @@
---
id: 0960205f-85d1-447c-9921-57fec764e1d5
type: fix
title: "Fix: Scorebug tracker read-failure tolerance prevents false channel hiding"
tags: [major-domo, scorebug, live-scorebug-tracker, resilience, google-sheets, discord, fix]
importance: 0.7
confidence: 0.8
created: "2026-02-20T20:30:07.053777+00:00"
updated: "2026-02-20T20:30:07.053777+00:00"
---
# Scorebug Tracker: Read-Failure Tolerance
## Project
major-domo / discord-app-v2
## File
`tasks/live_scorebug_tracker.py``_update_scorebugs()` method
## Problem
The method hid `#live-sba-scores` whenever `active_scorebugs` was empty after the read loop. It did not distinguish between:
- All games confirmed FINAL (safe to hide)
- All sheet reads failed due to transient errors (incorrect to hide)
A single Google Sheets timeout would cause the live scores channel to disappear mid-game.
## Fix
Added `read_failures` and `confirmed_final` counters with three-branch logic:
1. **Active scorebugs present** → show channel (normal case)
2. **Read failures with not all games confirmed final** → preserve last known state, log warning (resilience case)
3. **All confirmed final** → safe to hide channel (expected end-of-game case)
## Key Takeaway
Channel visibility decisions that depend on external I/O (Google Sheets) must account for transient read failures before taking destructive action (hiding channels). Always distinguish "no data" from "failed to fetch data."