fix: bug: supervisor preflight uses direct wpdb SQL — should use existing woodpecker_api() helper (#541) #560
No reviewers
Labels
No labels
action
backlog
blocked
bug-report
cannot-reproduce
in-progress
in-triage
needs-triage
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
rejected
reproduced
tech-debt
underspecified
vision
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#560
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-541"
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?
Fixes #541
Changes
wpdbSQL — should use existingwoodpecker_api()helper (#541)AI Review
Summary
Replaces three (raw PostgreSQL) queries in with calls to the existing REST helper from . This makes CI pipeline data collection database-driver-agnostic, consistent with how every other part of the codebase (ci-helpers.sh) already queries Woodpecker.
Findings
preflight.sh:150:perPage=50means stuck/pending counts only consider the 50 most recent pipelines. If a busy repo has >50 pipelines and a stuck one falls outside that window, it would be undercounted. In practice this is a non-issue for a self-hosted factory, and it's an inherent trade-off of using the paginated REST API without pagination — acceptable here given the monitoring context.Checklist
_prefix convention, properly double-quoted,set -euo pipefailalready present at top of file. No new unquoted expansions.|| echo '[]'fallback on the API call means all downstream jq runs against an empty array and produces safe zero/empty outputs. Correct.(.finished - .started) / 60 | floorvs oldROUND(...)— floor vs round is a trivial difference with no functional impact on the health report._nowreuse:_nowis also set at line 103 in the stale-phase-cleanup block. The reassignment at line 151 is fine — the prior block is complete by then. Both values serve the same purpose (current epoch).WOODPECKER_REPO_IDcomes from project TOML config (not user input).woodpecker_api()validatesWOODPECKER_SERVERbefore use (URL injection guard already in the helper). No new surface introduced.woodpecker_api()targets the internal Woodpecker instance — not an external service, no vault dispatch needed.lib/ci-helpers.shalready useswoodpecker_api(). Correct.Verdict
APPROVE — Clean, correct migration from direct wpdb SQL to woodpecker_api() helper; logic is sound and follows existing patterns
Reviewed at
2a1c974| AGENTS.mdAI Review: APPROVE — Clean, correct migration from direct wpdb SQL to woodpecker_api() helper; logic is sound and follows existing patterns