From c417a4324fb20c97a472c807607cde44dfb5e1b9 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Mon, 9 Nov 2026 19:45:51 -0700 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=90=9B=20dashboard:=20one=20human-gat?= =?UTF-8?q?e=20pill=20per=20gated=20row,=20no=20needs-human=20chevron=20wo?= =?UTF-8?q?rds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every row a person must settle carries exactly one segmented '👤 Needs human · ' control whose verbs are fixed per reason (review / decision / sentinel / hold; stacked reasons union, ≤3 visible + … menu). 'Needs human', 'Held · sentinel' and 'Sentinel alert · needs human' never ride a chevron: the lit chevron is the real stage with the amber ham-human-gated outline. Secondary rows of a shared PR render no gate; their 'decision pending on #N' chip links to the primary row. A new POST …/items/{number}/sentinel-confirm endpoint (comment + label removal, audited) gives a sentinel alert its own verb, Confirm safe. Fixes #17504 Signed-off-by: Andrew Anderson --- changelog.d/changed-needs-human-gate-pill.md | 1 + src/docs/api-reference/agents-and-controls.md | 16 +- src/docs/api-reference/beads.md | 10 +- src/docs/api-reference/configuration.md | 26 +- src/docs/api-reference/dashboard-misc.md | 24 +- src/docs/api-reference/inception.md | 28 +- src/docs/api-reference/knowledge.md | 90 ++-- src/docs/api-reference/nous.md | 50 +-- src/docs/api-reference/packs-and-acmm.md | 23 +- src/docs/dashboard-copy-inventory.md | 1 + .../dashboard-sections/activity-monitor.md | 31 +- src/pkg/dashboard/api.go | 1 + .../api_repo_item_sentinel_confirm.go | 153 +++++++ .../api_repo_item_sentinel_confirm_test.go | 124 ++++++ src/pkg/dashboard/operator_actions.go | 6 + src/pkg/dashboard/operator_actions_test.go | 2 + .../stage_tracker_human_gate_test.go | 223 ++++++++++ .../stage_tracker_needs_human_reason_test.go | 10 +- .../stage_tracker_repo_grouping_test.go | 1 + .../stage_tracker_sentinel_lane_test.go | 177 ++++---- .../stage_tracker_sentinel_notice_test.go | 8 +- .../stage_tracker_ui_prelude_test.go | 1 + .../dashboard/stage_tracker_ui_rows_test.go | 46 +- src/pkg/dashboard/static-src/css/tracker.css | 33 +- .../static-src/js/tracker-actions.js | 38 +- .../static-src/js/tracker-human-gate.js | 215 +++++++++ .../static-src/js/tracker-row-layout.js | 3 +- .../static-src/js/tracker-row-render.js | 9 +- .../static-src/js/tracker-row-strip.js | 44 +- .../dashboard/static-src/js/tracker-row.js | 33 +- .../static-src/js/tracker-words-stage.js | 1 - .../dashboard/static-src/js/tracker-words.js | 44 +- src/pkg/dashboard/static-src/manifest.txt | 1 + src/pkg/dashboard/static/index.html | 420 ++++++++++++++---- 34 files changed, 1449 insertions(+), 444 deletions(-) create mode 100644 changelog.d/changed-needs-human-gate-pill.md create mode 100644 src/pkg/dashboard/api_repo_item_sentinel_confirm.go create mode 100644 src/pkg/dashboard/api_repo_item_sentinel_confirm_test.go create mode 100644 src/pkg/dashboard/stage_tracker_human_gate_test.go create mode 100644 src/pkg/dashboard/static-src/js/tracker-human-gate.js diff --git a/changelog.d/changed-needs-human-gate-pill.md b/changelog.d/changed-needs-human-gate-pill.md new file mode 100644 index 0000000000..0e5d03d09d --- /dev/null +++ b/changelog.d/changed-needs-human-gate-pill.md @@ -0,0 +1 @@ +- Activity Monitor: every row a person must settle now carries exactly one human-gate control — a segmented `👤 Needs human · ` pill whose verbs are fixed per reason (review: Approve · Request changes… · Let hive decide; decision: Decide… · Approve as-is · Let hive decide; sentinel: Confirm safe · Let hive decide; hold: Release hold · Let hive decide; stacked reasons union, ≤ 3 visible + `…`). "Needs human", "Held · sentinel" and "Sentinel alert · needs human" never ride a chevron any more — the lit chevron is the real stage with the amber outline — the scattered `sentinel` chip / `Approve ▸` / `Let hive decide ▸` are folded into the pill, secondary rows of a shared PR render no gate (their *decision pending on #N* chip links to the primary row), and a new `POST /api/repos/{owner}/{repo}/items/{number}/sentinel-confirm` endpoint gives a sentinel alert its own answer (hivecommons/hive#17470). diff --git a/src/docs/api-reference/agents-and-controls.md b/src/docs/api-reference/agents-and-controls.md index 5b7bc3ec01..1523bc34b8 100644 --- a/src/docs/api-reference/agents-and-controls.md +++ b/src/docs/api-reference/agents-and-controls.md @@ -23,15 +23,15 @@ Part of the [Dashboard REST API reference](../api-reference.md); see that page f | `GET` | `/api/model-advisor` | Dashboard auth/session | Model Advisor | `pkg/dashboard/api.go:174` | | `GET` | `/api/governor/pr-models` | Dashboard auth/session | Agent-authored PR distribution by normalized attribution model/backend for `window=7d`, `30d`, or `all`, including per-model rework stats and the top 10 most-reworked PRs | `pkg/dashboard/api.go:175` | | `GET` | `/api/reviewer/accuracy` | Dashboard auth/session | Reviewer verdict calibration for the configured window: false-approve/false-block rates and confidence buckets per perspective and reviewer model | `pkg/dashboard/api.go:238` | -| `GET` | `/api/review/queue` | Dashboard auth/session | PR review queue: every open PR (agent and contributor, actionable and held) ranked by triage class, confidence band, CI state and age, with per-PR `reasons`; unreviewed items carry `pending_since` and `redispatch_count` from the review dispatch state; each entry carries `stage` `{stage, entered_at, last_activity_at, quiet_for, stalled, waiting_on_hive, past_dwell, history[]}` from the stage-label store (`stalled`/`past_dwell` follow `governor.labels.stage.dwell` and `stalled.require_quiet`; `history[]` is `{from, to, at, reason, regressed}`, newest last, capped at 8) and the top-level `hive_held` counts PRs past their stage dwell while waiting on the hive (`waiting_on_hive` and `past_dwell` both true); paged with `limit` (1-200, default 50) and `offset` | `pkg/dashboard/api.go:513` | -| `POST` | `/api/review/queue/{owner}/{repo}/{number}/superseded/close` | Owner only | Close a superseded PR now (grace window or not): posts the close comment, adds `hive/superseded`, closes it | `pkg/dashboard/api.go:516` | -| `POST` | `/api/review/queue/{owner}/{repo}/{number}/superseded/keep-open` | Owner only | Keep a superseded PR open: adds `hive/keep-open`, which the supersession sweep never auto-closes | `pkg/dashboard/api.go:517` | -| `GET` | `/api/review/pipeline` | Dashboard auth/session | Review pipeline: one card per review-queue PR placed in its stage (`unreviewed`, `reviewing`, `changes_requested`, `fixing`, `human_hold`, `approved`, `merged`, `abandoned`) with `since`, `reviewers`, P0–P3 `severity` counts, `loop_count`/`loop_cap`, `next_action` and `reasons`; filtered by `repo` and `stage`, paged with `limit` (1-200, default 50) and `offset` | `pkg/dashboard/api.go:521` | +| `GET` | `/api/review/queue` | Dashboard auth/session | PR review queue: every open PR (agent and contributor, actionable and held) ranked by triage class, confidence band, CI state and age, with per-PR `reasons`; unreviewed items carry `pending_since` and `redispatch_count` from the review dispatch state; each entry carries `stage` `{stage, entered_at, last_activity_at, quiet_for, stalled, waiting_on_hive, past_dwell, history[]}` from the stage-label store (`stalled`/`past_dwell` follow `governor.labels.stage.dwell` and `stalled.require_quiet`; `history[]` is `{from, to, at, reason, regressed}`, newest last, capped at 8) and the top-level `hive_held` counts PRs past their stage dwell while waiting on the hive (`waiting_on_hive` and `past_dwell` both true); paged with `limit` (1-200, default 50) and `offset` | `pkg/dashboard/api.go:514` | +| `POST` | `/api/review/queue/{owner}/{repo}/{number}/superseded/close` | Owner only | Close a superseded PR now (grace window or not): posts the close comment, adds `hive/superseded`, closes it | `pkg/dashboard/api.go:517` | +| `POST` | `/api/review/queue/{owner}/{repo}/{number}/superseded/keep-open` | Owner only | Keep a superseded PR open: adds `hive/keep-open`, which the supersession sweep never auto-closes | `pkg/dashboard/api.go:518` | +| `GET` | `/api/review/pipeline` | Dashboard auth/session | Review pipeline: one card per review-queue PR placed in its stage (`unreviewed`, `reviewing`, `changes_requested`, `fixing`, `human_hold`, `approved`, `merged`, `abandoned`) with `since`, `reviewers`, P0–P3 `severity` counts, `loop_count`/`loop_cap`, `next_action` and `reasons`; filtered by `repo` and `stage`, paged with `limit` (1-200, default 50) and `offset` | `pkg/dashboard/api.go:522` | | `GET` | `/api/review/dispatch/events` | Dashboard auth/session | Webhook review dispatch queue: `enabled`, `webhooks_configured`, `debounce_s`, `pending` (soonest first) and `recent` (newest first) dispatches with repo, number, head SHA, action, timestamps and coalesced count, plus `stats` counters; in memory, never calls GitHub | `pkg/dashboard/api_review_event_dispatch.go:16` | -| `GET` | `/api/review/evidence` | Merger or owner | [Review evidence bundle](../review-evidence.md) for one PR head. Query `repo` (`owner/name`), `number`, optional `head` (full SHA or unique prefix of at least 7 characters; `409` when ambiguous; default is the newest head), `format=json\|zip` (default `json`) and `download=1` for an attachment. `json` returns the bundle bytes exactly as sealed (verdicts, posted reviews, policy, CI check runs, sentinel findings, human actions, merge event, `hash`, optional `signature`); `zip` adds `verdicts.json`, `review-links.json` and a `manifest.json` of SHA-256s plus the signing public key when readable. `400` for a bad `repo`/`number`; `404` with `status: "expired"`/`expired: true` when retention removed a bundle Hive can prove existed, otherwise `status: "not_found"` | `pkg/dashboard/api.go:525` | -| `GET` | `/api/review/evidence/list` | Merger or owner | Every retained evidence bundle id and head for one PR (`repo`, `number`), oldest first, with the newest marked latest; `400` for a bad `repo`/`number` | `pkg/dashboard/api.go:526` | -| `GET` | `/api/evidence/write-counters` | Merger or owner | Durable attempted vs blocked agent GitHub write counters ([#12069](https://github.com/hivecommons/hive/issues/12069)): `totals` by intent tier (ACMM mode) with `blocked_by_reason`, and `weeks` keyed by the UTC Monday of each ISO week with per-tier and per-reason counts. Persisted across restarts; observation only, never gates a write or merge. Empty `totals`/`weeks` before anything is recorded | `pkg/dashboard/api.go:528` | -| `GET` | `/api/evidence/summary` | Dashboard auth/session | Read-only aggregate over `/data/evidence` bundles (schema v1) plus reviewer accuracy. Query `hours` (default 24, capped like `/api/pr-throughput`; `0` = all time) or a custom `from`/`to` range (RFC3339 or `YYYY-MM-DD`, date-only `to` inclusive, `to` defaults to now; `400` when `to` precedes `from`, the span exceeds 3 × 366 days, or `to` is given without `from`; the response echoes `from`/`to`), `repo` (`owner/name`) and `author_kind=human\|agent\|bot`; `400` for a bad value. A PR falls in the window by its open time (earliest bundle `created_at` or `merge.opened_at`), never by when a bundle was written; all bundles of a PR are folded so the newest supplies verdicts and the merge / `reverted_by` / backfilled close come from whichever record knows them. Returns `available_windows` (`{"24","168","720","all"}` → PR count under the same filters), `outcomes_by_author_kind` (merged/closed/open; `closed` comes from backfilled records, `reverted_14d` is null until bundles record it), `reviewer_calibration` buckets per perspective, `reviewer_accuracy_by_model` split by author kind (blocks split into `enforced_blocks` / `advisory_blocks` by `policy.require_approval`; advisory blocks that preceded a merge are `dissent_before_merge`, not false blocks), `sentinel_hits_per_week`, `shadow_gate` (`n`, `would_have_held`, `would_have_blocked`, and per gate `review_gate` / `intent` the evaluated `n` with `held` / `passed` outcomes `{n, merged, closed, open, reverted}`, plus `review_gate_by_lane` `{merge_eligible, self_merge}`), `write_counters` (per intent tier `{attempted, blocked, blocked_by_reason}` from the proxy write counter file; omitted when absent or unreadable), `write_activity` (blocked ÷ every agent write in the window: `total_writes`, `blocked`, `direct` `{recorded, since, partial_coverage, attempted, blocked, by_tier, blocked_by_reason}` from the proxy's weekly counter buckets under `/data/hive-metrics/write-counters.json`, `mediated` `{n, refused, by_action}` from the audit log), `claim_vs_verdict` (per ISO week of agent-authored PRs: `n`, `claimed`, `ci_captured`, `ci_not_green`, `verdict_not_approve`, `both`; records with empty CI are excluded from the CI column and disclosed under `missing.records_empty_ci`), `ci_recovery` (`policy` `{self_authored_automerge, required_checks}`, `n`, `at_claim` `{green, red, pending, none}`, `red` `{n, recovered_merged, green_open, abandoned, pending, outcome_unknown, enriched, not_enriched, median_pushes_to_green, median_hours_to_green, same_head_recovered}`, `gate` `{merged_n, with_checks, green, green_from_bundles, non_required_red, required_unknown, breaches, breach_prs[], suspected, suspected_prs[], pending, unknown, green_to_merge_n, median_green_to_merge_hours}` over every merged PR by GitHub-confirmed state of the *required* checks on the merged head, as the merge gate judges (`breach_prs[]` carry `red`, `merged_by`; a red non-required check is disclosed, not a breach; a red review-time snapshot, a required check with no run, or a red read without a resolvable required set is only suspected), and `convergence` `{n, passes {"1","2","3","4+","never"}, settled, in_flight, unknown, median_passes, from_github, from_bundles, by_week[]}` over agent PRs by CI passes to first green, from the durable `/data/hive-metrics/ci-recovery.json` GitHub check-run trail rollup), `work_balance` (per ISO week: `n`, `opened` by actor kind `{human, agent, bot}`, `closed`, `prs_opened`, `prs_merged`, `prs_closed`, `queue_issues`, `queue_prs`, `issue_source` `github|audit`, `throttled`) with `work_balance_sources` (`issues_github_since`, `issues_fetched_at`, `issues_known`, `audit_only_weeks`, `issue_series_weeks`, `queue_samples`, `queue_retention_days`; issues from the durable GitHub rollup `/data/hive-metrics/issue-activity.json` for weeks at or after `issues_github_since` and, for earlier weeks, from the backfilled issue series `///issues/.json` written by the issue backfill ([#12527](https://github.com/hivecommons/hive/pull/12527)) when its coverage spans the requested portion of the week (`issue_series_weeks` counts the repo-weeks it supplied), else the audit log (`audit_only_weeks`), PRs from folded bundles, queue depth from governor snapshots; `missing.issues_human_opens_unobserved` is true while no GitHub rollup exists unless the issue series covers every row, and whenever any row fell back to the audit log, `missing.throttle_windows_unavailable` discloses that no governor throttle windows are reported), `intent_counters` (per intent tier `{attempted, blocked}` from `/data/hive-metrics/intent-counters.json` — evaluations and the subset the intent gate would have blocked with enforcement on, [#12362](https://github.com/hivecommons/hive/issues/12362); omitted when absent or unreadable), `complexity_by_repo` (per managed repo the newest 12 monthly complexity snapshots, oldest first, each `{month, ref, captured_at, files, functions, mean_cyclomatic, median_cyclomatic, p90_cyclomatic, max_cyclomatic, functions_over_threshold, threshold, static_warnings, static_warnings_by_tool}`; omitted when no repo has a snapshot), the `/api/reviewer/accuracy` summary, and `n` plus `missing` counts (unknown-model verdicts, empty CI, unreadable records). Never consulted by merge decisions. | `pkg/dashboard/api.go:531` | +| `GET` | `/api/review/evidence` | Merger or owner | [Review evidence bundle](../review-evidence.md) for one PR head. Query `repo` (`owner/name`), `number`, optional `head` (full SHA or unique prefix of at least 7 characters; `409` when ambiguous; default is the newest head), `format=json\|zip` (default `json`) and `download=1` for an attachment. `json` returns the bundle bytes exactly as sealed (verdicts, posted reviews, policy, CI check runs, sentinel findings, human actions, merge event, `hash`, optional `signature`); `zip` adds `verdicts.json`, `review-links.json` and a `manifest.json` of SHA-256s plus the signing public key when readable. `400` for a bad `repo`/`number`; `404` with `status: "expired"`/`expired: true` when retention removed a bundle Hive can prove existed, otherwise `status: "not_found"` | `pkg/dashboard/api.go:526` | +| `GET` | `/api/review/evidence/list` | Merger or owner | Every retained evidence bundle id and head for one PR (`repo`, `number`), oldest first, with the newest marked latest; `400` for a bad `repo`/`number` | `pkg/dashboard/api.go:527` | +| `GET` | `/api/evidence/write-counters` | Merger or owner | Durable attempted vs blocked agent GitHub write counters ([#12069](https://github.com/hivecommons/hive/issues/12069)): `totals` by intent tier (ACMM mode) with `blocked_by_reason`, and `weeks` keyed by the UTC Monday of each ISO week with per-tier and per-reason counts. Persisted across restarts; observation only, never gates a write or merge. Empty `totals`/`weeks` before anything is recorded | `pkg/dashboard/api.go:529` | +| `GET` | `/api/evidence/summary` | Dashboard auth/session | Read-only aggregate over `/data/evidence` bundles (schema v1) plus reviewer accuracy. Query `hours` (default 24, capped like `/api/pr-throughput`; `0` = all time) or a custom `from`/`to` range (RFC3339 or `YYYY-MM-DD`, date-only `to` inclusive, `to` defaults to now; `400` when `to` precedes `from`, the span exceeds 3 × 366 days, or `to` is given without `from`; the response echoes `from`/`to`), `repo` (`owner/name`) and `author_kind=human\|agent\|bot`; `400` for a bad value. A PR falls in the window by its open time (earliest bundle `created_at` or `merge.opened_at`), never by when a bundle was written; all bundles of a PR are folded so the newest supplies verdicts and the merge / `reverted_by` / backfilled close come from whichever record knows them. Returns `available_windows` (`{"24","168","720","all"}` → PR count under the same filters), `outcomes_by_author_kind` (merged/closed/open; `closed` comes from backfilled records, `reverted_14d` is null until bundles record it), `reviewer_calibration` buckets per perspective, `reviewer_accuracy_by_model` split by author kind (blocks split into `enforced_blocks` / `advisory_blocks` by `policy.require_approval`; advisory blocks that preceded a merge are `dissent_before_merge`, not false blocks), `sentinel_hits_per_week`, `shadow_gate` (`n`, `would_have_held`, `would_have_blocked`, and per gate `review_gate` / `intent` the evaluated `n` with `held` / `passed` outcomes `{n, merged, closed, open, reverted}`, plus `review_gate_by_lane` `{merge_eligible, self_merge}`), `write_counters` (per intent tier `{attempted, blocked, blocked_by_reason}` from the proxy write counter file; omitted when absent or unreadable), `write_activity` (blocked ÷ every agent write in the window: `total_writes`, `blocked`, `direct` `{recorded, since, partial_coverage, attempted, blocked, by_tier, blocked_by_reason}` from the proxy's weekly counter buckets under `/data/hive-metrics/write-counters.json`, `mediated` `{n, refused, by_action}` from the audit log), `claim_vs_verdict` (per ISO week of agent-authored PRs: `n`, `claimed`, `ci_captured`, `ci_not_green`, `verdict_not_approve`, `both`; records with empty CI are excluded from the CI column and disclosed under `missing.records_empty_ci`), `ci_recovery` (`policy` `{self_authored_automerge, required_checks}`, `n`, `at_claim` `{green, red, pending, none}`, `red` `{n, recovered_merged, green_open, abandoned, pending, outcome_unknown, enriched, not_enriched, median_pushes_to_green, median_hours_to_green, same_head_recovered}`, `gate` `{merged_n, with_checks, green, green_from_bundles, non_required_red, required_unknown, breaches, breach_prs[], suspected, suspected_prs[], pending, unknown, green_to_merge_n, median_green_to_merge_hours}` over every merged PR by GitHub-confirmed state of the *required* checks on the merged head, as the merge gate judges (`breach_prs[]` carry `red`, `merged_by`; a red non-required check is disclosed, not a breach; a red review-time snapshot, a required check with no run, or a red read without a resolvable required set is only suspected), and `convergence` `{n, passes {"1","2","3","4+","never"}, settled, in_flight, unknown, median_passes, from_github, from_bundles, by_week[]}` over agent PRs by CI passes to first green, from the durable `/data/hive-metrics/ci-recovery.json` GitHub check-run trail rollup), `work_balance` (per ISO week: `n`, `opened` by actor kind `{human, agent, bot}`, `closed`, `prs_opened`, `prs_merged`, `prs_closed`, `queue_issues`, `queue_prs`, `issue_source` `github|audit`, `throttled`) with `work_balance_sources` (`issues_github_since`, `issues_fetched_at`, `issues_known`, `audit_only_weeks`, `issue_series_weeks`, `queue_samples`, `queue_retention_days`; issues from the durable GitHub rollup `/data/hive-metrics/issue-activity.json` for weeks at or after `issues_github_since` and, for earlier weeks, from the backfilled issue series `///issues/.json` written by the issue backfill ([#12527](https://github.com/hivecommons/hive/pull/12527)) when its coverage spans the requested portion of the week (`issue_series_weeks` counts the repo-weeks it supplied), else the audit log (`audit_only_weeks`), PRs from folded bundles, queue depth from governor snapshots; `missing.issues_human_opens_unobserved` is true while no GitHub rollup exists unless the issue series covers every row, and whenever any row fell back to the audit log, `missing.throttle_windows_unavailable` discloses that no governor throttle windows are reported), `intent_counters` (per intent tier `{attempted, blocked}` from `/data/hive-metrics/intent-counters.json` — evaluations and the subset the intent gate would have blocked with enforcement on, [#12362](https://github.com/hivecommons/hive/issues/12362); omitted when absent or unreadable), `complexity_by_repo` (per managed repo the newest 12 monthly complexity snapshots, oldest first, each `{month, ref, captured_at, files, functions, mean_cyclomatic, median_cyclomatic, p90_cyclomatic, max_cyclomatic, functions_over_threshold, threshold, static_warnings, static_warnings_by_tool}`; omitted when no repo has a snapshot), the `/api/reviewer/accuracy` summary, and `n` plus `missing` counts (unknown-model verdicts, empty CI, unreadable records). Never consulted by merge decisions. | `pkg/dashboard/api.go:532` | | `GET` | `/api/agents` | Dashboard auth/session | Agents List | `pkg/dashboard/api.go:319` | | `POST` | `/api/agents` | Owner only | Agent Create | `pkg/dashboard/api.go:320` | | `POST` | `/api/agents/import` | Owner only | Agent Import | `pkg/dashboard/api.go:321` | diff --git a/src/docs/api-reference/beads.md b/src/docs/api-reference/beads.md index 5caebab49f..5b1fa09a82 100644 --- a/src/docs/api-reference/beads.md +++ b/src/docs/api-reference/beads.md @@ -5,8 +5,8 @@ Part of the [Dashboard REST API reference](../api-reference.md); see that page f | Method | Path | Auth | Purpose | Source | |---|---|---|---|---| -| `GET` | `/api/beads` | Dashboard auth/session | Beads List | `pkg/dashboard/api.go:497` | -| `GET` | `/api/beads/{agent}` | Dashboard auth/session | Beads List | `pkg/dashboard/api.go:498` | -| `POST` | `/api/beads/{agent}` | Owner only | Beads Create | `pkg/dashboard/api.go:499` | -| `POST` | `/api/beads/reset` | Owner only | Beads Reset | `pkg/dashboard/api.go:500` | -| `POST` | `/api/beads/reset/{agent}` | Owner only | Beads Reset Agent | `pkg/dashboard/api.go:501` | +| `GET` | `/api/beads` | Dashboard auth/session | Beads List | `pkg/dashboard/api.go:498` | +| `GET` | `/api/beads/{agent}` | Dashboard auth/session | Beads List | `pkg/dashboard/api.go:499` | +| `POST` | `/api/beads/{agent}` | Owner only | Beads Create | `pkg/dashboard/api.go:500` | +| `POST` | `/api/beads/reset` | Owner only | Beads Reset | `pkg/dashboard/api.go:501` | +| `POST` | `/api/beads/reset/{agent}` | Owner only | Beads Reset Agent | `pkg/dashboard/api.go:502` | diff --git a/src/docs/api-reference/configuration.md b/src/docs/api-reference/configuration.md index 159c17bfa7..cfc998bdb2 100644 --- a/src/docs/api-reference/configuration.md +++ b/src/docs/api-reference/configuration.md @@ -75,17 +75,17 @@ Part of the [Dashboard REST API reference](../api-reference.md); see that page f | `POST` | `/api/config/governor/repos/check-access` | Dashboard auth/session | Governor Repo Check Access | `pkg/dashboard/api.go:313` | | `PUT` | `/api/config/github` | Owner only | Config GitHub | `pkg/dashboard/api.go:314` | | `GET` | `/api/config/github/forge-apps` | Dashboard auth/session | Config GitHub Forge Apps | `pkg/dashboard/api.go:317` | -| `GET` | `/api/config/sidebar` | Dashboard auth/session | Sidebar Get | `pkg/dashboard/api.go:371` | -| `PUT` | `/api/config/sidebar` | Dashboard auth/session | Sidebar Set | `pkg/dashboard/api.go:372` | -| `GET` | `/api/config/backends` | Dashboard auth/session | Backends | `pkg/dashboard/api.go:373` | -| `GET` | `/api/compliance/status` | Merger or owner | Evaluated compliance controls for the frameworks in `compliance.frameworks` (`compliance.Report`, JSON): per control `meets`/`deviates`/`off`/`not_covered` with current vs recommended value per mapped setting, a summary, and the non-certification disclaimer — see [Compliance](../compliance.md) ([#11078](https://github.com/hivecommons/hive/issues/11078)) | `pkg/dashboard/api.go:363` | -| `GET` | `/api/compliance/posture` | Merger or owner | Posture-check catalogue, effective interval / window / history retention, and the latest run (`compliance.PostureRun`: schedule/manual trigger, `triggered_by` identity, and per-check `pass`/`fail`/`skip`/`error`, detail, control ids, evidence refs); `?since=` (RFC 3339, `YYYY-MM-DD` or a look-back such as `168h`) adds every run since then, oldest first, capped at 1000 — see [Compliance](../compliance.md#posture-checks-catalogue) ([#11079](https://github.com/hivecommons/hive/issues/11079)) | `pkg/dashboard/api.go:364` | -| `POST` | `/api/compliance/posture/run` | Merger or owner | Run the posture checks now, attributed to the authenticated user, and record the pass in the history; audited as `compliance_posture_run`; `409` when no framework is selected or a pass is already running ([#11079](https://github.com/hivecommons/hive/issues/11079)) | `pkg/dashboard/api.go:365` | -| `GET` | `/api/compliance/posture/history` | Owner only | Posture history for `?since=`/`?until=` (default the last 30 days) as one series per check: points (`at`, `status`), status counts, `last_fail_at` and the latest result with detail and evidence refs; at most the 1000 most recent runs — see [Compliance](../compliance.md#evidence-exports-and-attestations) ([#11081](https://github.com/hivecommons/hive/issues/11081)) | `pkg/dashboard/api.go:366` | -| `GET` | `/api/compliance/export` | Owner only | Evidence download for `?since=`/`?until=`: `kind=controls` (`json`/`md`), `posture` (`json`/`csv`), `audit` (`json`), `config` (redacted effective config + sha256, `json`), `attestations` (`json`/`csv`) or `bundle` (`json`). Every format includes source, period, generator, selected profile versions, attesters, retention and a per-section SHA-256 manifest; audited as `compliance_export` with the SHA-256 of the delivered bytes ([#11081](https://github.com/hivecommons/hive/issues/11081), [#13582](https://github.com/hivecommons/hive/issues/13582)) | `pkg/dashboard/api.go:367` | -| `GET` | `/api/compliance/attestations` | Owner only | Owner attestations, newest first (`?framework=` filters) ([#11081](https://github.com/hivecommons/hive/issues/11081)) | `pkg/dashboard/api.go:368` | -| `POST` | `/api/compliance/attestations` | Owner only | Record `{"framework", "reviewed_on", "note"}` for the signed-in owner; audited as `compliance_attestation`; `201` with the attestation, `400` for an unknown framework, a bad or future date, or a note over 2000 characters ([#11081](https://github.com/hivecommons/hive/issues/11081)) | `pkg/dashboard/api.go:369` | -| `PUT` | `/api/config/governor/compliance` | Owner only | Settings → Compliance framework picker: `{"frameworks": [...]}` sets `compliance.frameworks` (empty list deselects all, absent key leaves it unchanged; unknown/duplicate ids are a `400` before any change); audited as `config_compliance`; returns the re-evaluated `compliance.Report` ([#11080](https://github.com/hivecommons/hive/issues/11080)) | `pkg/dashboard/api.go:538` | +| `GET` | `/api/config/sidebar` | Dashboard auth/session | Sidebar Get | `pkg/dashboard/api.go:372` | +| `PUT` | `/api/config/sidebar` | Dashboard auth/session | Sidebar Set | `pkg/dashboard/api.go:373` | +| `GET` | `/api/config/backends` | Dashboard auth/session | Backends | `pkg/dashboard/api.go:374` | +| `GET` | `/api/compliance/status` | Merger or owner | Evaluated compliance controls for the frameworks in `compliance.frameworks` (`compliance.Report`, JSON): per control `meets`/`deviates`/`off`/`not_covered` with current vs recommended value per mapped setting, a summary, and the non-certification disclaimer — see [Compliance](../compliance.md) ([#11078](https://github.com/hivecommons/hive/issues/11078)) | `pkg/dashboard/api.go:364` | +| `GET` | `/api/compliance/posture` | Merger or owner | Posture-check catalogue, effective interval / window / history retention, and the latest run (`compliance.PostureRun`: schedule/manual trigger, `triggered_by` identity, and per-check `pass`/`fail`/`skip`/`error`, detail, control ids, evidence refs); `?since=` (RFC 3339, `YYYY-MM-DD` or a look-back such as `168h`) adds every run since then, oldest first, capped at 1000 — see [Compliance](../compliance.md#posture-checks-catalogue) ([#11079](https://github.com/hivecommons/hive/issues/11079)) | `pkg/dashboard/api.go:365` | +| `POST` | `/api/compliance/posture/run` | Merger or owner | Run the posture checks now, attributed to the authenticated user, and record the pass in the history; audited as `compliance_posture_run`; `409` when no framework is selected or a pass is already running ([#11079](https://github.com/hivecommons/hive/issues/11079)) | `pkg/dashboard/api.go:366` | +| `GET` | `/api/compliance/posture/history` | Owner only | Posture history for `?since=`/`?until=` (default the last 30 days) as one series per check: points (`at`, `status`), status counts, `last_fail_at` and the latest result with detail and evidence refs; at most the 1000 most recent runs — see [Compliance](../compliance.md#evidence-exports-and-attestations) ([#11081](https://github.com/hivecommons/hive/issues/11081)) | `pkg/dashboard/api.go:367` | +| `GET` | `/api/compliance/export` | Owner only | Evidence download for `?since=`/`?until=`: `kind=controls` (`json`/`md`), `posture` (`json`/`csv`), `audit` (`json`), `config` (redacted effective config + sha256, `json`), `attestations` (`json`/`csv`) or `bundle` (`json`). Every format includes source, period, generator, selected profile versions, attesters, retention and a per-section SHA-256 manifest; audited as `compliance_export` with the SHA-256 of the delivered bytes ([#11081](https://github.com/hivecommons/hive/issues/11081), [#13582](https://github.com/hivecommons/hive/issues/13582)) | `pkg/dashboard/api.go:368` | +| `GET` | `/api/compliance/attestations` | Owner only | Owner attestations, newest first (`?framework=` filters) ([#11081](https://github.com/hivecommons/hive/issues/11081)) | `pkg/dashboard/api.go:369` | +| `POST` | `/api/compliance/attestations` | Owner only | Record `{"framework", "reviewed_on", "note"}` for the signed-in owner; audited as `compliance_attestation`; `201` with the attestation, `400` for an unknown framework, a bad or future date, or a note over 2000 characters ([#11081](https://github.com/hivecommons/hive/issues/11081)) | `pkg/dashboard/api.go:370` | +| `PUT` | `/api/config/governor/compliance` | Owner only | Settings → Compliance framework picker: `{"frameworks": [...]}` sets `compliance.frameworks` (empty list deselects all, absent key leaves it unchanged; unknown/duplicate ids are a `400` before any change); audited as `config_compliance`; returns the re-evaluated `compliance.Report` ([#11080](https://github.com/hivecommons/hive/issues/11080)) | `pkg/dashboard/api.go:539` | | `GET` | `/api/config/governor/threshold-scaling` | Owner only | Governor Threshold Scaling Get | `pkg/dashboard/api.go:219` | | `PUT` | `/api/config/governor/threshold-scaling` | Owner only | Governor Threshold Scaling Set | `pkg/dashboard/api.go:220` | @@ -94,8 +94,8 @@ Part of the [Dashboard REST API reference](../api-reference.md); see that page f | `PUT` | `/api/config/governor/watchdog` | Owner only | Governor Watchdog | `pkg/dashboard/api.go:229` | | `GET` | `/api/config/escalation` | Owner only | Escalation Config Get | `pkg/dashboard/api.go:232` | | `PUT` | `/api/config/escalation` | Owner only | Escalation Config Set | `pkg/dashboard/api.go:233` | -| `GET` | `/api/config/write-surface` | Owner only | Lane write allowlist (`write_surface.allowlist`, [#9587](https://github.com/hivecommons/hive/issues/9587)): `allowlist`, `ops`, `warnings` | `pkg/dashboard/api.go:534` | -| `PUT` | `/api/config/write-surface` | Owner only | Replace the lane write allowlist; `{"allowlist": {}}` clears it; unknown operation or bad lane name is a 400 with nothing changed | `pkg/dashboard/api.go:535` | +| `GET` | `/api/config/write-surface` | Owner only | Lane write allowlist (`write_surface.allowlist`, [#9587](https://github.com/hivecommons/hive/issues/9587)): `allowlist`, `ops`, `warnings` | `pkg/dashboard/api.go:535` | +| `PUT` | `/api/config/write-surface` | Owner only | Replace the lane write allowlist; `{"allowlist": {}}` clears it; unknown operation or bad lane name is a 400 with nothing changed | `pkg/dashboard/api.go:536` | | `GET` | `/api/config/review` | Dashboard auth/session | Review Config Get | `pkg/dashboard/api.go:236` | | `PUT` | `/api/config/review` | Owner only | Review Config Set | `pkg/dashboard/api.go:239` | | `PUT` | `/api/config/governor/features` | Owner only | Governor Features | `pkg/dashboard/api.go:245` | diff --git a/src/docs/api-reference/dashboard-misc.md b/src/docs/api-reference/dashboard-misc.md index 63af99a4d8..f893a521f4 100644 --- a/src/docs/api-reference/dashboard-misc.md +++ b/src/docs/api-reference/dashboard-misc.md @@ -25,7 +25,7 @@ The monitor renders CI and Review concurrently on one shared PR row; see | Method | Path | Auth | Purpose | Source | |---|---|---|---|---| | `GET` | `/api/audit` | Read-write role | Audit Log — `{"entries": [...]}` envelope, newest first, capped at 200; response shape and the serve-time `user_name` field in [audit-log.md](../audit-log.md#get-apiaudit) | `pkg/dashboard/api.go:62` | -| `GET` | `/api/watchdog/activity` | Read-write role | Watchdog activity readout for the Health tab (#7254): `watchdog-*` audit actions over `?days=` (default 30, clamped to 90) — total / taken / observed / `byAction`, a zero-filled per-day `daily` histogram, per-agent `agents` liveness, and the Observe → Heal `promotion` hint; see [agent-watchdog.md](../agent-watchdog.md#watchdog-activity-strip) | `pkg/dashboard/api.go:508` | +| `GET` | `/api/watchdog/activity` | Read-write role | Watchdog activity readout for the Health tab (#7254): `watchdog-*` audit actions over `?days=` (default 30, clamped to 90) — total / taken / observed / `byAction`, a zero-filled per-day `daily` histogram, per-agent `agents` liveness, and the Observe → Heal `promotion` hint; see [agent-watchdog.md](../agent-watchdog.md#watchdog-activity-strip) | `pkg/dashboard/api.go:509` | | `POST` | `/api/presence` | Dashboard auth/session | Presence | `pkg/dashboard/api.go:65` | | `POST` | `/api/upgrade/announce` | Owner role | Announce a pod roll before it happens ([#15788](https://github.com/hivecommons/hive/issues/15788)): body `{"target": "", "source": "hub"|"operator", "reason": "..."}` (`version` is an alias of `target`; all fields optional). Marks `/api/status`/`/api/version` `upgradeProgress` as `state: pulling, phase: announced` with the target and publishes an SSE `upgrading` event so every open dashboard shows the upgrade animation; a SIGTERM afterwards (or with no announce at all) publishes `phase: restarting` from the same record. The hub sends the same announce through the heartbeat response (`upgrade_announce`) for hub-managed hives; an announce with no kill expires after 15 minutes. Returns `{ok, upgradeProgress}` | `pkg/dashboard/api.go:68` | | `GET` | `/api/prompt-history` | Dashboard auth/session | Prompt History | `pkg/dashboard/api.go:66` | @@ -40,18 +40,18 @@ The monitor renders CI and Review concurrently on one shared PR row; see | `GET` | `/api/convergence/soak` | Owner only | Convergence Soak Status | `pkg/dashboard/api.go:263` | -| `POST` | `/api/plan/from-issue` | Dashboard auth/session | Plan From Issue | `pkg/dashboard/api.go:460` | -| `GET` | `/api/plan/{epicID}` | Dashboard auth/session | Plan Tree | `pkg/dashboard/api.go:463` | -| `POST` | `/api/plan/{epicID}/approve` | Owner only | Plan Approve | `pkg/dashboard/api.go:464` | -| `POST` | `/api/plan/{epicID}/reject` | Owner only | Plan Reject | `pkg/dashboard/api.go:466` | -| `POST` | `/api/plan/{epicID}/child/{childID}` | Owner only | Plan Child Action | `pkg/dashboard/api.go:467` | +| `POST` | `/api/plan/from-issue` | Dashboard auth/session | Plan From Issue | `pkg/dashboard/api.go:461` | +| `GET` | `/api/plan/{epicID}` | Dashboard auth/session | Plan Tree | `pkg/dashboard/api.go:464` | +| `POST` | `/api/plan/{epicID}/approve` | Owner only | Plan Approve | `pkg/dashboard/api.go:465` | +| `POST` | `/api/plan/{epicID}/reject` | Owner only | Plan Reject | `pkg/dashboard/api.go:467` | +| `POST` | `/api/plan/{epicID}/child/{childID}` | Owner only | Plan Child Action | `pkg/dashboard/api.go:468` | | `POST` | `/api/linear/agent/install` | Owner only | Linear Agent Install (OAuth start) | `pkg/dashboard/api_linear_agent.go:215` | | `GET` | `/api/linear/agent/status` | Owner only | Linear Agent Status | `pkg/dashboard/api_linear_agent.go:216` | | `POST` | `/api/linear/agent/disconnect` | Owner only | Linear Agent Disconnect | `pkg/dashboard/api_linear_agent.go:217` | | `GET` | `/api/upstream-watch` | Owner only | Upstream-watch divergence: per watched fork the upstream followed, the watermark and last-run time, surfaced/ported/dismissed/skipped counts, and the recent upstream refs with their upstream URL, diff URL, fork issue number and state. Read-only — it reads the config and the watch state file, never GitHub. Also carries `interval`, `project_repos` and each repo's configured entry (`config`) for the editor. | `pkg/dashboard/api.go:305` | | `PUT` | `/api/config/upstream-watch` | Owner only | Upstream Watch Config Update: edit `upstream_watch` from the Features tab. Body `{enabled?, interval?, repos?: {: {upstream?, sources?, pr_labels?, max_issues_per_run?, label?} \| null}}` — absent keys are unchanged, `null` removes a repo, keys are stored as the bare repo name. Validated with the loader's rules before the config changes (400 on failure), then persisted and audited as `config_upstream_watch`. | `pkg/dashboard/api.go:306` | -| `GET` | `/api/hotspots` | Dashboard auth/session | Merge-hotspot advisor report (`?repo=owner/name` optional): files repeatedly touched by concurrent PRs over the last `governor.hotspot_window_days`, each with `prs` (distinct PRs), `pr_numbers`, `overlaps` (PR pairs open at the same time), `conflicts` (rebase conflicts blamed on the file), `lines`, `kind` (`code`/`doc`/`lock`/`generated`/`data`), `score`, `symbol_groups`, `recommendation` (`split-code`/`split-doc`/`split-source`/`report-only`/`none`), `reason`, `generated_from`, `source_files` (files under `generated_from`, when known), `issue_number`/`issue_url` of the modularize issue filed, `last_updated`; top-level `count`/`actionable`/`filed`. Derived from the merge train's own PR file lists and the rebase follow-through's conflict records — never lists PRs or files from GitHub. See [operator-reference.md § Merge-hotspot advisor](../operator-reference.md#merge-hotspot-advisor-governorhotspot_). | `pkg/dashboard/api.go:545` | +| `GET` | `/api/hotspots` | Dashboard auth/session | Merge-hotspot advisor report (`?repo=owner/name` optional): files repeatedly touched by concurrent PRs over the last `governor.hotspot_window_days`, each with `prs` (distinct PRs), `pr_numbers`, `overlaps` (PR pairs open at the same time), `conflicts` (rebase conflicts blamed on the file), `lines`, `kind` (`code`/`doc`/`lock`/`generated`/`data`), `score`, `symbol_groups`, `recommendation` (`split-code`/`split-doc`/`split-source`/`report-only`/`none`), `reason`, `generated_from`, `source_files` (files under `generated_from`, when known), `issue_number`/`issue_url` of the modularize issue filed, `last_updated`; top-level `count`/`actionable`/`filed`. Derived from the merge train's own PR file lists and the rebase follow-through's conflict records — never lists PRs or files from GitHub. See [operator-reference.md § Merge-hotspot advisor](../operator-reference.md#merge-hotspot-advisor-governorhotspot_). | `pkg/dashboard/api.go:546` | | `GET` | `/api/widget` | Dashboard auth/session | Widget | `pkg/dashboard/api.go:117` | | `GET` | `/api/pane/{agent}` | Dashboard auth/session | Pane | `pkg/dashboard/api.go:122` | | `GET` | `/api/role` | Dashboard auth/session | Role | `pkg/dashboard/api.go:136` | @@ -62,11 +62,11 @@ The monitor renders CI and Review concurrently on one shared PR row; see | `GET` | `/api/stage-tracker` | Dashboard auth/session | Stage Tracker: every open issue and pull request of the watched repos for the Hive activity monitor — actionable, held, claimed, in-progress, covered-by-PR, filtered (`needs-*`), draft and exempt-labelled items alike, each with `stage`, `stage_since`, `labels`, `created_at`, `author_kind`, `modifiers`, `claimant: {kind: hive-agent|clanker|person, login, agent, hive, since, source: claim-ledger|claim-comment|assignee|kick-history|author}` naming who holds a claimed / in-progress issue or a PR under review or rework (absent when nobody is named; mirrored onto `linked_prs[]`), (PRs) `sentinel_alert` / `sentinel_findings` / `sentinel_reason` when the sentinel flagged the PR, `decision_needed` on a row parked on a person (085 / 045 / 015, the needs-human pill; mirrored onto the issue's `linked_prs[]` entry): `{question, asked_by, since, blocker, blocker_reason, options: [{action, label, enabled, reason_if_disabled}]}` — the reviewer's own decision question when the verdict record has one, the blocker in plain words, and the applicable actions under the row context menu's action ids (`decide:delegate` first), (PRs) `lineage` on the hive's copy of an adopted PR — `{kind: adopted|superseded|rebased-by-hive, from_number, from_url, from_author, from_author_kind, to_number, to_url, at, reason}`, derived from the stage store's adoption record or the `hive/adopt-` head branch, mirrored onto the issue's `linked_prs[]` entry; absent on every other row — and (issues) `linked_prs`; items with no stage yet report stage `0` "Open"; `needs_human_labels` is the "a person must act" label set behind the monitor's Needs human facet (the same list as `/api/status.labelPresets[needs-human]`); `recently_merged` lists the PRs (`repo`, `number`, `merged_at`) whose `pr_merged` audit entry is under 30 minutes old, so a client diffing two payloads can tell a merge from a close; a PR in a conflict-aware merge train carries `merge_train` `{id, state, front, position, size, attempt, max_attempts, overlap_files, ahead, length, head_number, head_state, head_reason, head_since, eta_s, eta_at, eta_basis, late, stalled, stalled_s}` — `head_state` one of `needs-human` / `ci` / `soaking` / `ready` / `merging` / `fixing` / `unknown` with `head_reason` in plain words; `eta_s` / `eta_at` the estimated wait for this member's own merge attempt (own remaining soak + each PR ahead's remaining soak or one sweep + the next sweep tick; absent while the head waits on a person or CI), `eta_at` anchored to the member's first estimate at its position so a countdown survives polls, `eta_basis` its short reading ("2 ahead · head soaking 12m · next sweep in 40s"), `late` once now has overrun the first estimate twice over, `stalled` / `stalled_s` once the head has sat longer than `governor.merge_train_stall_warn_s` ([#15395](https://github.com/hivecommons/hive/issues/15395)); a PR the queue holds because another open PR declares the same `Fixes #N` carries no `merge_train` and a `merge_gate` of `{state: "duplicate-of:", duplicate_of, duplicate_issue}` plus the `needs-decision` modifier (the queue keeps one PR per issue: green first, then the earlier-opened); a PR GitHub reports conflicting on its own, or one under repair (stage/070, 071, 072, 074, 085, or a red required check), carries no `merge_train` and is not counted in any member's `size` / `length` — a repaired member the view dropped carries `left_train: {why: fixing|needs-author|returned-to-contributor|adopted-by-hive|needs-decision|checks-failing, note}` instead (mirrored onto the issue's `linked_prs[]` entry), and a train left with one member reports no `merge_train` at all; a PR short of the merge queue (below stage/080) the planner ordered rides no train either — it carries `overlap: {behind, with, files, note}` ("overlaps #15637 (sidebar.html, index.html) — will queue behind it") and no `merge_train`, and counts in no member's `size` — the state slugs (`front`, `queued-behind`) are payload values only, the SPA renders ordinal places ("Queued for merge · 1st of 2", with the train's tag when more than one train is on the page). Served from a server-side cache rebuilt at most every `dashboard.stage_tracker.cache_ttl_s` (default `governor.eval_interval_s`) from the spoke's existing snapshot — a request never calls GitHub. Carries `generated_at`, `source` (`cache` or `fresh`), `cache_ttl_s`, an `ETag` and `Cache-Control: private, max-age=`; `If-None-Match` yields 304. Each hit is recorded under REST caller `dashboard:stage-tracker` so `/api/gh-rate-limits` shows it charged nothing. | `pkg/dashboard/api.go:190` | | `GET` | `/api/matrix/lines` | Dashboard auth/session | Matrix Lines (deprecated name, see [Published-checkpoint regions](#published-checkpoint-regions)): serve bounded backlog of pushed lines behind dashboard.matrix with repo allowlist filtering. `max` counts only lines the repo allowlist admits, so a page is never emptied by filtered-out lines. A client paging with `max` should use the last returned line's `seq` as its next `since`, not the top-level `seq`, which is the source's latest sequence number and would skip lines still past the page. `more` is true only while another line the caller may see remains past the page; stop paging when it is false. | `pkg/dashboard/api.go:191` | | `POST` | `/api/prs/{owner}/{repo}/{number}/queue-automerge` | Merger/owner role | Queue PRAuto Merge | `pkg/dashboard/api.go:192` | -| `GET` | `/api/inference/models/{backend}` | Dashboard auth/session | Inference Models | `pkg/dashboard/api.go:376` | -| `GET` | `/api/hive-id` | Dashboard auth/session | Hive IDGet | `pkg/dashboard/api.go:439` | -| `PUT` | `/api/hive-id` | Owner only | Hive IDSet | `pkg/dashboard/api.go:440` | -| `POST` | `/api/chat` | Dashboard auth/session | Chat | `pkg/dashboard/api.go:469` | -| `GET` | `/api/auth/token` | Public | Auth Token | `pkg/dashboard/api.go:503` | +| `GET` | `/api/inference/models/{backend}` | Dashboard auth/session | Inference Models | `pkg/dashboard/api.go:377` | +| `GET` | `/api/hive-id` | Dashboard auth/session | Hive IDGet | `pkg/dashboard/api.go:440` | +| `PUT` | `/api/hive-id` | Owner only | Hive IDSet | `pkg/dashboard/api.go:441` | +| `POST` | `/api/chat` | Dashboard auth/session | Chat | `pkg/dashboard/api.go:470` | +| `GET` | `/api/auth/token` | Public | Auth Token | `pkg/dashboard/api.go:504` | | `GET` | `/api/v1/` | GitHub token | Contributor v1 API dispatcher | `pkg/dashboard/api_contribute.go:350` | | `POST` | `/api/v1/` | GitHub token | Contributor v1 API dispatcher | `pkg/dashboard/api_contribute.go:351` | | `GET` | `/api/docs` | Dashboard auth/session | APIDocs | `pkg/dashboard/api_contribute.go:352` | diff --git a/src/docs/api-reference/inception.md b/src/docs/api-reference/inception.md index 87aa1ac754..9446f8926b 100644 --- a/src/docs/api-reference/inception.md +++ b/src/docs/api-reference/inception.md @@ -5,17 +5,17 @@ Part of the [Dashboard REST API reference](../api-reference.md); see that page f | Method | Path | Auth | Purpose | Source | |---|---|---|---|---| -| `POST` | `/api/inception/start` | Owner only | Inception Start | `pkg/dashboard/api.go:442` | -| `POST` | `/api/inception/scan` | Owner only | Inception Scan | `pkg/dashboard/api.go:443` | -| `GET` | `/api/inception/state` | Dashboard auth/session | Inception State | `pkg/dashboard/api.go:444` | -| `POST` | `/api/inception/questions` | Owner only | Inception Set Questions | `pkg/dashboard/api.go:445` | -| `POST` | `/api/inception/answer` | Owner only | Inception Answer | `pkg/dashboard/api.go:446` | -| `POST` | `/api/inception/facts` | Owner only | Inception Record Facts | `pkg/dashboard/api.go:447` | -| `GET` | `/api/inception/scaffold` | Dashboard auth/session | Inception Scaffold | `pkg/dashboard/api.go:448` | -| `POST` | `/api/inception/approve` | Owner only | Inception Approve | `pkg/dashboard/api.go:449` | -| `POST` | `/api/inception/reset` | Owner only | Inception Reset | `pkg/dashboard/api.go:450` | -| `GET` | `/api/inception/ideation-facts` | Dashboard auth/session | Inception Ideation Facts | `pkg/dashboard/api.go:451` | -| `GET` | `/api/inception/download` | Dashboard auth/session | Inception Download | `pkg/dashboard/api.go:452` | -| `GET` | `/api/inception/has-files` | Dashboard auth/session | Inception Has Files | `pkg/dashboard/api.go:453` | -| `PUT` | `/api/inception/wiki-name` | Owner only | Inception Rename Wiki | `pkg/dashboard/api.go:454` | -| `POST` | `/api/inception/import` | Owner only | Inception Import | `pkg/dashboard/api.go:455` | +| `POST` | `/api/inception/start` | Owner only | Inception Start | `pkg/dashboard/api.go:443` | +| `POST` | `/api/inception/scan` | Owner only | Inception Scan | `pkg/dashboard/api.go:444` | +| `GET` | `/api/inception/state` | Dashboard auth/session | Inception State | `pkg/dashboard/api.go:445` | +| `POST` | `/api/inception/questions` | Owner only | Inception Set Questions | `pkg/dashboard/api.go:446` | +| `POST` | `/api/inception/answer` | Owner only | Inception Answer | `pkg/dashboard/api.go:447` | +| `POST` | `/api/inception/facts` | Owner only | Inception Record Facts | `pkg/dashboard/api.go:448` | +| `GET` | `/api/inception/scaffold` | Dashboard auth/session | Inception Scaffold | `pkg/dashboard/api.go:449` | +| `POST` | `/api/inception/approve` | Owner only | Inception Approve | `pkg/dashboard/api.go:450` | +| `POST` | `/api/inception/reset` | Owner only | Inception Reset | `pkg/dashboard/api.go:451` | +| `GET` | `/api/inception/ideation-facts` | Dashboard auth/session | Inception Ideation Facts | `pkg/dashboard/api.go:452` | +| `GET` | `/api/inception/download` | Dashboard auth/session | Inception Download | `pkg/dashboard/api.go:453` | +| `GET` | `/api/inception/has-files` | Dashboard auth/session | Inception Has Files | `pkg/dashboard/api.go:454` | +| `PUT` | `/api/inception/wiki-name` | Owner only | Inception Rename Wiki | `pkg/dashboard/api.go:455` | +| `POST` | `/api/inception/import` | Owner only | Inception Import | `pkg/dashboard/api.go:456` | diff --git a/src/docs/api-reference/knowledge.md b/src/docs/api-reference/knowledge.md index 8c52923008..dacadb8729 100644 --- a/src/docs/api-reference/knowledge.md +++ b/src/docs/api-reference/knowledge.md @@ -5,38 +5,38 @@ Part of the [Dashboard REST API reference](../api-reference.md); see that page f | Method | Path | Auth | Purpose | Source | |---|---|---|---|---| -| `GET` | `/api/knowledge` | Dashboard auth/session | Paginated knowledge facts: `type` filter, `limit` (default 50, max 200; invalid/non-positive values use the default), `offset` (default 0). Returns `enabled`, `facts`, `count` (this page), `total`, `limit`, `offset`, `has_more`; ordered by layer then slug. Offsets are not snapshot cursors: concurrent edits may shift pages. | `pkg/dashboard/api.go:378` | -| `GET` | `/api/knowledge/export` | Dashboard auth/session | Knowledge Export | `pkg/dashboard/api.go:379` | -| `POST` | `/mcp/knowledge` | Public (read-only) when the dashboard setting or `HIVE_PUBLIC_KNOWLEDGE` is on; otherwise 404 to a signed-in caller and 401 to one who is not | Public Knowledge MCP endpoint — `initialize`, `tools/list`, `tools/call` for `knowledge_search`/`knowledge_toc`/`knowledge_get`/`knowledge_export` ([docs](../public-knowledge-mcp.md)) | `pkg/dashboard/api.go:388` | -| `GET` | `/api/knowledge/search` | Dashboard auth/session | Knowledge Search | `pkg/dashboard/api.go:380` | -| `GET` | `/api/knowledge/toc` | Dashboard auth/session | Scoped knowledge table of contents: capped, body-free entries (`id`, `title`, `type`, `layer`, `repo`, `tags`, `status`, `confidence`, `updated`, `size_bytes`, `source`) plus `total`/`returned`/`truncated`. Query: `layers`, `repos`, `types`, `tags` (comma-separated), `limit` (default 50, max 200), `include_states` (operator opt-in for `draft`/`deprecated`/`superseded`/`all`), `format=prompt` with `max_chars` for a bounded markdown rendering, `agent` to apply that agent's `knowledge.agent_scopes` entry (the other parameters can only narrow it). Approved knowledge only by default ([docs](../knowledge-toc.md)) | `pkg/dashboard/api.go:381` | -| `GET` | `/api/knowledge/effective` | Dashboard auth/session | Effective knowledge for one agent (`agent` required): the agent's `knowledge.agent_scopes` entry (unrestricted when it has none) intersected with the request scope (approved only unless `include_states` is set). Returns `scope` (resolved scope applied, with `configured`), `included` TOC entries, `excluded` entries each with a `reason` (`lifecycle`, `layer`, `repo`, `type` or `tag` — first failing check, in that order), `included_total`/`excluded_total`/`included_returned`/`excluded_returned` and `truncated`; `limit` caps each list (default 50, max 200) ([docs](../knowledge-toc.md#effective-knowledge)) | `pkg/dashboard/api.go:382` | -| `GET` | `/api/knowledge/entry/{id}` | Dashboard auth/session | Full read of one knowledge entry: `markdown` (front-matter plus body) and the fact. Takes the same scope, `include_states` and `agent` query as the table of contents and returns 404 for an entry outside it ([docs](../knowledge-toc.md)) | `pkg/dashboard/api.go:383` | -| `POST` | `/api/knowledge/cli-memory/drain-legacy` | Owner only | One-shot drain of the shared home's legacy Claude memory (`/data/home/.claude/projects/*/memory`) into `state: draft` entries in `bead-synth-wiki`, tagged `cli-memory` and `agent:shared`, deduplicated by content hash. Body `{"truncate": bool}` (default false) empties only files whose every fact is now stored. Returns `store`, `agent`, `sources`, `drained`, `dupes`, `skipped`, `truncate`, `truncated`, `kept`, `errors`; 409 when the vault is not connected. Audited as `knowledge_drain_legacy_memory` ([docs](../knowledge-lifecycle.md#auto-memory-drafts)) | `pkg/dashboard/api.go:385` | -| `GET` | `/api/knowledge/public` | Dashboard auth/session | Public Knowledge MCP sharing status (`enabled`, `tags`, `source`, endpoint URL) | `pkg/dashboard/api.go:389` | -| `PUT` | `/api/knowledge/public` | Owner only | Persist public Knowledge MCP sharing setting; overrides env vars until changed | `pkg/dashboard/api.go:390` | -| `GET` | `/api/knowledge/health` | Dashboard auth/session | Knowledge Health | `pkg/dashboard/api.go:391` | -| `GET` | `/api/knowledge/stats` | Dashboard auth/session | Knowledge Stats | `pkg/dashboard/api.go:392` | -| `GET` | `/api/knowledge/graph` | Dashboard auth/session | Knowledge Graph | `pkg/dashboard/api.go:393` | -| `GET` | `/api/knowledge/fact-history` | Dashboard auth/session | Fact History | `pkg/dashboard/api.go:394` | -| `POST` | `/api/knowledge/create` | Dashboard auth/session | Create one fact (`title`, `body`, `type`, `tags`, `layer`, `confidence`, `state`). `state` is `approved` (default) or `draft`; a draft is written with `state: draft` into the local channel named by `layer` (400 when there is none, 409 when its title already names an entry). A request tagged `cli-memory` must be a draft carrying only `cli-memory`, `agent:`, `cli:`, `memhash:` and `repo:/` tags (400 otherwise) | `pkg/dashboard/api.go:395` | -| `POST` | `/api/knowledge/import` | Dashboard auth/session | Knowledge Import | `pkg/dashboard/api.go:396` | -| `POST` | `/api/knowledge/promote` | Dashboard auth/session | Knowledge Promote | `pkg/dashboard/api.go:402` | -| `GET` | `/api/knowledge/subscriptions` | Dashboard auth/session | Knowledge Subs List | `pkg/dashboard/api.go:403` | -| `POST` | `/api/knowledge/subscriptions` | Dashboard auth/session | Knowledge Subs Add | `pkg/dashboard/api.go:404` | -| `DELETE` | `/api/knowledge/subscriptions` | Dashboard auth/session | Knowledge Subs Remove | `pkg/dashboard/api.go:405` | -| `PUT` | `/api/knowledge/{layer}/{slug}` | Dashboard auth/session | Knowledge Update | `pkg/dashboard/api.go:406` | -| `DELETE` | `/api/knowledge/{layer}/{slug}` | Dashboard auth/session | Knowledge Delete | `pkg/dashboard/api.go:407` | -| `GET` | `/api/knowledge/{layer}` | Dashboard auth/session | Knowledge Layer | `pkg/dashboard/api.go:408` | -| `GET` | `/api/knowledge/{layer}/{slug}` | Dashboard auth/session | Knowledge Fact | `pkg/dashboard/api.go:409` | -| `PUT` | `/api/knowledge/enabled` | Owner only | Knowledge Toggle | `pkg/dashboard/api.go:410` | -| `GET` | `/api/knowledge/bead-synthesizer` | Dashboard auth/session | Bead Synth Status | `pkg/dashboard/api.go:411` | -| `PUT` | `/api/knowledge/bead-synthesizer/enabled` | Owner only | Bead Synth Toggle | `pkg/dashboard/api.go:412` | -| `GET` | `/api/knowledge/vaults` | Dashboard auth/session | Vaults List | `pkg/dashboard/api.go:413` | -| `POST` | `/api/knowledge/vaults` | Owner only | Vaults Connect | `pkg/dashboard/api.go:414` | -| `DELETE` | `/api/knowledge/vaults` | Dashboard auth/session | Vaults Disconnect | `pkg/dashboard/api.go:415` | -| `POST` | `/api/knowledge/vaults/reindex` | Dashboard auth/session | Vaults Reindex | `pkg/dashboard/api.go:416` | -| `GET` | `/api/knowledge/vaults/{name}/facts` | Dashboard auth/session | Vault Facts | `pkg/dashboard/api.go:417` | +| `GET` | `/api/knowledge` | Dashboard auth/session | Paginated knowledge facts: `type` filter, `limit` (default 50, max 200; invalid/non-positive values use the default), `offset` (default 0). Returns `enabled`, `facts`, `count` (this page), `total`, `limit`, `offset`, `has_more`; ordered by layer then slug. Offsets are not snapshot cursors: concurrent edits may shift pages. | `pkg/dashboard/api.go:379` | +| `GET` | `/api/knowledge/export` | Dashboard auth/session | Knowledge Export | `pkg/dashboard/api.go:380` | +| `POST` | `/mcp/knowledge` | Public (read-only) when the dashboard setting or `HIVE_PUBLIC_KNOWLEDGE` is on; otherwise 404 to a signed-in caller and 401 to one who is not | Public Knowledge MCP endpoint — `initialize`, `tools/list`, `tools/call` for `knowledge_search`/`knowledge_toc`/`knowledge_get`/`knowledge_export` ([docs](../public-knowledge-mcp.md)) | `pkg/dashboard/api.go:389` | +| `GET` | `/api/knowledge/search` | Dashboard auth/session | Knowledge Search | `pkg/dashboard/api.go:381` | +| `GET` | `/api/knowledge/toc` | Dashboard auth/session | Scoped knowledge table of contents: capped, body-free entries (`id`, `title`, `type`, `layer`, `repo`, `tags`, `status`, `confidence`, `updated`, `size_bytes`, `source`) plus `total`/`returned`/`truncated`. Query: `layers`, `repos`, `types`, `tags` (comma-separated), `limit` (default 50, max 200), `include_states` (operator opt-in for `draft`/`deprecated`/`superseded`/`all`), `format=prompt` with `max_chars` for a bounded markdown rendering, `agent` to apply that agent's `knowledge.agent_scopes` entry (the other parameters can only narrow it). Approved knowledge only by default ([docs](../knowledge-toc.md)) | `pkg/dashboard/api.go:382` | +| `GET` | `/api/knowledge/effective` | Dashboard auth/session | Effective knowledge for one agent (`agent` required): the agent's `knowledge.agent_scopes` entry (unrestricted when it has none) intersected with the request scope (approved only unless `include_states` is set). Returns `scope` (resolved scope applied, with `configured`), `included` TOC entries, `excluded` entries each with a `reason` (`lifecycle`, `layer`, `repo`, `type` or `tag` — first failing check, in that order), `included_total`/`excluded_total`/`included_returned`/`excluded_returned` and `truncated`; `limit` caps each list (default 50, max 200) ([docs](../knowledge-toc.md#effective-knowledge)) | `pkg/dashboard/api.go:383` | +| `GET` | `/api/knowledge/entry/{id}` | Dashboard auth/session | Full read of one knowledge entry: `markdown` (front-matter plus body) and the fact. Takes the same scope, `include_states` and `agent` query as the table of contents and returns 404 for an entry outside it ([docs](../knowledge-toc.md)) | `pkg/dashboard/api.go:384` | +| `POST` | `/api/knowledge/cli-memory/drain-legacy` | Owner only | One-shot drain of the shared home's legacy Claude memory (`/data/home/.claude/projects/*/memory`) into `state: draft` entries in `bead-synth-wiki`, tagged `cli-memory` and `agent:shared`, deduplicated by content hash. Body `{"truncate": bool}` (default false) empties only files whose every fact is now stored. Returns `store`, `agent`, `sources`, `drained`, `dupes`, `skipped`, `truncate`, `truncated`, `kept`, `errors`; 409 when the vault is not connected. Audited as `knowledge_drain_legacy_memory` ([docs](../knowledge-lifecycle.md#auto-memory-drafts)) | `pkg/dashboard/api.go:386` | +| `GET` | `/api/knowledge/public` | Dashboard auth/session | Public Knowledge MCP sharing status (`enabled`, `tags`, `source`, endpoint URL) | `pkg/dashboard/api.go:390` | +| `PUT` | `/api/knowledge/public` | Owner only | Persist public Knowledge MCP sharing setting; overrides env vars until changed | `pkg/dashboard/api.go:391` | +| `GET` | `/api/knowledge/health` | Dashboard auth/session | Knowledge Health | `pkg/dashboard/api.go:392` | +| `GET` | `/api/knowledge/stats` | Dashboard auth/session | Knowledge Stats | `pkg/dashboard/api.go:393` | +| `GET` | `/api/knowledge/graph` | Dashboard auth/session | Knowledge Graph | `pkg/dashboard/api.go:394` | +| `GET` | `/api/knowledge/fact-history` | Dashboard auth/session | Fact History | `pkg/dashboard/api.go:395` | +| `POST` | `/api/knowledge/create` | Dashboard auth/session | Create one fact (`title`, `body`, `type`, `tags`, `layer`, `confidence`, `state`). `state` is `approved` (default) or `draft`; a draft is written with `state: draft` into the local channel named by `layer` (400 when there is none, 409 when its title already names an entry). A request tagged `cli-memory` must be a draft carrying only `cli-memory`, `agent:`, `cli:`, `memhash:` and `repo:/` tags (400 otherwise) | `pkg/dashboard/api.go:396` | +| `POST` | `/api/knowledge/import` | Dashboard auth/session | Knowledge Import | `pkg/dashboard/api.go:397` | +| `POST` | `/api/knowledge/promote` | Dashboard auth/session | Knowledge Promote | `pkg/dashboard/api.go:403` | +| `GET` | `/api/knowledge/subscriptions` | Dashboard auth/session | Knowledge Subs List | `pkg/dashboard/api.go:404` | +| `POST` | `/api/knowledge/subscriptions` | Dashboard auth/session | Knowledge Subs Add | `pkg/dashboard/api.go:405` | +| `DELETE` | `/api/knowledge/subscriptions` | Dashboard auth/session | Knowledge Subs Remove | `pkg/dashboard/api.go:406` | +| `PUT` | `/api/knowledge/{layer}/{slug}` | Dashboard auth/session | Knowledge Update | `pkg/dashboard/api.go:407` | +| `DELETE` | `/api/knowledge/{layer}/{slug}` | Dashboard auth/session | Knowledge Delete | `pkg/dashboard/api.go:408` | +| `GET` | `/api/knowledge/{layer}` | Dashboard auth/session | Knowledge Layer | `pkg/dashboard/api.go:409` | +| `GET` | `/api/knowledge/{layer}/{slug}` | Dashboard auth/session | Knowledge Fact | `pkg/dashboard/api.go:410` | +| `PUT` | `/api/knowledge/enabled` | Owner only | Knowledge Toggle | `pkg/dashboard/api.go:411` | +| `GET` | `/api/knowledge/bead-synthesizer` | Dashboard auth/session | Bead Synth Status | `pkg/dashboard/api.go:412` | +| `PUT` | `/api/knowledge/bead-synthesizer/enabled` | Owner only | Bead Synth Toggle | `pkg/dashboard/api.go:413` | +| `GET` | `/api/knowledge/vaults` | Dashboard auth/session | Vaults List | `pkg/dashboard/api.go:414` | +| `POST` | `/api/knowledge/vaults` | Owner only | Vaults Connect | `pkg/dashboard/api.go:415` | +| `DELETE` | `/api/knowledge/vaults` | Dashboard auth/session | Vaults Disconnect | `pkg/dashboard/api.go:416` | +| `POST` | `/api/knowledge/vaults/reindex` | Dashboard auth/session | Vaults Reindex | `pkg/dashboard/api.go:417` | +| `GET` | `/api/knowledge/vaults/{name}/facts` | Dashboard auth/session | Vault Facts | `pkg/dashboard/api.go:418` | | `GET` | `/api/config/knowledge/connectors` | Dashboard auth/session | Knowledge connectors config (name, type, layer, scope, env/file auth reference) and registered types | `pkg/dashboard/api.go` | | `PUT` | `/api/config/knowledge/connectors` | Owner only | Replace `knowledge.connectors` after validation; inline secrets rejected | `pkg/dashboard/api.go` | | `GET` | `/api/config/knowledge/connectors/status` | Dashboard auth/session | Per-connector status pill, last sync, pages/facts, last error, plus the `publish` mirror status | `pkg/dashboard/api.go` | @@ -46,19 +46,19 @@ Part of the [Dashboard REST API reference](../api-reference.md); see that page f | `PUT` | `/api/config/knowledge/agent-scopes` | Owner only | Replace `knowledge.agent_scopes` after validating layer and state names; persisted and audited as `config_knowledge_agent_scopes` | `pkg/dashboard/api.go` | | `GET` | `/api/config/knowledge/pipeline` | Owner only | Scalar bead synthesizer, curator, code map and primer settings, plus the read-only engine, vault paths and primer merge strategy ([docs](../settings.md#knowledge)) | `pkg/dashboard/api.go` | | `PUT` | `/api/config/knowledge/pipeline` | Owner only | Update those settings after `config.ValidateKnowledgePipeline`; 0 or empty restores the default; the bead synthesizer switch applies at once, the rest after a restart; audited as `config_knowledge_pipeline` | `pkg/dashboard/api.go` | -| `GET` | `/api/knowledge/git-sources` | Dashboard auth/session | Git Sources List | `pkg/dashboard/api.go:427` | -| `POST` | `/api/knowledge/git-sources` | Owner only | Git Sources Connect | `pkg/dashboard/api.go:428` | -| `DELETE` | `/api/knowledge/git-sources` | Owner only | Git Sources Disconnect | `pkg/dashboard/api.go:429` | -| `POST` | `/api/knowledge/obsidian/sync` | Dashboard auth/session | Obsidian Sync | `pkg/dashboard/api.go:430` | -| `GET` | `/api/knowledge/documents` | Dashboard auth/session | Documents List | `pkg/dashboard/api.go:431` | -| `POST` | `/api/knowledge/documents` | Dashboard auth/session | Documents Import | `pkg/dashboard/api.go:432` | -| `GET` | `/api/knowledge/documents/{slug}` | Dashboard auth/session | Document Get | `pkg/dashboard/api.go:433` | -| `DELETE` | `/api/knowledge/documents/{slug}` | Dashboard auth/session | Document Delete | `pkg/dashboard/api.go:434` | -| `POST` | `/api/knowledge/documents/{slug}/reimport` | Dashboard auth/session | Document Reimport | `pkg/dashboard/api.go:435` | -| `GET` | `/api/knowledge/context7/search` | Dashboard auth/session | Context7 Search | `pkg/dashboard/api.go:436` | -| `POST` | `/api/knowledge/cleanup-orphans` | Dashboard auth/session | Cleanup Orphans | `pkg/dashboard/api.go:437` | -| `GET` | `/api/knowledge/channels` | Dashboard auth/session | Knowledge Channels List | `pkg/dashboard/api.go:400` | -| `POST` | `/api/knowledge/channels` | Dashboard auth/session | Knowledge Channel Create | `pkg/dashboard/api.go:401` | +| `GET` | `/api/knowledge/git-sources` | Dashboard auth/session | Git Sources List | `pkg/dashboard/api.go:428` | +| `POST` | `/api/knowledge/git-sources` | Owner only | Git Sources Connect | `pkg/dashboard/api.go:429` | +| `DELETE` | `/api/knowledge/git-sources` | Owner only | Git Sources Disconnect | `pkg/dashboard/api.go:430` | +| `POST` | `/api/knowledge/obsidian/sync` | Dashboard auth/session | Obsidian Sync | `pkg/dashboard/api.go:431` | +| `GET` | `/api/knowledge/documents` | Dashboard auth/session | Documents List | `pkg/dashboard/api.go:432` | +| `POST` | `/api/knowledge/documents` | Dashboard auth/session | Documents Import | `pkg/dashboard/api.go:433` | +| `GET` | `/api/knowledge/documents/{slug}` | Dashboard auth/session | Document Get | `pkg/dashboard/api.go:434` | +| `DELETE` | `/api/knowledge/documents/{slug}` | Dashboard auth/session | Document Delete | `pkg/dashboard/api.go:435` | +| `POST` | `/api/knowledge/documents/{slug}/reimport` | Dashboard auth/session | Document Reimport | `pkg/dashboard/api.go:436` | +| `GET` | `/api/knowledge/context7/search` | Dashboard auth/session | Context7 Search | `pkg/dashboard/api.go:437` | +| `POST` | `/api/knowledge/cleanup-orphans` | Dashboard auth/session | Cleanup Orphans | `pkg/dashboard/api.go:438` | +| `GET` | `/api/knowledge/channels` | Dashboard auth/session | Knowledge Channels List | `pkg/dashboard/api.go:401` | +| `POST` | `/api/knowledge/channels` | Dashboard auth/session | Knowledge Channel Create | `pkg/dashboard/api.go:402` | | `GET` | `/api/knowledge/connectors` | Dashboard auth/session | Knowledge connector statuses and publish mirror status (`{"connectors": [...], "publish": {...}\|null}`, see [knowledge-connectors.md](../knowledge-connectors.md)) | `pkg/dashboard/api_knowledge_connectors.go:23` | | `POST` | `/api/knowledge/connectors/{name}/sync` | Owner only | Start one connector sync now (202; 404 unknown, 409 running) | `pkg/dashboard/api_knowledge_connectors.go:24` | | `POST` | `/api/knowledge/publish/sync` | Owner only | Run a publish mirror batch now (202 with publish status; 503 mirror not running, 409 batch in progress) | `pkg/dashboard/api_knowledge_connectors.go:25` | diff --git a/src/docs/api-reference/nous.md b/src/docs/api-reference/nous.md index 70dc9a23f0..c0249cf03f 100644 --- a/src/docs/api-reference/nous.md +++ b/src/docs/api-reference/nous.md @@ -5,28 +5,28 @@ Part of the [Dashboard REST API reference](../api-reference.md); see that page f | Method | Path | Auth | Purpose | Source | |---|---|---|---|---| -| `GET` | `/api/nous/status` | Dashboard auth/session | Nous Status — includes `experimentLoop` (`dir`, `lastWriteAt`, `running`, `idleAfterSeconds`): whether the external experiment loop, the only producer of proposals, has written under `/var/run/nous/governor` within 24 evaluation cycles; ready cards then carry `experimentLoopIdle` ([#12541](https://github.com/hivecommons/hive/issues/12541)) | `pkg/dashboard/api.go:471` | -| `GET` | `/api/nous/ledger` | Dashboard auth/session | Nous Ledger | `pkg/dashboard/api.go:472` | -| `GET` | `/api/nous/principles` | Dashboard auth/session | Nous Principles | `pkg/dashboard/api.go:473` | -| `POST` | `/api/nous/approve` | Owner only | Nous Approve | `pkg/dashboard/api.go:474` | -| `POST` | `/api/nous/abort` | Owner only | Nous Abort | `pkg/dashboard/api.go:475` | -| `PUT` | `/api/nous/mode` | Owner only | Nous Mode | `pkg/dashboard/api.go:476` | -| `PUT` | `/api/nous/scope` | Owner only | Nous Scope | `pkg/dashboard/api.go:477` | -| `GET` | `/api/nous/phase` | Dashboard auth/session | Nous Phase | `pkg/dashboard/api.go:478` | -| `PUT` | `/api/nous/gate-decision` | Owner only | Nous Gate Decision | `pkg/dashboard/api.go:479` | -| `GET` | `/api/nous/gate-pending` | Dashboard auth/session | Nous Gate Pending | `pkg/dashboard/api.go:480` | -| `POST` | `/api/nous/gate-respond` | Owner only | Nous Gate Respond | `pkg/dashboard/api.go:481` | -| `GET` | `/api/nous/gate-response` | Dashboard auth/session | Nous Gate Response | `pkg/dashboard/api.go:482` | -| `GET` | `/api/nous/config` | Dashboard auth/session | Nous Config Get | `pkg/dashboard/api.go:483` | -| `PUT` | `/api/nous/config/goals` | Owner only | Nous Config Goals — legacy; the dashboard no longer exposes the research question in the ⚙ dialog, use `PATCH /api/nous/campaigns/{id}` | `pkg/dashboard/api.go:484` | -| `PUT` | `/api/nous/config/repos` | Owner only | Nous Config Repos — the allow-list of repos experiments may target (empty = any) | `pkg/dashboard/api.go:485` | -| `PUT` | `/api/nous/config/output` | Owner only | Nous Config Output | `pkg/dashboard/api.go:486` | -| `PUT` | `/api/nous/config/fast-fail` | Owner only | Nous Config Fast Fail | `pkg/dashboard/api.go:487` | -| `PUT` | `/api/nous/config/schedule` | Owner only | Nous Config Schedule | `pkg/dashboard/api.go:488` | -| `PUT` | `/api/nous/config/controllables` | Owner only | Nous Config Controllables | `pkg/dashboard/api.go:489` | -| `PUT` | `/api/nous/config/principles` | Owner only | Nous Config Principles | `pkg/dashboard/api.go:490` | -| `DELETE` | `/api/nous/principles/{id}` | Owner only | Nous Delete Principle | `pkg/dashboard/api.go:491` | -| `POST` | `/api/nous/campaign/start` | Owner only | Nous Campaign Start — archives the active campaign and starts a new experiment whose baseline restarts at 0 ([#12501](https://github.com/hivecommons/hive/issues/12501)) | `pkg/dashboard/api.go:492` | -| `GET` | `/api/nous/campaigns` | Any | Nous Campaigns List — every experiment with its per-campaign baseline, scope, results and stage ([#12532](https://github.com/hivecommons/hive/issues/12532)) | `pkg/dashboard/api.go:493` | -| `POST` | `/api/nous/campaigns` | Owner only | Nous Campaigns Create — starts an experiment alongside the running ones; 409 `scope_conflict` when a running experiment shares a repo target or both are hive-wide ([#12532](https://github.com/hivecommons/hive/issues/12532)) | `pkg/dashboard/api.go:494` | -| `PATCH` | `/api/nous/campaigns/{id}` | Owner only | Nous Campaign Patch — pause / resume / archive, or edit question, hypothesis and scope. Hypothesis/tag edits save in place (`status: "updated"`); a changed question or repo set needs `restart: true` (else 409 `restart_required`) and archives the campaign as version N while creating version N+1 with `restartedFrom` (`status: "restarted", campaign, archived`); resume, scope widening and restarts re-run the conflict guard ([#12532](https://github.com/hivecommons/hive/issues/12532)) | `pkg/dashboard/api.go:495` | +| `GET` | `/api/nous/status` | Dashboard auth/session | Nous Status — includes `experimentLoop` (`dir`, `lastWriteAt`, `running`, `idleAfterSeconds`): whether the external experiment loop, the only producer of proposals, has written under `/var/run/nous/governor` within 24 evaluation cycles; ready cards then carry `experimentLoopIdle` ([#12541](https://github.com/hivecommons/hive/issues/12541)) | `pkg/dashboard/api.go:472` | +| `GET` | `/api/nous/ledger` | Dashboard auth/session | Nous Ledger | `pkg/dashboard/api.go:473` | +| `GET` | `/api/nous/principles` | Dashboard auth/session | Nous Principles | `pkg/dashboard/api.go:474` | +| `POST` | `/api/nous/approve` | Owner only | Nous Approve | `pkg/dashboard/api.go:475` | +| `POST` | `/api/nous/abort` | Owner only | Nous Abort | `pkg/dashboard/api.go:476` | +| `PUT` | `/api/nous/mode` | Owner only | Nous Mode | `pkg/dashboard/api.go:477` | +| `PUT` | `/api/nous/scope` | Owner only | Nous Scope | `pkg/dashboard/api.go:478` | +| `GET` | `/api/nous/phase` | Dashboard auth/session | Nous Phase | `pkg/dashboard/api.go:479` | +| `PUT` | `/api/nous/gate-decision` | Owner only | Nous Gate Decision | `pkg/dashboard/api.go:480` | +| `GET` | `/api/nous/gate-pending` | Dashboard auth/session | Nous Gate Pending | `pkg/dashboard/api.go:481` | +| `POST` | `/api/nous/gate-respond` | Owner only | Nous Gate Respond | `pkg/dashboard/api.go:482` | +| `GET` | `/api/nous/gate-response` | Dashboard auth/session | Nous Gate Response | `pkg/dashboard/api.go:483` | +| `GET` | `/api/nous/config` | Dashboard auth/session | Nous Config Get | `pkg/dashboard/api.go:484` | +| `PUT` | `/api/nous/config/goals` | Owner only | Nous Config Goals — legacy; the dashboard no longer exposes the research question in the ⚙ dialog, use `PATCH /api/nous/campaigns/{id}` | `pkg/dashboard/api.go:485` | +| `PUT` | `/api/nous/config/repos` | Owner only | Nous Config Repos — the allow-list of repos experiments may target (empty = any) | `pkg/dashboard/api.go:486` | +| `PUT` | `/api/nous/config/output` | Owner only | Nous Config Output | `pkg/dashboard/api.go:487` | +| `PUT` | `/api/nous/config/fast-fail` | Owner only | Nous Config Fast Fail | `pkg/dashboard/api.go:488` | +| `PUT` | `/api/nous/config/schedule` | Owner only | Nous Config Schedule | `pkg/dashboard/api.go:489` | +| `PUT` | `/api/nous/config/controllables` | Owner only | Nous Config Controllables | `pkg/dashboard/api.go:490` | +| `PUT` | `/api/nous/config/principles` | Owner only | Nous Config Principles | `pkg/dashboard/api.go:491` | +| `DELETE` | `/api/nous/principles/{id}` | Owner only | Nous Delete Principle | `pkg/dashboard/api.go:492` | +| `POST` | `/api/nous/campaign/start` | Owner only | Nous Campaign Start — archives the active campaign and starts a new experiment whose baseline restarts at 0 ([#12501](https://github.com/hivecommons/hive/issues/12501)) | `pkg/dashboard/api.go:493` | +| `GET` | `/api/nous/campaigns` | Any | Nous Campaigns List — every experiment with its per-campaign baseline, scope, results and stage ([#12532](https://github.com/hivecommons/hive/issues/12532)) | `pkg/dashboard/api.go:494` | +| `POST` | `/api/nous/campaigns` | Owner only | Nous Campaigns Create — starts an experiment alongside the running ones; 409 `scope_conflict` when a running experiment shares a repo target or both are hive-wide ([#12532](https://github.com/hivecommons/hive/issues/12532)) | `pkg/dashboard/api.go:495` | +| `PATCH` | `/api/nous/campaigns/{id}` | Owner only | Nous Campaign Patch — pause / resume / archive, or edit question, hypothesis and scope. Hypothesis/tag edits save in place (`status: "updated"`); a changed question or repo set needs `restart: true` (else 409 `restart_required`) and archives the campaign as version N while creating version N+1 with `restartedFrom` (`status: "restarted", campaign, archived`); resume, scope widening and restarts re-run the conflict guard ([#12532](https://github.com/hivecommons/hive/issues/12532)) | `pkg/dashboard/api.go:496` | diff --git a/src/docs/api-reference/packs-and-acmm.md b/src/docs/api-reference/packs-and-acmm.md index 5040dbb1c3..8ecae2c22b 100644 --- a/src/docs/api-reference/packs-and-acmm.md +++ b/src/docs/api-reference/packs-and-acmm.md @@ -18,15 +18,16 @@ Part of the [Dashboard REST API reference](../api-reference.md); see that page f | `GET` | `/api/repos/{owner}/{repo}/items/{number}` | Dashboard session | Per-item detail for the activity monitor's decision badge: `{repo, number, stage, stage_slug, operator_actions[], operator_action_count, last_operator_action}`. `operator_actions[]` is the server-side ledger of every row action submitted from the dashboard (hold/release, decision, decide-delegated, send-to-human, accept-triage — recorded by `recordOperatorAction` around those routes) as `{action, actor, at, note, target, outcome: pending|applied|no-op|failed, detail, head_sha, stage}`; `last_operator_action` adds the derived `state` (`waiting|addressed|stuck|pending|failed`), `stuck_after_seconds` and `followed[]` (the stage hops after the action). The same `last_operator_action` / `operator_action_count` ride every stage-tracker row and linked PR. Persisted in `/data/operator-actions.json`; `HIVE_OPERATOR_ACTION_STUCK_AFTER` (default `30m`) sets the stuck window. Rows also carry `rebase_merge: {state: approved|rebasing|ci-pending|merged|failed, actor, base, text, fail_reason, conflict_files[], armed_at}` while a *Rebase, then merge as maintainer* follow-through is live or just settled (persisted in `/data/rebase-merge-followups.json`; `fail_reason: foreign-head` when the head moved after the approval by someone other than the hive, so nothing merged), and `rebase: {attempt, max, exhausted, head, text}` on a conflicting PR the fixer is rebasing under the two-attempt loop guard (`/data/rebase-attempts.json`). | `pkg/dashboard/api.go`, `pkg/dashboard/operator_actions.go` | | `POST` | `/api/repos/{owner}/{repo}/items/{number}/hold` | Owner or repo write/maintain/admin | Add or remove a dashboard hold chip for an issue or PR. Body `{"held": true}` adds the hive's exact-match canonical `hive-pause/` label (shortened with a hash suffix when the plain spelling would exceed GitHub's 50-character label cap, [#17037](https://github.com/hivecommons/hive/issues/17037)); `{"held": false}` removes exactly the labels causing the hold (`hive-pause/` and/or generic hold labels) and never removes `hive/` provenance. A GitHub failure answers `424` with the step and GitHub's reason — never `502`/`503`, which the hosted Ingress replaces with its generic "hive unavailable" page. Every toggle writes an audit-log entry; the #8851 upgrade migration writes `/data/hive-hold-migration-.json` with audit-backed, provenance-only, and ambiguous legacy `hive/` classifications. | `pkg/dashboard/api.go:345`, `pkg/dashboard/api_repo_hold.go` | | `POST` | `/api/repos/{owner}/{repo}/items/{number}/decision` | Owner or repo write/maintain/admin, signed-in GitHub user | Record an operator decision from the activity monitor's row menu / selection bar. Body `{"decision": "approve"|"direction"|"close-superseded"|"close-wontfix"|"close-read"|"close-issue"|"adopt"|"reroute"|"re-author"|"merge-now"|"queue-merge", "comment": "…", "type": "issue"|"pr", "superseded_by": "#458", "force": true, "to": ""|"any"}` (`force` only with `adopt`, `to` only with `reroute`; an unknown `decision` is a 400). On an issue parked at 045, `approve`/`direction` act exactly as a maintainer's `/hive approve` / `/hive decision ` comment would (labels, `approved-direction`, stage-engine Unparked fact, reply comment naming the operator). On a PR parked at 085 (`type: "pr"`), `approve` posts the `/lgtm` and `/approve` commands as two comments attributed to the operator, records the approval against the head as the human answer to a `requires_human` / decision-requested verdict (the lanes and the stage engine honour it like a trusted merger's Approve review), lifts `needs-human`, clears the sentinel label and acknowledges the bundle's sentinel findings for that head, re-derives the stage and drops the tracker cache — the response adds `released` (`approval-recorded`, `needs-human`, `sentinel-label`, `sentinel-acknowledged`) and `stage`; the merge gate decides from there (no review as the operator, no merge) — and `direction` records the text as a human change request against the head — the `/hive decision` fix lane — on a hive-authored PR, and on a contributor's clanker PR (`author/clanker` / hive attribution markers) where the text is posted to the contributor's hive and the PR moves to `stage/072-returned-to-contributor` (`status: "direction-returned-to-contributor"`); a person's PR, which no hive can carry direction to, answers 409. The close variants first post a required comment naming the operator (and the superseding PR when `superseded_by` is given); a failed comment prevents closure. `close-superseded` and `close-wontfix` close as **not planned**; `close-read` acknowledges an advisory issue and closes it **as completed**. `close-issue` (`type: "issue"` only) closes the single named open issue **as completed**, at any stage, leaving linked PRs and other issues untouched; it returns 400 for a PR (including one sent as an issue), 404 when the issue is not found, and 409 when already closed. It retains the existing permission and mutation gates, including the paused-repo `status: "refused"` result without writes. `adopt` and `re-author` require `type: "pr"` and queue adoption via the `adoption/supersede` label (409 unless `governor.labels.stage.adoption` is enabled). `adopt` with `"force": true` is *Adopt now* ([#15038](https://github.com/hivecommons/hive/issues/15038)): it bypasses the author's presence, the grace window and `maintainer_policy`, marks the stage record and nudges the automerge sweep so the adoption engine supersedes the head at once (responds `status: "already-adopted"` when nothing is left to do; 400 on the hive's own PR). `reroute` (`type: "pr"`, `"to": ""|"any"`) hands the PR's follow-up work to another online clanker through the contributor fix queue, posts a `` note and arms a pickup timer that falls back to Adopt now after `governor.reroute.pickup_timeout`; answers `status: "rerouted"`, 409 when no clanker is online or adoption is disabled. On a PR at 090, `queue-merge` (*Approve and let hive merge*, the lead action) records an approval attributed to the operator and applies the automerge label, returning `status: "queued-for-merge"` (on the hive's own PR, which the App cannot review, the queue note is a comment and the operator's approval is recorded as `approve` records it — `released` lists `approval-recorded`, `admitted`); hive's merge sweep merges on its next tick once CI is green and the head has soaked, and that recorded operator approval is the one thing that lets the sweep merge an untrusted-author PR (the merge comment names the operator). `merge-now` (*Merge now as maintainer*, secondary) posts an attributed comment and merges immediately through the hive's GitHub App, returning `status: "merged"`. Both require `type: "pr"` and a verified owner or `merger` role in addition to the route's repo permission check; both refuse closed/merged PRs and the operator's own PR. `merge-now` on a PR whose `mergeable_state` is `dirty`/`behind` instead answers `202` with `status: "rebase-queued"` (approval recorded, rebase kicked, merge follows via the follow-through once the hive's own rebase is green; a head pushed by anyone else fails the follow-through closed; `head-not-pushable` refusal on a fork without maintainer edits). `approve` on such a PR adds `rebase: {attempt, max, exhausted, head, text}` for the rebase episode it opened. Every decision writes an audit-log entry (`repo_item_decision_*`, e.g. `repo_item_decision_adopt_now`, `repo_item_decision_reroute`). | `pkg/dashboard/api.go:346`, `pkg/dashboard/api_repo_item_decision.go` | -| `GET` | `/api/notes` | Signed-in GitHub user (or verified owner) | Maintainer notes — the private per-item notes maintainers leave each other on Activity Monitor rows ([#maintainer-notes](../operator-reference.md#maintainer-notes)). `?repo=owner/name&number=N` lists one item's live notes oldest first; with no query, every live note in the hive (the SPA's count badges). `{notes: [{id, repo, number, author, text, created_at}]}`. Never read from or written to GitHub. | `pkg/dashboard/api.go:349`, `pkg/dashboard/api_maintainer_notes.go` | -| `POST` | `/api/notes` | Owner or repo write/maintain/admin, signed-in GitHub user | Append a maintainer note. Body `{repo, number, text}` — `text` is plain text up to 2000 characters; the author is the dashboard session's GitHub login, never a body field. `401` signed out, `403` without write on the repo, `400` for an empty/oversized note or a bad item. `201 {ok, note}`; appended to `/data/maintainer-notes.jsonl`, audited as `maintainer_note_add`, and broadcast as the `maintainer-notes` SSE event `{seq, repo, number, count, action}` so other maintainers' browsers refresh the row. | `pkg/dashboard/api.go:350`, `pkg/dashboard/api_maintainer_notes.go` | -| `DELETE` | `/api/notes/{id}` | The note's author, or a verified owner | Tombstone a maintainer note (append-only store: a `deleted_at` record, never a rewrite). `404` unknown or already deleted, `403` for anyone else. `{ok, note}`; audited as `maintainer_note_delete`, broadcast as `maintainer-notes`. | `pkg/dashboard/api.go:351`, `pkg/dashboard/api_maintainer_notes.go` | +| `GET` | `/api/notes` | Signed-in GitHub user (or verified owner) | Maintainer notes — the private per-item notes maintainers leave each other on Activity Monitor rows ([#maintainer-notes](../operator-reference.md#maintainer-notes)). `?repo=owner/name&number=N` lists one item's live notes oldest first; with no query, every live note in the hive (the SPA's count badges). `{notes: [{id, repo, number, author, text, created_at}]}`. Never read from or written to GitHub. | `pkg/dashboard/api.go:350`, `pkg/dashboard/api_maintainer_notes.go` | +| `POST` | `/api/notes` | Owner or repo write/maintain/admin, signed-in GitHub user | Append a maintainer note. Body `{repo, number, text}` — `text` is plain text up to 2000 characters; the author is the dashboard session's GitHub login, never a body field. `401` signed out, `403` without write on the repo, `400` for an empty/oversized note or a bad item. `201 {ok, note}`; appended to `/data/maintainer-notes.jsonl`, audited as `maintainer_note_add`, and broadcast as the `maintainer-notes` SSE event `{seq, repo, number, count, action}` so other maintainers' browsers refresh the row. | `pkg/dashboard/api.go:351`, `pkg/dashboard/api_maintainer_notes.go` | +| `DELETE` | `/api/notes/{id}` | The note's author, or a verified owner | Tombstone a maintainer note (append-only store: a `deleted_at` record, never a rewrite). `404` unknown or already deleted, `403` for anyone else. `{ok, note}`; audited as `maintainer_note_delete`, broadcast as `maintainer-notes`. | `pkg/dashboard/api.go:352`, `pkg/dashboard/api_maintainer_notes.go` | | `POST` / `GET` | `/api/repos/{owner}/{repo}/items/{number}/decide-delegated` | Same as `…/hold` (owner or repo write), signed-in GitHub user; `decisions.delegate.enabled` (403 when off) | *Let hive decide*: enqueue a delegated-decision job in which the hive decides the parked item itself as the owner's delegate under `pkg/delegatedecision.PolicyText` and records it as a human decision (`/hive decision` comment with the `` marker, park labels off, `triage/accepted`, queue approval on a PR head). Body `{"type": "issue"|"pr", "reason", "caption", "sentinel_reason"}`. `POST` answers 202 with the job (`{id, status: "running"|"done"|"failed", decision: {verdict, rule, text, rationale, actions, keeps_park, ladder?: {decision, reason, ruled_out[]}}, notes, error}`; `ladder` is set on contributor-PR decisions and names the rung that decided — `already-fixed` → `mergeable-as-is` → `rebase-then-merge` → `return-to-contributor` → `contributor-offline` — and why each rung above it did not apply); 409 with the running job while one is in flight; `GET` reads it. Rails: never merges, refuses items wearing `hold`, never grants secrets/permissions (`needs-owner` + `hold` instead), recommends only on hive policy/governance questions (keeps 085). Audited as `repo_item_decision_delegated[_failed]`. See [dashboard-sections.md](../dashboard-sections.md#let-hive-decide). | `pkg/dashboard/api.go:329`, `pkg/dashboard/api_repo_item_decide_delegated.go` | -| `POST` | `/api/repos/{owner}/{repo}/items/{number}/decide-delegated/plan` | Same as `…/decide-delegated` | Preview for *Let hive decide*: runs the same owner-delegate policy with **no side effects** (nothing written, no job) and answers `{would, rule, acting, title, summary, why, consequences[], ladder, mergeable_as_is, alternatives[], writes: false, prior, notes}` — `summary` is one verb-first sentence with no "Hive would:" prefix (*Send #15332 back to its author with one instruction: make CI green, nothing else.*), `why` one short line (*CI is red.*), `consequences` at most two items, `ladder` the rung that decided with its `ruled_out` list, and `mergeable_as_is` whether an as-is merge is honest (the queue-merge and merge-now alternatives are dropped when it is not). The dialog shows **Cancel** / **Let hive do that**, plus **Approve and let hive merge** (or **Merge now as maintainer** when the hive would approve anyway) only when `mergeable_as_is`; only then does the SPA post `…/decide-delegated` with `chosen` naming the button. A transient GitHub failure (5xx, rate limit, timeout) is retried twice with backoff before the plan gives up. A failure answers `{ok: false, error, reason, retryable, attempts, elapsed_ms, hive, hint}` under **409** when the item is no longer open (`reason: not-open`) or **424** when a read it depends on failed (`github`), is not configured (`config`) or the plan itself failed (`plan`) — never 502/503, which the hosted Ingress intercepts and replaces with its generic *hive unavailable* page (hivecommons/hive#16776). See [dashboard-sections.md](../dashboard-sections.md#let-hive-decide). | `pkg/dashboard/api.go:354`, `pkg/dashboard/api_repo_item_decide_delegated_plan.go` | -| `POST` | `/api/repos/{owner}/{repo}/items/{number}/blocker/recheck` | Same as `…/hold` (owner or repo write), signed-in GitHub user | *Re-check permissions* on an issue parked on a capability blocker (#15099): probes the GitHub App installation's permissions; when the missing permission is granted, clears every ledger entry blocked on it and un-parks the item (`{result: {outcome: "released", …}}`), otherwise `{result: {outcome: "no-effect", reason: "blocker", options: [...]}}`; 404 when the item has no blocker, 409 when the blocker is not a capability gap | `pkg/dashboard/api.go:355` | -| `POST` | `/api/repos/{owner}/{repo}/items/{number}/blocker/close-partial` | Same as `…/hold` (owner or repo write), signed-in GitHub user | Option (c) on a capability blocker (#15099): labels the issue `hive/partially-addressed`, posts the operator's `{"comment"}` naming what remains and closes it; the ledger entry is cleared | `pkg/dashboard/api.go:356` | -| `POST` | `/api/repos/{owner}/{repo}/items/{number}/accept-triage` | Owner or repo write/maintain/admin | Accept triage on an issue from the activity monitor's row menu — what a maintainer accepting triage on GitHub does by hand: adds the reporter-trust triage label (`triage/accepted`, or the first of `issue_filter.reporter_trust.untrusted_require_labels`; the label is created in the repo if missing) and removes the awaiting label (`needs-triage` / `reporter_trust.awaiting_label`) and a Hive-written `stage/015-triage-needed`. Empty body. Returns `{ok, repo, number, acceptLabel, added, removed, alreadyAccepted, minStatusSeq}`; an issue already carrying the accept label with nothing left to remove is a no-op (`alreadyAccepted: true`, no write, no audit). 404 for a pull request or an unknown item. The status snapshot's labels are patched so the next reconcile reads 010 Actionable before the engine's own 015 → 010 derivation. Every write is audited as `repo_item_accept_triage` under the dashboard user. | `pkg/dashboard/api.go:552`, `pkg/dashboard/api_repo_item_accept_triage.go` | -| `GET` | `/api/acmm/evaluation` | Dashboard auth/session | ACMMEvaluation — combined codebase + operational result, cached server-side for 1 hour (`acmmEvalTTL`). `?refresh=1` (the dashboard's "🔄 Re-evaluate" button, #5877) bypasses the hourly TTL but is debounced server-side: requests within 1 minute of the last evaluation (`acmmRefreshDebounce`) still serve the cache, since a full refresh costs up to ~29 GitHub GetContents calls per repo. The response's `last_evaluated_at` timestamp reports when the cached evaluation was computed | `pkg/dashboard/api.go:358`, `pkg/dashboard/api_acmm_eval.go` | -| `POST` | `/api/acmm/issue` | Owner only | ACMMCreate Issue — files on GitHub or, with `governor.acmm.issue_tracker: work_source` / body `tracker: "work_source"` on a Linear-sourced hive, on Linear; response `tracker` says which. See [ACMM policy matrix](../acmm-policy-matrix.md#where-acmm-gap-issues-are-filed) | `pkg/dashboard/api.go:359` | -| `GET` | `/api/acmm-recommendation` | Dashboard auth/session | Advisory level-up recommendation (`acmmadvisor.Recommendation`, JSON): never changes the applied level — see [ACMM advisor](../acmm-advisor.md) | `pkg/dashboard/api.go:360` | -| `GET` | `/api/hive-advice` | Dashboard auth/session | Weekly owner advice (`hiveadvisor.Result`, JSON) shared with the advisory digest: recommendations with `items`, `links` (Overview export paths) and `bands`; `bands[]` rule text; `counts` naming the governor actionable queue vs. the Overview total. Which recommendations show is frozen for 7 days; their numbers refresh every call — see [Owner advice](../advisory.md#owner-advice) | `pkg/dashboard/api.go:362`, `pkg/dashboard/api_hive_advice.go` | +| `POST` | `/api/repos/{owner}/{repo}/items/{number}/decide-delegated/plan` | Same as `…/decide-delegated` | Preview for *Let hive decide*: runs the same owner-delegate policy with **no side effects** (nothing written, no job) and answers `{would, rule, acting, title, summary, why, consequences[], ladder, mergeable_as_is, alternatives[], writes: false, prior, notes}` — `summary` is one verb-first sentence with no "Hive would:" prefix (*Send #15332 back to its author with one instruction: make CI green, nothing else.*), `why` one short line (*CI is red.*), `consequences` at most two items, `ladder` the rung that decided with its `ruled_out` list, and `mergeable_as_is` whether an as-is merge is honest (the queue-merge and merge-now alternatives are dropped when it is not). The dialog shows **Cancel** / **Let hive do that**, plus **Approve and let hive merge** (or **Merge now as maintainer** when the hive would approve anyway) only when `mergeable_as_is`; only then does the SPA post `…/decide-delegated` with `chosen` naming the button. A transient GitHub failure (5xx, rate limit, timeout) is retried twice with backoff before the plan gives up. A failure answers `{ok: false, error, reason, retryable, attempts, elapsed_ms, hive, hint}` under **409** when the item is no longer open (`reason: not-open`) or **424** when a read it depends on failed (`github`), is not configured (`config`) or the plan itself failed (`plan`) — never 502/503, which the hosted Ingress intercepts and replaces with its generic *hive unavailable* page (hivecommons/hive#16776). See [dashboard-sections.md](../dashboard-sections.md#let-hive-decide). | `pkg/dashboard/api.go:355`, `pkg/dashboard/api_repo_item_decide_delegated_plan.go` | +| `POST` | `/api/repos/{owner}/{repo}/items/{number}/blocker/recheck` | Same as `…/hold` (owner or repo write), signed-in GitHub user | *Re-check permissions* on an issue parked on a capability blocker (#15099): probes the GitHub App installation's permissions; when the missing permission is granted, clears every ledger entry blocked on it and un-parks the item (`{result: {outcome: "released", …}}`), otherwise `{result: {outcome: "no-effect", reason: "blocker", options: [...]}}`; 404 when the item has no blocker, 409 when the blocker is not a capability gap | `pkg/dashboard/api.go:356` | +| `POST` | `/api/repos/{owner}/{repo}/items/{number}/blocker/close-partial` | Same as `…/hold` (owner or repo write), signed-in GitHub user | Option (c) on a capability blocker (#15099): labels the issue `hive/partially-addressed`, posts the operator's `{"comment"}` naming what remains and closes it; the ledger entry is cleared | `pkg/dashboard/api.go:357` | +| `POST` | `/api/repos/{owner}/{repo}/items/{number}/accept-triage` | Owner or repo write/maintain/admin | Accept triage on an issue from the activity monitor's row menu — what a maintainer accepting triage on GitHub does by hand: adds the reporter-trust triage label (`triage/accepted`, or the first of `issue_filter.reporter_trust.untrusted_require_labels`; the label is created in the repo if missing) and removes the awaiting label (`needs-triage` / `reporter_trust.awaiting_label`) and a Hive-written `stage/015-triage-needed`. Empty body. Returns `{ok, repo, number, acceptLabel, added, removed, alreadyAccepted, minStatusSeq}`; an issue already carrying the accept label with nothing left to remove is a no-op (`alreadyAccepted: true`, no write, no audit). 404 for a pull request or an unknown item. The status snapshot's labels are patched so the next reconcile reads 010 Actionable before the engine's own 015 → 010 derivation. Every write is audited as `repo_item_accept_triage` under the dashboard user. | `pkg/dashboard/api.go:553`, `pkg/dashboard/api_repo_item_accept_triage.go` | +| `POST` | `/api/repos/{owner}/{repo}/items/{number}/sentinel-confirm` | Owner or repo write/maintain/admin | **Confirm safe** on the activity monitor's human-gate pill ([#17470](https://github.com/hivecommons/hive/issues/17470)): a person confirms a sentinel finding is intended. Body `{comment?, type?}` (`type` is `pr` or `issue`, comment ≤ 4000 characters). Posts the confirmation as a comment first — ``, `@user confirmed the sentinel finding safe from the dashboard.`, then the comment text — and removes every label matching the configured sentinel label (`sentinel.label`, default `sentinel-alert`, case-insensitive). Returns `{ok, repo, number, label, removed, alreadyClear, result}`; with no sentinel label on the item the comment is still posted and `alreadyClear` is true. 403 for a repository the hive does not watch. Audited as `repo_item_sentinel_confirm` under the dashboard user; the operator-action ledger records it as `confirm-sentinel`. | `pkg/dashboard/api.go:347`, `pkg/dashboard/api_repo_item_sentinel_confirm.go` | +| `GET` | `/api/acmm/evaluation` | Dashboard auth/session | ACMMEvaluation — combined codebase + operational result, cached server-side for 1 hour (`acmmEvalTTL`). `?refresh=1` (the dashboard's "🔄 Re-evaluate" button, #5877) bypasses the hourly TTL but is debounced server-side: requests within 1 minute of the last evaluation (`acmmRefreshDebounce`) still serve the cache, since a full refresh costs up to ~29 GitHub GetContents calls per repo. The response's `last_evaluated_at` timestamp reports when the cached evaluation was computed | `pkg/dashboard/api.go:359`, `pkg/dashboard/api_acmm_eval.go` | +| `POST` | `/api/acmm/issue` | Owner only | ACMMCreate Issue — files on GitHub or, with `governor.acmm.issue_tracker: work_source` / body `tracker: "work_source"` on a Linear-sourced hive, on Linear; response `tracker` says which. See [ACMM policy matrix](../acmm-policy-matrix.md#where-acmm-gap-issues-are-filed) | `pkg/dashboard/api.go:360` | +| `GET` | `/api/acmm-recommendation` | Dashboard auth/session | Advisory level-up recommendation (`acmmadvisor.Recommendation`, JSON): never changes the applied level — see [ACMM advisor](../acmm-advisor.md) | `pkg/dashboard/api.go:361` | +| `GET` | `/api/hive-advice` | Dashboard auth/session | Weekly owner advice (`hiveadvisor.Result`, JSON) shared with the advisory digest: recommendations with `items`, `links` (Overview export paths) and `bands`; `bands[]` rule text; `counts` naming the governor actionable queue vs. the Overview total. Which recommendations show is frozen for 7 days; their numbers refresh every call — see [Owner advice](../advisory.md#owner-advice) | `pkg/dashboard/api.go:363`, `pkg/dashboard/api_hive_advice.go` | diff --git a/src/docs/dashboard-copy-inventory.md b/src/docs/dashboard-copy-inventory.md index c85fd6f503..b9441cd69e 100644 --- a/src/docs/dashboard-copy-inventory.md +++ b/src/docs/dashboard-copy-inventory.md @@ -67,6 +67,7 @@ The new hover, verbatim (title line omitted): | `stageTrackerTriageNeededCaption` (`stageTrackerCaption` 015, `stageTrackerNewState` hold text) | row caption, feed | 110 ("Actionable, but no maintainer has looked at it yet; waiting for triage — triage needed: carries needs triage": *triage* ×3 after the chevron word) / 84 ("New · waiting for a maintainer's triage (add `triage/accepted`); the hive's next pass in 7m") | 31 ("Triage needed — accept or close"; the next-mover and next-pass narration stay on the chevron hover) | `TestStageTracker_TriageNeededStage`, `TestStageTracker_ReporterTrustHoldReadsTriageNeeded`, `TestStageTrackerNewState` | | `stageTrackerLeadActionHtml` (`tracker-actions.js`) | the row header's inline lead button (chip slot) | — (the lead sat in the ⋯ menu only) | the menu entry's label (1–4), its hint as the hover | `TestStageTrackerLeadActionInline`, `TestStageTrackerMaintainerRowsHaveLeadAction` | | Toasts (`STAGE_TRACKER_ACTING_CAPTIONS`, acted labels) | toast | 2–4 each | unchanged | — | +| `stageTrackerHumanGateHtml` + `stageTrackerHumanGateStatusText` / `stageTrackerHumanGateTip` / `stageTrackerHumanGateVerbs` (`tracker-human-gate.js`, [#17470](https://github.com/hivecommons/hive/issues/17470)) | the one human-gate pill in the chip slot: status segment, its hover, the verb buttons, the `…` menu | three or four controls for one gate — *Needs human · review* chevron word (3) + `sentinel` chip (1) + `Approve ▸` (1) + `Let hive decide ▸` (3) — and no verb at all for a sentinel alert or a held 090 (*Held · sentinel · confirm intent*, 4) | one pill: *Needs human · review, sentinel* (4) + fixed verbs per reason (1–2 words each, ≤ 3 visible, the rest behind `…`); hover = one line per reason (`review: `, `sentinel: `); *settling…* (1) after a verb runs | `TestStageTrackerHumanGateRows`, `TestStageTrackerHumanGateWiring`, `TestStageTrackerSentinelLaneText` | | `stageTrackerStripItems` holder token + `stageTrackerClaimantIconKind` (`tracker-row-strip.js`, `tracker-row.js`) on the PR in progress chevron ([#15541](https://github.com/hivecommons/hive/issues/15541)) | lit chevron word, chevron hover | *PR in progress* (bare; the holder token only reached PRs from review on) | *PR in progress · scanner ⬡*, *PR in progress · @odttlnt's clanker 🤖*, *PR in progress · @clubanderson 👤* — the same token and hover line as *Claimed ·*; the name ellipsizes before the one-line sub-row wraps; a detour word that already names them (*Returned to @bob's clanker*) does not repeat them | `TestStageTrackerClaimantChevronJS`, `TestStageTrackerPRClaimant`, `TestStageTrackerClaimantStage` | | `stageTrackerHolderPresenceHtml` (`tracker-words.js`) after the holder token; `stageTrackerOfflineAuthorCaption` + `stageTrackerWaitingOn` at stage None (Go) | lit chevron holder suffix, chevron hover, row caption | *PR in progress · @odttlnt's clanker 🤖* (no live state; a fork PR the gate kept label-less read as unclassified even when the engine held it at 085) | *PR in progress · @odttlnt's clanker 🤖 · ■ offline 3h* (muted; *· ○ not registered* for a login with no profile here; nothing when online); caption "@odttlnt's clanker is offline 3h; a green PR is reviewed and merged without its author — hive adopts it only once it is returned (red CI, conflicts or review asks) and nothing is pushed for 15m"; a suppressed-label 085 record keeps *Needs human decision* | `TestStageTrackerHolderPresenceJS`, `TestStageTrackerUnclassifiedClankerPROfflineCaption`, `TestStageTrackerSuppressedDecisionRecordKeepsStage` | | `stageTrackerLinkedPRProgress` (Go) + `stageTrackerEventText` / `stageTrackerNestedOpenPRs` (`tracker-motion.js`, `tracker-row-layout.js`) on an adoption pair ([#15495](https://github.com/hivecommons/hive/issues/15495)) | issue row caption, feed line, inline lead button | *fell back to Covered by pr — Covered by PR #15537 — Review swarm requested; … ; PR #15508 — Hive adopted this PR … — changes requested* (48) and a *Let hive decide — all 2 PRs* lead on a row with nothing to decide | *Covered by #15537 (adopted from @mendezr's #15508) — in CI / review* (11); the feed says *moved to* when an issue stops mirroring its PR; the pair counts as one open PR so no lead button | `TestStageTrackerLinkedPRProgressCollapsesAdoptionPair`, `TestStageTrackerAdoptionPairIsOneOpenPR`, `TestStageTrackerEventTextUnmirroredCoveredByPR` | diff --git a/src/docs/dashboard-sections/activity-monitor.md b/src/docs/dashboard-sections/activity-monitor.md index 210528fb84..d11165f7de 100644 --- a/src/docs/dashboard-sections/activity-monitor.md +++ b/src/docs/dashboard-sections/activity-monitor.md @@ -72,7 +72,7 @@ Side stages share a column rather than adding columns: | 045 Needs human decision | Actionable on an issue. A pre-045 issue still wearing 085 is drawn here until reconciliation. | | 070 Fixing / 071 Needs author / 072 Returned to contributor | CI / Review: Hive repairs its own PR at 070; a human author acts at 071; a contributor agent gets its PR back at 072. `needs-rebase` explains a repair here, not at 050. | | 074 Adopted by hive | CI / Review while the Hive repairs adopted work; pending, green or red pushes remain 074 until the merge gate takes it. | -| 085 Needs human decision / 090 Ready for human merge | A human gate is a pill on the PR's real stage, not a stage of its own ([#17327](https://github.com/hivecommons/hive/issues/17327), [#17453](https://github.com/hivecommons/hive/issues/17453)). A 085 PR whose head is short of merge-ready — checks running, red or unreported; the review verdict pending or asking for a person — lights **CI / Review** (the CI track while checks run or are not green, the Review track while its verdict is what waits), with an amber marker on the lit track and the **needs human decision** pill carrying the question (its popover holds the actions); PR in progress is passed, Merge queue empty. Only a 085 PR that is merge-ready (review approved, CI green on this head), queued or merging, and every 090, sits in the **Merge queue** column — read the decision or merge reason rather than assuming Hive will merge it. A 090 cell reading **Held · sentinel · confirm intent** or **Held · hold** is a gate on an otherwise ready PR: Hive never merges it while the gate stands. | +| 085 Needs human decision / 090 Ready for human merge | A human gate is a pill on the PR's real stage, not a stage of its own ([#17327](https://github.com/hivecommons/hive/issues/17327), [#17453](https://github.com/hivecommons/hive/issues/17453)). A 085 PR whose head is short of merge-ready — checks running, red or unreported; the review verdict pending or asking for a person — lights **CI / Review** (the CI track while checks run or are not green, the Review track while its verdict is what waits), with an amber marker on the lit track and the one **👤 Needs human · …** gate pill carrying the question and the verbs (see *Settling a human gate*); PR in progress is passed, Merge queue empty. Only a 085 PR that is merge-ready (review approved, CI green on this head), queued or merging, and every 090, sits in the **Merge queue** column — read the decision or merge reason rather than assuming Hive will merge it. A 090 held by a sentinel alert or a `hold` label keeps its own column word with the amber marker; the gate pill names the reason (`sentinel`, `hold`) and Hive never merges it while the gate stands ([#17470](https://github.com/hivecommons/hive/issues/17470)). | | 060 / 080 / 095 / 100 | Separate gate states; use the [merge-gate reference](#merge-queue-pills--legend) below for exact words and countdowns. | The author legend is a blue Hive hexagon, purple contributor-agent robot or teal human silhouette. The kind is `author/*`, inferred from the snapshot if its label is absent; the link tooltip names the login. On Claimed, the actor is the claim holder; on PR in progress and Returned to contributor it is the author. Hive owns review, adoption and auto-merge work; a human owns a human decision or manual merge. The payload's `stage_actor` is the authoritative actor (see [Who is on it](#who-is-on-it-actor-icons)). @@ -236,15 +236,30 @@ Durations, the flash timing (`--ham-move-flash-ms`, `--ham-move-flash-gap-ms`, ` #### Sentinel alert -A pull request the suspicious-activity sentinel flagged — it wears the `sentinel-alert` label (`sentinel.label`), or the review evidence bundle for its current head records sentinel findings — carries `sentinel_alert: true` in the tracker payload (with `sentinel_findings` and a short `sentinel_reason` when the bundle has them); a webhook label change flips it live. **A sentinel alert is a gate, not a stage** (owner decision 2026-11-08, [#17327](https://github.com/hivecommons/hive/issues/17327)): the column is the PR's real progress (CI, Review, or Merge queue once checks are green and the verdict approves) and the alert rides along as a pill. A green, reviewed, flagged PR stands at `090` in the **Merge queue** column and its lit chevron reads **Held · sentinel · confirm intent** (amber, `ham-held`; the same words lead the cell's `title` / `aria-label`, followed by the sentinel reason, the route reason and "Hive never merges this head while the gate stands."), never *Queued for merge*; a PR a `hold` / `do-not-merge*` label stops reads **Held · hold** the same way, with the holder and reason from the hold pill. The cell keeps the sentinel question's actions — *Approve* (the human review the alert asked for), *Let hive decide*, direction, close. In the **Needs human decision** lane (a reviewer's question on a flagged head) the lit chevron's own words read **Sentinel alert · needs human** (danger-tinted, the same wording in the cell's `title` and `aria-label`, and in the compact caption), so a maintainer reads the security implication before the stage mechanics; in every other lane at or past the merge gate (080, 095, 100) the row shows a compact danger-tinted `sentinel` chip ahead of `needs rebase` / `regressed` / `stalled`; before the gate the chip is held back with the other merge-gate pills (see *Pills before the merge gate*) while `sentinel_alert` stays truthful in the payload. +A pull request the suspicious-activity sentinel flagged — it wears the `sentinel-alert` label (`sentinel.label`), or the review evidence bundle for its current head records sentinel findings — carries `sentinel_alert: true` in the tracker payload (with `sentinel_findings` and a short `sentinel_reason` when the bundle has them); a webhook label change flips it live. **A sentinel alert is a gate, not a stage** (owner decision 2026-11-08, [#17327](https://github.com/hivecommons/hive/issues/17327)): the column is the PR's real progress (CI, Review, or Merge queue once checks are green and the verdict approves) and the alert rides along as a pill. The lit chevron never names the alert ([#17470](https://github.com/hivecommons/hive/issues/17470) — *Held · sentinel · confirm intent* and *Sentinel alert · needs human* are gone): a green, reviewed, flagged PR stands at `090` in the **Merge queue** column with its own column word and the amber `ham-human-gated` marker, never *Queued for merge*; a PR still running CI lights CI the same way. The alert is a reason of the row's one **👤 Needs human · sentinel** gate pill, whose hover is the sentinel reason and whose verbs are **Confirm safe** and **Let hive decide** (see *Settling a human gate*); a `hold` / `do-not-merge*` label is the `hold` reason of the same pill, with the holder and reason from the hold data. Where the gate pill does not render (a draft, a merged head) the row shows the compact danger-tinted `sentinel` chip ahead of `needs rebase` / `regressed` / `stalled` instead; before the merge gate the chip is held back with the other merge-gate pills (see *Pills before the merge gate*) while `sentinel_alert` stays truthful in the payload. -The tooltip reads "Sentinel flagged security-relevant changes at ``: ``" (a generic description stands in when the bundle has no reason). An issue carried by one flagged PR shows the lane text too, and a nested PR sub-row shows its own. The *Decide…* dialogs for a flagged PR open with a ⚠ line per flagged PR naming the sentinel reason, and *Approve* is styled as a dangerous action. +The tooltip reads "Sentinel flagged security-relevant changes at ``: ``" (a generic description stands in when the bundle has no reason). An issue carried by one flagged PR carries the gate pill too, and a nested PR sub-row carries its own. The *Decide…* dialogs for a flagged PR open with a ⚠ line per flagged PR naming the sentinel reason, and *Approve* is styled as a dangerous action. The payload also carries `sentinel_details`: one entry per finding with its `rule` (`sensitive_path`, `permission_escalation`, `ci_gate_weakening`, …), `summary`, the flagged `paths` (sorted, at most 10 per finding) and `more_paths` for any cut. The *Let hive decide* dialog's ▼ Details and the ⚠ chip tooltip list them under the sentinel line — `· sensitive_path: .github/workflows/release.yml (+N more)` — so the person can see *which* files tripped the sentinel, not just how many; `/api/sentinel` serves the same `findings` per row, and the hive's "reviewed, intended" decision comment on a trusted author's flagged PR names the same files after the reason. The findings come from the head's review evidence bundle or the sweep's own record; nothing is re-fetched from GitHub. -A person's *Approve* through that dialog **is** the human review the alert asked for: it removes the `sentinel-alert` label when present and records a `sentinel_acknowledged` human action keyed to the head in the review evidence bundle, so a bundle-only alert (findings but no label — hivecommons/crux#30) clears too; the payload then reads `sentinel_alert: false` with `sentinel_reason` suffixed `— acknowledged by @login`, the findings stay on record, and a new head starts over. +**Confirm safe** on the gate pill is the alert's own answer: it posts the person's confirmation as a comment (``, their words after it) and then removes the `sentinel-alert` label (`POST …/items/{number}/sentinel-confirm`, audited as `repo_item_sentinel_confirm`). A person's *Approve* through the decision dialog **is** also the human review the alert asked for: it removes the `sentinel-alert` label when present and records a `sentinel_acknowledged` human action keyed to the head in the review evidence bundle, so a bundle-only alert (findings but no label — hivecommons/crux#30) clears too; the payload then reads `sentinel_alert: false` with `sentinel_reason` suffixed `— acknowledged by @login`, the findings stay on record, and a new head starts over. -The delegated *Let hive decide* path never clears it. Hovering the lit chevron of a parked row names the parking stage itself (`Needs human decision`) when it sits in the Merge queue column, and *· needs a person: * on the lit CI / Review track when the head is not merge-ready ([#17453](https://github.com/hivecommons/hive/issues/17453)); `Next move` follows the real stage (human at 085 and at a held 090, hive at 080). A held row's stage never advances the merge: the lanes and the dashboard's one-click shortcuts check the gate itself, so a parked PR never merges unattended. Lane text and chip update in place on refresh (keyed reconcile, no flash). +The delegated *Let hive decide* path never clears it. Hovering the lit chevron of a parked row names the parking stage itself (`Needs human decision`) when it sits in the Merge queue column, and *· needs a person: * on the lit CI / Review track when the head is not merge-ready ([#17453](https://github.com/hivecommons/hive/issues/17453)); `Next move` follows the real stage (human at 085 and at a held 090, hive at 080). A held row's stage never advances the merge: the lanes and the dashboard's one-click shortcuts check the gate itself, so a parked PR never merges unattended. The gate pill and the chip update in place on refresh (keyed reconcile, no flash). + +#### Settling a human gate + +Every row a person must settle carries exactly **one** control for it ([#17470](https://github.com/hivecommons/hive/issues/17470); owner, 2026-11-10: "I don't see a consistent way to settle each of these using the UI"): a segmented pill, `[👤 Needs human · ] [verb] [verb] [verb] [… more]`, in the row's pill strip. The status segment names *why* — `review`, `decision`, `sentinel`, `hold`, comma-separated when they stack — and carries the reviewer's question or the sentinel rule as its hover (and, when the row carries a decision, the decision popover on click; the question also stays in the expander line). The verbs are fixed per reason, so the same reason always offers the same answers; stacked reasons union their verbs in reason order, de-duplicated, at most three visible with the rest behind a `…` menu (the same popover pattern as the row's ⋯ menu). "Needs human" is never a chevron word: the lit chevron is the row's real stage with the amber `ham-human-gated` outline as the bar's only cue. The `sentinel`, `hold`, `needs-human` and `needs-decision` chips step aside when the pill renders; `↻ N` retry and the notes button stay separate. + +| Reason | Set by | Verbs | What gets posted | +|---|---|---|---| +| `review` | the review verdict requires a human on this head (`review_activity.state: human_decision`) | **Approve** · **Request changes…** · **Let hive decide** | Approve posts `/lgtm` + `/approve` on the current head (`…/items/{n}/decision`, `approve`); Request changes opens a modal whose text is posted as `/hive decision ` (`decision: direction`), the author agent pushes a new head; Let hive decide records a `/hive decision` under the hive's policy. | +| `decision` | `stage/085-needs-decision` on a PR, `045` on an issue, or a `needs-decision` / `needs-human` modifier | **Decide…** · **Approve as-is** (PR rows; *Approve* when stacked with `review`) · **Let hive decide** | Decide opens a modal with the question pre-filled; the answer is posted as `/hive decision `; Approve as-is is the GitHub approval of the head as it stands; Let hive decide as above. An issue with no PR offers Decide… and Let hive decide only. | +| `sentinel` | the `sentinel-alert` label or blocking findings on this head (`sentinel_alert`, not the trusted-author notice) | **Confirm safe** · **Let hive decide** | Confirm safe comments `` with the person's words and removes the sentinel label (`POST …/items/{n}/sentinel-confirm`, audited `repo_item_sentinel_confirm`); Let hive decide never clears the alert. | +| `hold` | a `hold` / `do-not-merge*` label (`hold`, `modifiers: hold`) | **Release hold** · **Let hive decide** | Release hold removes the label (`POST …/items/{n}/hold`, `{"held": false}`); Let hive decide as above. | + +Every verb runs `runRowAction` — the row menu's own path: the in-app confirm or prompt modal (never a native dialog), the result toast saying what was posted, the acting row — and the pill reads **settling…** (dashed outline, verbs disabled) until the next snapshot re-renders the row. A verb the viewer cannot run is greyed with the reason, never hidden. The review verdict's own question is not a second reason: a `requires_human` verdict on a 085 PR reads `review` alone; `review, sentinel` when the sentinel also flags it. + +A **secondary row of a shared PR** — an issue drawn under another listed issue's row because one PR closes both ([#17333](https://github.com/hivecommons/hive/issues/17333)) — never renders a gate pill or an amber chevron of its own; its *decision pending on #N* chip is a link that scrolls to and focuses the row that carries the gate. #### Unauthorized pill @@ -324,7 +339,7 @@ Issues on their own stages (Open, 010, 020, 045) keep every pill: a `needs-human `stage/071-needs-author` is a person's PR: a human-authored pull request sent back by a maintainer's CHANGES_REQUESTED review or by the review swarm. The same verdict on a clanker-authored PR (`author/clanker`, or an author resolved to a contributor's hive agent) routes to `stage/072-returned-to-contributor`, whichever lane carried it. The actor is the owning contributor, the caption reads `Returned to @thatguywob's hive — @clubanderson requested changes`, and the normal contributor nudge goes to that hive ([hivecommons/hive#15159](https://github.com/hivecommons/hive/pull/15159): a human's out-of-cycle review on a clanker PR parked it at 071 under a maintainer's name). -The 071/072 chevron names the routing — `Needs @sam`, `Returned to @thatguywob's hive` — and a sentinel finding on such a row is a ` · sentinel` suffix on that word (the chip folds into it, the tooltip carries the finding). `Sentinel alert · needs human` is only the chevron word when the maintainer's review is still outstanding (085). A trusted human's CHANGES_REQUESTED review on the current head *is* the human those parks (sentinel alert, `hold`, workflow-path) were waiting for: the PR routes to 071/072 and the sentinel pass does not re-assert 085 until a new head re-arms the alert. +The 071/072 chevron names the routing — `Needs @sam`, `Returned to @thatguywob's hive` — and a sentinel finding on such a row is the `sentinel` reason of the gate pill beside it (the chip folds into the pill, its hover carries the finding); the chevron word never names it. A trusted human's CHANGES_REQUESTED review on the current head *is* the human those parks (sentinel alert, `hold`, workflow-path) were waiting for: the PR routes to 071/072 and the sentinel pass does not re-assert 085 until a new head re-arms the alert. A return placed by hand counts too: when a trusted maintainer swaps `stage/085` for `stage/071`/`stage/072` on the PR, the reconciler reads the label event once per head, records it as that maintainer's change request against the head, and keeps the stage. The hive's own label events and untrusted actors are not honoured. @@ -456,7 +471,7 @@ An *active* chevron is filled amber and carries words; an inactive one is its ic 2. **CI and Review resolve first.** A track is active only while it genuinely runs on the current head (a check-run in progress or queued, a ring not yet full; a reviewer running or queued). The CI count, its pending names and its motion cover tests only: Prow's `tide` merge-gate status (pending on every PR until it carries lgtm/approved and all presubmits are green), `enforce-guardrails` and the DCO sign-off context (`dco` / `DCO`) are merge gates, not checks, so a PR whose only pending context is `tide` reads *CI 18/18* and lights Review or the Merge queue — never *CI 18/19 · 'tide' running* (`github.IsMergeGateContext`; merge eligibility still enforces the gates). If either runs, the PR is waiting on it: the stage chevron (PR in progress, Merge queue …) renders settled-current — filled but still, icon only, its words in the tooltip — and nothing else is active. Settled-current is always the neutral fill: the Open column's draft, blocked, New and stale tints and the held-gate amber never repaint it, so the running track is the row's only coloured chevron ([#17461](https://github.com/hivecommons/hive/issues/17461): a draft PR with no stage yet read as a slate Open beside amber CI). 3. **CI leads Review.** When both tracks would light at once — CI running while the review is queued, in progress or being re-adjudicated — CI is the lit chevron and Review is dim with a small note (*re-review queued* after a push, *review in progress*, *review queued*); its words stay in the tooltip, ending *… behind CI*. The stage chevron is the fallback: active only when no track is in motion. 4. **The PR in progress chevron speaks the PR's lifecycle** — draft, pushed, rebasing, *Unassigned · next: scanner*, *Deferred · waiting on #N*, *Waiting for @author · fix owed* — never a CI or review verdict. *CI failing*, *CI 4/11 · 1 failing* and *changes requested* are the CI and Review chevrons' words; the PR in progress tooltip keeps the red reason as detail. -5. **A human gate is a pill, not a stage.** A PR parked at 085 for a person — a reviewer's question, a permission only a maintainer holds, a rerun to approve — with checks running, red or unreported, or its review verdict pending, is drawn at its real stage: CI (with motion while checks run) or Review is the one lit chevron, wearing an amber marker (`ham-human-gated`), and the ask is the **needs human decision** pill in the row's pill strip (human icon, the question in its hover, the decision popover on click); the lit track's tooltip ends *· needs a person: *. It never lights a *Needs human · decision* chevron in the PR in progress column while CI and Review spin dim ([#17453](https://github.com/hivecommons/hive/issues/17453): #17442 did, with CI 3/9 running; #17416 read *Needs human · review* the same way). Only a merge-ready, queued or merging 085 is a Merge queue matter. +5. **A human gate is a pill, not a stage.** A PR parked at 085 for a person — a reviewer's question, a permission only a maintainer holds, a rerun to approve — with checks running, red or unreported, or its review verdict pending, is drawn at its real stage: CI (with motion while checks run) or Review is the one lit chevron, wearing an amber marker (`ham-human-gated`), and the ask is the one **👤 Needs human · …** gate pill in the row's pill strip (the question in its hover, the decision popover on click, the verbs beside it — see *Settling a human gate*); the lit track's tooltip ends *· needs a person: *. It never lights a *Needs human · decision* chevron in the PR in progress column while CI and Review spin dim ([#17453](https://github.com/hivecommons/hive/issues/17453): #17442 did, with CI 3/9 running; #17416 read *Needs human · review* the same way). Only a merge-ready, queued or merging 085 is a Merge queue matter. 6. **The CI and Review tooltips state what the track waits on — never "activity unknown".** With no verdict and no reviewer in flight the spoke derives the Review statement from what it already knows, in this order: the PR is merged or closed (*Review · n/a (closed)*), it is a draft (*Review · draft, not requested*), CI on the head has not finished (*Review · waiting for CI*), CI is done and nobody started (*Review · not started · hive reviewer next*, or *· needs reviewer* when the repo has no hive reviewer lane). A settled verdict explains itself — *Changes requested by the hive reviewer: 1 perspective posted findings … · 12m ago · quality ✓ · security ✗: token logged* — and stays known as its observation ages. The one no-data wording, *Review · no data for head f269349 yet · refreshing* (CI: *CI · no checks observed for head … yet · refreshing*), appears only when the spoke has fetched nothing for the head, and names the next step. On a red PR (CI failing or changes requested on the current head, or a 07x fix stage) the PR in progress word comes from pickup evidence: @@ -474,7 +489,7 @@ The relay records a deferral as an `agent_pr_deferred` audit entry bound to the #### The row's lead action, inline -A row whose next move is yours does not hide its answer behind three dots. Beside the chips on the right of the header (and on a nested PR sub-row's own header), the row renders its **lead action** as a real `'), 'the alert has its verb: ' + gate[1]); +assert.ok(!parked.includes('ham-badge-sentinel'), 'no chip when the gate already says it'); assert.ok(parked.includes(esc(TIP)), 'the PR link tooltip carries the sentinel line'); -// Other lanes: chip beside the modifier pill, same tooltip. +// Other lanes: the alert alone is a gate — the pill carries it beside the +// modifier chip, same tooltip; the sentinel chip stands in only where +// the gate does not render (a draft). const review = stageTrackerRowHtml(P('o/r', 110, 50, Object.assign({ modifiers: ['needs-rebase'] }, flagged)), stages, ctx); assert.ok(!review.includes('') && review.includes('data-track="ci"') && review.includes('data-track="review"'), 'the informational notice preserves both independent tracks off the merge gate'); const chips = /([\s\S]*?)<\/span><\/li>/.exec(review); assert.ok(chips, review); -assert.ok(/^sentinel<\/span>needs rebase<\/span>$/.test(chips[1]), 'sentinel chip leads the chip area: ' + chips[1]); -assert.ok(chips[1].includes('title="' + TIP + '"'), chips[1]); +assert.ok(/^needs rebase<\/span>sentinel<\/span>/.test(draft) && !draft.includes('ham-human-gate'), 'a draft is no gate: the chip says it: ' + draft); +assert.ok(draft.includes('title="' + TIP + '"'), draft); const generic = stageTrackerRowHtml(P('o/r', 110, 71, { sentinel_alert: true }), stages, ctx); assert.ok(generic.includes('Sentinel flagged security-relevant changes: ' + esc(STAGE_TRACKER_SENTINEL_TIP_FALLBACK)), 'generic tooltip without a reason: ' + generic); // 071/072 + sentinel (hivecommons/hive#15159): the chevron keeps the -// routing word — the human already acted — with the alert as a suffix, -// never "needs human"; the chip is folded into the word. +// routing word — the human already acted — never "needs human"; the +// alert is the gate pill's reason, not a chevron suffix. assert.strictEqual(stageTrackerReturnedWord({ stage: 72, kind: 'pr', author: 'thatguywob', author_kind: 'clanker' }, 'Returned to contributor'), "Returned to @thatguywob's clanker"); assert.strictEqual(stageTrackerReturnedWord({ stage: 72, kind: 'pr', author: 'bee', author_kind: 'hive' }, 'Returned to contributor'), "Returned to @bee's hive"); // An issue row drawn through its one covering PR names the PR's author, @@ -426,28 +429,23 @@ assert.strictEqual(stageTrackerReturnedWord(Object.assign({}, viaPR, { linked_pr // A row the sweep marked superseded says so instead of "Returned to": // nothing is owed by the author; a maintainer closes it (#15303 / #15304). assert.strictEqual(stageTrackerReturnedWord({ stage: 72, kind: 'pr', author: 'thatguywob', author_kind: 'clanker', superseded: { reason: 'superseded', closer_pr: 15304, closer_repo: 'hive' } }, 'Returned to contributor'), 'Superseded by #15304 · decide'); -assert.strictEqual(stageTrackerReturnedWord(Object.assign({ stage: 72, kind: 'pr', author: 'thatguywob', author_kind: 'clanker', superseded: { closer_pr: 15304 } }, flagged), 'x'), 'Superseded by #15304 · decide · sentinel'); +assert.strictEqual(stageTrackerReturnedWord(Object.assign({ stage: 72, kind: 'pr', author: 'thatguywob', author_kind: 'clanker', superseded: { closer_pr: 15304 } }, flagged), 'x'), 'Superseded by #15304 · decide', 'no sentinel suffix on the word'); assert.strictEqual(stageTrackerReturnedWord({ stage: 72, kind: 'pr', author: 'thatguywob', author_kind: 'clanker', superseded: true }, 'Returned to contributor'), "Returned to @thatguywob's clanker", 'a bare nested flag names no closer'); assert.strictEqual(stageTrackerReturnedWord({ stage: 72, kind: 'pr', author: 'sam', author_kind: 'human' }, 'Returned to contributor'), 'Returned to @sam'); assert.strictEqual(stageTrackerReturnedWord({ stage: 71, kind: 'pr', author: 'sam' }, 'Needs author'), 'Needs @sam'); assert.strictEqual(stageTrackerReturnedWord({ stage: 72, kind: 'pr' }, 'Returned to contributor'), 'Returned to contributor', 'no author → stage word'); -assert.strictEqual(stageTrackerReturnedWord(Object.assign({ stage: 72, kind: 'pr', author: 'thatguywob', author_kind: 'clanker' }, flagged), 'x'), "Returned to @thatguywob's clanker · sentinel"); -assert.ok(stageTrackerSentinelAsSuffix(P('o/r', 1, 72, flagged)) && stageTrackerSentinelAsSuffix(P('o/r', 1, 71, flagged))); -assert.ok(!stageTrackerSentinelAsSuffix(P('o/r', 1, 85, flagged)) && !stageTrackerSentinelAsSuffix(I('o/r', 1, 72, flagged))); +assert.strictEqual(stageTrackerReturnedWord(Object.assign({ stage: 72, kind: 'pr', author: 'thatguywob', author_kind: 'clanker' }, flagged), 'x'), "Returned to @thatguywob's clanker"); const returned = stageTrackerRowHtml(P('o/r', 15159, 72, Object.assign({ author: 'thatguywob', author_kind: 'clanker' }, flagged)), stages, ctx); -const retLit = /
  • ]*)>([\s\S]*?)<\/li>/.exec(returned); -assert.ok(retLit, 'the lit 072 chevron is tinted: ' + returned); -assert.ok(retLit[2].includes("Returned to @thatguywob's clanker · sentinel"), 'routing word with sentinel suffix: ' + retLit[2]); -assert.ok(!returned.includes('needs human') && !returned.includes('Needs human'), 'no needs-human wording at 072: ' + returned); -assert.ok(retLit[1].includes("aria-label=\"Returned to @thatguywob's clanker · sentinel — " + TIP + '"'), 'aria names the routing: ' + retLit[1]); -assert.ok(retLit[1].includes(' — ' + TIP), 'the tooltip carries the reason: ' + retLit[1]); -assert.ok(!returned.includes('ham-badge-sentinel'), 'no chip when the word carries the suffix'); +const retLit = /
  • ]*)>([\s\S]*?)<\/li>/.exec(returned); +assert.ok(retLit, 'the lit 072 chevron wears the amber outline: ' + returned); +assert.ok(retLit[2].includes("Returned to @thatguywob's clanker"), 'routing word, no sentinel suffix: ' + retLit[2]); +assert.ok(!/entinel/.test(retLit[2].replace(/]*class="config-tooltip ham-chevron-tip"[^>]*>[^<]*<\/span>/g, '')), 'no sentinel word on the chevron: ' + retLit[2]); +assert.ok(returned.includes('data-ham-gate-reasons="sentinel"') && returned.includes('>Confirm safe'), 'the alert is the gate pill\'s reason: ' + returned); +assert.ok(!returned.includes('ham-badge-sentinel'), 'no chip beside the gate'); const needsAuthor = stageTrackerRowHtml(P('o/r', 15160, 71, Object.assign({ author: 'sam', author_kind: 'human' }, flagged)), stages, ctx); -assert.ok(needsAuthor.includes('Needs @sam · sentinel') && !needsAuthor.includes('needs human'), needsAuthor); +assert.ok(needsAuthor.includes('Needs @sam') && needsAuthor.includes('data-ham-gate-reasons="sentinel"'), needsAuthor); const returnedClean = stageTrackerRowHtml(P('o/r', 15161, 72, { author: 'thatguywob', author_kind: 'clanker' }), stages, ctx); -assert.ok(returnedClean.includes("Returned to @thatguywob's clanker") && !returnedClean.includes('ham-sentinel') && !returnedClean.includes('entinel'), returnedClean); -// 085 still says it in full. -assert.ok(stageTrackerRowHtml(P('o/r', 15162, 85, flagged), stages, ctx).includes('Sentinel alert · needs human')); +assert.ok(returnedClean.includes("Returned to @thatguywob's clanker") && !returnedClean.includes('ham-human-gate') && !returnedClean.includes('entinel'), returnedClean); // Give direction on a clanker PR is carried to the contributor's clanker, // not to the hive's own fixer. assert.strictEqual(stageTrackerDirectionCarrier([{ kind: 'pr', author: 'thatguywob', author_kind: 'clanker' }]), "@thatguywob's clanker"); @@ -457,17 +455,17 @@ assert.strictEqual(stageTrackerDirectionCarrier([]), 'the author agent'); // Clean rows carry none of it. const clean = stageTrackerRowHtml(P('o/r', 104, 85), stages, ctx); -assert.ok(clean.includes('Needs human decision') && !clean.includes('entinel'), clean); +assert.ok(clean.includes('data-ham-gate-reasons="decision"') && !clean.includes('entinel'), clean); assert.ok(!stageTrackerRowHtml(P('o/r', 1, 50, { modifiers: ['needs-rebase'] }), stages, ctx).includes('entinel')); -// An issue with one covering PR rides that PR's lane word; several covering +// An issue with one covering PR carries that PR's gate; several covering // PRs put the alert on the flagged sub-row only. const single = stageTrackerRowHtml(I('o/r', 13, 85, { linked_prs: [Object.assign({ number: 112, stage: 85, title: 'Covers 13' }, flagged)] }), stages, ctx); -assert.ok(single.includes('Sentinel alert · needs human') && !single.includes('ham-badge-sentinel'), single); +assert.ok(single.includes('data-ham-gate-reasons="decision sentinel"') && !single.includes('ham-badge-sentinel') && !single.includes('Sentinel alert · needs human'), single); const multi = stageTrackerRowHtml(I('o/r', 14, 20, { linked_prs: [Object.assign({ number: 115, stage: 85, title: 'A' }, flagged), { number: 116, stage: 50, title: 'B' }] }), stages, ctx); const subs = multi.split('
    Ready for human merge · human merge') && !breaking.includes('Awaiting human merge'), 'breaking-change 090 word: ' + breaking); -// hivecommons/hive#17327: a sentinel alert or hold label is a gate on the -// PR's real stage. A green, reviewed, flagged PR stands at 090 and its Merge -// queue cell reads "Held · sentinel · confirm intent" (amber ham-held, never -// red ham-sentinel, never "Queued for merge"), the tooltip carries the -// sentinel reason and the never-merges rule, and no sentinel chip repeats it. -assert.strictEqual(stageTrackerHeldWord(P('o/r', 1, 90, flagged)), 'Held · sentinel · confirm intent'); -assert.strictEqual(stageTrackerHeldWord(P('o/r', 1, 90, { modifiers: ['hold'], hold: { by: 'clubanderson', reason: 'wait for the release' } })), 'Held · hold'); -assert.strictEqual(stageTrackerHeldWord(P('o/r', 1, 90, { sentinel_alert: true, sentinel_notice: true })), '', 'the trusted-author notice is not a gate'); -assert.strictEqual(stageTrackerHeldWord(P('o/r', 1, 85, flagged)), '', 'only the 090 row wears the held word'); -assert.strictEqual(stageTrackerHeldWord(P('o/r', 1, 90)), ''); -assert.ok(stageTrackerSentinelInLane(P('o/r', 1, 90, flagged)), 'the held 090 word carries the alert: no chip'); +// hivecommons/hive#17327 → #17470: a sentinel alert or hold label is a +// gate on the PR's real stage. A green, reviewed, flagged PR stands at 090; +// the Merge queue cell keeps its own word (amber ham-human-gated, never +// "Held · sentinel", never red ham-sentinel), the gate pill names the +// reason with the sentinel rule as its hover and Confirm safe as its verb, +// and no sentinel chip repeats it. +assert.strictEqual(keys(P('o/r', 1, 90, flagged)), 'sentinel'); +assert.strictEqual(keys(P('o/r', 1, 90, { modifiers: ['hold'], hold: { by: 'clubanderson', reason: 'wait for the release' } })), 'hold'); +assert.strictEqual(keys(P('o/r', 1, 90, { sentinel_alert: true, sentinel_notice: true })), '', 'the trusted-author notice is not a gate'); +assert.strictEqual(keys(P('o/r', 1, 90)), ''); const heldSentinel = stageTrackerRowHtml(P('o/r', 17327, 90, Object.assign({ reason: 'a sentinel alert is open on this PR' }, flagged)), stages, ctx); -assert.ok(heldSentinel.includes('Held · sentinel · confirm intent'), 'held 090 word: ' + heldSentinel); -assert.ok(heldSentinel.includes('ham-held') && !heldSentinel.includes('ham-sentinel"') && !heldSentinel.includes('ham-sentinel ') , 'amber held class, not the red sentinel one: ' + heldSentinel); -assert.ok(!heldSentinel.includes('Queued for merge') && !heldSentinel.includes('Ready for human merge'), 'never queued / ready: ' + heldSentinel); -assert.ok(heldSentinel.includes(TIP) && heldSentinel.includes('Hive never merges this head while the gate stands.'), 'tooltip carries the reason and the rule: ' + heldSentinel); -assert.ok(!heldSentinel.includes('ham-badge-sentinel'), 'no sentinel chip beside the held word: ' + heldSentinel); +assert.ok(!heldSentinel.includes('Held · ') && !heldSentinel.includes('ham-held') && !heldSentinel.includes('ham-sentinel"'), 'no held / sentinel chevron word: ' + heldSentinel); +assert.ok(/
  • Confirm safe'), 'the gate pill carries the alert and its verb: ' + heldSentinel); +assert.ok(heldSentinel.includes(esc(TIP)), 'the hover carries the reason: ' + heldSentinel); +assert.ok(!heldSentinel.includes('ham-badge-sentinel'), 'no sentinel chip beside the gate: ' + heldSentinel); const heldHold = stageTrackerRowHtml(P('o/r', 17328, 90, { modifiers: ['hold'], hold: { by: 'clubanderson', reason: 'wait for the release', since: '2026-11-08T09:00:00Z' }, reason: 'held by label hold' }), stages, ctx); -assert.ok(heldHold.includes('Held · hold') && heldHold.includes('ham-held') && !heldHold.includes('Queued for merge'), 'held-by-label 090 word: ' + heldHold); -assert.ok(heldHold.includes('Held by @clubanderson · wait for the release'), 'hold tooltip names the holder: ' + heldHold); +assert.ok(!heldHold.includes('Held · hold') && !heldHold.includes('ham-held') && heldHold.includes('data-ham-gate-reasons="hold"') && heldHold.includes('>Release hold'), 'held-by-label 090 gate: ' + heldHold); +assert.ok(heldHold.includes('Held by @clubanderson · wait for the release'), 'the gate hover names the holder: ' + heldHold); // Decide… preface: one line per flagged PR, nothing for clean ones. assert.strictEqual(stageTrackerSentinelPreface([P('o/r', 109, 85, flagged), P('o/r', 104, 85)]), '⚠ o/r#109 — ' + TIP); @@ -556,7 +553,7 @@ r = stageTrackerReconcile(el, [row(P('o/r', 109, 85, flagged))], opts); assert.deepStrictEqual(r, { kept: 0, replaced: 1, entered: 0, exited: 0, deferred: 0 }, 'flag on → same key, swapped in place'); assert.strictEqual(el.children.length, 1); assert.notStrictEqual(el.children[0], first); -assert.ok(el.children[0].html.includes('Sentinel alert · needs human')); +assert.ok(el.children[0].html.includes('data-ham-gate-reasons="decision sentinel"')); assert.ok(!el.children[0].classList.contains('ham-entering'), 'a replaced row does not fade in'); r = stageTrackerReconcile(el, [row(P('o/r', 109, 85))], opts); assert.deepStrictEqual(r, { kept: 0, replaced: 1, entered: 0, exited: 0, deferred: 0 }, 'flag off → swapped back'); diff --git a/src/pkg/dashboard/stage_tracker_sentinel_notice_test.go b/src/pkg/dashboard/stage_tracker_sentinel_notice_test.go index 5737795610..b784cf19ca 100644 --- a/src/pkg/dashboard/stage_tracker_sentinel_notice_test.go +++ b/src/pkg/dashboard/stage_tracker_sentinel_notice_test.go @@ -43,8 +43,8 @@ func TestStageTrackerSentinelNoticePreservesActualReviewerDecision(t *testing.T) jsFunc(t, html, "stageTrackerSentinelTipWithPaths")+ jsFunc(t, html, "stageTrackerSentinelPreface")+ "\nconst notice = "+string(payload)+";\n"+` -assert.strictEqual(stageTrackerSentinelInLane(notice), false); -assert.strictEqual(stageTrackerSentinelAsSuffix({...notice, stage:71}), false); +assert.deepStrictEqual(stageTrackerHumanGateReasons(notice).map(r => r.key), [], 'an informational notice is not a human gate'); +assert.ok(!stageTrackerRowHtml(notice, stages, ctx).includes('ham-human-gate'), 'no gate pill for a notice'); assert.ok(stageTrackerSentinelTip(notice).includes('Informational security notice (not a merge gate)')); assert.ok(!stageTrackerSentinelTip({...notice, sentinel_reason:''}).includes('must review before merge')); const own = stageTrackerRowHtml(notice, stages, ctx); @@ -64,8 +64,8 @@ const nested = stageTrackerRowHtml({repo:notice.repo, kind:'issue', number:500, assert.ok(!text(nested).includes('Sentinel alert'), text(nested)); assert.ok(!text(nested).includes('Needs @clubanderson'), text(nested)); const blocking = {...notice, sentinel_notice:false}; -assert.strictEqual(stageTrackerSentinelInLane(blocking), true, 'actual blocking alert remains a sentinel gate'); -assert.strictEqual(stageTrackerSentinelAsSuffix({...blocking, stage:71}), true); +assert.ok(stageTrackerHumanGateReasons(blocking).some(r => r.key === 'sentinel'), 'actual blocking alert remains a sentinel gate'); +assert.ok(stageTrackerHumanGateReasons({...blocking, stage:71}).some(r => r.key === 'sentinel'), 'the gate stands on a returned PR too'); assert.ok(!stageTrackerSentinelTip(blocking).includes('Informational')); `) it.SentinelNotice = false diff --git a/src/pkg/dashboard/stage_tracker_ui_prelude_test.go b/src/pkg/dashboard/stage_tracker_ui_prelude_test.go index cef38b281f..f47aa07989 100644 --- a/src/pkg/dashboard/stage_tracker_ui_prelude_test.go +++ b/src/pkg/dashboard/stage_tracker_ui_prelude_test.go @@ -138,6 +138,7 @@ func stageTrackerRowsPreludeJS(t *testing.T, html string) string { jsFunc(t, html, "stageTrackerNeedsHumanWord"), jsFunc(t, html, "stageTrackerBlockedForDecisionPR"), jsFunc(t, html, "stageTrackerChipsHtml"), + stageTrackerHumanGateJS(t, html), jsFunc(t, html, "stageTrackerHeadColsHtml"), jsFunc(t, html, "stageTrackerSinceHtml"), jsFunc(t, html, "stageTrackerSubRowHtml"), diff --git a/src/pkg/dashboard/stage_tracker_ui_rows_test.go b/src/pkg/dashboard/stage_tracker_ui_rows_test.go index 9f56d6a52e..d36707fa75 100644 --- a/src/pkg/dashboard/stage_tracker_ui_rows_test.go +++ b/src/pkg/dashboard/stage_tracker_ui_rows_test.go @@ -57,10 +57,11 @@ row = stageTrackerRowHtml({ repo: 'acme/console', number: 12, kind: 'pr', title: assert.ok(row.includes('scanner logscrub misses attrs'), 'linked issue slot draws the chip: ' + row); // Open but held: the Open segment itself names the hold state and the row -// tooltip names the matching hold label, while the trailing flag pill remains. +// tooltip names the matching hold label; the hold is a human gate, so the +// trailing control is the one gate pill (reason "hold") rather than a chip. row = stageTrackerRowHtml({ repo: 'acme/console', number: 9, kind: 'pr', title: 'Paused', stage: 0, caption: 'No stage recorded yet', labels: ['do-not-merge/hold'], modifiers: ['hold'] }, stages, ctx); -assert.deepStrictEqual(segStates(row), ['active ham-open-hold', T, T, T, T, T, 'todo cap']); -assert.ok(row.includes('ham-mod-hold">hold'), row); +assert.deepStrictEqual(segStates(row), ['active ham-open-hold ham-human-gated', T, T, T, T, T, 'todo cap']); +assert.ok(!row.includes('ham-mod-hold">hold') && row.includes('ham-human-gate') && row.includes('Needs human · hold'), row); assert.ok(tooltip(row).includes('Open · on hold (do-not-merge/hold) · No stage recorded yet · acme/console'), tooltip(row)); // Open and awaiting triage: the action chip reads "triage needed"; the Open @@ -111,7 +112,7 @@ assert.deepStrictEqual(stageTrackerOpenSince({ created_at: '2025-01-01T00:00:00Z assert.deepStrictEqual(stageTrackerOpenSince({}), { ms: 0, fromCreated: false }); row = stageTrackerRowHtml({ repo: 'acme/console', number: 23, kind: 'pr', title: 'Held', stage: 0, stage_since: new Date(now - 3 * 86400000).toISOString(), modifiers: ['hold'] }, stages, ctx); assert.strictEqual(openWord(row), 'Open · hold', 'Open · hold never carries the age (owner)'); -assert.deepStrictEqual(segStates(row), ['active ham-open-hold', T, T, T, T, T, 'todo cap'], 'held: no stale tint either'); +assert.deepStrictEqual(segStates(row), ['active ham-open-hold ham-human-gated', T, T, T, T, T, 'todo cap'], 'held: no stale tint either'); // Open · blocked (the blocked label) mirrors Open · hold but, unlike it, // keeps the age — a stale blocked item is what the owner wants to see // (hivecommons/hive#14194). hold wins when both are present. @@ -151,7 +152,7 @@ row = stageTrackerRowHtml({ repo: 'acme/console', number: 30, kind: 'issue', tit assert.ok(!row.includes('3d'), 'only blocked rows borrow created_at for the since column'); row = stageTrackerRowHtml({ repo: 'acme/console', number: 27, kind: 'pr', title: 'Held and blocked', stage: 0, stage_since: new Date(now - 3 * 86400000).toISOString(), modifiers: ['blocked', 'hold'] }, stages, ctx); assert.strictEqual(openWord(row), 'Open · hold', 'hold is a human instruction: it wins over blocked and still carries no age'); -assert.deepStrictEqual(segStates(row), ['active ham-open-hold', T, T, T, T, T, 'todo cap']); +assert.deepStrictEqual(segStates(row), ['active ham-open-hold ham-human-gated', T, T, T, T, T, 'todo cap']); row = stageTrackerRowHtml({ repo: 'acme/console', number: 28, kind: 'pr', title: 'Blocked later', stage: 50, modifiers: ['blocked'] }, stages, ctx); assert.ok(!row.includes('ham-open-blocked') && !row.includes('Open · blocked'), 'blocked past Open is a chip, not an Open word'); // A draft PR with no stage (hivecommons/hive#14572): the far-right pill @@ -173,6 +174,7 @@ assert.strictEqual(stageTrackerCurrentStageHtml({ stage: 0, stage_since: new Dat // and the folded draft still explains itself on hover. row = stageTrackerRowHtml({ repo: 'acme/console', number: 31, kind: 'pr', title: 'Held draft', stage: 0, stage_since: new Date(now - 3 * 86400000).toISOString(), labels: ['do-not-merge/hold'], modifiers: ['hold', 'draft'] }, stages, ctx); assert.strictEqual(openWord(row), 'Open · hold', 'hold wins the Open word over draft'); +// A draft is not a human gate, so the held draft keeps its chips and no gate pill. assert.deepStrictEqual(segStates(row), ['active ham-open-hold', T, T, T, T, T, 'todo cap']); assert.ok(row.includes('ham-mod-hold" title="' + STAGE_TRACKER_DRAFT_TIP + '">hold +1'), 'hold leads, draft folded: ' + row); row = stageTrackerRowHtml({ repo: 'acme/console', number: 32, kind: 'pr', title: 'Still drafting', stage: 50, modifiers: ['draft'] }, stages, ctx); @@ -241,7 +243,8 @@ assert.strictEqual(stageTrackerAnchor(95, stages, 'pr'), STAGE_TRACKER_MERGE_COL // PR returned to contributor: detour badge rides Review; chip cap = author kind + first modifier (+N). row = stageTrackerRowHtml({ repo: 'acme/console', number: 102, kind: 'pr', title: 'Fix flaky', stage: 72, lane: 'contributor', tier: 'trusted', author: 'karibhou', author_kind: 'clanker', author_kind_source: 'inferred', modifiers: ['needs-rebase', 'needs-human'], caption: 'Returned to @karibhou', history: [{number:50,slug:'review-pending'},{number:60,slug:'reviewed'},{number:72,slug:'returned-to-contributor',from:60}] }, stages, ctx); -assert.deepStrictEqual(segStates(row), [D, D, D, 'active detoured', T, T, 'todo cap']); +// needs-human is a gate reason: the lit chevron wears the amber outline and the gate pill carries the verbs. +assert.deepStrictEqual(segStates(row), [D, D, D, 'active detoured ham-human-gated', T, T, 'todo cap']); // hivecommons/hive#15159: the chevron names the routing — the contributor's clanker, for a clanker's PR. assert.ok(row.includes('Returned to @karibhou's clanker'), row); // Invariant: a PR never occupies the issue slot. A PR with no linked issue @@ -257,7 +260,8 @@ assert.ok(!/#102') && prCol(row)[0].includes('Fix flaky'), 'coloured author icon, #102, title in the PR column: ' + prCol(row)[0]); assert.strictEqual(titles(row, 'Fix flaky'), 1, 'title appears once'); assert.strictEqual(chips(row), 1, 'author kind is an icon, not a chip'); -assert.ok(row.includes('ham-mod-needs-human">needs human +1'), row); +// needs-human moved into the gate pill, so the chip strip reads the remaining modifier alone. +assert.ok(row.includes('ham-mod-needs-rebase">needs rebase') && !row.includes('ham-mod-needs-human') && row.includes('ham-human-gate'), row); assert.ok(tooltip(row).includes('Flags: needs-rebase, needs-human') && tooltip(row).includes('Trail: CI / Review → Reviewed → Returned to contributor'), tooltip(row)); // PR reviewed (060): pre-admission (CI pending or soak), so CI / Review stays lit; the merge gate starts at 080. @@ -281,10 +285,15 @@ assert.ok(row.includes('3h'), row); row = stageTrackerRowHtml({ repo: 'acme/console', number: 105, kind: 'pr', stage: 90 }, stages, ctx); assert.deepStrictEqual(segStates(row), [D, D, D, D, D, 'active detoured', 'todo cap']); assert.ok(row.includes('Ready for human merge')); -// 085 has its own word; needs-decision as a modifier elsewhere reads "needs human decision". +// 085 on a PR: the chevron reads the real stage column (the human gate is +// the pill on the right, never a chevron word — hivecommons/hive#17470). row = stageTrackerRowHtml({ repo: 'acme/console', number: 106, kind: 'pr', stage: 85, modifiers: ['blocked'], caption: 'DCO failing — fix, waive or close' }, stages, ctx); -assert.deepStrictEqual(segStates(row), [D, D, D, D, D, 'active detoured', 'todo cap']); -assert.ok(row.includes('Needs human decision') && !row.includes('ham-mod-needs-decision'), row); +assert.deepStrictEqual(segStates(row), [D, D, D, D, D, 'active detoured ham-human-gated', 'todo cap']); +assert.ok(row.includes('Merge queue') && !row.includes('ham-mod-needs-decision'), row); +// (The hover tooltip may still open with "Needs human decision"; the visible chevron copy never does.) +assert.ok(!strip(row).split('

    ')[0].replace(/]*class="config-tooltip[^"]*"[^>]*>[\s\S]*?<\/span>/g, '').replace(/<[^>]*>/g, '').includes('Needs human'), 'no "Needs human" chevron word: ' + strip(row)); +assert.ok(row.includes('

    Needs human decision · '), 'the expander line still names the decision: ' + row); +assert.ok(row.includes('ham-human-gate') && row.includes('Needs human · decision'), row); assert.ok(tooltip(row).includes('Needs a human decision'), row); // A blocked issue with a hive:recheck-after deadline names it on the chip // (hivecommons/hive#13310); a bare blocked row keeps the plain chip. @@ -299,7 +308,7 @@ assert.ok(row.includes('>blocked') && !row.includes('re-check'), row); // pre-045 issue still wearing 085 is drawn the same way until re-staged. for (const parked of [45, 85]) { row = stageTrackerRowHtml({ repo: 'acme/console', number: 355, kind: 'issue', stage: parked }, stages, ctx); - assert.deepStrictEqual(segStates(row), [D, 'active detoured', T, T, T, T, 'todo cap'], row); + assert.deepStrictEqual(segStates(row), [D, 'active detoured ham-human-gated', T, T, T, T, 'todo cap'], row); assert.ok(row.includes('Needs human decision') && tooltip(row).includes('Needs a human decision') && !tooltip(row).includes('(its PR)'), row); } // 045 needs attention like the other parking stages. @@ -314,7 +323,7 @@ assert.strictEqual(stageTrackerHeadline({ kind: 'pr', stage: 70, modifiers: ['re // ...but an issue whose single covering PR sits on 085 still rides the PR's // merge gate, with the "(its PR)" suffix. row = stageTrackerRowHtml({ repo: 'acme/console', number: 356, kind: 'issue', stage: 40, linked_prs: [{ number: 109, author_kind: 'hive', stage: 85 }] }, stages, ctx); -assert.deepStrictEqual(segStates(row), [D, D, D, D, D, 'active detoured', 'todo cap'], row); +assert.deepStrictEqual(segStates(row), [D, D, D, D, D, 'active detoured ham-human-gated', 'todo cap'], row); assert.ok(tooltip(row).includes('Needs a human decision (its PR)'), row); // A PR parked at 085 lights the 080 column as a detour; its chevron hover // names the parking stage, not the column it rides on — the owner read @@ -326,7 +335,8 @@ assert.ok(chevronTip(row).startsWith('Needs human decision') && !chevronTip(row) row = stageTrackerRowHtml({ repo: 'acme/console', number: 14830, kind: 'pr', stage: 80, caption: 'CI green' }, stages, ctx); assert.ok(chevronTip(row).startsWith('Awaiting merge admission — not yet admitted') && chevronTip(row).includes('Next move: hive'), '080 keeps its own hover: ' + chevronTip(row)); row = stageTrackerRowHtml({ repo: 'acme/console', number: 107, kind: 'pr', stage: 50, modifiers: ['needs-decision'] }, stages, ctx); -assert.ok(row.includes('ham-mod-needs-decision">needs human decision') && tooltip(row).includes('Flags: needs human decision'), row); +// needs-decision as a modifier is the gate pill's reason "decision", not a chip; the row tooltip still flags it. +assert.ok(!row.includes('ham-mod-needs-decision') && row.includes('Needs human · decision') && tooltip(row).includes('Flags: needs human decision'), row); // Whose move it is, as an ink-coloured icon after the word: Review = hive, // PR in progress = the PR author, Claimed = the claimant; Open/Actionable carry none. assert.ok(row.includes('data-track="ci"') && row.includes('data-track="review"') && !row.includes('ham-actor-ico'), 'a native stage cannot identify the actual reviewer: ' + row); @@ -559,7 +569,7 @@ assert.deepStrictEqual(segStates(row), ['active', T, T, T, T, T, 'todo cap']); // is what the chevron says, the actor is whose move it is. The active // chevron now leads with its stage icon, so the regex skips that svg. const prWords = {}; -for (const [st, word, actor] of [[50, 'CI / Review', 'hive'], [60, 'Review passed', 'hive'], [70, 'Fixing', 'author'], [71, 'Needs author', 'author'], [72, 'Returned to contributor', 'author'], [74, 'Adopted by hive', 'hive'], [80, 'Queued for merge', 'hive'], [85, 'Needs human decision', 'human'], [90, 'Ready for human merge', 'human'], [100, 'Merging', 'hive']]) { +for (const [st, word, actor] of [[50, 'CI / Review', 'hive'], [60, 'Review passed', 'hive'], [70, 'Fixing', 'author'], [71, 'Needs author', 'author'], [72, 'Returned to contributor', 'author'], [74, 'Adopted by hive', 'hive'], [80, 'Queued for merge', 'hive'], [85, 'Merge queue', 'human'], [90, 'Ready for human merge', 'human'], [100, 'Merging', 'hive']]) { const r = stageTrackerRowHtml({ repo: 'acme/console', number: 500 + st, kind: 'pr', stage: st, author_kind: 'clanker' }, stages, ctx); if ([50, 60, 70, 71, 72, 74].includes(st)) { assert.ok(r.includes('data-track="ci"') && r.includes('data-track="review"'), 'pre-gate tracks remain separate at ' + st); @@ -749,7 +759,7 @@ assert.ok(/[^<]*<\/span>/.test(row) && !/ // the person's move ON THE PR, not a merge matter: the row lights its REAL // stage — the CI track, stalled, amber-marked (ham-human-gated) — with // PR in progress passed and the Merge queue column empty; the ask rides -// as the needs-human pill, never as a "Needs human" chevron of its own +// in the one human-gate pill, never as a "Needs human" chevron of its own // (hivecommons/hive#17453). A merge-ready twin (approved + CI green) or a // queued one keeps the gate. { @@ -805,7 +815,7 @@ assert.ok(/[^<]*<\/span>/.test(row) && !/ assert.ok(/

  • ]*data-motion="active"[^>]*>[\s\S]*?CI 3\/9 · 6 running<\/span>/.test(row), 'CI is the lit chevron, in motion, amber-marked: ' + strip(row)); assert.ok(/
  • ]*>[\s\S]*?Needs human/.test(strip(row)), 'no "Needs human" stage chevron: ' + strip(row)); - assert.ok(row.includes('ham-mod-needs-decision') && row.includes('>needs human decision<'), 'the ask rides as the needs-decision pill: ' + strip(row)); + assert.ok(!row.includes('ham-mod-needs-decision') && row.includes('ham-human-gate') && row.includes('Needs human · review, decision'), 'the ask rides as the human-gate pill (review verdict + 085 stack): ' + row); assert.ok(row.includes('needs a person: ' + question.replace(/'/g, ''')) || row.includes('needs a person: ' + question), 'the lit CI chevron\'s tooltip carries the question: ' + row); // The same row with CI green and the review verdict pending lights Review, stalled, amber-marked. const reviewing = stageTrackerRowHtml(shape({ ci_activity: { head, state: 'passing', caption: 'CI green', checks_passed: 9, checks_total: 9, source: 'checks', observed_at: seen }, review_activity: { head, state: 'unknown', caption: 'Review pending', perspectives_done: 0, perspectives_total: 5, source: 'review-dispatch-wait', observed_at: seen } }), stages, ctx); @@ -814,8 +824,8 @@ assert.ok(/[^<]*<\/span>/.test(row) && !/ assert.ok(/
  • ]*data-verdict="pass"/.test(reviewing), 'green CI is the ring alone: ' + strip(reviewing)); // A payload that predates the server re-adding the modifier still shows the pill. const bare = stageTrackerRowHtml(shape({ modifiers: [] }), stages, ctx); - assert.ok(bare.includes('ham-mod-needs-decision'), 'the pill is derived client-side too: ' + strip(bare)); - assert.strictEqual((bare.match(/ham-mod-needs-decision/g) || []).length, 1, bare); + assert.ok(bare.includes('ham-human-gate') && bare.includes('Needs human · review, decision'), 'the gate is derived client-side too: ' + bare); + assert.strictEqual((bare.match(/class="ham-human-gate"/g) || []).length, 1, 'exactly one gate control: ' + bare); } // hivecommons/hive#16599 rows (canonical: active = amber + words, inactive = // icon only). #16567 (dependabot, 050, review approved, 10 workflow runs diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css index 8dce519905..d999a3f391 100644 --- a/src/pkg/dashboard/static-src/css/tracker.css +++ b/src/pkg/dashboard/static-src/css/tracker.css @@ -316,7 +316,6 @@ status token the sentinel pill on the repo card already uses. */ .ham-badge-sentinel { color: var(--status-error); border-color: color-mix(in srgb, var(--status-error) 55%, transparent); font-weight: var(--fw-medium); } .ham-badge-sentinel.ham-sentinel-notice { color: var(--status-info); border-color: color-mix(in srgb, var(--status-info) 55%, transparent); } - .ham-seg.active.ham-sentinel { background: var(--status-error); color: var(--surface-0); } /* 072 adoption chip (maintainer-policy, hive PR 14524): "waiting on @author (maintainer, offline 26h) — adopt?" */ .ham-badge-adoption { color: var(--status-warn); border-color: color-mix(in srgb, var(--status-warn) 55%, transparent); font-weight: var(--fw-medium); } /* "supersedes N": the closed original a live PR replaced (hive PR 15135 follow-up). Muted — a trace, not a call to act. */ @@ -476,12 +475,10 @@ .ham-seg.active.ham-open-hold { background: var(--yellow); color: var(--surface-0); } /* A 090 row a sentinel alert or hold label gates (hivecommons/hive#17327): the Merge queue cell wears the pill amber — held, not queued, not red. */ - .ham-seg.active.ham-held { background: var(--amber); color: var(--surface-0); } - .ham-seg.active.ham-held .ham-detour::before { content: '⏸'; margin-right: var(--sp-1); } /* A 085 PR a person acts on lights its real stage — the CI / Review track — and that track wears an amber marker; the gate itself is the needs-human pill beside the row (hivecommons/hive#17453). */ - .ham-seg.ham-activity-track.active.ham-human-gated { outline: var(--focus-ring-width) solid var(--amber); outline-offset: calc(-1 * var(--focus-ring-width)); } + .ham-seg.active.ham-human-gated { outline: var(--focus-ring-width) solid var(--amber); outline-offset: calc(-1 * var(--focus-ring-width)); } .ham-seg.active.ham-open-hold .ham-seg-t::before { content: '⏸'; margin-right: var(--sp-1); } .ham-seg.active.ham-open-blocked { background: var(--yellow); color: var(--surface-0); } .ham-seg.active.ham-open-blocked .ham-seg-t::before { content: '⛔'; margin-right: var(--sp-1); } @@ -981,6 +978,28 @@ /* Busy (Let hive decide gathering its preview) also sets aria-disabled, so this compound rule sits after the disabled one and wins: the working colour, not faint/dashed. */ .ham-lead-act[aria-busy="true"][aria-disabled="true"] { cursor: progress; opacity: 1; border-style: solid; border-color: var(--cue-work); background: color-mix(in srgb, var(--cue-work) 10%, transparent); color: var(--cue-work); } + /* One human-gate control per gated row: a segmented pill whose left + segment names the reasons (👤 Needs human · review, sentinel) and whose + right segments are the verbs those reasons determine. Replaces the + scattered sentinel chip + Approve + Let hive decide + needs-human pill. */ + .ham-human-gate { display: inline-flex; align-items: stretch; max-width: 100%; border: var(--line-width) solid color-mix(in srgb, var(--amber) 60%, var(--line-subtle)); border-radius: var(--r-pill); background: color-mix(in srgb, var(--amber) 8%, var(--panel)); font-size: var(--fs-xs); line-height: 1.5; vertical-align: middle; } + .ham-human-gate > .ham-gate-status { display: inline-flex; align-items: center; gap: var(--sp-1); min-width: 0; padding: 0 var(--sp-2) 0 var(--sp-3); border: 0; border-radius: var(--r-pill) 0 0 var(--r-pill); background: transparent; color: var(--amber); font: inherit; font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + .ham-human-gate > .ham-gate-status > .ham-mod-word { overflow: hidden; text-overflow: ellipsis; } + .ham-human-gate > button.ham-gate-status { cursor: pointer; } + .ham-human-gate > button.ham-gate-status:hover, .ham-human-gate > button.ham-gate-status:focus-visible { text-decoration: underline; outline: none; } + .ham-human-gate > .ham-gate-act { border-radius: 0; border-top: 0; border-bottom: 0; border-right: 0; border-left-color: color-mix(in srgb, var(--amber) 35%, transparent); margin: 0; } + .ham-human-gate > .ham-gate-act.ham-act-secondary, .ham-human-gate > .ham-gate-more { --ham-act-fill: transparent; --ham-act-ink: var(--text); } + .ham-human-gate > .ham-gate-act:last-child, .ham-human-gate > .ham-gate-more:last-child { border-radius: 0 var(--r-pill) var(--r-pill) 0; } + .ham-human-gate > .ham-gate-act:hover, .ham-human-gate > .ham-gate-act:focus-visible { box-shadow: none; background: color-mix(in srgb, var(--amber) 22%, transparent); filter: none; } + .ham-human-gate > .ham-gate-act.ham-act-primary:hover, .ham-human-gate > .ham-gate-act.ham-act-primary:focus-visible { filter: brightness(1.12); } + .ham-human-gate > .ham-gate-more { padding-inline: var(--sp-2); } + .ham-human-gate > .ham-gate-more::after { content: none; } + .ham-human-gate > .ham-gate-more[aria-expanded="true"] { background: color-mix(in srgb, var(--amber) 22%, transparent); } + .ham-human-gate.ham-gate-settling { opacity: 0.75; border-style: dashed; } + .ham-human-gate.ham-gate-settling > .ham-gate-status { color: var(--cue-work); } + .ham-gate-menu[hidden] { display: none; } + /* The passive "decision pending on #N" chip is a link to the primary row. */ + .ham-decision-pending[data-ham-scroll-to] { text-decoration: underline dotted; text-underline-offset: var(--sp-1); } /* The technical background folds behind one collapsed Details. */ .ham-decision-details { margin: var(--sp-2) 0 0; font-size: var(--fs-xs); color: var(--text-muted); } .ham-decision-details > summary { cursor: pointer; color: var(--text-faint); } @@ -1008,6 +1027,8 @@ /* Stacked head: the ask pill is its person icon alone (#17453). */ .ham-head-cols .ham-badges > .ham-badge-mod.ham-mod-ask > .ham-mod-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } .ham-head-cols .ham-badges > .ham-badge-mod.ham-mod-ask > .ham-mod-ico { margin-right: 0; } + .ham-head-cols .ham-human-gate > .ham-gate-status > .ham-mod-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } + .ham-head-cols .ham-human-gate > .ham-gate-status { position: relative; padding-right: var(--sp-2); } .ham-row .ham-seg { padding: 0 var(--sp-2) 0 var(--sp-3); } .ham-row .ham-seg.cap { flex-basis: 2em; } .ham-since { width: 3em; } @@ -1240,6 +1261,10 @@ one-line box so a card row stays under the #17161 height budget; the hit area is padded out to the tap target like .ham-pill (#17453). */ #activity-monitor-section .ham-badge-mod.ham-decision-trigger { position: relative; } + /* Gate segments keep the one-line pill; each segment pads its hit area + out to the tap target so the phone harness sees ≥44×44. */ + #activity-monitor-section .ham-human-gate > .ham-gate-act, #activity-monitor-section .ham-human-gate > .ham-gate-more, #activity-monitor-section .ham-human-gate > button.ham-gate-status { position: relative; min-width: var(--tap-target); min-height: 0; padding-block: var(--sp-2); } + #activity-monitor-section .ham-human-gate > .ham-gate-act::before, #activity-monitor-section .ham-human-gate > .ham-gate-more::before, #activity-monitor-section .ham-human-gate > button.ham-gate-status::before { content: ""; position: absolute; inset: calc((1lh - var(--tap-target)) / 2) 0; } #activity-monitor-section .ham-badge-mod.ham-decision-trigger::before { content: ""; position: absolute; inset: calc((1lh - var(--tap-target)) / 2) calc((100% - var(--tap-target)) / 2); } /* A card keeps its two-line head and its density (#17161): the 🗒 shows on a phone only once the item has notes; the row's ⋯ menu diff --git a/src/pkg/dashboard/static-src/js/tracker-actions.js b/src/pkg/dashboard/static-src/js/tracker-actions.js index 94a6ffb54c..691b54825c 100644 --- a/src/pkg/dashboard/static-src/js/tracker-actions.js +++ b/src/pkg/dashboard/static-src/js/tracker-actions.js @@ -43,6 +43,8 @@ open: 'Open on GitHub', copy: 'Copy link', 'open:app-settings': 'Grant the App permission', 'blocker:recheck': 'Re-check permissions', 'blocker:patch': 'Prepare the patch for a person to push', 'blocker:close-partial': 'Mark partially-addressed and close', 'blocker:wait': 'Keep waiting', + // The human-gate pill's reason-bound verbs (hivecommons/hive#17470). + 'gate:decide': 'Decide', 'gate:request-changes': 'Request changes', 'gate:confirm-sentinel': 'Confirm safe', }; // Actions that end with a commit on the base branch — the lead // "Approve and let hive merge" (the hive's sweep merges on its next @@ -983,8 +985,14 @@ const key = sub ? sub.dataset.hamSubKey : (row ? row.dataset.hamKey : ''); const item = key ? stageTrackerItemByKey(_stageTracker, key) : null; if (!item) return; - stageTrackerDecisionRun(item, b.dataset.hamAct); + const run = stageTrackerDecisionRun(item, b.dataset.hamAct); + // A human-gate verb that went through reads "settling…" on its pill + // until the next snapshot re-renders the row (hivecommons/hive#17470). + if (b.classList.contains('ham-gate-act') && run && typeof run.then === 'function' && typeof stageTrackerHumanGateSettling === 'function') { + run.then(r => { if (r && !r.cancelled && Array.isArray(r.results) && r.results.length && r.results.every(x => x && x.ok)) stageTrackerHumanGateSettling(b); }, () => {}); + } }); + if (typeof stageTrackerWireHumanGate === 'function') stageTrackerWireHumanGate(el); // Cmd/Ctrl- or Shift-click anywhere on a row (not on its links or // buttons) selects it too. el.addEventListener('click', e => { @@ -1360,6 +1368,14 @@ const to = payload.to || stageTrackerRerouteTargetOf(id) || STAGE_TRACKER_REROUTE_ANY; return { url: '/api/repos/' + seg + '/items/' + n + '/decision', body: { decision: 'reroute', to, comment: payload.comment || '', type } }; } + // The human-gate verbs: Decide… and Request changes… are directions + // (the "/hive decision …" carrier); Confirm safe clears the sentinel. + if (id === 'gate:decide' || id === 'gate:request-changes') { + return { url: '/api/repos/' + seg + '/items/' + n + '/decision', body: { decision: 'direction', comment: payload.comment || '', type } }; + } + if (id === 'gate:confirm-sentinel') { + return { url: '/api/repos/' + seg + '/items/' + n + '/sentinel-confirm', body: { comment: payload.comment || '', type } }; + } if (id.indexOf('decide:') === 0) { const body = { decision: id.slice('decide:'.length), comment: payload.comment || '', type }; if (payload.supersededBy) body.superseded_by = payload.supersededBy; @@ -2104,6 +2120,21 @@ return (await stageTrackerAsk(id, 'confirm', { title: 'Approve pull request' + (items.length > 1 ? 's' : ''), message: preface + 'Post "/lgtm" and "/approve" on ' + refs + ' as ' + who + '? The merge queue takes it from there — the dashboard does not merge.', confirmLabel: 'Post /lgtm + /approve', danger: !!sentinel })) ? {} : null; } return (await stageTrackerAsk(id, 'confirm', { title: 'Approve direction', message: 'Record "/hive approve" on ' + refs + ' as ' + who + '? The hive un-parks the issue' + (items.length > 1 ? 's' : '') + ' and carries on; nothing is merged.', confirmLabel: 'Approve' })) ? {} : null; + case 'gate:decide': { + // The reviewer's question leads the modal, pre-filled; the answer is required. + const dec = typeof stageTrackerDecisionOf === 'function' ? stageTrackerDecisionOf(items[0]) : null; + const q = (dec && dec.item && dec.item.decision_needed && dec.item.decision_needed.question) || (items[0] && items[0].human_attention && items[0].human_attention.reason) || ''; + const v = await hivePrompt({ title: 'Decide — ' + refs, label: preface + (q ? 'Question: ' + q + '\n\n' : '') + 'Your decision (posted as "/hive decision …"; the hive carries on with it)', placeholder: 'e.g. take option B and keep the API as is', validate: s => s ? true : 'A decision is required', confirmLabel: 'Send' }); + return v == null ? null : { comment: v }; + } + case 'gate:request-changes': { + const v = await hivePrompt({ title: 'Request changes — ' + refs, label: preface + 'What should change on ' + refs + '? (posted as "/hive decision …"; ' + stageTrackerDirectionCarrier(items) + ' pushes a new head)', placeholder: 'e.g. drop the retry loop and keep the flag', validate: s => s ? true : 'The requested change is required', confirmLabel: 'Send' }); + return v == null ? null : { comment: v }; + } + case 'gate:confirm-sentinel': { + const v = await stageTrackerAsk(id, 'prompt', { title: 'Confirm safe — ' + refs, label: preface + 'Confirm the sentinel finding is intended: this comments your confirmation on ' + refs + ' and removes the sentinel label so the lane may continue. Note (optional)', placeholder: 'e.g. the workflow edit is the point of this PR', confirmLabel: 'Confirm safe', danger: true }); + return v == null ? null : { comment: v }; + } case 'decide:direction': { // The direction is required, so this prompt is never skipped. const v = await hivePrompt(prs @@ -2253,11 +2284,12 @@ 'decide:delegate': 'Hive deciding…', 'decide:delegate:preview': 'Asking the hive…', 'decide:delegate-all': 'Hive deciding each PR…', 'decide:delegate:rerun': 'Hive deciding again…', 'decide:approve': 'Approving…', 'decide:direction': 'Recording direction…', 'decide:close-superseded': 'Closing…', 'decide:close-wontfix': 'Closing…', 'decide:close-read': 'Closing…', 'decide:close-deferred': 'Closing…', 'decide:close-issue': 'Closing…', 'decide:merge-now': 'Merging…', 'decide:queue-merge': 'Recording approval…', 'decide:adopt': 'Adopting…', 'decide:adopt-now': 'Adopting now…', 'decide:reroute': 'Rerouting…', + 'gate:decide': 'Sending your decision…', 'gate:request-changes': 'Requesting changes…', 'gate:confirm-sentinel': 'Confirming safe…', }; const STAGE_TRACKER_ACTION_WORDS = { adopted: 'adopted', approved: 'approved', recommended: 'recommendation only', closed: 'closed', directed: 'direction recorded', refused: 'refused', 'decided-each': 'decided per PR', merged: 'merged', 'queued-for-merge': 'queued for merge — hive merges it on its next pass once CI is green', [STAGE_TRACKER_ACTION_REBASE_QUEUED]: 'rebase queued, merge to follow', - held: 'held', released: 'hold released', rescanned: 'rescanned', 'triage-accepted': 'triage accepted', 'needs-human': 'marked needs-human', rerouted: 'rerouted', [STAGE_TRACKER_ACTION_NOOP]: 'no change', + held: 'held', released: 'hold released', 'sentinel-confirmed': 'sentinel confirmed safe', rescanned: 'rescanned', 'triage-accepted': 'triage accepted', 'needs-human': 'marked needs-human', rerouted: 'rerouted', [STAGE_TRACKER_ACTION_NOOP]: 'no change', [STAGE_TRACKER_ACTION_NO_EFFECT]: 'no effect yet', }; // Once the server has answered, a terminal action's caption says so @@ -2270,7 +2302,7 @@ } // The ledger name of a row action id (the inverse of the badge's // STAGE_TRACKER_ACTED_OPTION_ID), for a failure noted on the client. - const STAGE_TRACKER_ACTION_LEDGER_NAME = { 'decide:delegate': 'let-hive-decide', 'decide:approve': 'approve', 'decide:direction': 'give-direction', 'decide:close-superseded': 'close-superseded', 'decide:close-wontfix': 'wontfix', 'decide:close-deferred': 'wontfix', 'decide:close-read': 'close-read', 'decide:close-issue': 'close-issue', 'accept-triage': 'accept-triage', hold: 'hold', release: 'release', 'needs-human': 'mark-needs-human', 'decide:merge-now': 'merge-now', 'decide:queue-merge': 'queue-merge', 'decide:adopt': 'adopt', 'decide:adopt-now': 'adopt-now', 'decide:reroute': 'reroute' }; + const STAGE_TRACKER_ACTION_LEDGER_NAME = { 'decide:delegate': 'let-hive-decide', 'decide:approve': 'approve', 'decide:direction': 'give-direction', 'decide:close-superseded': 'close-superseded', 'decide:close-wontfix': 'wontfix', 'decide:close-deferred': 'wontfix', 'decide:close-read': 'close-read', 'decide:close-issue': 'close-issue', 'accept-triage': 'accept-triage', hold: 'hold', release: 'release', 'needs-human': 'mark-needs-human', 'decide:merge-now': 'merge-now', 'decide:queue-merge': 'queue-merge', 'decide:adopt': 'adopt', 'decide:adopt-now': 'adopt-now', 'decide:reroute': 'reroute', 'gate:decide': 'give-direction', 'gate:request-changes': 'give-direction', 'gate:confirm-sentinel': 'confirm-sentinel' }; // A failed or refused action is noted on the row at once, so the // history badge turns red and its hover's first line names the reason // — the server's ledger only sees 5xx and refused answers, and a diff --git a/src/pkg/dashboard/static-src/js/tracker-human-gate.js b/src/pkg/dashboard/static-src/js/tracker-human-gate.js new file mode 100644 index 0000000000..abb7aa3b50 --- /dev/null +++ b/src/pkg/dashboard/static-src/js/tracker-human-gate.js @@ -0,0 +1,215 @@ + /* ---- The human gate: one control per gated row ---------------------- + A row a person must settle used to say so three or four ways at once + — a "Needs human · review" chevron word, a `sentinel` chip, a + needs-decision pill, `Approve ▸` and `Let hive decide ▸` — and still + offered no verb for some gates (a sentinel alert had nothing that + confirmed it; a "needs decision" had nothing that decided). The + maintainer on hivecommons/hive (2026-11-10): "I don't see a consistent + way to settle each of these using the UI. Some are confusing, others + have no controls to take action, others have too many." + + Now every gated row carries exactly ONE segmented pill: + [👤 Needs human · ] [verb] [verb] [verb] [… more] + The status segment names why (review / decision / sentinel / hold, + comma-separated when they stack) and carries the reviewer's question + or the sentinel rule as its hover and popover; the verb segments are + the fixed set for those reasons (STAGE_TRACKER_GATE_VERBS), unioned + and de-duplicated, at most STAGE_TRACKER_GATE_VISIBLE visible with the + rest behind a `…` menu. "Needs human" is never a chevron word: the lit + chevron is the row's real stage with the amber ham-human-gated outline + as the bar's only cue. A secondary row of a shared PR renders no gate + of its own; its "decision pending on #N" chip is the link to the row + that does. Every verb runs the row menu's path (runRowAction: in-app + modal, result toast, acting row); the pill reads "settling…" until the + next snapshot. */ + const STAGE_TRACKER_GATE_WORD = 'Needs human'; + const STAGE_TRACKER_GATE_SETTLING = 'settling…'; + const STAGE_TRACKER_GATE_VISIBLE = 3; + // Reason → verbs, in the order they stand on the pill. The same reason + // always offers the same verbs (the maintainer's "consistent way"). + const STAGE_TRACKER_GATE_VERBS = { + review: ['decide:approve', 'gate:request-changes', 'decide:delegate'], + decision: ['gate:decide', 'decide:approve', 'decide:delegate'], + sentinel: ['gate:confirm-sentinel', 'decide:delegate'], + hold: ['release', 'decide:delegate'], + }; + const STAGE_TRACKER_GATE_ORDER = ['review', 'decision', 'sentinel', 'hold']; + const STAGE_TRACKER_GATE_PR_ONLY = ['decide:approve', 'gate:request-changes']; + // The verb's label on the pill; "Approve" reads "Approve as-is" when the + // gate is a decision (a GitHub approval of the head as it stands). + const STAGE_TRACKER_GATE_LABELS = { + 'decide:approve': 'Approve', 'gate:request-changes': 'Request changes…', 'decide:delegate': 'Let hive decide', + 'gate:decide': 'Decide…', 'gate:confirm-sentinel': 'Confirm safe', release: 'Release hold', + }; + const STAGE_TRACKER_GATE_APPROVE_AS_IS = 'Approve as-is'; + // What each verb posts, for the pill hover and the docs table. + const STAGE_TRACKER_GATE_POSTS = { + 'decide:approve': 'Posts a GitHub approval (/lgtm + /approve) on the current head.', + 'gate:request-changes': 'Posts your text as "/hive decision …" — the hive pushes a new head.', + 'decide:delegate': 'The hive decides for you under its policy and rails; recorded as your decision.', + 'gate:decide': 'Answers the question as "/hive decision …" — the hive carries on with your answer.', + 'gate:confirm-sentinel': 'Comments your confirmation and removes the sentinel label.', + release: 'Removes the hold label; the lane may merge.', + }; + + // Pure: whether the row is a PR (its own, or an issue drawn through its + // one covering PR) — the gate is a PR matter except for a parked issue. + function stageTrackerGateIsPR(item) { + return !!item && (item.via_pr ? 'pr' : item.kind) === 'pr'; + } + // Pure: the reasons a person is owed on the row, each with the text the + // status segment explains itself with. [] when nobody is owed anything. + // review — the reviewer's verdict requires a human (review_activity + // human_decision on this head); tip = the reviewer's question + // decision — stage/085 (PR) or 045 (issue), or a needs-decision / + // needs-human modifier; tip = the decision question + // sentinel — a blocking sentinel alert; tip = the rule and paths + // hold — a hold label; tip = who held it and why + function stageTrackerHumanGateReasons(item) { + if (!item || item.state === 'closed' || item.superseded || item.superseded_by || item.adopted_by) return []; + if (Number(item.stage) >= (typeof STAGE_TRACKER_TERMINAL === 'number' ? STAGE_TRACKER_TERMINAL : 110)) return []; + const mods = Array.isArray(item.modifiers) ? item.modifiers : []; + if (mods.indexOf('merged') >= 0 || mods.indexOf('draft') >= 0) return []; + const out = []; + const pr = stageTrackerGateIsPR(item); + const onHead = a => !!a && (!a.head || !item.head || String(a.head) === String(item.head)); + const review = pr && onHead(item.review_activity) ? item.review_activity : null; + if (review && review.state === 'human_decision') { + out.push({ key: 'review', tip: String(review.blocker || review.detail || review.caption || '').trim() || 'A reviewer asked for a person\'s sign-off.' }); + } + const stage = Number(item.stage) || 0; + const prDecision = typeof STAGE_TRACKER_NEEDS_DECISION === 'number' ? STAGE_TRACKER_NEEDS_DECISION : 85; + const issueDecision = typeof STAGE_TRACKER_ISSUE_NEEDS_DECISION === 'number' ? STAGE_TRACKER_ISSUE_NEEDS_DECISION : 45; + // A pre-045 issue still wearing 085 is parked on a person all the same. + const decisionStage = pr ? stage === prDecision : (stage === issueDecision || stage === prDecision); + const flagged = decisionStage || mods.indexOf('needs-decision') >= 0 || mods.indexOf('needs-human') >= 0 || item.needs_human === true; + // An unauthorized step and a structured blocker name the person owed + // in their own pills (hive-bot-lacks-permission, Blocked · …); they + // are not a decision anyone is asked for. + if (flagged && !String(item.unauthorized_step || '').trim() && !(item.blocker && String(item.blocker.short || '').trim())) { + const d = item.decision_needed || {}; + const attention = typeof stageTrackerHumanAttentionOf === 'function' ? stageTrackerHumanAttentionOf(item) : null; + const ask = typeof stageTrackerNeedsHumanAsk === 'function' ? stageTrackerNeedsHumanAsk(item) : null; + const short = typeof stageTrackerNeedsHumanShort === 'function' ? stageTrackerNeedsHumanShort(item) : ''; + const tip = String(d.question || (attention && (attention.question || attention.reason)) || (ask && (ask.question || ask.reason)) || short || '').trim(); + // The review gate already carries the reviewer's question; the same + // question is not a second reason. + if (!(review && review.state === 'human_decision' && out.length && (!tip || out[0].tip === tip))) out.push({ key: 'decision', tip: tip || 'A person\'s decision is owed.' }); + } + if (item.sentinel_alert && !item.sentinel_notice) { + out.push({ key: 'sentinel', tip: typeof stageTrackerSentinelTipWithPaths === 'function' ? stageTrackerSentinelTipWithPaths(item) : (typeof stageTrackerSentinelTip === 'function' ? stageTrackerSentinelTip(item) : 'Sentinel alert') }); + } + if (item.hold || mods.indexOf('hold') >= 0) { + const tip = typeof stageTrackerHoldTip === 'function' ? stageTrackerHoldTip(item, Date.now()) : ''; + out.push({ key: 'hold', tip: tip || 'A hold label keeps the hive off this item until a person releases it.' }); + } + out.sort((x, y) => STAGE_TRACKER_GATE_ORDER.indexOf(x.key) - STAGE_TRACKER_GATE_ORDER.indexOf(y.key)); + return out; + } + // Pure: the verbs for a set of reasons — the union in reason order, + // de-duplicated, first label wins (so "Approve" on review + decision + // reads "Approve", and "Approve as-is" when the decision stands alone). + function stageTrackerHumanGateVerbs(reasons, item) { + const ids = []; + // A row with no PR has no head to approve or send back; those verbs + // belong to PR rows (or an issue drawn through its covering PR). + const onPR = item == null || stageTrackerGateIsPR(item); + (reasons || []).forEach(r => (STAGE_TRACKER_GATE_VERBS[r.key] || []).forEach(id => { if (ids.indexOf(id) < 0 && (onPR || STAGE_TRACKER_GATE_PR_ONLY.indexOf(id) < 0)) ids.push(id); })); + const onlyDecision = (reasons || []).length && reasons.every(r => r.key === 'decision'); + return ids.map(id => ({ id, label: id === 'decide:approve' && onlyDecision ? STAGE_TRACKER_GATE_APPROVE_AS_IS : STAGE_TRACKER_GATE_LABELS[id] || id, posts: STAGE_TRACKER_GATE_POSTS[id] || '' })); + } + // Pure: the status segment's words — "Needs human · review, sentinel". + function stageTrackerHumanGateStatusText(reasons) { + return STAGE_TRACKER_GATE_WORD + (reasons && reasons.length ? ' · ' + reasons.map(r => r.key).join(', ') : ''); + } + // Pure: the status segment's hover — one line per reason. + function stageTrackerHumanGateTip(reasons) { + return (reasons || []).map(r => r.key + ': ' + r.tip).join('\n'); + } + // Pure: whether a verb is enabled for this viewer and why not. The + // row's own lead actions (server-judged delegate, approve) are trusted + // first; the rest follow the hold permission the endpoints share. + function stageTrackerHumanGateVerbState(id, item, ctx, leads) { + const lead = (leads || []).find(a => a && a.id === id); + if (lead) return { enabled: lead.enabled !== false, why: lead.enabled === false ? String(lead.why || '') : '' }; + return typeof stageTrackerActionAllowed === 'function' ? stageTrackerActionAllowed(id, ctx) : { enabled: true, why: '' }; + } + function stageTrackerHumanGateVerbHtml(item, v, state, more) { + const ref = typeof stageTrackerRefOf === 'function' ? stageTrackerRefOf(item) : ''; + const tip = state.enabled ? v.posts : state.why; + const attrs = `data-ham-act="${esc(v.id)}"${state.enabled ? '' : ' aria-disabled="true"'}${tip ? ` title="${esc(tip)}"` : ''} aria-label="${esc(v.label + (ref ? ' — ' + ref : ''))}"`; + if (more) return ``; + return ``; + } + // Pure: the pill. '' when the row has no gate. The status segment is + // the decision popover's trigger when the row carries a decision, else + // a plain segment with the reasons as its hover. + function stageTrackerHumanGateHtml(item, shown, nowMs, subRows, opts) { + shown = shown || item; + if (!item) return ''; + const reasons = stageTrackerHumanGateReasons(shown); + if (!reasons.length) return ''; + // A secondary row of a shared PR (drawn under another issue's row, + // hivecommons/hive#17333) never carries the gate: the primary row + // does, and this row's only control is the chip that links to it. + if (opts && opts.sharedUnder) { + if (typeof stageTrackerItemKey !== 'function') return ''; + const under = Number(opts.sharedUnder); + const lp = (Array.isArray(item.linked_prs) ? item.linked_prs : []).find(x => x && Number(x.drawn_under) === under) || (shown.via_pr ? { number: shown.number } : null); + const prNum = Number(lp && lp.number) || 0; + const row = stageTrackerItemKey({ repo: item.repo, kind: 'issue', number: under }); + const to = prNum ? stageTrackerItemKey({ repo: item.repo, kind: 'pr', number: prNum }) : row; + return ``; + } + const ctx = typeof stageTrackerActionCtx === 'function' ? stageTrackerActionCtx(item.repo) : null; + if (ctx) { ctx.nowMs = typeof nowMs === 'number' ? nowMs : Date.now(); ctx.rows = typeof _stageTrackerRows !== 'undefined' ? _stageTrackerRows : null; } + const leads = ctx && typeof stageTrackerLeadActionsOnRow === 'function' ? stageTrackerLeadActionsOnRow(item, ctx, subRows) : []; + // The decision lives on another listed row: that row carries the + // gate; this one only points at it. + const passive = leads.find(a => a && a.passive); + if (passive) return typeof stageTrackerLeadPillHtml === 'function' ? stageTrackerLeadPillHtml(item, passive) : ''; + // A gate owed on a PR drawn under this issue row renders on that sub-row. + if (Array.isArray(subRows) && subRows.length && item.kind === 'issue' && !item.via_pr && !leads.length && subRows.some(s => stageTrackerHumanGateReasons(s).length)) return ''; + const verbs = stageTrackerHumanGateVerbs(reasons, shown); + const text = stageTrackerHumanGateStatusText(reasons); + const tip = stageTrackerHumanGateTip(reasons); + const ico = typeof stageTrackerIcon === 'function' ? stageTrackerIcon('human', 'ham-ico ham-mod-ico') : ''; + const inner = `${ico}${esc(text)}`; + const decision = typeof stageTrackerDecisionOf === 'function' ? stageTrackerDecisionOf(item) : null; + const status = decision && typeof stageTrackerDecisionTriggerHtml === 'function' + ? stageTrackerDecisionTriggerHtml(decision, inner, tip, 'ham-gate-status ham-mod-ask') + : `${inner}`; + const shownVerbs = verbs.slice(0, STAGE_TRACKER_GATE_VISIBLE); + const moreVerbs = verbs.slice(STAGE_TRACKER_GATE_VISIBLE); + const acts = shownVerbs.map(v => stageTrackerHumanGateVerbHtml(item, v, stageTrackerHumanGateVerbState(v.id, shown, ctx, leads), false)).join(''); + const more = moreVerbs.length ? `` : ''; + const key = typeof stageTrackerItemKey === 'function' ? stageTrackerItemKey(item) : ''; + return `${status}${acts}${more}`; + } + // The pill's optimistic state after one of its verbs ran: the status + // reads "settling…" until the next snapshot re-renders the row. + function stageTrackerHumanGateSettling(button) { + const gate = button && button.closest ? button.closest('.ham-human-gate') : null; + if (!gate) return; + gate.classList.add('ham-gate-settling'); + const word = gate.querySelector('.ham-gate-status .ham-mod-word'); + if (word) word.textContent = STAGE_TRACKER_GATE_SETTLING; + gate.querySelectorAll('.ham-gate-act').forEach(b => b.setAttribute('aria-disabled', 'true')); + } + // The `…` menu: open / close on its button, close on outside click or + // Escape, the same popover pattern the row's ⋯ menu uses. + function stageTrackerWireHumanGate(el) { + if (!el || el._hamGateWired) return; + el._hamGateWired = true; + const closeAll = () => el.querySelectorAll('.ham-gate-menu:not([hidden])').forEach(m => { m.hidden = true; const b = m.previousElementSibling; if (b) b.setAttribute('aria-expanded', 'false'); }); + el.addEventListener('click', e => { + const b = e.target.closest ? e.target.closest('[data-ham-gate-more]') : null; + if (!b) { if (!(e.target.closest && e.target.closest('.ham-gate-menu'))) closeAll(); return; } + e.preventDefault(); e.stopPropagation(); + const menu = b.nextElementSibling; + const open = menu && menu.hidden; + closeAll(); + if (menu && open) { menu.hidden = false; b.setAttribute('aria-expanded', 'true'); const first = menu.querySelector('[role="menuitem"]'); if (first) first.focus(); } + }); + el.addEventListener('keydown', e => { if (e.key === 'Escape') closeAll(); }); + } diff --git a/src/pkg/dashboard/static-src/js/tracker-row-layout.js b/src/pkg/dashboard/static-src/js/tracker-row-layout.js index b373f9add8..72485206b8 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row-layout.js +++ b/src/pkg/dashboard/static-src/js/tracker-row-layout.js @@ -271,10 +271,11 @@ const subKey = stageTrackerItemKey(pr); const humanNote = typeof stageTrackerHumanContextHtml === 'function' ? stageTrackerHumanContextHtml(pr, stages, nowMs, undefined, ctx, subKey) : ''; const noteCtx = humanNote && typeof stageTrackerNoteTakenCtx === 'function' ? stageTrackerNoteTakenCtx(ctx, subKey) : ctx; + const prGate = typeof stageTrackerHumanGateHtml === 'function' ? stageTrackerHumanGateHtml(pr, pr, nowMs) : ''; return `
    ${typeof stageTrackerRowToolsHtml === 'function' ? stageTrackerRowToolsHtml(pr) : ''}
    - ${stageTrackerHeadColsHtml([ref], '', stageTrackerActedBadgeHtml(pr, nowMs) + stageTrackerChipsHtml(pr) + (typeof stageTrackerLeadButtonHtml === 'function' ? stageTrackerLeadButtonHtml(pr, nowMs) : '') + (typeof stageTrackerNotesButtonHtml === 'function' ? stageTrackerNotesButtonHtml(pr, hamNotesCtx(pr)) : ''))} + ${stageTrackerHeadColsHtml([ref], '', stageTrackerActedBadgeHtml(pr, nowMs) + stageTrackerChipsHtml(pr, { gate: !!prGate }) + (prGate || (typeof stageTrackerLeadButtonHtml === 'function' ? stageTrackerLeadButtonHtml(pr, nowMs) : '')) + (typeof stageTrackerNotesButtonHtml === 'function' ? stageTrackerNotesButtonHtml(pr, hamNotesCtx(pr)) : ''))}
    ${typeof stageTrackerPreparationNodeHtml === 'function' ? stageTrackerPreparationNodeHtml(pr, stages, ctx) : ''} diff --git a/src/pkg/dashboard/static-src/js/tracker-row-render.js b/src/pkg/dashboard/static-src/js/tracker-row-render.js index 1148d03d86..63c8f4f4b3 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row-render.js +++ b/src/pkg/dashboard/static-src/js/tracker-row-render.js @@ -196,14 +196,19 @@ const rowKey = stageTrackerItemKey(item); const humanNote = typeof stageTrackerHumanContextHtml === 'function' ? stageTrackerHumanContextHtml(item, stages, nowMs, subRows, ctx, rowKey) : ''; const noteCtx = humanNote && typeof stageTrackerNoteTakenCtx === 'function' ? stageTrackerNoteTakenCtx(ctx, rowKey) : ctx; + // One human-gate pill per gated row (hivecommons/hive#17470): it + // absorbs the sentinel / hold / needs-human chips and the lead verbs; + // a secondary row of a shared PR gets only the chip that links to its + // primary. Guarded: the harnesses load helpers by name. + const gate = typeof stageTrackerHumanGateHtml === 'function' ? stageTrackerHumanGateHtml(item, shown, nowMs, subRows, { sharedUnder }) : ''; return `
    ${stageTrackerRowToolsHtml(item)}
    - ${stageTrackerHeadColsHtml(prRefs, leadHtml, stageTrackerActedBadgeHtml(item, nowMs) + stageTrackerChipsHtml(shown) + (typeof stageTrackerLeadButtonHtml === 'function' ? stageTrackerLeadButtonHtml(item, nowMs, subRows) : '') + (typeof stageTrackerNotesButtonHtml === 'function' ? stageTrackerNotesButtonHtml(item, hamNotesCtx(item)) : ''), prTargetKey)} + ${stageTrackerHeadColsHtml(prRefs, leadHtml, stageTrackerActedBadgeHtml(item, nowMs) + stageTrackerChipsHtml(shown, { gate: !!gate }) + (gate || (typeof stageTrackerLeadButtonHtml === 'function' ? stageTrackerLeadButtonHtml(item, nowMs, subRows) : '')) + (typeof stageTrackerNotesButtonHtml === 'function' ? stageTrackerNotesButtonHtml(item, hamNotesCtx(item)) : ''), prTargetKey)}
    ${typeof stageTrackerPreparationNodeHtml === 'function' ? stageTrackerPreparationNodeHtml(item, stages, ctx) : ''} -
      ${stageTrackerStripItems(shown, stages, range, nowMs, ctx)}
    +
      ${stageTrackerStripItems(shown, stages, range, nowMs, sharedUnder ? Object.assign({}, ctx, { gateElsewhere: true }) : ctx)}
    ${stageTrackerSinceHtml(shown, nowMs)}${typeof stageTrackerPillHtml === 'function' ? stageTrackerPillHtml(shown, stages, range, nowMs, ctx) : ''}
    ${humanNote}${stageTrackerCurrentStageHtml(shown, stages, range, nowMs)}${typeof stageTrackerPreparationCommentHtml === 'function' ? stageTrackerPreparationCommentHtml(shown, noteCtx, rowKey) : typeof stageTrackerEventHtml === 'function' ? stageTrackerEventHtml(rowKey, noteCtx) : ''}${typeof stageTrackerExecutionHtml === 'function' ? stageTrackerExecutionHtml(shown) : ''}${typeof stageTrackerReviewNotesHtml === 'function' ? stageTrackerReviewNotesHtml(item, ctx) : ''}${typeof stageTrackerNotesPanelHtml === 'function' ? stageTrackerNotesPanelHtml(item, hamNotesCtx(item)) : ''}${subs}
    `; diff --git a/src/pkg/dashboard/static-src/js/tracker-row-strip.js b/src/pkg/dashboard/static-src/js/tracker-row-strip.js index 86c75c68be..9823d98734 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row-strip.js +++ b/src/pkg/dashboard/static-src/js/tracker-row-strip.js @@ -386,7 +386,7 @@ // The lit track of a 085 PR a person acts on wears an amber marker // (ham-human-gated): the chevron is the real stage, the gate is the // needs-human pill beside it (hivecommons/hive#17453). - const humanGated = lit && typeof stageTrackerPersonActsOnPR === 'function' && stageTrackerPersonActsOnPR(item); + const humanGated = lit && !(opts && opts.gateElsewhere) && ((typeof stageTrackerPersonActsOnPR === 'function' && stageTrackerPersonActsOnPR(item)) || (typeof stageTrackerHumanGateReasons === 'function' && stageTrackerHumanGateReasons(item).length > 0)); const cls = lit ? 'active' + (stalled ? ' ham-stalled' : '') + (humanGated ? ' ham-human-gated' : '') : (finished ? 'done' : finding ? 'failing' : settled ? 'done decided' : 'todo') + (queued ? ' ham-track-queued' : ''); const approvalPending = kind === 'ci' && matches ? stageTrackerWorkflowApprovalPending(a) : 0; const humanAction = approvalPending > 0 ? STAGE_TRACKER_WORKFLOW_APPROVAL_TIP : kind === 'review' && state === 'human_decision' ? 'Needs a person\'s decision' : ''; @@ -534,14 +534,15 @@ const col50 = segs.find(sg => sg.number === 50); const leadTrack = col50 && typeof stageTrackerLeadTrack === 'function' ? stageTrackerLeadTrack(item, col50.state === 'active', stalledTrack) : ''; return segs.map(sg => { - if (sg.number === 50) return ['ci', 'review'].map(kind => stageTrackerActivityTrackHtml(item, kind, sg, sg.number < from || sg.number > to, nowMs, { stalled: stalledTrack === kind, lead: leadTrack })).join(''); + if (sg.number === 50) return ['ci', 'review'].map(kind => stageTrackerActivityTrackHtml(item, kind, sg, sg.number < from || sg.number > to, nowMs, { stalled: stalledTrack === kind, lead: leadTrack, gateElsewhere: !!(ctx && ctx.gateElsewhere) })).join(''); if (sg.number < from || sg.number > to) return `
  • `; - const sentinel = !!(sg.detour && sg.detour.sentinel); - const sentinelSuffix = !!(sg.detour && sg.detour.sentinelSuffix); - const heldGate = !!(sg.detour && sg.detour.held); + // The one bar-level sign of a human gate: the lit chevron's amber + // outline. The reasons and verbs live in the human-gate pill; a + // secondary row of a shared PR (ctx.gateElsewhere) wears neither. + const gateHere = sg.state === 'active' && !sg.cap && !(ctx && ctx.gateElsewhere) && typeof stageTrackerHumanGateReasons === 'function' && stageTrackerHumanGateReasons(item).length > 0; const fixPushed = sg.number === 30 && sg.state === 'done' && remediation === 'fix_pushed'; const blockerNote = sg.state === 'done' && sg.blockerNote ? String(sg.blockerNote) : ''; - const cls = ['ham-seg', sg.state, sg.cap ? 'cap' : '', sg.state === 'active' && !sg.cap && waitingOnTracks ? 'ham-settled-current' : '', fixPushed ? 'ham-fix-pushed' : '', blockerNote ? 'ham-blocker-note' : '', sg.state === 'active' && sg.number === 30 && remediation ? 'ham-remediation-' + remediation : '', sg.cap && sg.terminal ? 'merged' : '', sg.detour ? 'detoured' : '', sg.hold ? 'ham-open-hold' : '', sg.blocked ? 'ham-open-blocked' : '', sg.draft ? 'ham-open-draft' : '', sg.isNew ? 'ham-open-new' : '', sg.advisory ? 'ham-open-advisory' : '', sg.openSince && sg.openSince.stale ? 'ham-open-stale' : '', sentinel || sentinelSuffix ? 'ham-sentinel' : '', heldGate ? 'ham-held' : ''].filter(Boolean).join(' '); + const cls = ['ham-seg', sg.state, sg.cap ? 'cap' : '', sg.state === 'active' && !sg.cap && waitingOnTracks ? 'ham-settled-current' : '', fixPushed ? 'ham-fix-pushed' : '', blockerNote ? 'ham-blocker-note' : '', sg.state === 'active' && sg.number === 30 && remediation ? 'ham-remediation-' + remediation : '', sg.cap && sg.terminal ? 'merged' : '', sg.detour ? 'detoured' : '', sg.hold ? 'ham-open-hold' : '', sg.blocked ? 'ham-open-blocked' : '', sg.draft ? 'ham-open-draft' : '', sg.isNew ? 'ham-open-new' : '', sg.advisory ? 'ham-open-advisory' : '', sg.openSince && sg.openSince.stale ? 'ham-open-stale' : '', gateHere ? 'ham-human-gated' : ''].filter(Boolean).join(' '); const active = sg.state === 'active'; let tip = ''; let gateCaption = ''; @@ -565,7 +566,6 @@ else if (curStage === 100) tip = sg.label + ' — admitted, merging'; // Why a person merges a 090 PR leads its tooltip (hivecommons/hive#14658). // The reason is the whole story; the stage description would only repeat it (hivecommons/hive#15394). - else if (heldGate && typeof stageTrackerHeldTip === 'function') tip = stageTrackerHeldTip(item, nowMs); else if (curStage === STAGE_TRACKER_READY_FOR_HUMAN_MERGE && item.human_merge_reason_text) tip = ((sg.detour && sg.detour.text) || sg.label) + ' — ' + String(item.human_merge_reason_text).trim(); // A refusal on an earlier head is history, not the word: the // chevron reads the live stage and the hover keeps "merge attempt @@ -574,10 +574,6 @@ if (priorNote) tip += ' — ' + priorNote; if (actorTip && !sg.cap) tip += actorTip; if (claimant && !sg.cap) tip += ' · ' + stageTrackerClaimantLine(claimant, nowMs); - // The sentinel's reason leads the lane tooltip so the security - // implication is read before the stage mechanics. - if (sentinel) tip = stageTrackerSentinelTip(item) + ' — ' + tip; - else if (sentinelSuffix) tip = tip + ' — ' + stageTrackerSentinelTip(item); // Working or waiting leads: what happens now, or what it waits on. if (!sg.cap && typeof stageTrackerCueLead === 'function') tip = stageTrackerCueLead(item, worker, nowMs) + tip; if (sg.number === 30 && item.code_activity && Number(item.display_column) === 30) { @@ -636,9 +632,11 @@ const tipID = 'ham-chevron-tip-' + [item.repo || '', item.kind || '', item.number || 0, sg.number].map(x => encodeURIComponent(String(x))).join('-'); const caption = gateWord || word; const text = decision ? stageTrackerDecisionTriggerHtml(decision, caption, fullTip) : caption; - // Deferred to a running track: the icon alone (a decision trigger - // keeps its button, since the popover lives in the word). - const content = waitingOnTracks && !sg.cap && !decision ? stageTrackerIcon(sg.number, 'ham-ico') : `${gateCue}${workIco}${text}${actorIco || holderIco || progressIco}`; + // Deferred to a running track: the icon alone. A decision's + // popover rides the human-gate pill's status segment then, so no + // dim "Needs human …" words sit in the PR-in-progress slot + // (hivecommons/hive#17470). + const content = waitingOnTracks && !sg.cap ? stageTrackerIcon(sg.number, 'ham-ico') : `${gateCue}${workIco}${text}${actorIco || holderIco || progressIco}`; // A decision's dialog is its sole hover/focus detail surface. inner = decision ? `${content}` : `${content}${esc(fullTip)}`; } else if (fixPushed) { @@ -656,7 +654,7 @@ const tipID = 'ham-chevron-tip-' + [item.repo || '', item.kind || '', item.number || 0, sg.number].map(x => encodeURIComponent(String(x))).join('-'); inner = `${stageTrackerIcon(sg.number, 'ham-ico')}${esc(blockerNote)}${stageTrackerIcon('human', 'ham-ico ham-actor-ico', 'Next move: human')}${esc(noteTip)}`; } else inner = stageTrackerIcon(sg.number, 'ham-ico'); - return `
  • ${inner}
  • `; + return `
  • ${inner}
  • `; }).join(''); } @@ -779,6 +777,8 @@ // carries none of these and sits on a hive-driven stage is the hive's // to work through, so the dashboard must not dress it as a human call. const STAGE_TRACKER_HUMAN_MODS = ['hold', 'unauthorized', 'needs-human', 'needs-decision', 'needs-rebase', 'blocked', 'stalled']; + // The modifiers the one human-gate pill absorbs when a row renders it. + const STAGE_TRACKER_GATE_MODS = ['hold', 'needs-human', 'needs-decision']; // The pill says what happened in words ("stage ↓" read as a sort glyph, // hivecommons/hive#17335); after a push it says what caused the fall. const STAGE_TRACKER_HANDLED_TEXT = 'stage reset', STAGE_TRACKER_HANDLED_PUSH_TEXT = 'stage reset by push'; @@ -918,7 +918,7 @@ return `${esc(text)}`; } function stageTrackerSentinelChipHtml(item) { - if (!item || !item.sentinel_alert || stageTrackerSentinelInLane(item) || stageTrackerSentinelAsSuffix(item) || stageTrackerDeferredMods(item).indexOf(STAGE_TRACKER_SENTINEL_CHIP) >= 0) return ''; + if (!item || !item.sentinel_alert || stageTrackerDeferredMods(item).indexOf(STAGE_TRACKER_SENTINEL_CHIP) >= 0) return ''; const label = item.sentinel_notice ? 'Informational security notice' : 'Sentinel alert'; return `${esc(STAGE_TRACKER_SENTINEL_CHIP)}`; } @@ -960,9 +960,13 @@ const parked = Number(lp.stage) === STAGE_TRACKER_NEEDS_DECISION || (Array.isArray(lp.modifiers) && lp.modifiers.indexOf('needs-decision') >= 0) || !!(lp.decision_needed && lp.decision_needed.question); return parked ? lp : null; } - function stageTrackerChipsHtml(item) { - const sentinel = stageTrackerSentinelChipHtml(item) + (typeof stageTrackerPreparationChipHtml === 'function' ? stageTrackerPreparationChipHtml(item) : '') + (typeof stageTrackerAdoptionChipHtml === 'function' ? stageTrackerAdoptionChipHtml(item) : '') + (typeof stageTrackerPresenceChipHtml === 'function' ? stageTrackerPresenceChipHtml(item) : '') + (typeof stageTrackerPushChipHtml === 'function' ? stageTrackerPushChipHtml(item, Date.now()) : '') + (typeof stageTrackerReroutePillHtml === 'function' ? stageTrackerReroutePillHtml(item) : '') + (typeof stageTrackerSupersedesChipHtml === 'function' ? stageTrackerSupersedesChipHtml(item, Date.now()) : '') + (typeof stageTrackerOverlapBadgeHtml === 'function' ? stageTrackerOverlapBadgeHtml(item) : ''); + function stageTrackerChipsHtml(item, opts) { + // opts.gate: the row renders the one human-gate pill, which carries the + // sentinel / hold / needs-human reasons itself — those chips step aside. + const gated = !!(opts && opts.gate); + const sentinel = (gated ? '' : stageTrackerSentinelChipHtml(item)) + (typeof stageTrackerPreparationChipHtml === 'function' ? stageTrackerPreparationChipHtml(item) : '') + (typeof stageTrackerAdoptionChipHtml === 'function' ? stageTrackerAdoptionChipHtml(item) : '') + (typeof stageTrackerPresenceChipHtml === 'function' ? stageTrackerPresenceChipHtml(item) : '') + (typeof stageTrackerPushChipHtml === 'function' ? stageTrackerPushChipHtml(item, Date.now()) : '') + (typeof stageTrackerReroutePillHtml === 'function' ? stageTrackerReroutePillHtml(item) : '') + (typeof stageTrackerSupersedesChipHtml === 'function' ? stageTrackerSupersedesChipHtml(item, Date.now()) : '') + (typeof stageTrackerOverlapBadgeHtml === 'function' ? stageTrackerOverlapBadgeHtml(item) : ''); const mods = (Array.isArray(item.modifiers) ? item.modifiers.slice() : []) + .filter(m => !gated || STAGE_TRACKER_GATE_MODS.indexOf(m) < 0) .sort((x, y) => STAGE_TRACKER_MOD_PRIORITY.indexOf(x) - STAGE_TRACKER_MOD_PRIORITY.indexOf(y)); // A 085 PR a person acts on lights its real stage (CI / Review), so // the chevron no longer says "Needs human decision": the ask rides @@ -970,7 +974,7 @@ // re-adds the modifier (stageTrackerApplyPersonActsOnPRPill); this // covers a payload that predates it. Any pill that already names the // person owed (unauthorized, hold …) stands in for it. - if (item.kind === 'pr' && !mods.some(m => STAGE_TRACKER_HUMAN_MODS.indexOf(m) >= 0) && typeof stageTrackerPersonActsOnPR === 'function' && stageTrackerPersonActsOnPR(item)) { + if (!gated && item.kind === 'pr' && !mods.some(m => STAGE_TRACKER_HUMAN_MODS.indexOf(m) >= 0) && typeof stageTrackerPersonActsOnPR === 'function' && stageTrackerPersonActsOnPR(item)) { mods.push('needs-decision'); mods.sort((x, y) => STAGE_TRACKER_MOD_PRIORITY.indexOf(x) - STAGE_TRACKER_MOD_PRIORITY.indexOf(y)); } @@ -1058,7 +1062,7 @@ approve: 'Approve', 'give-direction': 'Give direction', 'close-superseded': 'Close as superseded', wontfix: "Close as won't-fix", 'close-read': 'Closed', 'close-issue': 'Close issue', 'let-hive-decide': 'Let hive decide', hold: 'Hold', release: 'Release hold', 'accept-triage': 'Accept triage', 'mark-needs-human': 'Mark needs-human', 'queue-merge': 'Approve and let hive merge', 'merge-now': 'Merge now as maintainer', - adopt: 'Adopt', 'adopt-now': 'Adopt now', reroute: 'Reroute to another clanker', + adopt: 'Adopt', 'adopt-now': 'Adopt now', reroute: 'Reroute to another clanker', 'confirm-sentinel': 'Confirm safe', // Historical ledger entries only: the hive now re-authors its own // exhausted PRs itself and a person's rewrite of a contributor PR is adopt. 're-author': 'Re-author (now: adopt)', diff --git a/src/pkg/dashboard/static-src/js/tracker-row.js b/src/pkg/dashboard/static-src/js/tracker-row.js index 61eaa4500d..6f72f8dfda 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row.js +++ b/src/pkg/dashboard/static-src/js/tracker-row.js @@ -11,33 +11,26 @@ const curStage = byNum[cur] || {}; const anchor = stageTrackerAnchor(cur, stages, item.via_pr ? 'pr' : item.kind, item); const terminal = anchor >= STAGE_TRACKER_TERMINAL; - const sentinelLane = stageTrackerSentinelInLane(item); // A 071 / 072 row whose author has pushed is back with the hive: the // chevron reads the column's own word ("CI / Review"), not "Needs // @author" (hivecommons/hive#15784). Guarded: the harnesses load by name. const pushedBack = (cur === 71 || cur === 72) && typeof stageTrackerPushedBack === 'function' && stageTrackerPushedBack(item); const detour = (!terminal && !pushedBack && STAGE_TRACKER_PATH.indexOf(cur) < 0 && cur !== STAGE_TRACKER_TRIAGE_NEEDED && cur !== STAGE_TRACKER_POSSIBLY_EXISTS && cur !== STAGE_TRACKER_OPEN_FOR_DISCUSSION && cur !== 40 && cur !== 60 && cur !== STAGE_TRACKER_PRE_MERGE_SOAK && cur !== 100) - ? { text: sentinelLane ? STAGE_TRACKER_SENTINEL_WORD : (cur === STAGE_TRACKER_HUMAN_GATED && typeof stageTrackerTrainWord === 'function' && stageTrackerTrainWord(item)) || (cur === STAGE_TRACKER_READY_FOR_HUMAN_MERGE && item.manual_merge ? stageTrackerManualMergeWord(item) : (cur === STAGE_TRACKER_HUMAN_GATED && stageTrackerUnauthorizedWord(item)) || (typeof stageTrackerBlockerWord === 'function' && cur === STAGE_TRACKER_ISSUE_NEEDS_DECISION && stageTrackerBlockerWord(item)) || ((cur === STAGE_TRACKER_ADOPTED_BY_HIVE || (cur === STAGE_TRACKER_HUMAN_GATED && item.adopted_by_state)) && stageTrackerAdoptedWord(item)) || (cur === STAGE_TRACKER_READY_FOR_HUMAN_MERGE && stageTrackerReadyForHumanWord(item, STAGE_TRACKER_ACTIVE_WORD[cur] || curStage.short || curStage.label || String(cur))) || (STAGE_TRACKER_ACTIVE_WORD[cur] || curStage.short || curStage.label || String(cur))), sentinel: sentinelLane } : null; - if (detour && cur === 70 && !detour.sentinel && typeof stageTrackerFixingWord === 'function') detour.text = stageTrackerFixingWord(item, detour.text); - // A 090 row a sentinel alert or hold label gates: the Merge queue - // cell reads "Held · …" (amber), never "Queued" — the gate is a pill - // on the real stage, not a stage (hivecommons/hive#17327). - if (detour && cur === STAGE_TRACKER_READY_FOR_HUMAN_MERGE && typeof stageTrackerHeldWord === 'function') { - const held = stageTrackerHeldWord(item); - if (held) { detour.text = held; detour.held = true; detour.sentinel = false; } - } - // A bare "Needs human decision" (045 / 085) says why in the chevron - // itself — "Needs human · edits CI workflows" — when a short reason - // is known (rationguard#480: "what does 'needs human' mean?"). A - // word already carrying its why (Blocked · …, Waiting for @x · …, - // the train, the sentinel) stands. - if (detour && (cur === STAGE_TRACKER_NEEDS_DECISION || cur === STAGE_TRACKER_ISSUE_NEEDS_DECISION) && !detour.sentinel && detour.text === STAGE_TRACKER_ACTIVE_WORD[cur] && typeof stageTrackerNeedsHumanWord === 'function') { - const nh = stageTrackerNeedsHumanWord(item); - if (nh) detour.text = nh; + ? { text: (cur === STAGE_TRACKER_HUMAN_GATED && typeof stageTrackerTrainWord === 'function' && stageTrackerTrainWord(item)) || (cur === STAGE_TRACKER_READY_FOR_HUMAN_MERGE && item.manual_merge ? stageTrackerManualMergeWord(item) : (cur === STAGE_TRACKER_HUMAN_GATED && stageTrackerUnauthorizedWord(item)) || (typeof stageTrackerBlockerWord === 'function' && cur === STAGE_TRACKER_ISSUE_NEEDS_DECISION && stageTrackerBlockerWord(item)) || ((cur === STAGE_TRACKER_ADOPTED_BY_HIVE || (cur === STAGE_TRACKER_HUMAN_GATED && item.adopted_by_state)) && stageTrackerAdoptedWord(item)) || (cur === STAGE_TRACKER_READY_FOR_HUMAN_MERGE && stageTrackerReadyForHumanWord(item, STAGE_TRACKER_ACTIVE_WORD[cur] || curStage.short || curStage.label || String(cur))) || (STAGE_TRACKER_ACTIVE_WORD[cur] || curStage.short || curStage.label || String(cur))) } : null; + if (detour && cur === 70 && typeof stageTrackerFixingWord === 'function') detour.text = stageTrackerFixingWord(item, detour.text); + // A human gate (sentinel alert, hold label, a reviewer's question, a + // needs-decision park) is never a chevron word: the bar lights the + // real stage with the amber ham-human-gated outline and the one + // human-gate pill beside it names the reasons and carries the verbs + // (hivecommons/hive#17470: "needs human, approve, let hive decide all + // in the same line"). A 085 PR that is merge-ready still anchors at + // the Merge queue column and reads that column's own word there. + if (detour && cur === STAGE_TRACKER_NEEDS_DECISION && (item.kind === 'pr' || item.via_pr) && detour.text === STAGE_TRACKER_ACTIVE_WORD[cur]) { + detour.text = String((byNum[anchor] || {}).short || (byNum[anchor] || {}).label || detour.text); + detour.gate = true; } if (detour && (cur === 71 || cur === 72) && typeof stageTrackerReturnedWord === 'function') { detour.text = stageTrackerReturnedWord(item, detour.text); - detour.sentinelSuffix = stageTrackerSentinelAsSuffix(item); } const code = item.code_activity; const codeMatches = code && String(code.head || '') === String(item.head || ''); @@ -46,7 +39,7 @@ const clock = Number(nowMs) || Date.now(); const codeWorking = codeMatches && code.source === 'fix-dispatch+successful-edit+verified-git-worktree' && code.active && Number.isFinite(codeObserved) && codeObserved <= clock && clock - codeObserved <= activityFreshMS; const codeCaption = codeMatches ? (!codeWorking && code.state === 'fixing' ? 'Fix task assigned · activity unknown' : (code.state === 'fixing' ? String(code.caption || '').replace(/^Fixing\b/, 'Remediating') : code.caption)) : 'Code activity unknown'; - if (detour && !code && cur === 70 && !detour.sentinel) detour.text = 'Waiting for fixer · activity unknown'; + if (detour && !code && cur === 70) detour.text = 'Waiting for fixer · activity unknown'; if (detour && code && [70, 71, 72].includes(cur)) detour.text = codeCaption || detour.text; if (detour && code && cur === 74 && codeWorking) detour.text += ' · ' + codeCaption; if (detour && code && cur === 74 && !codeWorking) { diff --git a/src/pkg/dashboard/static-src/js/tracker-words-stage.js b/src/pkg/dashboard/static-src/js/tracker-words-stage.js index b139ee477a..d4beb03f76 100644 --- a/src/pkg/dashboard/static-src/js/tracker-words-stage.js +++ b/src/pkg/dashboard/static-src/js/tracker-words-stage.js @@ -18,7 +18,6 @@ // words come from the hive's sentinel (possible security override, // privilege escalation or codebase damage), so a maintainer reads the // security reason before the row's "needs human". - const STAGE_TRACKER_SENTINEL_WORD = 'Sentinel alert · needs human'; const STAGE_TRACKER_SENTINEL_CHIP = 'sentinel'; const STAGE_TRACKER_SENTINEL_TIP = 'Sentinel flagged security-relevant changes'; const STAGE_TRACKER_SENTINEL_TIP_FALLBACK = 'possible security override, privilege escalation or codebase damage — a maintainer must review before merge'; diff --git a/src/pkg/dashboard/static-src/js/tracker-words.js b/src/pkg/dashboard/static-src/js/tracker-words.js index 8105f4de56..b0e95b991e 100644 --- a/src/pkg/dashboard/static-src/js/tracker-words.js +++ b/src/pkg/dashboard/static-src/js/tracker-words.js @@ -512,48 +512,6 @@ const lines = stageTrackerSentinelPathLines(item); return lines.length ? tip + lines.map(l => '\n · ' + l).join('') : tip; } - // Whether the item's lit chevron word carries the alert itself (a PR - // parked at 085, an issue riding one, or a 090 row the gate holds — - // see stageTrackerHeldWord): the chip then adds nothing. - function stageTrackerSentinelInLane(item) { - const st = Number(item && item.stage) || 0; - return !!(item && item.sentinel_alert && !item.sentinel_notice) && (st === STAGE_TRACKER_NEEDS_DECISION || st === STAGE_TRACKER_READY_FOR_HUMAN_MERGE) && (item.kind === 'pr' || !!item.via_pr); - } - // A sentinel alert or a hold label is a gate on the PR's real stage, - // not a stage of its own (hivecommons/hive#17327): a green, reviewed - // PR stands in the Merge queue column at 090 and the column word says - // the gate — "Held · sentinel · confirm intent" / "Held · hold" — - // never "Queued for merge". '' when the row is not a held 090 PR. - const STAGE_TRACKER_HELD_SENTINEL_WORD = 'Held · sentinel · confirm intent'; - const STAGE_TRACKER_HELD_HOLD_WORD = 'Held · hold'; - const STAGE_TRACKER_HELD_NEVER_MERGES = 'Hive never merges this head while the gate stands.'; - function stageTrackerHeldWord(item) { - if (!item || (Number(item.stage) || 0) !== STAGE_TRACKER_READY_FOR_HUMAN_MERGE || !(item.kind === 'pr' || item.via_pr)) return ''; - if (item.sentinel_alert && !item.sentinel_notice) return STAGE_TRACKER_HELD_SENTINEL_WORD; - if ((Array.isArray(item.modifiers) && item.modifiers.indexOf('hold') >= 0) || (item.hold && item.hold.by)) return STAGE_TRACKER_HELD_HOLD_WORD; - return ''; - } - // Pure: the held cell's hover — the gate's own reason (the sentinel - // tip, or who holds it and why), then the route reason and the rule. - function stageTrackerHeldTip(item, nowMs) { - const word = stageTrackerHeldWord(item); - if (!word) return ''; - const lines = [word]; - if (word === STAGE_TRACKER_HELD_SENTINEL_WORD) lines.push(stageTrackerSentinelTip(item)); - else if (typeof stageTrackerHoldTip === 'function') { const ht = stageTrackerHoldTip(item, nowMs); if (ht) lines.push(ht); } - const reason = String(item.human_merge_reason_text || item.reason || '').trim(); - if (reason && lines.indexOf(reason) < 0) lines.push(reason); - lines.push(STAGE_TRACKER_HELD_NEVER_MERGES); - return lines.filter(Boolean).join('\n'); - } - // A returned PR (071/072) keeps its routing word — the human already - // acted, nothing is owed by the maintainer — and carries the alert as - // a " · sentinel" suffix instead (hivecommons/hive#15159); the chip - // then adds nothing. - function stageTrackerSentinelAsSuffix(item) { - const st = Number(item && item.stage) || 0; - return !!(item && item.sentinel_alert && !item.sentinel_notice) && (st === 71 || st === 72) && (item.kind === 'pr' || !!item.via_pr); - } // Pure: whose PR a 071/072 row waits on — the row's own author, or, for // an issue row drawn through its one covering PR (via_pr), that PR's // author. The issue's author is whoever filed it (on hive's hive the @@ -588,5 +546,5 @@ if (sup) text = 'Superseded by #' + sup + ' · decide'; else if (who.author && st === 71) text = 'Needs @' + who.author; else if (who.author && st === 72) text = 'Returned to @' + who.author + stageTrackerToolingSuffix(who.kind); - return text + (stageTrackerSentinelAsSuffix(item) ? ' · ' + STAGE_TRACKER_SENTINEL_CHIP : ''); + return text; } diff --git a/src/pkg/dashboard/static-src/manifest.txt b/src/pkg/dashboard/static-src/manifest.txt index 648feda4ea..2ba70649aa 100644 --- a/src/pkg/dashboard/static-src/manifest.txt +++ b/src/pkg/dashboard/static-src/manifest.txt @@ -90,6 +90,7 @@ js/tracker-integration-execution.js js/tracker-filter-render.js js/tracker-filter-fetch.js js/tracker-actions.js +js/tracker-human-gate.js js/tracker-merged.js js/tracker-queue.js js/tracker-sound.js diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index a775fe6a31..6a381c4519 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -1659,7 +1659,6 @@ status token the sentinel pill on the repo card already uses. */ .ham-badge-sentinel { color: var(--status-error); border-color: color-mix(in srgb, var(--status-error) 55%, transparent); font-weight: var(--fw-medium); } .ham-badge-sentinel.ham-sentinel-notice { color: var(--status-info); border-color: color-mix(in srgb, var(--status-info) 55%, transparent); } - .ham-seg.active.ham-sentinel { background: var(--status-error); color: var(--surface-0); } /* 072 adoption chip (maintainer-policy, hive PR 14524): "waiting on @author (maintainer, offline 26h) — adopt?" */ .ham-badge-adoption { color: var(--status-warn); border-color: color-mix(in srgb, var(--status-warn) 55%, transparent); font-weight: var(--fw-medium); } /* "supersedes N": the closed original a live PR replaced (hive PR 15135 follow-up). Muted — a trace, not a call to act. */ @@ -1819,12 +1818,10 @@ .ham-seg.active.ham-open-hold { background: var(--yellow); color: var(--surface-0); } /* A 090 row a sentinel alert or hold label gates (hivecommons/hive#17327): the Merge queue cell wears the pill amber — held, not queued, not red. */ - .ham-seg.active.ham-held { background: var(--amber); color: var(--surface-0); } - .ham-seg.active.ham-held .ham-detour::before { content: '⏸'; margin-right: var(--sp-1); } /* A 085 PR a person acts on lights its real stage — the CI / Review track — and that track wears an amber marker; the gate itself is the needs-human pill beside the row (hivecommons/hive#17453). */ - .ham-seg.ham-activity-track.active.ham-human-gated { outline: var(--focus-ring-width) solid var(--amber); outline-offset: calc(-1 * var(--focus-ring-width)); } + .ham-seg.active.ham-human-gated { outline: var(--focus-ring-width) solid var(--amber); outline-offset: calc(-1 * var(--focus-ring-width)); } .ham-seg.active.ham-open-hold .ham-seg-t::before { content: '⏸'; margin-right: var(--sp-1); } .ham-seg.active.ham-open-blocked { background: var(--yellow); color: var(--surface-0); } .ham-seg.active.ham-open-blocked .ham-seg-t::before { content: '⛔'; margin-right: var(--sp-1); } @@ -2324,6 +2321,28 @@ /* Busy (Let hive decide gathering its preview) also sets aria-disabled, so this compound rule sits after the disabled one and wins: the working colour, not faint/dashed. */ .ham-lead-act[aria-busy="true"][aria-disabled="true"] { cursor: progress; opacity: 1; border-style: solid; border-color: var(--cue-work); background: color-mix(in srgb, var(--cue-work) 10%, transparent); color: var(--cue-work); } + /* One human-gate control per gated row: a segmented pill whose left + segment names the reasons (👤 Needs human · review, sentinel) and whose + right segments are the verbs those reasons determine. Replaces the + scattered sentinel chip + Approve + Let hive decide + needs-human pill. */ + .ham-human-gate { display: inline-flex; align-items: stretch; max-width: 100%; border: var(--line-width) solid color-mix(in srgb, var(--amber) 60%, var(--line-subtle)); border-radius: var(--r-pill); background: color-mix(in srgb, var(--amber) 8%, var(--panel)); font-size: var(--fs-xs); line-height: 1.5; vertical-align: middle; } + .ham-human-gate > .ham-gate-status { display: inline-flex; align-items: center; gap: var(--sp-1); min-width: 0; padding: 0 var(--sp-2) 0 var(--sp-3); border: 0; border-radius: var(--r-pill) 0 0 var(--r-pill); background: transparent; color: var(--amber); font: inherit; font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + .ham-human-gate > .ham-gate-status > .ham-mod-word { overflow: hidden; text-overflow: ellipsis; } + .ham-human-gate > button.ham-gate-status { cursor: pointer; } + .ham-human-gate > button.ham-gate-status:hover, .ham-human-gate > button.ham-gate-status:focus-visible { text-decoration: underline; outline: none; } + .ham-human-gate > .ham-gate-act { border-radius: 0; border-top: 0; border-bottom: 0; border-right: 0; border-left-color: color-mix(in srgb, var(--amber) 35%, transparent); margin: 0; } + .ham-human-gate > .ham-gate-act.ham-act-secondary, .ham-human-gate > .ham-gate-more { --ham-act-fill: transparent; --ham-act-ink: var(--text); } + .ham-human-gate > .ham-gate-act:last-child, .ham-human-gate > .ham-gate-more:last-child { border-radius: 0 var(--r-pill) var(--r-pill) 0; } + .ham-human-gate > .ham-gate-act:hover, .ham-human-gate > .ham-gate-act:focus-visible { box-shadow: none; background: color-mix(in srgb, var(--amber) 22%, transparent); filter: none; } + .ham-human-gate > .ham-gate-act.ham-act-primary:hover, .ham-human-gate > .ham-gate-act.ham-act-primary:focus-visible { filter: brightness(1.12); } + .ham-human-gate > .ham-gate-more { padding-inline: var(--sp-2); } + .ham-human-gate > .ham-gate-more::after { content: none; } + .ham-human-gate > .ham-gate-more[aria-expanded="true"] { background: color-mix(in srgb, var(--amber) 22%, transparent); } + .ham-human-gate.ham-gate-settling { opacity: 0.75; border-style: dashed; } + .ham-human-gate.ham-gate-settling > .ham-gate-status { color: var(--cue-work); } + .ham-gate-menu[hidden] { display: none; } + /* The passive "decision pending on #N" chip is a link to the primary row. */ + .ham-decision-pending[data-ham-scroll-to] { text-decoration: underline dotted; text-underline-offset: var(--sp-1); } /* The technical background folds behind one collapsed Details. */ .ham-decision-details { margin: var(--sp-2) 0 0; font-size: var(--fs-xs); color: var(--text-muted); } .ham-decision-details > summary { cursor: pointer; color: var(--text-faint); } @@ -2351,6 +2370,8 @@ /* Stacked head: the ask pill is its person icon alone (#17453). */ .ham-head-cols .ham-badges > .ham-badge-mod.ham-mod-ask > .ham-mod-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } .ham-head-cols .ham-badges > .ham-badge-mod.ham-mod-ask > .ham-mod-ico { margin-right: 0; } + .ham-head-cols .ham-human-gate > .ham-gate-status > .ham-mod-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } + .ham-head-cols .ham-human-gate > .ham-gate-status { position: relative; padding-right: var(--sp-2); } .ham-row .ham-seg { padding: 0 var(--sp-2) 0 var(--sp-3); } .ham-row .ham-seg.cap { flex-basis: 2em; } .ham-since { width: 3em; } @@ -2583,6 +2604,10 @@ one-line box so a card row stays under the #17161 height budget; the hit area is padded out to the tap target like .ham-pill (#17453). */ #activity-monitor-section .ham-badge-mod.ham-decision-trigger { position: relative; } + /* Gate segments keep the one-line pill; each segment pads its hit area + out to the tap target so the phone harness sees ≥44×44. */ + #activity-monitor-section .ham-human-gate > .ham-gate-act, #activity-monitor-section .ham-human-gate > .ham-gate-more, #activity-monitor-section .ham-human-gate > button.ham-gate-status { position: relative; min-width: var(--tap-target); min-height: 0; padding-block: var(--sp-2); } + #activity-monitor-section .ham-human-gate > .ham-gate-act::before, #activity-monitor-section .ham-human-gate > .ham-gate-more::before, #activity-monitor-section .ham-human-gate > button.ham-gate-status::before { content: ""; position: absolute; inset: calc((1lh - var(--tap-target)) / 2) 0; } #activity-monitor-section .ham-badge-mod.ham-decision-trigger::before { content: ""; position: absolute; inset: calc((1lh - var(--tap-target)) / 2) calc((100% - var(--tap-target)) / 2); } /* A card keeps its two-line head and its density (#17161): the 🗒 shows on a phone only once the item has notes; the row's ⋯ menu @@ -16682,7 +16707,6 @@

    Where to get help

    // words come from the hive's sentinel (possible security override, // privilege escalation or codebase damage), so a maintainer reads the // security reason before the row's "needs human". - const STAGE_TRACKER_SENTINEL_WORD = 'Sentinel alert · needs human'; const STAGE_TRACKER_SENTINEL_CHIP = 'sentinel'; const STAGE_TRACKER_SENTINEL_TIP = 'Sentinel flagged security-relevant changes'; const STAGE_TRACKER_SENTINEL_TIP_FALLBACK = 'possible security override, privilege escalation or codebase damage — a maintainer must review before merge'; @@ -17910,48 +17934,6 @@

    Where to get help

    const lines = stageTrackerSentinelPathLines(item); return lines.length ? tip + lines.map(l => '\n · ' + l).join('') : tip; } - // Whether the item's lit chevron word carries the alert itself (a PR - // parked at 085, an issue riding one, or a 090 row the gate holds — - // see stageTrackerHeldWord): the chip then adds nothing. - function stageTrackerSentinelInLane(item) { - const st = Number(item && item.stage) || 0; - return !!(item && item.sentinel_alert && !item.sentinel_notice) && (st === STAGE_TRACKER_NEEDS_DECISION || st === STAGE_TRACKER_READY_FOR_HUMAN_MERGE) && (item.kind === 'pr' || !!item.via_pr); - } - // A sentinel alert or a hold label is a gate on the PR's real stage, - // not a stage of its own (hivecommons/hive#17327): a green, reviewed - // PR stands in the Merge queue column at 090 and the column word says - // the gate — "Held · sentinel · confirm intent" / "Held · hold" — - // never "Queued for merge". '' when the row is not a held 090 PR. - const STAGE_TRACKER_HELD_SENTINEL_WORD = 'Held · sentinel · confirm intent'; - const STAGE_TRACKER_HELD_HOLD_WORD = 'Held · hold'; - const STAGE_TRACKER_HELD_NEVER_MERGES = 'Hive never merges this head while the gate stands.'; - function stageTrackerHeldWord(item) { - if (!item || (Number(item.stage) || 0) !== STAGE_TRACKER_READY_FOR_HUMAN_MERGE || !(item.kind === 'pr' || item.via_pr)) return ''; - if (item.sentinel_alert && !item.sentinel_notice) return STAGE_TRACKER_HELD_SENTINEL_WORD; - if ((Array.isArray(item.modifiers) && item.modifiers.indexOf('hold') >= 0) || (item.hold && item.hold.by)) return STAGE_TRACKER_HELD_HOLD_WORD; - return ''; - } - // Pure: the held cell's hover — the gate's own reason (the sentinel - // tip, or who holds it and why), then the route reason and the rule. - function stageTrackerHeldTip(item, nowMs) { - const word = stageTrackerHeldWord(item); - if (!word) return ''; - const lines = [word]; - if (word === STAGE_TRACKER_HELD_SENTINEL_WORD) lines.push(stageTrackerSentinelTip(item)); - else if (typeof stageTrackerHoldTip === 'function') { const ht = stageTrackerHoldTip(item, nowMs); if (ht) lines.push(ht); } - const reason = String(item.human_merge_reason_text || item.reason || '').trim(); - if (reason && lines.indexOf(reason) < 0) lines.push(reason); - lines.push(STAGE_TRACKER_HELD_NEVER_MERGES); - return lines.filter(Boolean).join('\n'); - } - // A returned PR (071/072) keeps its routing word — the human already - // acted, nothing is owed by the maintainer — and carries the alert as - // a " · sentinel" suffix instead (hivecommons/hive#15159); the chip - // then adds nothing. - function stageTrackerSentinelAsSuffix(item) { - const st = Number(item && item.stage) || 0; - return !!(item && item.sentinel_alert && !item.sentinel_notice) && (st === 71 || st === 72) && (item.kind === 'pr' || !!item.via_pr); - } // Pure: whose PR a 071/072 row waits on — the row's own author, or, for // an issue row drawn through its one covering PR (via_pr), that PR's // author. The issue's author is whoever filed it (on hive's hive the @@ -17986,7 +17968,7 @@

    Where to get help

    if (sup) text = 'Superseded by #' + sup + ' · decide'; else if (who.author && st === 71) text = 'Needs @' + who.author; else if (who.author && st === 72) text = 'Returned to @' + who.author + stageTrackerToolingSuffix(who.kind); - return text + (stageTrackerSentinelAsSuffix(item) ? ' · ' + STAGE_TRACKER_SENTINEL_CHIP : ''); + return text; } // Which strip segment a stage lights: main stages light themselves, // 040 shares the PR in progress column with 030, 060 shares CI / Review @@ -18067,33 +18049,26 @@

    Where to get help

    const curStage = byNum[cur] || {}; const anchor = stageTrackerAnchor(cur, stages, item.via_pr ? 'pr' : item.kind, item); const terminal = anchor >= STAGE_TRACKER_TERMINAL; - const sentinelLane = stageTrackerSentinelInLane(item); // A 071 / 072 row whose author has pushed is back with the hive: the // chevron reads the column's own word ("CI / Review"), not "Needs // @author" (hivecommons/hive#15784). Guarded: the harnesses load by name. const pushedBack = (cur === 71 || cur === 72) && typeof stageTrackerPushedBack === 'function' && stageTrackerPushedBack(item); const detour = (!terminal && !pushedBack && STAGE_TRACKER_PATH.indexOf(cur) < 0 && cur !== STAGE_TRACKER_TRIAGE_NEEDED && cur !== STAGE_TRACKER_POSSIBLY_EXISTS && cur !== STAGE_TRACKER_OPEN_FOR_DISCUSSION && cur !== 40 && cur !== 60 && cur !== STAGE_TRACKER_PRE_MERGE_SOAK && cur !== 100) - ? { text: sentinelLane ? STAGE_TRACKER_SENTINEL_WORD : (cur === STAGE_TRACKER_HUMAN_GATED && typeof stageTrackerTrainWord === 'function' && stageTrackerTrainWord(item)) || (cur === STAGE_TRACKER_READY_FOR_HUMAN_MERGE && item.manual_merge ? stageTrackerManualMergeWord(item) : (cur === STAGE_TRACKER_HUMAN_GATED && stageTrackerUnauthorizedWord(item)) || (typeof stageTrackerBlockerWord === 'function' && cur === STAGE_TRACKER_ISSUE_NEEDS_DECISION && stageTrackerBlockerWord(item)) || ((cur === STAGE_TRACKER_ADOPTED_BY_HIVE || (cur === STAGE_TRACKER_HUMAN_GATED && item.adopted_by_state)) && stageTrackerAdoptedWord(item)) || (cur === STAGE_TRACKER_READY_FOR_HUMAN_MERGE && stageTrackerReadyForHumanWord(item, STAGE_TRACKER_ACTIVE_WORD[cur] || curStage.short || curStage.label || String(cur))) || (STAGE_TRACKER_ACTIVE_WORD[cur] || curStage.short || curStage.label || String(cur))), sentinel: sentinelLane } : null; - if (detour && cur === 70 && !detour.sentinel && typeof stageTrackerFixingWord === 'function') detour.text = stageTrackerFixingWord(item, detour.text); - // A 090 row a sentinel alert or hold label gates: the Merge queue - // cell reads "Held · …" (amber), never "Queued" — the gate is a pill - // on the real stage, not a stage (hivecommons/hive#17327). - if (detour && cur === STAGE_TRACKER_READY_FOR_HUMAN_MERGE && typeof stageTrackerHeldWord === 'function') { - const held = stageTrackerHeldWord(item); - if (held) { detour.text = held; detour.held = true; detour.sentinel = false; } - } - // A bare "Needs human decision" (045 / 085) says why in the chevron - // itself — "Needs human · edits CI workflows" — when a short reason - // is known (rationguard#480: "what does 'needs human' mean?"). A - // word already carrying its why (Blocked · …, Waiting for @x · …, - // the train, the sentinel) stands. - if (detour && (cur === STAGE_TRACKER_NEEDS_DECISION || cur === STAGE_TRACKER_ISSUE_NEEDS_DECISION) && !detour.sentinel && detour.text === STAGE_TRACKER_ACTIVE_WORD[cur] && typeof stageTrackerNeedsHumanWord === 'function') { - const nh = stageTrackerNeedsHumanWord(item); - if (nh) detour.text = nh; + ? { text: (cur === STAGE_TRACKER_HUMAN_GATED && typeof stageTrackerTrainWord === 'function' && stageTrackerTrainWord(item)) || (cur === STAGE_TRACKER_READY_FOR_HUMAN_MERGE && item.manual_merge ? stageTrackerManualMergeWord(item) : (cur === STAGE_TRACKER_HUMAN_GATED && stageTrackerUnauthorizedWord(item)) || (typeof stageTrackerBlockerWord === 'function' && cur === STAGE_TRACKER_ISSUE_NEEDS_DECISION && stageTrackerBlockerWord(item)) || ((cur === STAGE_TRACKER_ADOPTED_BY_HIVE || (cur === STAGE_TRACKER_HUMAN_GATED && item.adopted_by_state)) && stageTrackerAdoptedWord(item)) || (cur === STAGE_TRACKER_READY_FOR_HUMAN_MERGE && stageTrackerReadyForHumanWord(item, STAGE_TRACKER_ACTIVE_WORD[cur] || curStage.short || curStage.label || String(cur))) || (STAGE_TRACKER_ACTIVE_WORD[cur] || curStage.short || curStage.label || String(cur))) } : null; + if (detour && cur === 70 && typeof stageTrackerFixingWord === 'function') detour.text = stageTrackerFixingWord(item, detour.text); + // A human gate (sentinel alert, hold label, a reviewer's question, a + // needs-decision park) is never a chevron word: the bar lights the + // real stage with the amber ham-human-gated outline and the one + // human-gate pill beside it names the reasons and carries the verbs + // (hivecommons/hive#17470: "needs human, approve, let hive decide all + // in the same line"). A 085 PR that is merge-ready still anchors at + // the Merge queue column and reads that column's own word there. + if (detour && cur === STAGE_TRACKER_NEEDS_DECISION && (item.kind === 'pr' || item.via_pr) && detour.text === STAGE_TRACKER_ACTIVE_WORD[cur]) { + detour.text = String((byNum[anchor] || {}).short || (byNum[anchor] || {}).label || detour.text); + detour.gate = true; } if (detour && (cur === 71 || cur === 72) && typeof stageTrackerReturnedWord === 'function') { detour.text = stageTrackerReturnedWord(item, detour.text); - detour.sentinelSuffix = stageTrackerSentinelAsSuffix(item); } const code = item.code_activity; const codeMatches = code && String(code.head || '') === String(item.head || ''); @@ -18102,7 +18077,7 @@

    Where to get help

    const clock = Number(nowMs) || Date.now(); const codeWorking = codeMatches && code.source === 'fix-dispatch+successful-edit+verified-git-worktree' && code.active && Number.isFinite(codeObserved) && codeObserved <= clock && clock - codeObserved <= activityFreshMS; const codeCaption = codeMatches ? (!codeWorking && code.state === 'fixing' ? 'Fix task assigned · activity unknown' : (code.state === 'fixing' ? String(code.caption || '').replace(/^Fixing\b/, 'Remediating') : code.caption)) : 'Code activity unknown'; - if (detour && !code && cur === 70 && !detour.sentinel) detour.text = 'Waiting for fixer · activity unknown'; + if (detour && !code && cur === 70) detour.text = 'Waiting for fixer · activity unknown'; if (detour && code && [70, 71, 72].includes(cur)) detour.text = codeCaption || detour.text; if (detour && code && cur === 74 && codeWorking) detour.text += ' · ' + codeCaption; if (detour && code && cur === 74 && !codeWorking) { @@ -18850,7 +18825,7 @@

    Where to get help

    // The lit track of a 085 PR a person acts on wears an amber marker // (ham-human-gated): the chevron is the real stage, the gate is the // needs-human pill beside it (hivecommons/hive#17453). - const humanGated = lit && typeof stageTrackerPersonActsOnPR === 'function' && stageTrackerPersonActsOnPR(item); + const humanGated = lit && !(opts && opts.gateElsewhere) && ((typeof stageTrackerPersonActsOnPR === 'function' && stageTrackerPersonActsOnPR(item)) || (typeof stageTrackerHumanGateReasons === 'function' && stageTrackerHumanGateReasons(item).length > 0)); const cls = lit ? 'active' + (stalled ? ' ham-stalled' : '') + (humanGated ? ' ham-human-gated' : '') : (finished ? 'done' : finding ? 'failing' : settled ? 'done decided' : 'todo') + (queued ? ' ham-track-queued' : ''); const approvalPending = kind === 'ci' && matches ? stageTrackerWorkflowApprovalPending(a) : 0; const humanAction = approvalPending > 0 ? STAGE_TRACKER_WORKFLOW_APPROVAL_TIP : kind === 'review' && state === 'human_decision' ? 'Needs a person\'s decision' : ''; @@ -18998,14 +18973,15 @@

    Where to get help

    const col50 = segs.find(sg => sg.number === 50); const leadTrack = col50 && typeof stageTrackerLeadTrack === 'function' ? stageTrackerLeadTrack(item, col50.state === 'active', stalledTrack) : ''; return segs.map(sg => { - if (sg.number === 50) return ['ci', 'review'].map(kind => stageTrackerActivityTrackHtml(item, kind, sg, sg.number < from || sg.number > to, nowMs, { stalled: stalledTrack === kind, lead: leadTrack })).join(''); + if (sg.number === 50) return ['ci', 'review'].map(kind => stageTrackerActivityTrackHtml(item, kind, sg, sg.number < from || sg.number > to, nowMs, { stalled: stalledTrack === kind, lead: leadTrack, gateElsewhere: !!(ctx && ctx.gateElsewhere) })).join(''); if (sg.number < from || sg.number > to) return ``; - const sentinel = !!(sg.detour && sg.detour.sentinel); - const sentinelSuffix = !!(sg.detour && sg.detour.sentinelSuffix); - const heldGate = !!(sg.detour && sg.detour.held); + // The one bar-level sign of a human gate: the lit chevron's amber + // outline. The reasons and verbs live in the human-gate pill; a + // secondary row of a shared PR (ctx.gateElsewhere) wears neither. + const gateHere = sg.state === 'active' && !sg.cap && !(ctx && ctx.gateElsewhere) && typeof stageTrackerHumanGateReasons === 'function' && stageTrackerHumanGateReasons(item).length > 0; const fixPushed = sg.number === 30 && sg.state === 'done' && remediation === 'fix_pushed'; const blockerNote = sg.state === 'done' && sg.blockerNote ? String(sg.blockerNote) : ''; - const cls = ['ham-seg', sg.state, sg.cap ? 'cap' : '', sg.state === 'active' && !sg.cap && waitingOnTracks ? 'ham-settled-current' : '', fixPushed ? 'ham-fix-pushed' : '', blockerNote ? 'ham-blocker-note' : '', sg.state === 'active' && sg.number === 30 && remediation ? 'ham-remediation-' + remediation : '', sg.cap && sg.terminal ? 'merged' : '', sg.detour ? 'detoured' : '', sg.hold ? 'ham-open-hold' : '', sg.blocked ? 'ham-open-blocked' : '', sg.draft ? 'ham-open-draft' : '', sg.isNew ? 'ham-open-new' : '', sg.advisory ? 'ham-open-advisory' : '', sg.openSince && sg.openSince.stale ? 'ham-open-stale' : '', sentinel || sentinelSuffix ? 'ham-sentinel' : '', heldGate ? 'ham-held' : ''].filter(Boolean).join(' '); + const cls = ['ham-seg', sg.state, sg.cap ? 'cap' : '', sg.state === 'active' && !sg.cap && waitingOnTracks ? 'ham-settled-current' : '', fixPushed ? 'ham-fix-pushed' : '', blockerNote ? 'ham-blocker-note' : '', sg.state === 'active' && sg.number === 30 && remediation ? 'ham-remediation-' + remediation : '', sg.cap && sg.terminal ? 'merged' : '', sg.detour ? 'detoured' : '', sg.hold ? 'ham-open-hold' : '', sg.blocked ? 'ham-open-blocked' : '', sg.draft ? 'ham-open-draft' : '', sg.isNew ? 'ham-open-new' : '', sg.advisory ? 'ham-open-advisory' : '', sg.openSince && sg.openSince.stale ? 'ham-open-stale' : '', gateHere ? 'ham-human-gated' : ''].filter(Boolean).join(' '); const active = sg.state === 'active'; let tip = ''; let gateCaption = ''; @@ -19029,7 +19005,6 @@

    Where to get help

    else if (curStage === 100) tip = sg.label + ' — admitted, merging'; // Why a person merges a 090 PR leads its tooltip (hivecommons/hive#14658). // The reason is the whole story; the stage description would only repeat it (hivecommons/hive#15394). - else if (heldGate && typeof stageTrackerHeldTip === 'function') tip = stageTrackerHeldTip(item, nowMs); else if (curStage === STAGE_TRACKER_READY_FOR_HUMAN_MERGE && item.human_merge_reason_text) tip = ((sg.detour && sg.detour.text) || sg.label) + ' — ' + String(item.human_merge_reason_text).trim(); // A refusal on an earlier head is history, not the word: the // chevron reads the live stage and the hover keeps "merge attempt @@ -19038,10 +19013,6 @@

    Where to get help

    if (priorNote) tip += ' — ' + priorNote; if (actorTip && !sg.cap) tip += actorTip; if (claimant && !sg.cap) tip += ' · ' + stageTrackerClaimantLine(claimant, nowMs); - // The sentinel's reason leads the lane tooltip so the security - // implication is read before the stage mechanics. - if (sentinel) tip = stageTrackerSentinelTip(item) + ' — ' + tip; - else if (sentinelSuffix) tip = tip + ' — ' + stageTrackerSentinelTip(item); // Working or waiting leads: what happens now, or what it waits on. if (!sg.cap && typeof stageTrackerCueLead === 'function') tip = stageTrackerCueLead(item, worker, nowMs) + tip; if (sg.number === 30 && item.code_activity && Number(item.display_column) === 30) { @@ -19100,9 +19071,11 @@

    Where to get help

    const tipID = 'ham-chevron-tip-' + [item.repo || '', item.kind || '', item.number || 0, sg.number].map(x => encodeURIComponent(String(x))).join('-'); const caption = gateWord || word; const text = decision ? stageTrackerDecisionTriggerHtml(decision, caption, fullTip) : caption; - // Deferred to a running track: the icon alone (a decision trigger - // keeps its button, since the popover lives in the word). - const content = waitingOnTracks && !sg.cap && !decision ? stageTrackerIcon(sg.number, 'ham-ico') : `${gateCue}${workIco}${text}${actorIco || holderIco || progressIco}`; + // Deferred to a running track: the icon alone. A decision's + // popover rides the human-gate pill's status segment then, so no + // dim "Needs human …" words sit in the PR-in-progress slot + // (hivecommons/hive#17470). + const content = waitingOnTracks && !sg.cap ? stageTrackerIcon(sg.number, 'ham-ico') : `${gateCue}${workIco}${text}${actorIco || holderIco || progressIco}`; // A decision's dialog is its sole hover/focus detail surface. inner = decision ? `${content}` : `${content}${esc(fullTip)}`; } else if (fixPushed) { @@ -19120,7 +19093,7 @@

    Where to get help

    const tipID = 'ham-chevron-tip-' + [item.repo || '', item.kind || '', item.number || 0, sg.number].map(x => encodeURIComponent(String(x))).join('-'); inner = `${stageTrackerIcon(sg.number, 'ham-ico')}${esc(blockerNote)}${stageTrackerIcon('human', 'ham-ico ham-actor-ico', 'Next move: human')}${esc(noteTip)}`; } else inner = stageTrackerIcon(sg.number, 'ham-ico'); - return `
  • ${inner}
  • `; + return `
  • ${inner}
  • `; }).join(''); } @@ -19243,6 +19216,8 @@

    Where to get help

    // carries none of these and sits on a hive-driven stage is the hive's // to work through, so the dashboard must not dress it as a human call. const STAGE_TRACKER_HUMAN_MODS = ['hold', 'unauthorized', 'needs-human', 'needs-decision', 'needs-rebase', 'blocked', 'stalled']; + // The modifiers the one human-gate pill absorbs when a row renders it. + const STAGE_TRACKER_GATE_MODS = ['hold', 'needs-human', 'needs-decision']; // The pill says what happened in words ("stage ↓" read as a sort glyph, // hivecommons/hive#17335); after a push it says what caused the fall. const STAGE_TRACKER_HANDLED_TEXT = 'stage reset', STAGE_TRACKER_HANDLED_PUSH_TEXT = 'stage reset by push'; @@ -19382,7 +19357,7 @@

    Where to get help

    return `${esc(text)}`; } function stageTrackerSentinelChipHtml(item) { - if (!item || !item.sentinel_alert || stageTrackerSentinelInLane(item) || stageTrackerSentinelAsSuffix(item) || stageTrackerDeferredMods(item).indexOf(STAGE_TRACKER_SENTINEL_CHIP) >= 0) return ''; + if (!item || !item.sentinel_alert || stageTrackerDeferredMods(item).indexOf(STAGE_TRACKER_SENTINEL_CHIP) >= 0) return ''; const label = item.sentinel_notice ? 'Informational security notice' : 'Sentinel alert'; return `${esc(STAGE_TRACKER_SENTINEL_CHIP)}`; } @@ -19424,9 +19399,13 @@

    Where to get help

    const parked = Number(lp.stage) === STAGE_TRACKER_NEEDS_DECISION || (Array.isArray(lp.modifiers) && lp.modifiers.indexOf('needs-decision') >= 0) || !!(lp.decision_needed && lp.decision_needed.question); return parked ? lp : null; } - function stageTrackerChipsHtml(item) { - const sentinel = stageTrackerSentinelChipHtml(item) + (typeof stageTrackerPreparationChipHtml === 'function' ? stageTrackerPreparationChipHtml(item) : '') + (typeof stageTrackerAdoptionChipHtml === 'function' ? stageTrackerAdoptionChipHtml(item) : '') + (typeof stageTrackerPresenceChipHtml === 'function' ? stageTrackerPresenceChipHtml(item) : '') + (typeof stageTrackerPushChipHtml === 'function' ? stageTrackerPushChipHtml(item, Date.now()) : '') + (typeof stageTrackerReroutePillHtml === 'function' ? stageTrackerReroutePillHtml(item) : '') + (typeof stageTrackerSupersedesChipHtml === 'function' ? stageTrackerSupersedesChipHtml(item, Date.now()) : '') + (typeof stageTrackerOverlapBadgeHtml === 'function' ? stageTrackerOverlapBadgeHtml(item) : ''); + function stageTrackerChipsHtml(item, opts) { + // opts.gate: the row renders the one human-gate pill, which carries the + // sentinel / hold / needs-human reasons itself — those chips step aside. + const gated = !!(opts && opts.gate); + const sentinel = (gated ? '' : stageTrackerSentinelChipHtml(item)) + (typeof stageTrackerPreparationChipHtml === 'function' ? stageTrackerPreparationChipHtml(item) : '') + (typeof stageTrackerAdoptionChipHtml === 'function' ? stageTrackerAdoptionChipHtml(item) : '') + (typeof stageTrackerPresenceChipHtml === 'function' ? stageTrackerPresenceChipHtml(item) : '') + (typeof stageTrackerPushChipHtml === 'function' ? stageTrackerPushChipHtml(item, Date.now()) : '') + (typeof stageTrackerReroutePillHtml === 'function' ? stageTrackerReroutePillHtml(item) : '') + (typeof stageTrackerSupersedesChipHtml === 'function' ? stageTrackerSupersedesChipHtml(item, Date.now()) : '') + (typeof stageTrackerOverlapBadgeHtml === 'function' ? stageTrackerOverlapBadgeHtml(item) : ''); const mods = (Array.isArray(item.modifiers) ? item.modifiers.slice() : []) + .filter(m => !gated || STAGE_TRACKER_GATE_MODS.indexOf(m) < 0) .sort((x, y) => STAGE_TRACKER_MOD_PRIORITY.indexOf(x) - STAGE_TRACKER_MOD_PRIORITY.indexOf(y)); // A 085 PR a person acts on lights its real stage (CI / Review), so // the chevron no longer says "Needs human decision": the ask rides @@ -19434,7 +19413,7 @@

    Where to get help

    // re-adds the modifier (stageTrackerApplyPersonActsOnPRPill); this // covers a payload that predates it. Any pill that already names the // person owed (unauthorized, hold …) stands in for it. - if (item.kind === 'pr' && !mods.some(m => STAGE_TRACKER_HUMAN_MODS.indexOf(m) >= 0) && typeof stageTrackerPersonActsOnPR === 'function' && stageTrackerPersonActsOnPR(item)) { + if (!gated && item.kind === 'pr' && !mods.some(m => STAGE_TRACKER_HUMAN_MODS.indexOf(m) >= 0) && typeof stageTrackerPersonActsOnPR === 'function' && stageTrackerPersonActsOnPR(item)) { mods.push('needs-decision'); mods.sort((x, y) => STAGE_TRACKER_MOD_PRIORITY.indexOf(x) - STAGE_TRACKER_MOD_PRIORITY.indexOf(y)); } @@ -19522,7 +19501,7 @@

    Where to get help

    approve: 'Approve', 'give-direction': 'Give direction', 'close-superseded': 'Close as superseded', wontfix: "Close as won't-fix", 'close-read': 'Closed', 'close-issue': 'Close issue', 'let-hive-decide': 'Let hive decide', hold: 'Hold', release: 'Release hold', 'accept-triage': 'Accept triage', 'mark-needs-human': 'Mark needs-human', 'queue-merge': 'Approve and let hive merge', 'merge-now': 'Merge now as maintainer', - adopt: 'Adopt', 'adopt-now': 'Adopt now', reroute: 'Reroute to another clanker', + adopt: 'Adopt', 'adopt-now': 'Adopt now', reroute: 'Reroute to another clanker', 'confirm-sentinel': 'Confirm safe', // Historical ledger entries only: the hive now re-authors its own // exhausted PRs itself and a person's rewrite of a contributor PR is adopt. 're-author': 'Re-author (now: adopt)', @@ -20262,10 +20241,11 @@

    Where to get help

    const subKey = stageTrackerItemKey(pr); const humanNote = typeof stageTrackerHumanContextHtml === 'function' ? stageTrackerHumanContextHtml(pr, stages, nowMs, undefined, ctx, subKey) : ''; const noteCtx = humanNote && typeof stageTrackerNoteTakenCtx === 'function' ? stageTrackerNoteTakenCtx(ctx, subKey) : ctx; + const prGate = typeof stageTrackerHumanGateHtml === 'function' ? stageTrackerHumanGateHtml(pr, pr, nowMs) : ''; return `
    ${typeof stageTrackerRowToolsHtml === 'function' ? stageTrackerRowToolsHtml(pr) : ''}
    - ${stageTrackerHeadColsHtml([ref], '', stageTrackerActedBadgeHtml(pr, nowMs) + stageTrackerChipsHtml(pr) + (typeof stageTrackerLeadButtonHtml === 'function' ? stageTrackerLeadButtonHtml(pr, nowMs) : '') + (typeof stageTrackerNotesButtonHtml === 'function' ? stageTrackerNotesButtonHtml(pr, hamNotesCtx(pr)) : ''))} + ${stageTrackerHeadColsHtml([ref], '', stageTrackerActedBadgeHtml(pr, nowMs) + stageTrackerChipsHtml(pr, { gate: !!prGate }) + (prGate || (typeof stageTrackerLeadButtonHtml === 'function' ? stageTrackerLeadButtonHtml(pr, nowMs) : '')) + (typeof stageTrackerNotesButtonHtml === 'function' ? stageTrackerNotesButtonHtml(pr, hamNotesCtx(pr)) : ''))}
    ${typeof stageTrackerPreparationNodeHtml === 'function' ? stageTrackerPreparationNodeHtml(pr, stages, ctx) : ''} @@ -20621,14 +20601,19 @@

    Where to get help

    const rowKey = stageTrackerItemKey(item); const humanNote = typeof stageTrackerHumanContextHtml === 'function' ? stageTrackerHumanContextHtml(item, stages, nowMs, subRows, ctx, rowKey) : ''; const noteCtx = humanNote && typeof stageTrackerNoteTakenCtx === 'function' ? stageTrackerNoteTakenCtx(ctx, rowKey) : ctx; + // One human-gate pill per gated row (hivecommons/hive#17470): it + // absorbs the sentinel / hold / needs-human chips and the lead verbs; + // a secondary row of a shared PR gets only the chip that links to its + // primary. Guarded: the harnesses load helpers by name. + const gate = typeof stageTrackerHumanGateHtml === 'function' ? stageTrackerHumanGateHtml(item, shown, nowMs, subRows, { sharedUnder }) : ''; return `
    ${stageTrackerRowToolsHtml(item)}
    - ${stageTrackerHeadColsHtml(prRefs, leadHtml, stageTrackerActedBadgeHtml(item, nowMs) + stageTrackerChipsHtml(shown) + (typeof stageTrackerLeadButtonHtml === 'function' ? stageTrackerLeadButtonHtml(item, nowMs, subRows) : '') + (typeof stageTrackerNotesButtonHtml === 'function' ? stageTrackerNotesButtonHtml(item, hamNotesCtx(item)) : ''), prTargetKey)} + ${stageTrackerHeadColsHtml(prRefs, leadHtml, stageTrackerActedBadgeHtml(item, nowMs) + stageTrackerChipsHtml(shown, { gate: !!gate }) + (gate || (typeof stageTrackerLeadButtonHtml === 'function' ? stageTrackerLeadButtonHtml(item, nowMs, subRows) : '')) + (typeof stageTrackerNotesButtonHtml === 'function' ? stageTrackerNotesButtonHtml(item, hamNotesCtx(item)) : ''), prTargetKey)}
    ${typeof stageTrackerPreparationNodeHtml === 'function' ? stageTrackerPreparationNodeHtml(item, stages, ctx) : ''} -
      ${stageTrackerStripItems(shown, stages, range, nowMs, ctx)}
    +
      ${stageTrackerStripItems(shown, stages, range, nowMs, sharedUnder ? Object.assign({}, ctx, { gateElsewhere: true }) : ctx)}
    ${stageTrackerSinceHtml(shown, nowMs)}${typeof stageTrackerPillHtml === 'function' ? stageTrackerPillHtml(shown, stages, range, nowMs, ctx) : ''}
    ${humanNote}${stageTrackerCurrentStageHtml(shown, stages, range, nowMs)}${typeof stageTrackerPreparationCommentHtml === 'function' ? stageTrackerPreparationCommentHtml(shown, noteCtx, rowKey) : typeof stageTrackerEventHtml === 'function' ? stageTrackerEventHtml(rowKey, noteCtx) : ''}${typeof stageTrackerExecutionHtml === 'function' ? stageTrackerExecutionHtml(shown) : ''}${typeof stageTrackerReviewNotesHtml === 'function' ? stageTrackerReviewNotesHtml(item, ctx) : ''}${typeof stageTrackerNotesPanelHtml === 'function' ? stageTrackerNotesPanelHtml(item, hamNotesCtx(item)) : ''}${subs}
    `; @@ -23465,6 +23450,8 @@

    All labels

    open: 'Open on GitHub', copy: 'Copy link', 'open:app-settings': 'Grant the App permission', 'blocker:recheck': 'Re-check permissions', 'blocker:patch': 'Prepare the patch for a person to push', 'blocker:close-partial': 'Mark partially-addressed and close', 'blocker:wait': 'Keep waiting', + // The human-gate pill's reason-bound verbs (hivecommons/hive#17470). + 'gate:decide': 'Decide', 'gate:request-changes': 'Request changes', 'gate:confirm-sentinel': 'Confirm safe', }; // Actions that end with a commit on the base branch — the lead // "Approve and let hive merge" (the hive's sweep merges on its next @@ -24405,8 +24392,14 @@

    All labels

    const key = sub ? sub.dataset.hamSubKey : (row ? row.dataset.hamKey : ''); const item = key ? stageTrackerItemByKey(_stageTracker, key) : null; if (!item) return; - stageTrackerDecisionRun(item, b.dataset.hamAct); + const run = stageTrackerDecisionRun(item, b.dataset.hamAct); + // A human-gate verb that went through reads "settling…" on its pill + // until the next snapshot re-renders the row (hivecommons/hive#17470). + if (b.classList.contains('ham-gate-act') && run && typeof run.then === 'function' && typeof stageTrackerHumanGateSettling === 'function') { + run.then(r => { if (r && !r.cancelled && Array.isArray(r.results) && r.results.length && r.results.every(x => x && x.ok)) stageTrackerHumanGateSettling(b); }, () => {}); + } }); + if (typeof stageTrackerWireHumanGate === 'function') stageTrackerWireHumanGate(el); // Cmd/Ctrl- or Shift-click anywhere on a row (not on its links or // buttons) selects it too. el.addEventListener('click', e => { @@ -24782,6 +24775,14 @@

    All labels

    const to = payload.to || stageTrackerRerouteTargetOf(id) || STAGE_TRACKER_REROUTE_ANY; return { url: '/api/repos/' + seg + '/items/' + n + '/decision', body: { decision: 'reroute', to, comment: payload.comment || '', type } }; } + // The human-gate verbs: Decide… and Request changes… are directions + // (the "/hive decision …" carrier); Confirm safe clears the sentinel. + if (id === 'gate:decide' || id === 'gate:request-changes') { + return { url: '/api/repos/' + seg + '/items/' + n + '/decision', body: { decision: 'direction', comment: payload.comment || '', type } }; + } + if (id === 'gate:confirm-sentinel') { + return { url: '/api/repos/' + seg + '/items/' + n + '/sentinel-confirm', body: { comment: payload.comment || '', type } }; + } if (id.indexOf('decide:') === 0) { const body = { decision: id.slice('decide:'.length), comment: payload.comment || '', type }; if (payload.supersededBy) body.superseded_by = payload.supersededBy; @@ -25526,6 +25527,21 @@

    All labels

    return (await stageTrackerAsk(id, 'confirm', { title: 'Approve pull request' + (items.length > 1 ? 's' : ''), message: preface + 'Post "/lgtm" and "/approve" on ' + refs + ' as ' + who + '? The merge queue takes it from there — the dashboard does not merge.', confirmLabel: 'Post /lgtm + /approve', danger: !!sentinel })) ? {} : null; } return (await stageTrackerAsk(id, 'confirm', { title: 'Approve direction', message: 'Record "/hive approve" on ' + refs + ' as ' + who + '? The hive un-parks the issue' + (items.length > 1 ? 's' : '') + ' and carries on; nothing is merged.', confirmLabel: 'Approve' })) ? {} : null; + case 'gate:decide': { + // The reviewer's question leads the modal, pre-filled; the answer is required. + const dec = typeof stageTrackerDecisionOf === 'function' ? stageTrackerDecisionOf(items[0]) : null; + const q = (dec && dec.item && dec.item.decision_needed && dec.item.decision_needed.question) || (items[0] && items[0].human_attention && items[0].human_attention.reason) || ''; + const v = await hivePrompt({ title: 'Decide — ' + refs, label: preface + (q ? 'Question: ' + q + '\n\n' : '') + 'Your decision (posted as "/hive decision …"; the hive carries on with it)', placeholder: 'e.g. take option B and keep the API as is', validate: s => s ? true : 'A decision is required', confirmLabel: 'Send' }); + return v == null ? null : { comment: v }; + } + case 'gate:request-changes': { + const v = await hivePrompt({ title: 'Request changes — ' + refs, label: preface + 'What should change on ' + refs + '? (posted as "/hive decision …"; ' + stageTrackerDirectionCarrier(items) + ' pushes a new head)', placeholder: 'e.g. drop the retry loop and keep the flag', validate: s => s ? true : 'The requested change is required', confirmLabel: 'Send' }); + return v == null ? null : { comment: v }; + } + case 'gate:confirm-sentinel': { + const v = await stageTrackerAsk(id, 'prompt', { title: 'Confirm safe — ' + refs, label: preface + 'Confirm the sentinel finding is intended: this comments your confirmation on ' + refs + ' and removes the sentinel label so the lane may continue. Note (optional)', placeholder: 'e.g. the workflow edit is the point of this PR', confirmLabel: 'Confirm safe', danger: true }); + return v == null ? null : { comment: v }; + } case 'decide:direction': { // The direction is required, so this prompt is never skipped. const v = await hivePrompt(prs @@ -25675,11 +25691,12 @@

    All labels

    'decide:delegate': 'Hive deciding…', 'decide:delegate:preview': 'Asking the hive…', 'decide:delegate-all': 'Hive deciding each PR…', 'decide:delegate:rerun': 'Hive deciding again…', 'decide:approve': 'Approving…', 'decide:direction': 'Recording direction…', 'decide:close-superseded': 'Closing…', 'decide:close-wontfix': 'Closing…', 'decide:close-read': 'Closing…', 'decide:close-deferred': 'Closing…', 'decide:close-issue': 'Closing…', 'decide:merge-now': 'Merging…', 'decide:queue-merge': 'Recording approval…', 'decide:adopt': 'Adopting…', 'decide:adopt-now': 'Adopting now…', 'decide:reroute': 'Rerouting…', + 'gate:decide': 'Sending your decision…', 'gate:request-changes': 'Requesting changes…', 'gate:confirm-sentinel': 'Confirming safe…', }; const STAGE_TRACKER_ACTION_WORDS = { adopted: 'adopted', approved: 'approved', recommended: 'recommendation only', closed: 'closed', directed: 'direction recorded', refused: 'refused', 'decided-each': 'decided per PR', merged: 'merged', 'queued-for-merge': 'queued for merge — hive merges it on its next pass once CI is green', [STAGE_TRACKER_ACTION_REBASE_QUEUED]: 'rebase queued, merge to follow', - held: 'held', released: 'hold released', rescanned: 'rescanned', 'triage-accepted': 'triage accepted', 'needs-human': 'marked needs-human', rerouted: 'rerouted', [STAGE_TRACKER_ACTION_NOOP]: 'no change', + held: 'held', released: 'hold released', 'sentinel-confirmed': 'sentinel confirmed safe', rescanned: 'rescanned', 'triage-accepted': 'triage accepted', 'needs-human': 'marked needs-human', rerouted: 'rerouted', [STAGE_TRACKER_ACTION_NOOP]: 'no change', [STAGE_TRACKER_ACTION_NO_EFFECT]: 'no effect yet', }; // Once the server has answered, a terminal action's caption says so @@ -25692,7 +25709,7 @@

    All labels

    } // The ledger name of a row action id (the inverse of the badge's // STAGE_TRACKER_ACTED_OPTION_ID), for a failure noted on the client. - const STAGE_TRACKER_ACTION_LEDGER_NAME = { 'decide:delegate': 'let-hive-decide', 'decide:approve': 'approve', 'decide:direction': 'give-direction', 'decide:close-superseded': 'close-superseded', 'decide:close-wontfix': 'wontfix', 'decide:close-deferred': 'wontfix', 'decide:close-read': 'close-read', 'decide:close-issue': 'close-issue', 'accept-triage': 'accept-triage', hold: 'hold', release: 'release', 'needs-human': 'mark-needs-human', 'decide:merge-now': 'merge-now', 'decide:queue-merge': 'queue-merge', 'decide:adopt': 'adopt', 'decide:adopt-now': 'adopt-now', 'decide:reroute': 'reroute' }; + const STAGE_TRACKER_ACTION_LEDGER_NAME = { 'decide:delegate': 'let-hive-decide', 'decide:approve': 'approve', 'decide:direction': 'give-direction', 'decide:close-superseded': 'close-superseded', 'decide:close-wontfix': 'wontfix', 'decide:close-deferred': 'wontfix', 'decide:close-read': 'close-read', 'decide:close-issue': 'close-issue', 'accept-triage': 'accept-triage', hold: 'hold', release: 'release', 'needs-human': 'mark-needs-human', 'decide:merge-now': 'merge-now', 'decide:queue-merge': 'queue-merge', 'decide:adopt': 'adopt', 'decide:adopt-now': 'adopt-now', 'decide:reroute': 'reroute', 'gate:decide': 'give-direction', 'gate:request-changes': 'give-direction', 'gate:confirm-sentinel': 'confirm-sentinel' }; // A failed or refused action is noted on the row at once, so the // history badge turns red and its hover's first line names the reason // — the server's ledger only sees 5xx and refused answers, and a @@ -26247,6 +26264,221 @@

    All labels

    // kind → { name, bytes (ArrayBuffer), buffer (AudioBuffer|null), failed } var _stageTrackerClips = { open: null, merge: null }; var _stageTrackerSettingsReturnFocus = null; + /* ---- The human gate: one control per gated row ---------------------- + A row a person must settle used to say so three or four ways at once + — a "Needs human · review" chevron word, a `sentinel` chip, a + needs-decision pill, `Approve ▸` and `Let hive decide ▸` — and still + offered no verb for some gates (a sentinel alert had nothing that + confirmed it; a "needs decision" had nothing that decided). The + maintainer on hivecommons/hive (2026-11-10): "I don't see a consistent + way to settle each of these using the UI. Some are confusing, others + have no controls to take action, others have too many." + + Now every gated row carries exactly ONE segmented pill: + [👤 Needs human · ] [verb] [verb] [verb] [… more] + The status segment names why (review / decision / sentinel / hold, + comma-separated when they stack) and carries the reviewer's question + or the sentinel rule as its hover and popover; the verb segments are + the fixed set for those reasons (STAGE_TRACKER_GATE_VERBS), unioned + and de-duplicated, at most STAGE_TRACKER_GATE_VISIBLE visible with the + rest behind a `…` menu. "Needs human" is never a chevron word: the lit + chevron is the row's real stage with the amber ham-human-gated outline + as the bar's only cue. A secondary row of a shared PR renders no gate + of its own; its "decision pending on #N" chip is the link to the row + that does. Every verb runs the row menu's path (runRowAction: in-app + modal, result toast, acting row); the pill reads "settling…" until the + next snapshot. */ + const STAGE_TRACKER_GATE_WORD = 'Needs human'; + const STAGE_TRACKER_GATE_SETTLING = 'settling…'; + const STAGE_TRACKER_GATE_VISIBLE = 3; + // Reason → verbs, in the order they stand on the pill. The same reason + // always offers the same verbs (the maintainer's "consistent way"). + const STAGE_TRACKER_GATE_VERBS = { + review: ['decide:approve', 'gate:request-changes', 'decide:delegate'], + decision: ['gate:decide', 'decide:approve', 'decide:delegate'], + sentinel: ['gate:confirm-sentinel', 'decide:delegate'], + hold: ['release', 'decide:delegate'], + }; + const STAGE_TRACKER_GATE_ORDER = ['review', 'decision', 'sentinel', 'hold']; + const STAGE_TRACKER_GATE_PR_ONLY = ['decide:approve', 'gate:request-changes']; + // The verb's label on the pill; "Approve" reads "Approve as-is" when the + // gate is a decision (a GitHub approval of the head as it stands). + const STAGE_TRACKER_GATE_LABELS = { + 'decide:approve': 'Approve', 'gate:request-changes': 'Request changes…', 'decide:delegate': 'Let hive decide', + 'gate:decide': 'Decide…', 'gate:confirm-sentinel': 'Confirm safe', release: 'Release hold', + }; + const STAGE_TRACKER_GATE_APPROVE_AS_IS = 'Approve as-is'; + // What each verb posts, for the pill hover and the docs table. + const STAGE_TRACKER_GATE_POSTS = { + 'decide:approve': 'Posts a GitHub approval (/lgtm + /approve) on the current head.', + 'gate:request-changes': 'Posts your text as "/hive decision …" — the hive pushes a new head.', + 'decide:delegate': 'The hive decides for you under its policy and rails; recorded as your decision.', + 'gate:decide': 'Answers the question as "/hive decision …" — the hive carries on with your answer.', + 'gate:confirm-sentinel': 'Comments your confirmation and removes the sentinel label.', + release: 'Removes the hold label; the lane may merge.', + }; + + // Pure: whether the row is a PR (its own, or an issue drawn through its + // one covering PR) — the gate is a PR matter except for a parked issue. + function stageTrackerGateIsPR(item) { + return !!item && (item.via_pr ? 'pr' : item.kind) === 'pr'; + } + // Pure: the reasons a person is owed on the row, each with the text the + // status segment explains itself with. [] when nobody is owed anything. + // review — the reviewer's verdict requires a human (review_activity + // human_decision on this head); tip = the reviewer's question + // decision — stage/085 (PR) or 045 (issue), or a needs-decision / + // needs-human modifier; tip = the decision question + // sentinel — a blocking sentinel alert; tip = the rule and paths + // hold — a hold label; tip = who held it and why + function stageTrackerHumanGateReasons(item) { + if (!item || item.state === 'closed' || item.superseded || item.superseded_by || item.adopted_by) return []; + if (Number(item.stage) >= (typeof STAGE_TRACKER_TERMINAL === 'number' ? STAGE_TRACKER_TERMINAL : 110)) return []; + const mods = Array.isArray(item.modifiers) ? item.modifiers : []; + if (mods.indexOf('merged') >= 0 || mods.indexOf('draft') >= 0) return []; + const out = []; + const pr = stageTrackerGateIsPR(item); + const onHead = a => !!a && (!a.head || !item.head || String(a.head) === String(item.head)); + const review = pr && onHead(item.review_activity) ? item.review_activity : null; + if (review && review.state === 'human_decision') { + out.push({ key: 'review', tip: String(review.blocker || review.detail || review.caption || '').trim() || 'A reviewer asked for a person\'s sign-off.' }); + } + const stage = Number(item.stage) || 0; + const prDecision = typeof STAGE_TRACKER_NEEDS_DECISION === 'number' ? STAGE_TRACKER_NEEDS_DECISION : 85; + const issueDecision = typeof STAGE_TRACKER_ISSUE_NEEDS_DECISION === 'number' ? STAGE_TRACKER_ISSUE_NEEDS_DECISION : 45; + // A pre-045 issue still wearing 085 is parked on a person all the same. + const decisionStage = pr ? stage === prDecision : (stage === issueDecision || stage === prDecision); + const flagged = decisionStage || mods.indexOf('needs-decision') >= 0 || mods.indexOf('needs-human') >= 0 || item.needs_human === true; + // An unauthorized step and a structured blocker name the person owed + // in their own pills (hive-bot-lacks-permission, Blocked · …); they + // are not a decision anyone is asked for. + if (flagged && !String(item.unauthorized_step || '').trim() && !(item.blocker && String(item.blocker.short || '').trim())) { + const d = item.decision_needed || {}; + const attention = typeof stageTrackerHumanAttentionOf === 'function' ? stageTrackerHumanAttentionOf(item) : null; + const ask = typeof stageTrackerNeedsHumanAsk === 'function' ? stageTrackerNeedsHumanAsk(item) : null; + const short = typeof stageTrackerNeedsHumanShort === 'function' ? stageTrackerNeedsHumanShort(item) : ''; + const tip = String(d.question || (attention && (attention.question || attention.reason)) || (ask && (ask.question || ask.reason)) || short || '').trim(); + // The review gate already carries the reviewer's question; the same + // question is not a second reason. + if (!(review && review.state === 'human_decision' && out.length && (!tip || out[0].tip === tip))) out.push({ key: 'decision', tip: tip || 'A person\'s decision is owed.' }); + } + if (item.sentinel_alert && !item.sentinel_notice) { + out.push({ key: 'sentinel', tip: typeof stageTrackerSentinelTipWithPaths === 'function' ? stageTrackerSentinelTipWithPaths(item) : (typeof stageTrackerSentinelTip === 'function' ? stageTrackerSentinelTip(item) : 'Sentinel alert') }); + } + if (item.hold || mods.indexOf('hold') >= 0) { + const tip = typeof stageTrackerHoldTip === 'function' ? stageTrackerHoldTip(item, Date.now()) : ''; + out.push({ key: 'hold', tip: tip || 'A hold label keeps the hive off this item until a person releases it.' }); + } + out.sort((x, y) => STAGE_TRACKER_GATE_ORDER.indexOf(x.key) - STAGE_TRACKER_GATE_ORDER.indexOf(y.key)); + return out; + } + // Pure: the verbs for a set of reasons — the union in reason order, + // de-duplicated, first label wins (so "Approve" on review + decision + // reads "Approve", and "Approve as-is" when the decision stands alone). + function stageTrackerHumanGateVerbs(reasons, item) { + const ids = []; + // A row with no PR has no head to approve or send back; those verbs + // belong to PR rows (or an issue drawn through its covering PR). + const onPR = item == null || stageTrackerGateIsPR(item); + (reasons || []).forEach(r => (STAGE_TRACKER_GATE_VERBS[r.key] || []).forEach(id => { if (ids.indexOf(id) < 0 && (onPR || STAGE_TRACKER_GATE_PR_ONLY.indexOf(id) < 0)) ids.push(id); })); + const onlyDecision = (reasons || []).length && reasons.every(r => r.key === 'decision'); + return ids.map(id => ({ id, label: id === 'decide:approve' && onlyDecision ? STAGE_TRACKER_GATE_APPROVE_AS_IS : STAGE_TRACKER_GATE_LABELS[id] || id, posts: STAGE_TRACKER_GATE_POSTS[id] || '' })); + } + // Pure: the status segment's words — "Needs human · review, sentinel". + function stageTrackerHumanGateStatusText(reasons) { + return STAGE_TRACKER_GATE_WORD + (reasons && reasons.length ? ' · ' + reasons.map(r => r.key).join(', ') : ''); + } + // Pure: the status segment's hover — one line per reason. + function stageTrackerHumanGateTip(reasons) { + return (reasons || []).map(r => r.key + ': ' + r.tip).join('\n'); + } + // Pure: whether a verb is enabled for this viewer and why not. The + // row's own lead actions (server-judged delegate, approve) are trusted + // first; the rest follow the hold permission the endpoints share. + function stageTrackerHumanGateVerbState(id, item, ctx, leads) { + const lead = (leads || []).find(a => a && a.id === id); + if (lead) return { enabled: lead.enabled !== false, why: lead.enabled === false ? String(lead.why || '') : '' }; + return typeof stageTrackerActionAllowed === 'function' ? stageTrackerActionAllowed(id, ctx) : { enabled: true, why: '' }; + } + function stageTrackerHumanGateVerbHtml(item, v, state, more) { + const ref = typeof stageTrackerRefOf === 'function' ? stageTrackerRefOf(item) : ''; + const tip = state.enabled ? v.posts : state.why; + const attrs = `data-ham-act="${esc(v.id)}"${state.enabled ? '' : ' aria-disabled="true"'}${tip ? ` title="${esc(tip)}"` : ''} aria-label="${esc(v.label + (ref ? ' — ' + ref : ''))}"`; + if (more) return ``; + return ``; + } + // Pure: the pill. '' when the row has no gate. The status segment is + // the decision popover's trigger when the row carries a decision, else + // a plain segment with the reasons as its hover. + function stageTrackerHumanGateHtml(item, shown, nowMs, subRows, opts) { + shown = shown || item; + if (!item) return ''; + const reasons = stageTrackerHumanGateReasons(shown); + if (!reasons.length) return ''; + // A secondary row of a shared PR (drawn under another issue's row, + // hivecommons/hive#17333) never carries the gate: the primary row + // does, and this row's only control is the chip that links to it. + if (opts && opts.sharedUnder) { + if (typeof stageTrackerItemKey !== 'function') return ''; + const under = Number(opts.sharedUnder); + const lp = (Array.isArray(item.linked_prs) ? item.linked_prs : []).find(x => x && Number(x.drawn_under) === under) || (shown.via_pr ? { number: shown.number } : null); + const prNum = Number(lp && lp.number) || 0; + const row = stageTrackerItemKey({ repo: item.repo, kind: 'issue', number: under }); + const to = prNum ? stageTrackerItemKey({ repo: item.repo, kind: 'pr', number: prNum }) : row; + return ``; + } + const ctx = typeof stageTrackerActionCtx === 'function' ? stageTrackerActionCtx(item.repo) : null; + if (ctx) { ctx.nowMs = typeof nowMs === 'number' ? nowMs : Date.now(); ctx.rows = typeof _stageTrackerRows !== 'undefined' ? _stageTrackerRows : null; } + const leads = ctx && typeof stageTrackerLeadActionsOnRow === 'function' ? stageTrackerLeadActionsOnRow(item, ctx, subRows) : []; + // The decision lives on another listed row: that row carries the + // gate; this one only points at it. + const passive = leads.find(a => a && a.passive); + if (passive) return typeof stageTrackerLeadPillHtml === 'function' ? stageTrackerLeadPillHtml(item, passive) : ''; + // A gate owed on a PR drawn under this issue row renders on that sub-row. + if (Array.isArray(subRows) && subRows.length && item.kind === 'issue' && !item.via_pr && !leads.length && subRows.some(s => stageTrackerHumanGateReasons(s).length)) return ''; + const verbs = stageTrackerHumanGateVerbs(reasons, shown); + const text = stageTrackerHumanGateStatusText(reasons); + const tip = stageTrackerHumanGateTip(reasons); + const ico = typeof stageTrackerIcon === 'function' ? stageTrackerIcon('human', 'ham-ico ham-mod-ico') : ''; + const inner = `${ico}${esc(text)}`; + const decision = typeof stageTrackerDecisionOf === 'function' ? stageTrackerDecisionOf(item) : null; + const status = decision && typeof stageTrackerDecisionTriggerHtml === 'function' + ? stageTrackerDecisionTriggerHtml(decision, inner, tip, 'ham-gate-status ham-mod-ask') + : `${inner}`; + const shownVerbs = verbs.slice(0, STAGE_TRACKER_GATE_VISIBLE); + const moreVerbs = verbs.slice(STAGE_TRACKER_GATE_VISIBLE); + const acts = shownVerbs.map(v => stageTrackerHumanGateVerbHtml(item, v, stageTrackerHumanGateVerbState(v.id, shown, ctx, leads), false)).join(''); + const more = moreVerbs.length ? `` : ''; + const key = typeof stageTrackerItemKey === 'function' ? stageTrackerItemKey(item) : ''; + return `${status}${acts}${more}`; + } + // The pill's optimistic state after one of its verbs ran: the status + // reads "settling…" until the next snapshot re-renders the row. + function stageTrackerHumanGateSettling(button) { + const gate = button && button.closest ? button.closest('.ham-human-gate') : null; + if (!gate) return; + gate.classList.add('ham-gate-settling'); + const word = gate.querySelector('.ham-gate-status .ham-mod-word'); + if (word) word.textContent = STAGE_TRACKER_GATE_SETTLING; + gate.querySelectorAll('.ham-gate-act').forEach(b => b.setAttribute('aria-disabled', 'true')); + } + // The `…` menu: open / close on its button, close on outside click or + // Escape, the same popover pattern the row's ⋯ menu uses. + function stageTrackerWireHumanGate(el) { + if (!el || el._hamGateWired) return; + el._hamGateWired = true; + const closeAll = () => el.querySelectorAll('.ham-gate-menu:not([hidden])').forEach(m => { m.hidden = true; const b = m.previousElementSibling; if (b) b.setAttribute('aria-expanded', 'false'); }); + el.addEventListener('click', e => { + const b = e.target.closest ? e.target.closest('[data-ham-gate-more]') : null; + if (!b) { if (!(e.target.closest && e.target.closest('.ham-gate-menu'))) closeAll(); return; } + e.preventDefault(); e.stopPropagation(); + const menu = b.nextElementSibling; + const open = menu && menu.hidden; + closeAll(); + if (menu && open) { menu.hidden = false; b.setAttribute('aria-expanded', 'true'); const first = menu.querySelector('[role="menuitem"]'); if (first) first.focus(); } + }); + el.addEventListener('keydown', e => { if (e.key === 'Escape') closeAll(); }); + } function stageTrackerPRKey(repo, number) { return (repo || '') + '/pr#' + (Number(number) || 0); } function stageTrackerItemKey(it) { return (it.repo || '') + '/' + (it.kind || '') + '#' + (Number(it.number) || 0); } From b199fb20aa591d2e893029dbaf4a7c78502c80b3 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Mon, 9 Nov 2026 20:00:54 -0700 Subject: [PATCH 2/4] Fix CI: typed RowActionTarget compare, token-only gate radii, register sentinel-confirm write site Signed-off-by: Andrew Anderson --- src/docs/notifications.md | 1 + src/pkg/dashboard/api_repo_item_sentinel_confirm_test.go | 2 +- src/pkg/dashboard/static-src/css/tracker.css | 9 ++++----- src/pkg/dashboard/static/index.html | 9 ++++----- src/pkg/github/notification_write_sites.go | 1 + 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/docs/notifications.md b/src/docs/notifications.md index 5fc74c537f..d036a5c274 100644 --- a/src/docs/notifications.md +++ b/src/docs/notifications.md @@ -472,6 +472,7 @@ without a class. Review submissions and review requests are always counted as | `dashboard.(*Server).handleRepoItemAdoptNow` | `status` | | | `dashboard.(*Server).handleRepoItemBlockerClosePartial` | `status` | | | `dashboard.(*Server).handleRepoItemDecision` | `status` | | +| `dashboard.(*Server).handleRepoItemSentinelConfirm` | `status` | | | `dashboard.(*Server).handleReviewQueueSupersededClose` | `status` | | | `dashboard.(*Server).mirrorPlanWith` | `status` | | | `github.(*Client).CloseIssueForConfiguredLinePR` | `status` | | diff --git a/src/pkg/dashboard/api_repo_item_sentinel_confirm_test.go b/src/pkg/dashboard/api_repo_item_sentinel_confirm_test.go index fd067d9440..f3910d9d15 100644 --- a/src/pkg/dashboard/api_repo_item_sentinel_confirm_test.go +++ b/src/pkg/dashboard/api_repo_item_sentinel_confirm_test.go @@ -67,7 +67,7 @@ func TestRepoItemSentinelConfirmAuthorizationCommentAndLabel(t *testing.T) { if got := strings.Join(mock.removed, ","); got != config.DefaultSentinelLabel { t.Fatalf("removed = %q, want only the sentinel label", got) } - if resp.Result == nil || resp.Result.Action != rowActionSentinelConfirmed || resp.Result.Target != "testorg/testrepo#7" || !strings.Contains(resp.Result.Outcome, "@writer") || !strings.Contains(resp.Result.Outcome, config.DefaultSentinelLabel) { + if resp.Result == nil || resp.Result.Action != rowActionSentinelConfirmed || resp.Result.Target.Repo != "testorg/testrepo" || resp.Result.Target.Number != 7 || !strings.Contains(resp.Result.Outcome, "@writer") || !strings.Contains(resp.Result.Outcome, config.DefaultSentinelLabel) { t.Fatalf("result = %+v", resp.Result) } diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css index d999a3f391..52e325d480 100644 --- a/src/pkg/dashboard/static-src/css/tracker.css +++ b/src/pkg/dashboard/static-src/css/tracker.css @@ -982,15 +982,14 @@ segment names the reasons (👤 Needs human · review, sentinel) and whose right segments are the verbs those reasons determine. Replaces the scattered sentinel chip + Approve + Let hive decide + needs-human pill. */ - .ham-human-gate { display: inline-flex; align-items: stretch; max-width: 100%; border: var(--line-width) solid color-mix(in srgb, var(--amber) 60%, var(--line-subtle)); border-radius: var(--r-pill); background: color-mix(in srgb, var(--amber) 8%, var(--panel)); font-size: var(--fs-xs); line-height: 1.5; vertical-align: middle; } - .ham-human-gate > .ham-gate-status { display: inline-flex; align-items: center; gap: var(--sp-1); min-width: 0; padding: 0 var(--sp-2) 0 var(--sp-3); border: 0; border-radius: var(--r-pill) 0 0 var(--r-pill); background: transparent; color: var(--amber); font: inherit; font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + .ham-human-gate { display: inline-flex; align-items: stretch; max-width: 100%; overflow: hidden; border: var(--line-width) solid color-mix(in srgb, var(--amber) 60%, var(--line-subtle)); border-radius: var(--r-pill); background: color-mix(in srgb, var(--amber) 8%, var(--panel)); font-size: var(--fs-xs); line-height: 1.5; vertical-align: middle; } + .ham-human-gate > .ham-gate-status { display: inline-flex; align-items: center; gap: var(--sp-1); min-width: 0; padding: 0 var(--sp-2) 0 var(--sp-3); border: 0; background: transparent; color: var(--amber); font: inherit; font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .ham-human-gate > .ham-gate-status > .ham-mod-word { overflow: hidden; text-overflow: ellipsis; } .ham-human-gate > button.ham-gate-status { cursor: pointer; } .ham-human-gate > button.ham-gate-status:hover, .ham-human-gate > button.ham-gate-status:focus-visible { text-decoration: underline; outline: none; } - .ham-human-gate > .ham-gate-act { border-radius: 0; border-top: 0; border-bottom: 0; border-right: 0; border-left-color: color-mix(in srgb, var(--amber) 35%, transparent); margin: 0; } + .ham-human-gate > .ham-gate-act { --ham-gate-seg-radius: 0; border-radius: var(--ham-gate-seg-radius); border-top: 0; border-bottom: 0; border-right: 0; border-left-color: color-mix(in srgb, var(--amber) 35%, transparent); margin: 0; } .ham-human-gate > .ham-gate-act.ham-act-secondary, .ham-human-gate > .ham-gate-more { --ham-act-fill: transparent; --ham-act-ink: var(--text); } - .ham-human-gate > .ham-gate-act:last-child, .ham-human-gate > .ham-gate-more:last-child { border-radius: 0 var(--r-pill) var(--r-pill) 0; } - .ham-human-gate > .ham-gate-act:hover, .ham-human-gate > .ham-gate-act:focus-visible { box-shadow: none; background: color-mix(in srgb, var(--amber) 22%, transparent); filter: none; } + .ham-human-gate > .ham-gate-act:hover, .ham-human-gate > .ham-gate-act:focus-visible { box-shadow: none; background: color-mix(in srgb, var(--amber) 22%, transparent); filter: none; } .ham-human-gate > .ham-gate-act.ham-act-primary:hover, .ham-human-gate > .ham-gate-act.ham-act-primary:focus-visible { filter: brightness(1.12); } .ham-human-gate > .ham-gate-more { padding-inline: var(--sp-2); } .ham-human-gate > .ham-gate-more::after { content: none; } diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 6a381c4519..cdbad9bcf0 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -2325,15 +2325,14 @@ segment names the reasons (👤 Needs human · review, sentinel) and whose right segments are the verbs those reasons determine. Replaces the scattered sentinel chip + Approve + Let hive decide + needs-human pill. */ - .ham-human-gate { display: inline-flex; align-items: stretch; max-width: 100%; border: var(--line-width) solid color-mix(in srgb, var(--amber) 60%, var(--line-subtle)); border-radius: var(--r-pill); background: color-mix(in srgb, var(--amber) 8%, var(--panel)); font-size: var(--fs-xs); line-height: 1.5; vertical-align: middle; } - .ham-human-gate > .ham-gate-status { display: inline-flex; align-items: center; gap: var(--sp-1); min-width: 0; padding: 0 var(--sp-2) 0 var(--sp-3); border: 0; border-radius: var(--r-pill) 0 0 var(--r-pill); background: transparent; color: var(--amber); font: inherit; font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + .ham-human-gate { display: inline-flex; align-items: stretch; max-width: 100%; overflow: hidden; border: var(--line-width) solid color-mix(in srgb, var(--amber) 60%, var(--line-subtle)); border-radius: var(--r-pill); background: color-mix(in srgb, var(--amber) 8%, var(--panel)); font-size: var(--fs-xs); line-height: 1.5; vertical-align: middle; } + .ham-human-gate > .ham-gate-status { display: inline-flex; align-items: center; gap: var(--sp-1); min-width: 0; padding: 0 var(--sp-2) 0 var(--sp-3); border: 0; background: transparent; color: var(--amber); font: inherit; font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .ham-human-gate > .ham-gate-status > .ham-mod-word { overflow: hidden; text-overflow: ellipsis; } .ham-human-gate > button.ham-gate-status { cursor: pointer; } .ham-human-gate > button.ham-gate-status:hover, .ham-human-gate > button.ham-gate-status:focus-visible { text-decoration: underline; outline: none; } - .ham-human-gate > .ham-gate-act { border-radius: 0; border-top: 0; border-bottom: 0; border-right: 0; border-left-color: color-mix(in srgb, var(--amber) 35%, transparent); margin: 0; } + .ham-human-gate > .ham-gate-act { --ham-gate-seg-radius: 0; border-radius: var(--ham-gate-seg-radius); border-top: 0; border-bottom: 0; border-right: 0; border-left-color: color-mix(in srgb, var(--amber) 35%, transparent); margin: 0; } .ham-human-gate > .ham-gate-act.ham-act-secondary, .ham-human-gate > .ham-gate-more { --ham-act-fill: transparent; --ham-act-ink: var(--text); } - .ham-human-gate > .ham-gate-act:last-child, .ham-human-gate > .ham-gate-more:last-child { border-radius: 0 var(--r-pill) var(--r-pill) 0; } - .ham-human-gate > .ham-gate-act:hover, .ham-human-gate > .ham-gate-act:focus-visible { box-shadow: none; background: color-mix(in srgb, var(--amber) 22%, transparent); filter: none; } + .ham-human-gate > .ham-gate-act:hover, .ham-human-gate > .ham-gate-act:focus-visible { box-shadow: none; background: color-mix(in srgb, var(--amber) 22%, transparent); filter: none; } .ham-human-gate > .ham-gate-act.ham-act-primary:hover, .ham-human-gate > .ham-gate-act.ham-act-primary:focus-visible { filter: brightness(1.12); } .ham-human-gate > .ham-gate-more { padding-inline: var(--sp-2); } .ham-human-gate > .ham-gate-more::after { content: none; } diff --git a/src/pkg/github/notification_write_sites.go b/src/pkg/github/notification_write_sites.go index c53e6d5dfe..8f95e3f079 100644 --- a/src/pkg/github/notification_write_sites.go +++ b/src/pkg/github/notification_write_sites.go @@ -42,6 +42,7 @@ var notificationWriteSites = map[string]NotificationWriteSite{ "dashboard.(*Server).handleRepoItemAdoptNow": {Class: NotificationClassStatus}, "dashboard.(*Server).handleRepoItemBlockerClosePartial": {Class: NotificationClassStatus}, "dashboard.(*Server).handleRepoItemDecision": {Class: NotificationClassStatus}, + "dashboard.(*Server).handleRepoItemSentinelConfirm": {Class: NotificationClassStatus}, "dashboard.(*Server).handleReviewQueueSupersededClose": {Class: NotificationClassStatus}, "dashboard.(*Server).mirrorPlanWith": {Class: NotificationClassStatus}, "github.(*Client).CloseIssueForConfiguredLinePR": {Class: NotificationClassStatus}, From b508ec8053ea7df640d9016cb83b9cf347bf9356 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Mon, 9 Nov 2026 20:22:30 -0700 Subject: [PATCH 3/4] Fix CI: openapi route, solicited writes, owner path, notice gate, lead pins, fold gate verbs on stacked/phone tiers Signed-off-by: Andrew Anderson --- dashboard/openapi.json | 116 ++++++++++++++++++ .../dashboard-sections/activity-monitor.md | 2 +- .../api_repo_item_sentinel_confirm.go | 4 +- .../api_repo_item_sentinel_confirm_test.go | 5 +- .../stage_tracker_human_gate_test.go | 8 +- .../stage_tracker_lead_action_test.go | 4 +- .../stage_tracker_sentinel_notice_test.go | 7 +- src/pkg/dashboard/static-src/css/tracker.css | 13 +- .../static-src/js/tracker-human-gate.js | 19 ++- src/pkg/dashboard/static/index.html | 32 ++++- 10 files changed, 186 insertions(+), 24 deletions(-) diff --git a/dashboard/openapi.json b/dashboard/openapi.json index b468e6494e..a895906118 100644 --- a/dashboard/openapi.json +++ b/dashboard/openapi.json @@ -29148,6 +29148,122 @@ } } }, + "/api/repos/{owner}/{repo}/items/{number}/sentinel-confirm": { + "post": { + "tags": [ + "Status" + ], + "summary": "Confirm a sentinel finding safe on one issue or pull request from the activity monitor", + "description": "Backs the human-gate pill's Confirm safe verb on a row carrying the sentinel label. Posts a comment marked `` naming the signed-in operator (plus their words when given), then removes the configured sentinel label so the merge gate no longer holds the item; when the label is already gone the comment is still posted and the response says alreadyClear. Same authorisation as the hold toggle plus a signed-in GitHub user; every confirmation is written to the audit log as repo_item_sentinel_confirm.", + "parameters": [ + { + "name": "owner", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "repo", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "number", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "comment": { + "type": "string", + "description": "Optional: why the finding is safe; posted with the confirmation" + }, + "type": { + "type": "string", + "enum": [ + "issue", + "pr" + ], + "description": "Row kind for the result wording; defaults to issue" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Finding confirmed safe", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "ok": { + "type": "boolean" + }, + "repo": { + "type": "string" + }, + "number": { + "type": "integer" + }, + "label": { + "type": "string", + "description": "The configured sentinel label" + }, + "removed": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Sentinel labels removed from the item" + }, + "alreadyClear": { + "type": "boolean", + "description": "No sentinel label was on the item; only the comment was posted" + }, + "result": { + "type": "object", + "description": "Shared row-action outcome for the dashboard toast" + } + } + } + } + } + }, + "400": { + "description": "Invalid request body" + }, + "401": { + "description": "GitHub user session required" + }, + "403": { + "description": "Repository write permission required" + }, + "502": { + "description": "GitHub mutation failed" + }, + "503": { + "description": "GitHub client not configured" + } + } + } + }, "/api/notes": { "get": { "tags": [ diff --git a/src/docs/dashboard-sections/activity-monitor.md b/src/docs/dashboard-sections/activity-monitor.md index d11165f7de..8749d210a5 100644 --- a/src/docs/dashboard-sections/activity-monitor.md +++ b/src/docs/dashboard-sections/activity-monitor.md @@ -248,7 +248,7 @@ The delegated *Let hive decide* path never clears it. Hovering the lit chevron o #### Settling a human gate -Every row a person must settle carries exactly **one** control for it ([#17470](https://github.com/hivecommons/hive/issues/17470); owner, 2026-11-10: "I don't see a consistent way to settle each of these using the UI"): a segmented pill, `[👤 Needs human · ] [verb] [verb] [verb] [… more]`, in the row's pill strip. The status segment names *why* — `review`, `decision`, `sentinel`, `hold`, comma-separated when they stack — and carries the reviewer's question or the sentinel rule as its hover (and, when the row carries a decision, the decision popover on click; the question also stays in the expander line). The verbs are fixed per reason, so the same reason always offers the same answers; stacked reasons union their verbs in reason order, de-duplicated, at most three visible with the rest behind a `…` menu (the same popover pattern as the row's ⋯ menu). "Needs human" is never a chevron word: the lit chevron is the row's real stage with the amber `ham-human-gated` outline as the bar's only cue. The `sentinel`, `hold`, `needs-human` and `needs-decision` chips step aside when the pill renders; `↻ N` retry and the notes button stay separate. +Every row a person must settle carries exactly **one** control for it ([#17470](https://github.com/hivecommons/hive/issues/17470); owner, 2026-11-10: "I don't see a consistent way to settle each of these using the UI"): a segmented pill, `[👤 Needs human · ] [verb] [verb] [verb] [… more]`, in the row's pill strip. The status segment names *why* — `review`, `decision`, `sentinel`, `hold`, comma-separated when they stack — and carries the reviewer's question or the sentinel rule as its hover (and, when the row carries a decision, the decision popover on click; the question also stays in the expander line). The verbs are fixed per reason, so the same reason always offers the same answers; stacked reasons union their verbs in reason order, de-duplicated, at most three visible with the rest behind a `…` menu (the same popover pattern as the row's ⋯ menu); on the stacked head (≤ 1100px) and the phone card the status folds to its icon and only the first verb stays inline, the rest behind the `…`, so the pill is one line and leaves the title its room. "Needs human" is never a chevron word: the lit chevron is the row's real stage with the amber `ham-human-gated` outline as the bar's only cue. The `sentinel`, `hold`, `needs-human` and `needs-decision` chips step aside when the pill renders; `↻ N` retry and the notes button stay separate. | Reason | Set by | Verbs | What gets posted | |---|---|---|---| diff --git a/src/pkg/dashboard/api_repo_item_sentinel_confirm.go b/src/pkg/dashboard/api_repo_item_sentinel_confirm.go index 3a123918a9..34fe22be43 100644 --- a/src/pkg/dashboard/api_repo_item_sentinel_confirm.go +++ b/src/pkg/dashboard/api_repo_item_sentinel_confirm.go @@ -126,13 +126,13 @@ func (s *Server) handleRepoItemSentinelConfirm(w http.ResponseWriter, r *http.Re on := sentinelLabelsOn(labels, sentinel) // The comment first: should the label removal fail, GitHub still // carries who confirmed and why, and the retry is idempotent. - if err := s.deps.GHClient.CreateIssueComment(ctx, repoFull, number, sentinelConfirmComment(user, comment)); err != nil { + if err := s.deps.GHClient.CreateIssueComment(ctx, repoFull, number, sentinelConfirmComment(user, comment)); err != nil { // writeback:solicited operator pressed Confirm safe on this row s.repoHoldGitHubError(w, "post confirmation comment", repoFull, number, sentinel, err) return } removed := []string{} for _, label := range on { - if err := s.deps.GHClient.RemoveLabel(ctx, repoFull, number, label); err != nil { + if err := s.deps.GHClient.RemoveLabel(ctx, repoFull, number, label); err != nil { // writeback:solicited operator pressed Confirm safe on this row s.repoHoldGitHubError(w, "remove sentinel label", repoFull, number, label, err) return } diff --git a/src/pkg/dashboard/api_repo_item_sentinel_confirm_test.go b/src/pkg/dashboard/api_repo_item_sentinel_confirm_test.go index f3910d9d15..6a5345f6b1 100644 --- a/src/pkg/dashboard/api_repo_item_sentinel_confirm_test.go +++ b/src/pkg/dashboard/api_repo_item_sentinel_confirm_test.go @@ -89,10 +89,11 @@ func TestRepoItemSentinelConfirmAuthorizationCommentAndLabel(t *testing.T) { // The label already gone: the confirmation is still commented so the // record names the person; nothing is removed; the owner role passes - // without a permission lookup. + // without a permission lookup (a user session is still required so the + // comment can name who confirmed). mock.comments, mock.removed = nil, nil mock.issueLabels = []string{"lgtm"} - w = postSentinelConfirm(t, srv, "", `{}`, true) + w = postSentinelConfirm(t, srv, "owner-ada", `{}`, true) if w.Code != http.StatusOK { t.Fatalf("owner, already clear: code=%d body=%s", w.Code, w.Body.String()) } diff --git a/src/pkg/dashboard/stage_tracker_human_gate_test.go b/src/pkg/dashboard/stage_tracker_human_gate_test.go index 7967965dbc..0eb5a4c8f7 100644 --- a/src/pkg/dashboard/stage_tracker_human_gate_test.go +++ b/src/pkg/dashboard/stage_tracker_human_gate_test.go @@ -106,7 +106,7 @@ const seen = new Date(now - 60000).toISOString(); const visible = (html) => strip(html).split('

    ')[0].replace(/]*class="config-tooltip[^"]*"[^>]*>[\s\S]*?<\/span>/g, '').replace(/<[^>]*>/g, ' '); const gates = (html) => (html.match(/class="ham-human-gate"/g) || []).length; const reasons = (html) => (/data-ham-gate-reasons="([^"]*)"/.exec(html) || [])[1] || ''; -const verbs = (html) => Array.from(html.matchAll(/data-ham-act="([^"]*)"[^>]*>([^<]*)<\/button>/g)).map(m => m[2]); +const verbs = (html) => Array.from(html.matchAll(/data-ham-act="([^"]*)"[^>]*>([^<]*)<\/button>/g)).map(m => m[2]).filter((v, i, a) => a.indexOf(v) === i); const gateWord = (html) => (/]*>[\s\S]*?([^<]*)<\/span>/.exec(html) || [])[1] || ''; const gateTip = (html) => (/]*>[\s\S]*?Confirm safe/.test(row), 'the fourth verb folds into the … menu: ' + row); +assert.ok(row.includes('data-ham-gate-overflow="1"') && /

    ]*>[\s\S]*?Confirm safe/.test(row), 'the fourth verb folds into the … menu: ' + row); +assert.ok(!/data-ham-gate-inline[^>]*>Confirm safe/.test(row) && /data-ham-gate-inline[^>]*>Let hive decide/.test(row), 'menu copies of inline verbs are marked for the phone tier'); assert.ok(!row.includes('ham-badge-sentinel') && !row.includes('ham-mod-needs-decision') && !row.includes('ham-lead-pill'), 'no sentinel chip, needs-decision pill or loose lead buttons beside the gate: ' + row); assert.ok(row.includes('

    ') && row.includes('Needs human decision'), 'the expander line still names the decision'); @@ -169,7 +170,8 @@ assert.strictEqual(gates(row), 1, row); assert.strictEqual(reasons(row), 'decision'); assert.deepStrictEqual(verbs(row), ['Decide…', 'Approve as-is', 'Let hive decide']); assert.ok(gateTip(row).includes('Two fixes are possible'), gateTip(row)); -assert.ok(!row.includes('data-ham-gate-more'), 'three verbs need no overflow'); +assert.ok(row.includes('data-ham-gate-overflow="0"'), 'three verbs need no overflow on the strip tier (the … is the phone tier\'s fold)'); +assert.strictEqual((row.match(/ham-gate-act-rest/g) || []).length, 2, 'the verbs after the first fold on the phone tier'); assert.deepStrictEqual(segStates(row), [D, D, D, D, D, 'active detoured ham-human-gated', 'todo cap'], strip(row)); assert.ok(row.includes('Merge queue'), 'the chevron reads its column: ' + strip(row)); diff --git a/src/pkg/dashboard/stage_tracker_lead_action_test.go b/src/pkg/dashboard/stage_tracker_lead_action_test.go index de9a82eb87..d29850fc74 100644 --- a/src/pkg/dashboard/stage_tracker_lead_action_test.go +++ b/src/pkg/dashboard/stage_tracker_lead_action_test.go @@ -26,8 +26,8 @@ func TestStageTrackerLeadActionInline(t *testing.T) { `class="ham-lead-act`, `e.target.closest('.ham-lead-act[data-ham-act]')`, `stageTrackerDecisionRun(item, b.dataset.hamAct)`, - `stageTrackerChipsHtml(shown) + (typeof stageTrackerLeadButtonHtml === 'function' ? stageTrackerLeadButtonHtml(item, nowMs, subRows) : '')`, - `stageTrackerChipsHtml(pr) + (typeof stageTrackerLeadButtonHtml === 'function' ? stageTrackerLeadButtonHtml(pr, nowMs) : '')`, + `stageTrackerChipsHtml(shown, { gate: !!gate }) + (gate || (typeof stageTrackerLeadButtonHtml === 'function' ? stageTrackerLeadButtonHtml(item, nowMs, subRows) : ''))`, + `stageTrackerChipsHtml(pr, { gate: !!prGate }) + (prGate || (typeof stageTrackerLeadButtonHtml === 'function' ? stageTrackerLeadButtonHtml(pr, nowMs) : ''))`, `.ham-lead-act[aria-disabled="true"]`, `.ham-lead-act::after { content: '▸';`, `.ham-lead-act.ham-act-secondary {`, diff --git a/src/pkg/dashboard/stage_tracker_sentinel_notice_test.go b/src/pkg/dashboard/stage_tracker_sentinel_notice_test.go index b784cf19ca..07a642709a 100644 --- a/src/pkg/dashboard/stage_tracker_sentinel_notice_test.go +++ b/src/pkg/dashboard/stage_tracker_sentinel_notice_test.go @@ -43,8 +43,11 @@ func TestStageTrackerSentinelNoticePreservesActualReviewerDecision(t *testing.T) jsFunc(t, html, "stageTrackerSentinelTipWithPaths")+ jsFunc(t, html, "stageTrackerSentinelPreface")+ "\nconst notice = "+string(payload)+";\n"+` -assert.deepStrictEqual(stageTrackerHumanGateReasons(notice).map(r => r.key), [], 'an informational notice is not a human gate'); -assert.ok(!stageTrackerRowHtml(notice, stages, ctx).includes('ham-human-gate'), 'no gate pill for a notice'); +const noticeKeys = stageTrackerHumanGateReasons(notice).map(r => r.key); +assert.ok(!noticeKeys.includes('sentinel'), 'an informational notice is not a human gate: ' + noticeKeys); +assert.deepStrictEqual(noticeKeys, ['decision'], 'the reviewer question stays the only gate on the row'); +assert.ok(stageTrackerRowHtml(notice, stages, ctx).includes('data-ham-gate-reasons="decision"'), 'the gate pill names the reviewer question, not the notice'); +assert.ok(!stageTrackerRowHtml(notice, stages, ctx).includes('gate:confirm-sentinel'), 'nothing to confirm on an informational notice'); assert.ok(stageTrackerSentinelTip(notice).includes('Informational security notice (not a merge gate)')); assert.ok(!stageTrackerSentinelTip({...notice, sentinel_reason:''}).includes('must review before merge')); const own = stageTrackerRowHtml(notice, stages, ctx); diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css index 52e325d480..7acbbe0327 100644 --- a/src/pkg/dashboard/static-src/css/tracker.css +++ b/src/pkg/dashboard/static-src/css/tracker.css @@ -996,6 +996,9 @@ .ham-human-gate > .ham-gate-more[aria-expanded="true"] { background: color-mix(in srgb, var(--amber) 22%, transparent); } .ham-human-gate.ham-gate-settling { opacity: 0.75; border-style: dashed; } .ham-human-gate.ham-gate-settling > .ham-gate-status { color: var(--cue-work); } + /* Strip tier: the … button only when a verb overflows; menu copies of + the inline verbs stay hidden. The phone tier flips both. */ + .ham-gate-more-wrap[data-ham-gate-overflow="0"], .ham-gate-menu > [data-ham-gate-inline] { display: none; } .ham-gate-menu[hidden] { display: none; } /* The passive "decision pending on #N" chip is a link to the primary row. */ .ham-decision-pending[data-ham-scroll-to] { text-decoration: underline dotted; text-underline-offset: var(--sp-1); } @@ -1028,6 +1031,11 @@ .ham-head-cols .ham-badges > .ham-badge-mod.ham-mod-ask > .ham-mod-ico { margin-right: 0; } .ham-head-cols .ham-human-gate > .ham-gate-status > .ham-mod-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } .ham-head-cols .ham-human-gate > .ham-gate-status { position: relative; padding-right: var(--sp-2); } + /* Stacked head: the first verb inline, the rest behind …, so the pill + leaves the title its line and no verb is squeezed into a fragment. */ + .ham-head-cols .ham-human-gate > .ham-gate-act-rest { display: none; } + .ham-head-cols .ham-human-gate .ham-gate-more-wrap[data-ham-gate-overflow="0"] { display: inline; } + .ham-head-cols .ham-human-gate .ham-gate-menu > [data-ham-gate-inline] { display: flex; } .ham-row .ham-seg { padding: 0 var(--sp-2) 0 var(--sp-3); } .ham-row .ham-seg.cap { flex-basis: 2em; } .ham-since { width: 3em; } @@ -1262,7 +1270,10 @@ #activity-monitor-section .ham-badge-mod.ham-decision-trigger { position: relative; } /* Gate segments keep the one-line pill; each segment pads its hit area out to the tap target so the phone harness sees ≥44×44. */ - #activity-monitor-section .ham-human-gate > .ham-gate-act, #activity-monitor-section .ham-human-gate > .ham-gate-more, #activity-monitor-section .ham-human-gate > button.ham-gate-status { position: relative; min-width: var(--tap-target); min-height: 0; padding-block: var(--sp-2); } + #activity-monitor-section .ham-human-gate { display: inline-flex; line-height: inherit; vertical-align: baseline; } + #activity-monitor-section .ham-human-gate > .ham-gate-act, #activity-monitor-section .ham-human-gate > .ham-gate-more, #activity-monitor-section .ham-human-gate > button.ham-gate-status { position: relative; display: inline-flex; min-width: var(--tap-target); min-height: 0; height: auto; padding-block: 0; line-height: inherit; } + #activity-monitor-section .ham-human-gate > .ham-gate-act-rest { display: none; } + #activity-monitor-section .ham-human-gate > .ham-gate-act::before, #activity-monitor-section .ham-human-gate > .ham-gate-more::before, #activity-monitor-section .ham-human-gate > button.ham-gate-status::before { content: ""; position: absolute; inset: calc((1lh - var(--tap-target)) / 2) 0; } #activity-monitor-section .ham-badge-mod.ham-decision-trigger::before { content: ""; position: absolute; inset: calc((1lh - var(--tap-target)) / 2) calc((100% - var(--tap-target)) / 2); } /* A card keeps its two-line head and its density (#17161): the 🗒 diff --git a/src/pkg/dashboard/static-src/js/tracker-human-gate.js b/src/pkg/dashboard/static-src/js/tracker-human-gate.js index abb7aa3b50..57d2d72534 100644 --- a/src/pkg/dashboard/static-src/js/tracker-human-gate.js +++ b/src/pkg/dashboard/static-src/js/tracker-human-gate.js @@ -134,12 +134,16 @@ if (lead) return { enabled: lead.enabled !== false, why: lead.enabled === false ? String(lead.why || '') : '' }; return typeof stageTrackerActionAllowed === 'function' ? stageTrackerActionAllowed(id, ctx) : { enabled: true, why: '' }; } - function stageTrackerHumanGateVerbHtml(item, v, state, more) { + // more: a menu item. inline: this menu item doubles a verb that is also + // drawn inline on the strip tier (the phone tier hides the inline copy + // and shows this one). rest: an inline verb after the first (the phone + // tier folds it into the … menu). + function stageTrackerHumanGateVerbHtml(item, v, state, more, inline, rest) { const ref = typeof stageTrackerRefOf === 'function' ? stageTrackerRefOf(item) : ''; const tip = state.enabled ? v.posts : state.why; const attrs = `data-ham-act="${esc(v.id)}"${state.enabled ? '' : ' aria-disabled="true"'}${tip ? ` title="${esc(tip)}"` : ''} aria-label="${esc(v.label + (ref ? ' — ' + ref : ''))}"`; - if (more) return ``; - return ``; + if (more) return ``; + return ``; } // Pure: the pill. '' when the row has no gate. The status segment is // the decision popover's trigger when the row carries a decision, else @@ -181,8 +185,13 @@ : `${inner}`; const shownVerbs = verbs.slice(0, STAGE_TRACKER_GATE_VISIBLE); const moreVerbs = verbs.slice(STAGE_TRACKER_GATE_VISIBLE); - const acts = shownVerbs.map(v => stageTrackerHumanGateVerbHtml(item, v, stageTrackerHumanGateVerbState(v.id, shown, ctx, leads), false)).join(''); - const more = moreVerbs.length ? `

    ` : ''; + const acts = shownVerbs.map((v, i) => stageTrackerHumanGateVerbHtml(item, v, stageTrackerHumanGateVerbState(v.id, shown, ctx, leads), false, false, i > 0)).join(''); + // The … menu holds every verb after the first: on the strip tier CSS + // shows only the ones past STAGE_TRACKER_GATE_VISIBLE (and hides the + // button when there are none); the phone tier shows the first verb + // inline and the rest here, so the pill stays one line (#17161). + const menuVerbs = verbs.slice(1); + const more = menuVerbs.length ? `` : ''; const key = typeof stageTrackerItemKey === 'function' ? stageTrackerItemKey(item) : ''; return `${status}${acts}${more}`; } diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index cdbad9bcf0..2c5caa673a 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -2339,6 +2339,9 @@ .ham-human-gate > .ham-gate-more[aria-expanded="true"] { background: color-mix(in srgb, var(--amber) 22%, transparent); } .ham-human-gate.ham-gate-settling { opacity: 0.75; border-style: dashed; } .ham-human-gate.ham-gate-settling > .ham-gate-status { color: var(--cue-work); } + /* Strip tier: the … button only when a verb overflows; menu copies of + the inline verbs stay hidden. The phone tier flips both. */ + .ham-gate-more-wrap[data-ham-gate-overflow="0"], .ham-gate-menu > [data-ham-gate-inline] { display: none; } .ham-gate-menu[hidden] { display: none; } /* The passive "decision pending on #N" chip is a link to the primary row. */ .ham-decision-pending[data-ham-scroll-to] { text-decoration: underline dotted; text-underline-offset: var(--sp-1); } @@ -2371,6 +2374,11 @@ .ham-head-cols .ham-badges > .ham-badge-mod.ham-mod-ask > .ham-mod-ico { margin-right: 0; } .ham-head-cols .ham-human-gate > .ham-gate-status > .ham-mod-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } .ham-head-cols .ham-human-gate > .ham-gate-status { position: relative; padding-right: var(--sp-2); } + /* Stacked head: the first verb inline, the rest behind …, so the pill + leaves the title its line and no verb is squeezed into a fragment. */ + .ham-head-cols .ham-human-gate > .ham-gate-act-rest { display: none; } + .ham-head-cols .ham-human-gate .ham-gate-more-wrap[data-ham-gate-overflow="0"] { display: inline; } + .ham-head-cols .ham-human-gate .ham-gate-menu > [data-ham-gate-inline] { display: flex; } .ham-row .ham-seg { padding: 0 var(--sp-2) 0 var(--sp-3); } .ham-row .ham-seg.cap { flex-basis: 2em; } .ham-since { width: 3em; } @@ -2605,7 +2613,10 @@ #activity-monitor-section .ham-badge-mod.ham-decision-trigger { position: relative; } /* Gate segments keep the one-line pill; each segment pads its hit area out to the tap target so the phone harness sees ≥44×44. */ - #activity-monitor-section .ham-human-gate > .ham-gate-act, #activity-monitor-section .ham-human-gate > .ham-gate-more, #activity-monitor-section .ham-human-gate > button.ham-gate-status { position: relative; min-width: var(--tap-target); min-height: 0; padding-block: var(--sp-2); } + #activity-monitor-section .ham-human-gate { display: inline-flex; line-height: inherit; vertical-align: baseline; } + #activity-monitor-section .ham-human-gate > .ham-gate-act, #activity-monitor-section .ham-human-gate > .ham-gate-more, #activity-monitor-section .ham-human-gate > button.ham-gate-status { position: relative; display: inline-flex; min-width: var(--tap-target); min-height: 0; height: auto; padding-block: 0; line-height: inherit; } + #activity-monitor-section .ham-human-gate > .ham-gate-act-rest { display: none; } + #activity-monitor-section .ham-human-gate > .ham-gate-act::before, #activity-monitor-section .ham-human-gate > .ham-gate-more::before, #activity-monitor-section .ham-human-gate > button.ham-gate-status::before { content: ""; position: absolute; inset: calc((1lh - var(--tap-target)) / 2) 0; } #activity-monitor-section .ham-badge-mod.ham-decision-trigger::before { content: ""; position: absolute; inset: calc((1lh - var(--tap-target)) / 2) calc((100% - var(--tap-target)) / 2); } /* A card keeps its two-line head and its density (#17161): the 🗒 @@ -26399,12 +26410,16 @@

    All labels

    if (lead) return { enabled: lead.enabled !== false, why: lead.enabled === false ? String(lead.why || '') : '' }; return typeof stageTrackerActionAllowed === 'function' ? stageTrackerActionAllowed(id, ctx) : { enabled: true, why: '' }; } - function stageTrackerHumanGateVerbHtml(item, v, state, more) { + // more: a menu item. inline: this menu item doubles a verb that is also + // drawn inline on the strip tier (the phone tier hides the inline copy + // and shows this one). rest: an inline verb after the first (the phone + // tier folds it into the … menu). + function stageTrackerHumanGateVerbHtml(item, v, state, more, inline, rest) { const ref = typeof stageTrackerRefOf === 'function' ? stageTrackerRefOf(item) : ''; const tip = state.enabled ? v.posts : state.why; const attrs = `data-ham-act="${esc(v.id)}"${state.enabled ? '' : ' aria-disabled="true"'}${tip ? ` title="${esc(tip)}"` : ''} aria-label="${esc(v.label + (ref ? ' — ' + ref : ''))}"`; - if (more) return ``; - return ``; + if (more) return ``; + return ``; } // Pure: the pill. '' when the row has no gate. The status segment is // the decision popover's trigger when the row carries a decision, else @@ -26446,8 +26461,13 @@

    All labels

    : `${inner}`; const shownVerbs = verbs.slice(0, STAGE_TRACKER_GATE_VISIBLE); const moreVerbs = verbs.slice(STAGE_TRACKER_GATE_VISIBLE); - const acts = shownVerbs.map(v => stageTrackerHumanGateVerbHtml(item, v, stageTrackerHumanGateVerbState(v.id, shown, ctx, leads), false)).join(''); - const more = moreVerbs.length ? `` : ''; + const acts = shownVerbs.map((v, i) => stageTrackerHumanGateVerbHtml(item, v, stageTrackerHumanGateVerbState(v.id, shown, ctx, leads), false, false, i > 0)).join(''); + // The … menu holds every verb after the first: on the strip tier CSS + // shows only the ones past STAGE_TRACKER_GATE_VISIBLE (and hides the + // button when there are none); the phone tier shows the first verb + // inline and the rest here, so the pill stays one line (#17161). + const menuVerbs = verbs.slice(1); + const more = menuVerbs.length ? `` : ''; const key = typeof stageTrackerItemKey === 'function' ? stageTrackerItemKey(item) : ''; return `${status}${acts}${more}`; } From d8e0bb92313ea10203fd4c96ec42e62fd57aefbc Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Mon, 9 Nov 2026 20:28:47 -0700 Subject: [PATCH 4/4] Keep the informational sentinel-notice chip beside the gate pill Signed-off-by: Andrew Anderson --- src/pkg/dashboard/static-src/js/tracker-row-strip.js | 3 ++- src/pkg/dashboard/static/index.html | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pkg/dashboard/static-src/js/tracker-row-strip.js b/src/pkg/dashboard/static-src/js/tracker-row-strip.js index 9823d98734..95c70e3647 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row-strip.js +++ b/src/pkg/dashboard/static-src/js/tracker-row-strip.js @@ -964,7 +964,8 @@ // opts.gate: the row renders the one human-gate pill, which carries the // sentinel / hold / needs-human reasons itself — those chips step aside. const gated = !!(opts && opts.gate); - const sentinel = (gated ? '' : stageTrackerSentinelChipHtml(item)) + (typeof stageTrackerPreparationChipHtml === 'function' ? stageTrackerPreparationChipHtml(item) : '') + (typeof stageTrackerAdoptionChipHtml === 'function' ? stageTrackerAdoptionChipHtml(item) : '') + (typeof stageTrackerPresenceChipHtml === 'function' ? stageTrackerPresenceChipHtml(item) : '') + (typeof stageTrackerPushChipHtml === 'function' ? stageTrackerPushChipHtml(item, Date.now()) : '') + (typeof stageTrackerReroutePillHtml === 'function' ? stageTrackerReroutePillHtml(item) : '') + (typeof stageTrackerSupersedesChipHtml === 'function' ? stageTrackerSupersedesChipHtml(item, Date.now()) : '') + (typeof stageTrackerOverlapBadgeHtml === 'function' ? stageTrackerOverlapBadgeHtml(item) : ''); + // The informational notice is not a gate reason, so its chip stays. + const sentinel = (gated && !item.sentinel_notice ? '' : stageTrackerSentinelChipHtml(item)) + (typeof stageTrackerPreparationChipHtml === 'function' ? stageTrackerPreparationChipHtml(item) : '') + (typeof stageTrackerAdoptionChipHtml === 'function' ? stageTrackerAdoptionChipHtml(item) : '') + (typeof stageTrackerPresenceChipHtml === 'function' ? stageTrackerPresenceChipHtml(item) : '') + (typeof stageTrackerPushChipHtml === 'function' ? stageTrackerPushChipHtml(item, Date.now()) : '') + (typeof stageTrackerReroutePillHtml === 'function' ? stageTrackerReroutePillHtml(item) : '') + (typeof stageTrackerSupersedesChipHtml === 'function' ? stageTrackerSupersedesChipHtml(item, Date.now()) : '') + (typeof stageTrackerOverlapBadgeHtml === 'function' ? stageTrackerOverlapBadgeHtml(item) : ''); const mods = (Array.isArray(item.modifiers) ? item.modifiers.slice() : []) .filter(m => !gated || STAGE_TRACKER_GATE_MODS.indexOf(m) < 0) .sort((x, y) => STAGE_TRACKER_MOD_PRIORITY.indexOf(x) - STAGE_TRACKER_MOD_PRIORITY.indexOf(y)); diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 2c5caa673a..8ac33586c1 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -19413,7 +19413,8 @@

    Where to get help

    // opts.gate: the row renders the one human-gate pill, which carries the // sentinel / hold / needs-human reasons itself — those chips step aside. const gated = !!(opts && opts.gate); - const sentinel = (gated ? '' : stageTrackerSentinelChipHtml(item)) + (typeof stageTrackerPreparationChipHtml === 'function' ? stageTrackerPreparationChipHtml(item) : '') + (typeof stageTrackerAdoptionChipHtml === 'function' ? stageTrackerAdoptionChipHtml(item) : '') + (typeof stageTrackerPresenceChipHtml === 'function' ? stageTrackerPresenceChipHtml(item) : '') + (typeof stageTrackerPushChipHtml === 'function' ? stageTrackerPushChipHtml(item, Date.now()) : '') + (typeof stageTrackerReroutePillHtml === 'function' ? stageTrackerReroutePillHtml(item) : '') + (typeof stageTrackerSupersedesChipHtml === 'function' ? stageTrackerSupersedesChipHtml(item, Date.now()) : '') + (typeof stageTrackerOverlapBadgeHtml === 'function' ? stageTrackerOverlapBadgeHtml(item) : ''); + // The informational notice is not a gate reason, so its chip stays. + const sentinel = (gated && !item.sentinel_notice ? '' : stageTrackerSentinelChipHtml(item)) + (typeof stageTrackerPreparationChipHtml === 'function' ? stageTrackerPreparationChipHtml(item) : '') + (typeof stageTrackerAdoptionChipHtml === 'function' ? stageTrackerAdoptionChipHtml(item) : '') + (typeof stageTrackerPresenceChipHtml === 'function' ? stageTrackerPresenceChipHtml(item) : '') + (typeof stageTrackerPushChipHtml === 'function' ? stageTrackerPushChipHtml(item, Date.now()) : '') + (typeof stageTrackerReroutePillHtml === 'function' ? stageTrackerReroutePillHtml(item) : '') + (typeof stageTrackerSupersedesChipHtml === 'function' ? stageTrackerSupersedesChipHtml(item, Date.now()) : '') + (typeof stageTrackerOverlapBadgeHtml === 'function' ? stageTrackerOverlapBadgeHtml(item) : ''); const mods = (Array.isArray(item.modifiers) ? item.modifiers.slice() : []) .filter(m => !gated || STAGE_TRACKER_GATE_MODS.indexOf(m) < 0) .sort((x, y) => STAGE_TRACKER_MOD_PRIORITY.indexOf(x) - STAGE_TRACKER_MOD_PRIORITY.indexOf(y));