State change (block toggle, bypass) not reflected by GET /api/state until debounced disk write completes #18
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
Observed:
PATCH /api/blocks {enabled:false}returns success immediately, but a subsequentGET /api/stateshows the block still enabled. The state only updates after the 500ms debounced save writes to disk.Root cause:
_gather_channel_state()callspm.load()which reads from disk. The PATCH handler uses_debounced_save_preset()which waits 500ms before writing. During that window, state reads return stale data.Impact: Any quick-toggle operation (block toggle, bypass) is invisible to the UI until the debounce fires. This affects the automated test runner at speed.
Suggested fix: Either:
_gather_channel_state()and use the last-loaded in-memory presetSeverity: Medium — only affects rapid reads within 500ms of a write