mirror of
https://github.com/block/buzz.git
synced 2026-11-30 05:02:57 +00:00
The PR described the preflight as waiting for the draft to be "stable for one second," which reads as one second of keyboard idle. Review took it that way and filed the resulting behavior as a blocking defect. The interval never measured typing pauses: it measures how long the wake gates hold, and the gates are re-evaluated on every editor update. Nothing in the code said so. MENTION_WAKE_DELAY_MS read like a debounce interval, and the plan-key early return that keeps a running window armed looked like a missed invalidation rather than the deliberate choice it is. Name and document the contract instead: - Rename MENTION_WAKE_DELAY_MS to MENTION_WAKE_GATE_HOLD_MS and give it the full contract as a doc comment: the gates, cancel-on-lapse, and why continued typing must not restart the window. - Comment the early return and the fire-time re-checks at the points where the "delay vs hold" reading diverges. Pin the behavior so the distinction is enforced, not just asserted: - "typing through the window does not restart the gate hold" edits the draft 500 ms into the window and requires the start at the original one-second mark. Adding draft content to the plan key -- the change that would turn the hold into a debounce -- fails this test alone. - "a lapse in the gates requires a fresh full gate hold" trims to the bare mention mid-window and requires a full fresh second afterward, proving the window is cancelled rather than shortened. The E2E journey only asserted that a start had happened after ~3.9 s of typing, which left both halves of the contract unproven. It now rests a bare mention for 2.5 s and asserts no start, then asserts the start mid-composition with further keystrokes following it, and that those keystrokes queue no second start before Send single-flights. Behavior is unchanged; a keystroke debounce would have been a regression, since continuous typing straight into Send is the flow this speeds up. Signed-off-by: Matt Toohey <contact@matttoohey.com>