@plot-pm/board 0.27.0 → 0.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/board-server.mjs +413 -319
- package/package.json +1 -1
- package/plot-config.sh +12 -0
- package/plot-host.sh +20 -70
package/package.json
CHANGED
package/plot-config.sh
CHANGED
|
@@ -241,6 +241,18 @@
|
|
|
241
241
|
# release workflow cannot raise the `default-branch-red`
|
|
242
242
|
# hold or the board's red-branch status. Names match a run's
|
|
243
243
|
# workflow name exactly. Absent = every workflow's runs.
|
|
244
|
+
# Merge checks comma-separated check names (a job's check run or a
|
|
245
|
+
# status context, `validate`) that `plot-ask.mjs merge`
|
|
246
|
+
# and fleetd's merge arm require to have a completed
|
|
247
|
+
# `success` on the pinned head. A named check with no run
|
|
248
|
+
# on the head, or a queued or running one, reads
|
|
249
|
+
# `pending` and refuses `checks-not-green`; of several
|
|
250
|
+
# completed runs of one name, the latest decides. Name the job
|
|
251
|
+
# that aggregates the selected jobs: a re-run removes a
|
|
252
|
+
# job from the rollup until it runs again, so the rest of
|
|
253
|
+
# the rollup can read green without it. Bitbucket reports
|
|
254
|
+
# no check runs, so a named check refuses there. Absent =
|
|
255
|
+
# no named check is required.
|
|
244
256
|
# Jenkins instance the slug or URL passed to a Jenkins CLI's -I flag.
|
|
245
257
|
# Read back by /plot-board-setup to verify auth against
|
|
246
258
|
# the right instance — without it the only runnable
|
package/plot-host.sh
CHANGED
|
@@ -531,21 +531,12 @@
|
|
|
531
531
|
# The transition id is LOOKED UP, never guessed:
|
|
532
532
|
# ids are per workflow and per issue, so a
|
|
533
533
|
# hardcoded one writes to the wrong column.
|
|
534
|
-
# pr-body <number>
|
|
535
|
-
#
|
|
534
|
+
# pr-body <number> [--body B | --body-file F]
|
|
535
|
+
# with no flag, print the PR description;
|
|
536
|
+
# with one, replace it. GitHub replaces
|
|
536
537
|
# it over REST (`PATCH pulls/<n>`), which
|
|
537
538
|
# spends `core` and never GraphQL. --body-file
|
|
538
539
|
# reads the body from a file, on both ops.
|
|
539
|
-
# rate-limit both GitHub budgets from `gh api rate_limit`.
|
|
540
|
-
# SUPERSEDED BY `limit`, and kept only because
|
|
541
|
-
# its callers have not moved: that endpoint was
|
|
542
|
-
# measured 2026-09-01 reporting graphql
|
|
543
|
-
# 5000/5000 used=0 while a real call's header
|
|
544
|
-
# read Remaining 1236, Used 3764, and reproduced
|
|
545
|
-
# 2026-09-02 against a header's 2732. NOTHING
|
|
546
|
-
# ROUTES ON IT any more — `gh_route` reads the
|
|
547
|
-
# budget record, which is written from response
|
|
548
|
-
# headers. Prefer `limit`.
|
|
549
540
|
# limit what is this connector's limit, and how well
|
|
550
541
|
# does it know it? One JSON line per metered
|
|
551
542
|
# bucket: {"connector","bucket","limit",
|
|
@@ -733,7 +724,9 @@ MERGEABLE_OF='def mergeable_of: if .mergeable == "CONFLICTING" or .mergeable ==
|
|
|
733
724
|
|
|
734
725
|
# THE ONE PROJECTION of a GraphQL-shaped PR into `pr-state`'s printed line, read by
|
|
735
726
|
# the GraphQL arm and by `rest_pr_state`, so the two transports print one shape.
|
|
736
|
-
|
|
727
|
+
# `checkRuns` carries every rollup item unfolded, so the merge controller can
|
|
728
|
+
# require a named check (`Merge checks`) that the folded `checks` word cannot see.
|
|
729
|
+
PR_STATE_OF='{number:.number,state:.state,draft:.isDraft,url:.url,mergeCommit:(.mergeCommit.oid // ""),head:(.headRefName // ""),headSha:(.headRefOid // ""),base:(.baseRefName // ""),checks:checks_of,ciChecks:ci_checks_of,checkRuns:[.statusCheckRollup[]? | {name:(.name // .context // ""),status:(.status // .state // ""),conclusion:(.conclusion // ""),at:(.startedAt // "")}],checksSha:(.headRefOid // ""),mergeable:mergeable_of,mergedAt:(.mergedAt // "")}'
|
|
737
730
|
|
|
738
731
|
# Exit 5 — the host refused to answer FOR NOW. A rate limit, primary or
|
|
739
732
|
# secondary: nothing is broken, nothing needs fixing, and the same question
|
|
@@ -2450,9 +2443,9 @@ graphql_budget_spent() {
|
|
|
2450
2443
|
# pr-state both transports. The only op with a REST fallback
|
|
2451
2444
|
# written, so the only one where the budget can change the
|
|
2452
2445
|
# answer.
|
|
2453
|
-
#
|
|
2446
|
+
# limit REST-only BY NATURE rather than by omission. It is
|
|
2454
2447
|
# reached through `gh api`, which is REST's transport.
|
|
2455
|
-
#
|
|
2448
|
+
# It spends a GraphQL call to read its own headers —
|
|
2456
2449
|
# the call it makes is GraphQL, the route to it is not.
|
|
2457
2450
|
# * GraphQL-only. Ten ops, and this is where "every op
|
|
2458
2451
|
# consults the router" is honest rather than decorative:
|
|
@@ -2488,7 +2481,7 @@ graphql_budget_spent() {
|
|
|
2488
2481
|
gh_route() { # $1=op → graphql|rest
|
|
2489
2482
|
case "${1:-}" in
|
|
2490
2483
|
# REST-only: no GraphQL route exists to choose, so nothing is consulted.
|
|
2491
|
-
|
|
2484
|
+
limit|pr-create|pr-body)
|
|
2492
2485
|
printf 'rest\n'
|
|
2493
2486
|
;;
|
|
2494
2487
|
# Both transports implemented — the one op where the reasons apply.
|
|
@@ -2554,7 +2547,7 @@ rest_pr_state() { # $1=owner/repo $2=PR number or branch; returns 3 when the bra
|
|
|
2554
2547
|
else pr="$(gh_api_harvest "repos/$1/pulls?head=${1%%/*}:$2&state=all&per_page=1")" || return 1; pr="$(jq -ce '.[0]' <<<"$pr")" || return 3; fi
|
|
2555
2548
|
sha="$(jq -r '.head.sha // ""' <<<"$pr")"
|
|
2556
2549
|
ck="$(gh_api_harvest "repos/$1/commits/$sha/check-runs?per_page=100")" && st="$(gh_api_harvest "repos/$1/commits/$sha/status?per_page=100")" || return 2
|
|
2557
|
-
jq -cs "$CHECKS_OF$MERGEABLE_OF"'.[0] as $p | (.[1].check_runs // []) as $c | (.[2].statuses // []) as $s | (($p.merged == true) or ($p.merged_at != null)) as $m | {number: $p.number, state: (if $m then "MERGED" else ($p.state // "" | ascii_upcase) end), isDraft: ($p.draft // false), url: ($p.html_url // ""), mergeCommit: (if $m then {oid: ($p.merge_commit_sha // "")} else null end), headRefName: ($p.head.ref // ""), headRefOid: ($p.head.sha // ""), baseRefName: ($p.base.ref // ""), mergedAt: ($p.merged_at // ""), mergeable: (if $p.mergeable == true then "MERGEABLE" elif $p.mergeable == false then "CONFLICTING" else "UNKNOWN" end), mergeStateStatus: (($p.mergeable_state // "") | ascii_upcase), statusCheckRollup: ([$c[] | {name, status: ((.status // "") | ascii_upcase), conclusion: ((.conclusion // "") | ascii_upcase)}] + [$s[] | {context, state: ((.state // "") | ascii_upcase)}] + (if ((.[1].total_count // 0) > ($c | length)) or ((.[2].total_count // 0) > ($s | length)) then [{status: "QUEUED"}] else [] end))} |'"$PR_STATE_OF" <<<"$pr$ck$st"
|
|
2550
|
+
jq -cs "$CHECKS_OF$MERGEABLE_OF"'.[0] as $p | (.[1].check_runs // []) as $c | (.[2].statuses // []) as $s | (($p.merged == true) or ($p.merged_at != null)) as $m | {number: $p.number, state: (if $m then "MERGED" else ($p.state // "" | ascii_upcase) end), isDraft: ($p.draft // false), url: ($p.html_url // ""), mergeCommit: (if $m then {oid: ($p.merge_commit_sha // "")} else null end), headRefName: ($p.head.ref // ""), headRefOid: ($p.head.sha // ""), baseRefName: ($p.base.ref // ""), mergedAt: ($p.merged_at // ""), mergeable: (if $p.mergeable == true then "MERGEABLE" elif $p.mergeable == false then "CONFLICTING" else "UNKNOWN" end), mergeStateStatus: (($p.mergeable_state // "") | ascii_upcase), statusCheckRollup: ([$c[] | {name, status: ((.status // "") | ascii_upcase), conclusion: ((.conclusion // "") | ascii_upcase), startedAt: (.started_at // "")}] + [$s[] | {context, state: ((.state // "") | ascii_upcase), startedAt: (.created_at // "")}] + (if ((.[1].total_count // 0) > ($c | length)) or ((.[2].total_count // 0) > ($s | length)) then [{status: "QUEUED"}] else [] end))} |'"$PR_STATE_OF" <<<"$pr$ck$st"
|
|
2558
2551
|
}
|
|
2559
2552
|
|
|
2560
2553
|
# `owner/repo` from the `origin` URL, with no host call. An `ssh://` URL may carry
|
|
@@ -5786,7 +5779,15 @@ case "$op" in
|
|
|
5786
5779
|
printf '%s' "$body" | jq -c '.[] | {name, released: (.released // false), releaseDate: (.releaseDate // null)}' || exit 3 ;;
|
|
5787
5780
|
|
|
5788
5781
|
pr-body)
|
|
5789
|
-
num="${1:?pr-body needs a PR number}"; shift
|
|
5782
|
+
num="${1:?pr-body needs a PR number}"; shift
|
|
5783
|
+
# WITH NO FLAG IT READS: it prints the PR's body, "" where it has none.
|
|
5784
|
+
# GitHub reads `GET pulls/<n>` over REST; Bitbucket reads `description`.
|
|
5785
|
+
if [ $# -eq 0 ]; then
|
|
5786
|
+
if [ "$be" = "github" ]; then gh_api_harvest "repos/$(gh_origin_slug)/pulls/$num" | jq -r '.body // ""'
|
|
5787
|
+
else bb_require_json; bb pr view "$num" --json | jq -r '.description // ""'; fi
|
|
5788
|
+
exit
|
|
5789
|
+
fi
|
|
5790
|
+
pr_text_args pr-body "$@"
|
|
5790
5791
|
[ -z "$title$base$head$draft" ] || die "pr-body takes only --body or --body-file"
|
|
5791
5792
|
[ -n "$body" ] || die "pr-body needs --body or --body-file"
|
|
5792
5793
|
# GITHUB REPLACES THE BODY OVER REST, `PATCH repos/<origin slug>/pulls/<n>`,
|
|
@@ -5799,57 +5800,6 @@ case "$op" in
|
|
|
5799
5800
|
else bb pr edit "$num" --body "$body"; fi
|
|
5800
5801
|
;;
|
|
5801
5802
|
|
|
5802
|
-
rate-limit)
|
|
5803
|
-
# Report the remaining API budget, per API. GitHub has TWO separate budgets
|
|
5804
|
-
# (GraphQL and REST/core), and exhausting one says nothing about the other.
|
|
5805
|
-
# Bitbucket has a single budget and no way to query it, so it reports unknown.
|
|
5806
|
-
#
|
|
5807
|
-
# Output: JSON object with the remaining budget per API:
|
|
5808
|
-
# {"graphql":{"remaining":N,"limit":N,"reset":N},"core":{"remaining":N,"limit":N,"reset":N}}
|
|
5809
|
-
# where N is a number, or each field is "unknown" when the host cannot answer.
|
|
5810
|
-
#
|
|
5811
|
-
# `reset` is epoch seconds — when the budget resets. A caller that wants
|
|
5812
|
-
# "time until reset" computes it from now.
|
|
5813
|
-
#
|
|
5814
|
-
# The call itself is FREE — `gh api rate_limit` consumes neither bucket.
|
|
5815
|
-
# Measured 2026-08-27: three consecutive readings, all `used=0`.
|
|
5816
|
-
#
|
|
5817
|
-
# This op REPORTS; it does not decide. A caller that wants to fall back when
|
|
5818
|
-
# one budget is spent reads this, compares remaining to zero, and acts.
|
|
5819
|
-
if [ "$be" = "github" ]; then
|
|
5820
|
-
if out="$(gh api rate_limit 2>"$HOST_ERR")"; then
|
|
5821
|
-
rm -f "$HOST_ERR"
|
|
5822
|
-
# The payload has `resources.graphql` and `resources.core`, each with
|
|
5823
|
-
# `remaining`, `limit`, and `reset`. Extract the two we care about.
|
|
5824
|
-
jq -c '{
|
|
5825
|
-
graphql: {
|
|
5826
|
-
remaining: .resources.graphql.remaining,
|
|
5827
|
-
limit: .resources.graphql.limit,
|
|
5828
|
-
reset: .resources.graphql.reset
|
|
5829
|
-
},
|
|
5830
|
-
core: {
|
|
5831
|
-
remaining: .resources.core.remaining,
|
|
5832
|
-
limit: .resources.core.limit,
|
|
5833
|
-
reset: .resources.core.reset
|
|
5834
|
-
}
|
|
5835
|
-
}' <<<"$out"
|
|
5836
|
-
else
|
|
5837
|
-
host_err
|
|
5838
|
-
# The host could not be asked. Report unknown rather than failing outright,
|
|
5839
|
-
# because this is informational — a caller that cannot read the budget
|
|
5840
|
-
# should proceed with the default path, not error out.
|
|
5841
|
-
echo '{"graphql":{"remaining":"unknown","limit":"unknown","reset":"unknown"},"core":{"remaining":"unknown","limit":"unknown","reset":"unknown"}}'
|
|
5842
|
-
echo "plot-host: rate-limit query failed: $err" >&2
|
|
5843
|
-
fi
|
|
5844
|
-
else
|
|
5845
|
-
# Bitbucket has no budget reporting. `unknown` is not `zero` — a host that
|
|
5846
|
-
# cannot answer the budget question must report unknown, because zero means
|
|
5847
|
-
# *spent*, and a caller that reads "cannot ask" as "exhausted" will take
|
|
5848
|
-
# the expensive fallback path forever.
|
|
5849
|
-
echo '{"graphql":{"remaining":"unknown","limit":"unknown","reset":"unknown"},"core":{"remaining":"unknown","limit":"unknown","reset":"unknown"}}'
|
|
5850
|
-
fi
|
|
5851
|
-
;;
|
|
5852
|
-
|
|
5853
5803
|
limit)
|
|
5854
5804
|
# WHAT IS THIS CONNECTOR'S LIMIT, AND HOW WELL DOES IT KNOW IT?
|
|
5855
5805
|
#
|
|
@@ -6078,6 +6028,6 @@ case "$op" in
|
|
|
6078
6028
|
gh_edit_or_post_comment "$cid" pr "$num" "${2:?pr-comment needs a body}" || gh_fail; rm -f "$HOST_ERR" ;;
|
|
6079
6029
|
|
|
6080
6030
|
*)
|
|
6081
|
-
die "unknown op '$op' (backend|default-branch|pr-state|pr-create|pr-merge|pr-list|issue-list|issue-view|issue-status|issue-open|issue-label|issue-comment|issue-comment-read|issue-close|version-list|pr-body|pr-review|
|
|
6031
|
+
die "unknown op '$op' (backend|default-branch|pr-state|pr-create|pr-merge|pr-list|issue-list|issue-view|issue-status|issue-open|issue-label|issue-comment|issue-comment-read|issue-close|version-list|pr-body|pr-review|limit|ci-limit|spend-rate|commit-status|pr-comment)"
|
|
6082
6032
|
;;
|
|
6083
6033
|
esac
|