Fix non-zero exit on error and debounce transient mergeable=false #2

Merged
benvin merged 1 commits from benvin/followup-fixes into main 2026-08-12 22:22:58 +10:00
Member

Follow-up bug fixes for a v0.1.1 patch. agentpr/watchpr already exited non-zero on command errors but had no regression coverage and the root command was not constructible outside main(); watchpr also fired a spurious "lost mergeability (conflict)" alert because Gitea computes mergeability asynchronously and can briefly report mergeable=false right after a push; and the docs printed the AppRole role_id literal UUID.

  • Extract newRootCmd() in cmd/agentpr and cmd/watchpr so main() only runs Execute() and exits non-zero on any command error (bad ref, Vault/Gitea failure); add tests asserting Execute() returns an error for a bad PR ref, malformed --repo, and no args.
  • Debounce mergeability loss in MeaningfulChange: alert only when mergeable=false persists across two consecutive polls (both prev and cur false, still open); a single false poll is benign. Update the table test to cover one-poll-false (benign), false-persisting (alert), and recovered false->true (benign). Other alert conditions (merge/close, non-agent comment, CI failure) are unchanged.
  • Refer to AGENT_APPROLE_ROLE_ID by env var in README.md/AGENTS.md without printing the literal role_id; keep the code default and env override.
Follow-up bug fixes for a v0.1.1 patch. agentpr/watchpr already exited non-zero on command errors but had no regression coverage and the root command was not constructible outside main(); watchpr also fired a spurious "lost mergeability (conflict)" alert because Gitea computes mergeability asynchronously and can briefly report mergeable=false right after a push; and the docs printed the AppRole role_id literal UUID. - Extract `newRootCmd()` in `cmd/agentpr` and `cmd/watchpr` so `main()` only runs `Execute()` and exits non-zero on any command error (bad ref, Vault/Gitea failure); add tests asserting `Execute()` returns an error for a bad PR ref, malformed `--repo`, and no args. - Debounce mergeability loss in `MeaningfulChange`: alert only when `mergeable=false` persists across two consecutive polls (both prev and cur false, still open); a single false poll is benign. Update the table test to cover one-poll-false (benign), false-persisting (alert), and recovered false->true (benign). Other alert conditions (merge/close, non-agent comment, CI failure) are unchanged. - Refer to `AGENT_APPROLE_ROLE_ID` by env var in README.md/AGENTS.md without printing the literal role_id; keep the code default and env override.
unkin-agent added 1 commit 2026-08-12 22:17:35 +10:00
Fix non-zero exit on error and debounce transient mergeable=false
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
05594113a2
agentpr/watchpr already propagated command errors to a non-zero exit, but
that behaviour had no regression coverage and the root command was not
constructible outside main(). watchpr also fired a spurious conflict alert
because Gitea computes mergeability asynchronously and can briefly report
mergeable=false right after a push. The docs additionally printed the
AppRole role_id literal UUID.

- Extract newRootCmd() in both cmd/agentpr and cmd/watchpr so main() only
  runs Execute and exits non-zero on error; add tests asserting Execute
  returns an error for a bad PR ref / malformed --repo / no args.
- Debounce mergeability loss in MeaningfulChange: only alert when
  mergeable=false persists across two consecutive polls (both prev and cur
  false, still open); update the table test for one-poll-false (benign),
  false-persisting (alert), and recovered false->true (benign).
- Refer to AGENT_APPROLE_ROLE_ID by env var in README.md/AGENTS.md without
  printing the literal role_id; keep the code default and env override.
benvin merged commit 7d9ae0fcc6 into main 2026-08-12 22:22:58 +10:00
benvin deleted branch benvin/followup-fixes 2026-08-12 22:22:59 +10:00
Sign in to join this conversation.