test(labels): exercise the priority-label path's six degraded branches - #9867
Conversation
#9866) Every I/O call in maybeHandlePriorityLabelEligibility is wrapped in a .catch that degrades rather than failing the webhook delivery -- which is what makes a label-mutating rule safe to run on a webhook at all, since an escaping throw would take every handler after it on the same event down with it. None of the six was exercised: the existing fail-open case asserts a 404 RESPONSE, which takes the ordinary return path, not the catch. These make each call actually throw and assert the degraded outcome.
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-29 17:33:38 UTC
Review summary Nits — 5 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. Decision record
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9867 +/- ##
==========================================
- Coverage 91.74% 90.87% -0.88%
==========================================
Files 918 918
Lines 112965 112965
Branches 27184 27184
==========================================
- Hits 103642 102654 -988
- Misses 8037 9223 +1186
+ Partials 1286 1088 -198
Flags with carried forward coverage won't be shown. Click here to find out more. |
Closes #9866. Follow-up to #9737 / #9862.
Problem
maybeHandlePriorityLabelEligibilitywraps every I/O call it makes in a.catchthat degrades rather than failing the webhook delivery — the settings resolve, the collaborator-permission read, the label removal, the policy comment, the audit row, and the webhook-event row.Those handlers are the entire reason a label-mutating rule is safe to run on a webhook path: a throw that escaped would fail the whole delivery, taking every handler after it on the same event with it. None of the six was exercised — the existing "fails open when the permission cannot be read" case asserts a 404 response, which takes the ordinary return path rather than the catch.
codecov/patchon #9862 measured 93.18% against the 99% target for exactly these six arrow bodies.What changed
Test-only, +71 lines, four cases that make the calls genuinely throw and assert the degraded outcome rather than merely the absence of a throw:
gittensor:priorityand still enforcesThe D1 stub matches both
insert into audit_eventsand Drizzle's quotedinsert into "audit_events", since the two writers generate different SQL.Validation
17 tests pass. Measured against the v8 report, branch-counted, over the whole
maybeHandlePriorityLabelEligibilitybody: zero uncovered statements, zero uncovered functions (the six.catcharrows), zero uncovered branches.src/github/comments.tsandsrc/review/priority-label-eligibility.tsare likewise clean across the #9737 diff.