Skip to content

πŸ› fix: offer Close issue on every open tracker issue - #16012

Merged
clubanderson merged 4 commits into
v5from
fix/tracker-close-issue
Oct 31, 2026
Merged

clubanderson merged 4 commits into
v5from
fix/tracker-close-issue

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Summary

  • Offer a dedicated Close issue action at every issue stage, including held/claimed/human-needed issues and exact linked issue targets in PR-only views.
  • Reuse the existing permission-checked decision endpoint and attributed comment/close pipeline, with a styled confirmation naming the repository, number and title. Close as completed; linked PRs and sibling issues are unchanged.
  • Preserve remote mutation gates, canonical refresh, closed-row policy and all existing PR actions. Block duplicate submissions and surface refusals/errors without optimistic closure.

Validation

  • Added API and tracker regression coverage for permissions/read-only, open vs closed issues vs PRs, all stages, exact nested targets, confirmation, pending, cancellation and remote failures.
  • Changed Go files checked with gofmt -l; dashboard artifact regenerated.
  • No local tests/builds/lints executed; CI is the sole verdict.
  • No live issue closes, deployment, configuration or activation changes.

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 31, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 31, 2026
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#16025 πŸ“– docs: mark Matrix view as pending and add close-read to decision enum CONFLICT src/docs/api-reference/packs-and-acmm.md
#16020 ✨ feature: add opt-in Matrix Rain and Cascade display same files src/pkg/dashboard/static/index.html
#16027 πŸ› fix: keep the preparation train connector continuous between adjacent members same files src/docs/dashboard-sections/activity-monitor.md
src/pkg/dashboard/static/index.html
#15890 πŸ› dashboard: point operator-reference help marks at the section sub-pages same files src/pkg/dashboard/static/index.html
#16011 πŸ› fix: explain human requirements and optional tracker actions same files src/docs/dashboard-sections/activity-monitor.md
src/pkg/dashboard/static-src/js/tracker-row-layout.js
src/pkg/dashboard/static-src/js/tracker-row-strip.js
src/pkg/dashboard/static/index.html
#15977 ✨ feat: serve Matrix lines via authorized /api/matrix/lines and content-free code-lines SSE nudge same files src/docs/api-reference/packs-and-acmm.md

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@hivecommons-hive

hivecommons-hive Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Hive status β€” updated in place; edits do not notify. Full history is in the Activity Monitor.

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Why:

  • the review swarm requested changes

Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path.

Review findings from reviewer-2 (folded here because this head already carries its hive review):

Read the new close-issue branch against the existing decision pipeline at a25079e; this looks correct to me.

What I verified:

  • Permission and refusal path reused, not bypassed. close-issue joins the existing case at src/pkg/dashboard/api_repo_item_decision.go:430, so it runs after the shared canToggleRepoHold gate, the X-Hive-User requirement, the paused-repo refused short-circuit, the attributed comment, gh.CloseIssue(... AllowTrackingIssue: true) and the audit record β€” the same sequence close-wontfix/close-read already take. No new write path is introduced.
  • Issue-only, open-only pre-flight. Lines 434-449 reject type != issue, issue.IsPullRequest() (400) and non-open issues (409) before any comment is posted, so a stale row cannot produce a comment on an already-closed issue or a PR. verb/stateReason become completed/issueStateReasonCompleted as the body states.
  • Closed-row grace. operator_actions.go:914 adds the action to operatorClosedActions, so the row is hidden under the existing closed-grace policy instead of flickering back from GitHub's list lag.
  • Client gate matches server. stageTrackerActionAllowed('decide:close-issue', ctx) (tracker-actions.js:358-363) enables it on canHold && user, the same condition the server's gate expresses; the single-item guard at tracker-actions.js:2337-2353 prevents fan-out and remapping through a covering PR, and _stageTrackerCloseIssueBusy blocks double submission.
  • Styled confirmation. The confirm uses hivePrompt (in-app modal, static/index.html), not a native window.confirm, consistent with the dashboard's no-native-dialog rule.

One thing I checked and found benign: stageTrackerItemState now includes |state:, which is what lets the acting toast resolve when the issue flips to closed; state does not otherwise change on open rows, so existing stuck/no-op detection is unaffected.

Not approving (that is a human's signature); flagging as ready for a maintainer's read.

Review findings from ci-maintainer (folded here because this head already carries its hive review):

docs-currency β€” reviewed head a25079e.

Operator docs still describe the old decision set and now state something false. The PR adds a new API decision value and a new row action on every open issue (src/pkg/dashboard/api_repo_item_decision.go:69, :288-291, :430-450; static-src/js/tracker-actions.js:38, :55, :1898-1902), but neither doc surface that enumerates them was touched:

  • src/docs/api-reference/packs-and-acmm.md:20 lists the accepted decision body values (approve|direction|close-superseded|close-wontfix|adopt|…) and says "The close variants post a comment naming the operator … and close the item as not planned." After this PR close-issue closes as completed (api_repo_item_decision.go:449 sets issueStateReasonCompleted), so that sentence is now wrong for one of the variants, and the new value is absent from the list (the 400 message at api_repo_item_decision.go:559 now advertises it).
  • src/docs/dashboard-sections/activity-monitor.md:359, :397, :417 and :429 enumerate the row actions / ledger actions / confirm dialogs; Close issue is missing from each, and :397 ("For an issue: …") is where an operator would look for it.

Suggested wording for packs-and-acmm.md:20 (inline, replacing the two spans):

-Body `{"decision": "approve"|"direction"|"close-superseded"|"close-wontfix"|"adopt"|"reroute"|"re-author"|"merge-now"|"queue-merge", …
+Body `{"decision": "approve"|"direction"|"close-superseded"|"close-wontfix"|"close-read"|"close-issue"|"adopt"|"reroute"|"re-author"|"merge-now"|"queue-merge", …
…
-The close variants post a comment naming the operator (and the superseding PR when `superseded_by` is given) and close the item as not planned.
+The close variants post a comment naming the operator (and the superseding PR when `superseded_by` is given) and close the item as not planned; `close-issue` (`type: "issue"` only; 400 on a PR, 409 when already closed) closes the single named issue as completed and leaves linked PRs and other issues untouched.

And for activity-monitor.md:397, append after Close as won't-fix…:

-*Close as superseded by…* and *Close as won't-fix…*.
+*Close as superseded by…*, *Close as won't-fix…* and β€” on every open issue, whatever its stage, including a linked issue reached from a PR-only row β€” *Close issue* (in-app confirmation naming repo, number and title, optional comment; closes only that issue as completed).

Adding Close issue to the lists at :359, :417 and :429 is a one-word edit each.

(close-read was already missing from the API body list before this PR β€” noted only because the suggested line fixes it in passing.)

Review findings from adjudicator-4 (folded here because this head already carries its hive review):

Style review (head a25079e) β€” no blockers; three consistency notes, worst first.

  1. Missing-issue pre-flight returns 502 where the sibling handler returns 404. src/pkg/dashboard/api_repo_item_decision.go:439-443 passes any Issues.Get error straight to jsonError(..., http.StatusBadGateway), and api_repo_item_close_issue_test.go:59 pins "missing issue" β†’ 502. The existing pre-flight in api_repo_item_accept_triage.go:152-157 maps a 404 to "issue not found" / http.StatusNotFound and reserves 502 for forge failures. Suggest matching it so a stale/typo'd number is not reported as a forge outage:

    			issue, resp, err := gh.GoGitHub().Issues.Get(ctx, owner, repoName, number)
    			if err != nil {
    				if resp != nil && resp.StatusCode == http.StatusNotFound {
    					jsonError(w, "issue not found", http.StatusNotFound)
    					return
    				}
    				jsonError(w, err.Error(), http.StatusBadGateway)
    				return
    			}
    

    (and flip the test expectation to http.StatusNotFound).

  2. Linked-issue DTO is built inline twice instead of via a helper. tracker-actions.js:165-166 and :179 each hand-assemble { repo, number, kind: 'issue', ... } for a linked issue, while the linked-PR path right below (:170) goes through stageTrackerLinkedPRItem(it, lp). A stageTrackerLinkedIssueItem(it, li) mirroring that keeps the two shapes from drifting (the two inline copies already differ: one carries title/url/state, the other does not).

  3. New mock fields break the documented-field convention of repoItemDecisionMock. api_repo_item_decision_test.go:73-81 adds issueState, commentError, editError, editPaths separated by blank lines and with no comments, whereas every other field in that struct (:55-72) carries a one-line comment naming the GitHub route it shapes.

    	// issueState is GET /issues/7's state ("" = open); commentError /
    	// editError make POST /comments and PATCH /issues/N answer that HTTP
    	// status; editPaths records each PATCH path alongside edits.
    	issueState             string
    	commentError, editError int
    	editPaths              []string
    

Advisory, not a request: decide:close-issue prompts via hivePrompt directly (tracker-actions.js:1900) rather than stageTrackerAsk(id, 'prompt', …) used by the other close actions (:1889, :1893), so it never offers the "don't ask again" opt-out. That reads as deliberate for a destructive close; a one-line comment saying so would stop the next reader from "fixing" it.

Review findings from reviewer (folded here because this head already carries its hive review):

Read at 78c30d9, against the v5 tree. The implementation looks correct to me; one cosmetic note.

Verified

  • Server (src/pkg/dashboard/api_repo_item_decision.go:434-456): close-issue rejects type != "issue", fetches the issue, 404s on not-found, 400s when IsPullRequest(), 409s unless state == "open", then falls into the shared close path β€” paused-repo refusal (:481), required attributed comment before any close (:486), CloseIssue with StateReason: completed (:498-505), audit + Status: "closed" (:512). Nothing else in that path branches on the new decision, so linked PRs/issues are untouched as claimed.
  • Client: stageTrackerActionRequest (tracker-actions.js:1195) refuses non-issue / closed items, and the dispatcher (:2338-2354) forces single-target, no fan-out, with a per-key busy set; the response check at :1352 throws unless status is closed or refused, so no optimistic closure.
  • Linked-issue kebabs (stageTrackerLinkedIssueToolsHtml, :177) only render for li.state === 'open'; StageTrackerLinkedIssue.State is populated lower-cased at stage_tracker_links.go:47, and stageTrackerMenuTargets (:794) already resolves [data-ham-sub-key], with stageTrackerItemByKey (:165) now synthesising the issue item.
  • Ledger wiring is complete: operator_actions.go:40/342/914 and tracker-row-acted.js:97.

Info (cosmetic)

  • tracker-actions.js:1901 passes danger: true to hivePrompt, but hivePrompt (tooltips-dialogs.js:495-531) never reads cfg.danger β€” its confirm button is hard-coded btn-primary at :513. Only hiveConfirm honours danger. The "Close issue" button therefore renders as a normal primary action, not the red destructive style the call intends. Harmless; worth a follow-up if the red styling was the goal.

Not approving β€” that's a human's signature.

Signed-off-by: Andy Anderson <andy@clubanderson.com>

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the handler at the PR head and the existing close path it joins; this looks correct to me.

  • src/pkg/dashboard/api_repo_item_decision.go:430-452 β€” close-issue joins the existing close-* case, so it inherits the permission check, the paused-repo refusal (repoWritesPaused, line 478), the attributed comment via renderRepoItemDecisionCloseComment, gh.CloseIssue(... StateReason: completed, AllowTrackingIssue: true) and the auditRepoItemDecisionClose record. The new pre-checks (Issues.Get β†’ not a PR, still open) run before any write, so a stale row cannot post a comment on an already-closed issue. GoGitHub() exists on *ghpkg.Client (src/pkg/github/client.go:529).
  • operator_actions.go:914 β€” added to operatorClosedActions, so the closed-row grace policy treats it like wontfix/close-read.
  • tracker-actions.js β€” confirmation uses hivePrompt (in-app, not window.confirm); _stageTrackerCloseIssueBusy plus the _stageTrackerPending check blocks a second click, and items.length !== 1 refuses fan-out so a multi-select can never close more than the chosen issue. Success requires data.status of closed or refused, so a non-confirming 200 is not rendered as closed.
  • Tests: api_repo_item_close_issue_test.go covers anonymous/read-only/PR-disguised/already-closed/paused/remote-failure paths against the existing repoItemDecisionMock.

Note for sequencing: #16011 also edits tracker-row-layout.js, tracker-row-strip.js and static/index.html; whichever lands second will likely need a rebase/regenerated artifact. Both are mergeable against v5 individually.

β€” hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Hive filed review findings that do not block this PR as backlog items:

Cap: 10 backlog item(s) per PR per day.

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@clubanderson

Copy link
Copy Markdown
Member Author

Addressed the actionable docs-currency review (not dismissing it as stale UI): the API decision enum now includes close-read and close-issue; the close variants explicitly distinguish not-planned from both completed variants; Activity Monitor ledger/action/result/confirmation docs describe every-open-issue availability, exact selected issue targeting, linked PR-only access, permission/refusal behavior and the deliberately non-skippable in-app confirmation. Also matched the sibling preflight: missing issues return 404, while forge failures remain 502, with the regression expectation updated. Documented mock-route fields and why close-issue always confirms. Regenerated the shipped dashboard artifact. Only changed-Go gofmt -l and the generator ran locally; the new head requires fresh full CI. The optional linked-issue helper refactor is not needed for this fix and was left out to keep the change surgical.

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the diff against the tree at pr16012 (server handler, operator ledger, tracker JS, dialog helper) β€” looks correct to me; no blocking findings.

What I verified:

  • Server: close-issue joins the existing close case at api_repo_item_decision.go:430, so it inherits the paused-repo refusal (:479-484), the attributed closing comment (:485), CloseIssue with StateReason: completed / AllowTrackingIssue: true (:497-505), the audit record and the Status: "closed" response (:511-513). The added pre-checks (:434-456) reject PRs, non-issues and already-closed issues before any write, which is what keeps the action exact-target.
  • The JS result guard (tracker-actions.js:1352) accepts exactly the two statuses the server can return on this path β€” closed (:512) and refused (:482) β€” so a 200 without a close surfaces as an error rather than an optimistic closed row.
  • Permission gate: stageTrackerActionAllowed('decide:close-issue', ctx) (tracker-actions.js:358-363) resolves to the same canHold && user rule the other decide:close-* actions use, so this does not widen who can close an issue from the dashboard.
  • Confirmation uses hivePrompt (tooltips-dialogs.js:495), the in-app modal β€” no native dialog β€” and cancel resolves null, matching the v == null check at :1901.
  • stageTrackerLinkedIssueToolsHtml is wired into the row layout (tracker-row-layout.js:535) and stageTrackerItemByKey now resolves linked-issue keys (tracker-actions.js:165-168), so the per-issue kebab in PR-only views has a real target.
  • operatorClosedActions (operator_actions.go:914) includes the new action, so the closed-row grace policy applies. go build ./pkg/dashboard/ is clean (go test is disabled on agent hosts; reading CI for the suite).

Info only: the danger: true passed to hivePrompt at tracker-actions.js:1900 is not a field that helper reads (tooltips-dialogs.js:496-516), so the Close button renders as the ordinary primary button rather than a destructive one. Cosmetic; drop or add support, either is fine.

β€” hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 31, 2026
@clubanderson
clubanderson merged commit ee9db3e into v5 Oct 31, 2026
80 of 81 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/tracker-close-issue branch October 31, 2026 11:50
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

hivecommons-hive Bot added a commit that referenced this pull request Oct 31, 2026
Rebased onto v5: the close-read decision enum is already documented there
by #16012, so that hunk is dropped. The Matrix section no longer claims
the renderer is pending (#16020 may land without a docs change); instead
it states the renderer as a dependency and adds an activation-checklist
step to confirm the deployed build serves view=matrix before scale-up,
as issue #16003 asks.

Fixes #16003

Hive-Fix-Attempt: 1/6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: ci-maintainer <280983584+hivecommons-hive[bot]@users.noreply.github.com>
hivecommons-hive Bot added a commit that referenced this pull request Oct 31, 2026
Rebased onto v5: the close-read decision enum is already documented there
by #16012, so that hunk is dropped. The Matrix section no longer claims
the renderer is pending (#16020 may land without a docs change); instead
it states the renderer as a dependency and adds an activation-checklist
step to confirm the deployed build serves view=matrix before scale-up,
as issue #16003 asks.

Fixes #16003

Hive-Fix-Attempt: 1/6

Signed-off-by: ci-maintainer <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: ci-maintainer <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflicts-with-open-pr Open PR has a merge conflict with another open PR dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant