watchpr: start the conflict window at the arm #21
Reference in New Issue
Block a user
Delete Branch "benvin/watchpr-arm-window-start"
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?
The conflict window ran from the first non-mergeable poll even while the rule was disarmed, so the poll that armed it — a push, or
base.shamoving — confirmed a run it played no part in. Any watch baselined non-mergeable alerted falsely the moment main moved.time.Timeis a legal clock value--json; cobra's terminalError:line stays plain textFindings:
cmd/watchpr/main.go:11-12/README.md:109— both say a later head/base move restarts the two-minute window.arm()returns early when already armed, so only the disarmed→armed transition ever movesarmedAt; a move under an already-armed watch (the mergeable-baseline case, and every move after the first) restarts nothing. Verified: baseline mergeable, run of falses from t=30s,base.shamoves at t=90s, alert fires at t=150s — 60s into that fresh recompute, not 120s. -> scope the sentence to the first arm, or drop the "restarts from itself" claim.cmd/watchpr/main.go:111-112— "under--jsonstderr carries nothing but NDJSON records" is not true: cobra still printsError: <msg>as plain text to stderr, so a caller parsing stderr line by line meets a non-record line on exactly the failures it cares about (describeFailure, bad ref, unknown flag, no refs — all confirmed against the built binary).TestJSONModeStderrIsAllRecordsasserts the invariant only overwarnandemitBaselines, so its name overstates too. -> emit the terminal error as a record (SilenceErrors+warn), or scope the comment and the test name to warnings and baselines.cmd/watchpr/main.go:258— "disarmed until Gitea answers or the commits move": afalseanswer does not arm; onlytrueor movement does. -> "until Gitea reports it mergeable or the commits move".--jsonwarning normalisation and theMergeUnknownbaseline line are independent of the window fix and would stand alone.