You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GET /requests?approver=me hides a request the caller could approve (uses remaining(), not could-count) #790
Found by reviewer 2 (Fable) on PR #785, 2026-12-01 (reviewer 2's report section 5, finding 4). Pre-existing.
approver=me hides a request that the caller can approve (Low)
Parent: story #18. routers/requests.py:80 keeps a request when the caller is in a group of ledger.remaining(). :approve accepts a wider set: a person whose approval fills one more seat after an earlier approver of two groups moves
(ApprovalLedger._eligible). Proof: the ledger of test_who_may_reject_is_who_may_approve_and_the_group_is_one_still_open; bob approves, and any(token_group(r["group"]) in bob.groups for r in ledger.remaining()) is false.
# core/approvals.py, in ApprovalLedgerdefcould_count(self, groups: frozenset[str]) ->bool:
"""Whether a person of these groups would fill one more seat now: the last check of _eligible, for a list."""returnlen(self._assign(self.entries+ [{"groups": frozenset(groups)}])) >len(self._assign(self.entries))
# routers/requests.pydef_can_still_approve(repo: RequestRepo, row, who: Identity) ->bool:
ledger=repo.ledger(row)
returnbool(ledger) andledger.could_count(who.groups)
# tests/core/test_approvals.pydeftest_the_approver_list_keeps_a_request_that_the_person_can_approve(rules):
req=rules.decide(facts(action="update", quotaIncreasePct=150))
prod, platform=req.token_group("approver-prod"), req.token_group("approver-platform")
led=ApprovalLedger(req, requester_sub="sub-ola")
led.approve(person("amy", groups={prod, platform}, **APPROVER))
assertnotany(req.token_group(r["group"]) ==prodforrinled.remaining()) # today's list rule hides it from bobassertled.could_count(frozenset({prod})) andled.could_count(frozenset({platform}))
assertnotled.could_count(frozenset({"/cmapi/app-cmapi-rbac-approver-qa"}))
Run in a scratch copy of the final tree, tests/core/test_approvals.py: before the method, 1 failed (ApprovalLedger
has no could_count) and 40 passed; with it, 41 passed. The change of _can_still_approve itself was not run: it needs a
service test with a two-group request, which the issue's fix adds.
Severity: Low. The Approvals tab hides a request the caller could approve; no wrong decision.
Activity