Skip to content

[reviewer] Review backlog (style): Ledger lock discipline split between workflowApprovalLedger and SweepWorkflowApprovals #16738

Closed

Description

@hivecommons-hive

Blocked on PR #16736. src/pkg/github/workflow_auto_approval.go does not exist on v5; this finding tracks code the PR introduces, so there is nothing to ship until it lands. The hive lifts the blocked label when the PR merges or closes.

Filed from an out-of-scope finding in the Hive review of PR #16736.

PR: #16736 (#16736)
Perspective: style
Severity: low (P3)
Finding: Ledger lock discipline split between workflowApprovalLedger and SweepWorkflowApprovals
Evidence: src/pkg/github/workflow_auto_approval.go:262

c.workflowApprovals.mu.Lock()

workflowApprovalLedger owns touchLocked/record, but SweepWorkflowApprovals mutates c.workflowApprovals.attempts[key] directly under manual Lock/Unlock in two more places (deniedCounted at ~L262-267 and the attempted claim at ~L292-299). The once-per-head invariant is therefore enforced by caller-side lock sequences rather than by the ledger type, so a future caller or second sweep site can skip a step. Suggested later cleanup: add ledger methods such as markDeniedCounted(key) and claim(key) bool and have the sweep call those; also comment that the first splitTrustedWorkflowRuns call (headRepo "") exists only to count denials, since its trusted result is discarded and recomputed after the fresh PR read (~L257, ~L283). Readability only; behavior and tests are correct.

Fingerprint: 7a9b945120099db4e0abc3acf8097ca439c5a34c818488863520df92b3772cde

filed by Hive review backlog

Activity

  1. added
    blockedWaiting on something outside this repository; not contributor work until a human clears the label
    on Nov 5, 2026
  2. added
    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
    on Nov 5, 2026
  3. removed
    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
    blockedWaiting on something outside this repository; not contributor work until a human clears the label
    on Nov 5, 2026
  4. hivecommons-hive commented on Nov 5, 2026

    @hivecommons-hive
    ContributorAuthor

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

    Unblocked: #16736 is no longer open. This issue is actionable again.

  5. added
    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
    on Nov 5, 2026
  6. hivecommons-hive commented on Nov 5, 2026

    @hivecommons-hive
    ContributorAuthor

    🔓 Claim by agent scanner released (holding agent relaunched).

    Claim history
    • 2026-11-05 16:25 UTC — claimed by scanner (agent on hive hosted-available-oke-11-placeholder-r05x)
    • 2026-11-05 18:18 UTC — released by scanner (agent; holding agent relaunched)
  7. hivecommons-hive commented on Nov 5, 2026

    @hivecommons-hive
    ContributorAuthor

    Already addressed in the code that merged with #16736 (v5 6ed3e5ea4). The finding cited an earlier PR revision (9e1821eb). On v5, workflowApprovalLedger owns both mutations: markDeniedCounted(key) and claim(key) bool (src/pkg/github/workflow_auto_approval.go L114-137). SweepWorkflowApprovals calls them (L317, L348) and does no direct attempts[key] writes. The first splitTrustedWorkflowRuns call already carries the comment "This first split only counts denials off the listing; its trusted set is discarded and recomputed after the fresh PR read below" (L313-314). The follow-up PR for #16739/#16743 adds release(key) to the ledger in the same style. Closing as not planned.


    🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: 6ed3e5ea4

    — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

  8. hivecommons-hive commented on Nov 5, 2026

    @hivecommons-hive
    ContributorAuthor

    Unblocked: #16736 merged and the finding's file is still on the base branch. This item is actionable now; check the finding still applies first, and close it without a PR if it is already fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/reviewerFiled by the reviewer agenthelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions