Skip to content

fix(github): only swallow 404 in removePullRequestLabel (#6192)#6211

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
bohdansolovie:fix/remove-pr-label-404-only-6192
Jul 15, 2026
Merged

fix(github): only swallow 404 in removePullRequestLabel (#6192)#6211
JSONbored merged 1 commit into
JSONbored:mainfrom
bohdansolovie:fix/remove-pr-label-404-only-6192

Conversation

@bohdansolovie

Copy link
Copy Markdown
Contributor

Summary

  • removePullRequestLabel used a bare .catch(() => undefined), so 403/5xx/rate-limit failures were discarded the same as a missing-label 404
  • Narrow the catch to match ensurePullRequestLabel in the same file: only swallow status === 404; re-throw everything else
  • Add regression tests for swallowed 404, re-thrown 403/500, and successful DELETE

Closes #6192

Scope

  • Conventional Commit title
  • Focused change (single helper + its unit tests)
  • Linked open issue: Closes #6192

Validation

  • Extended test/unit/github-labels.test.ts for 404 / non-404 / success paths
  • CI green including codecov/patch ≥99%

Safety

  • No secrets or private evidence exposed
  • Auth/GitHub write path: negative-path coverage for non-404 failures

UI Evidence

Not applicable — no UI change.

Notes

  • ensurePullRequestLabel is unchanged; it remains the reference narrow-swallow pattern.
  • Callers that previously relied on total silence for non-404 errors will now see the failure — matching the documented contract.

Made with Cursor

Match ensurePullRequestLabel's narrow-swallow pattern so a missing label
(404) stays best-effort, while 403/5xx/rate-limit failures propagate
instead of being silently discarded.

Co-authored-by: Cursor <cursoragent@cursor.com>
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 15, 2026
@loopover-orb

loopover-orb Bot commented Jul 15, 2026

Copy link
Copy Markdown

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-15 23:14:51 UTC

2 files · 1 AI reviewer · no blockers · readiness 80/100 · CI green · unstable

⏸️ Suggested Action - Manual Review

Review summary
This narrows the previously blanket .catch(() => undefined) in removePullRequestLabel to only swallow a 404 (label not present), re-throwing 403/5xx/other errors, matching the established pattern already used in ensurePullRequestLabel in the same file. The fix is minimal, correctly scoped, and the new tests exercise all three real paths (404-swallow, 403/500-rethrow, 200/204-success) against the actual DELETE request the code issues. This is a small, well-targeted bug fix with a linked issue and matching regression tests.

Nits — 4 non-blocking
  • src/github/labels.ts: the error is cast as `error as { status?: number }` without verifying it's an object first; if octokit ever throws a non-object (e.g. a string) this cast is unsafe, though in practice octokit errors are always Error-like objects with status.
  • test/unit/github-labels.test.ts: the re-throw test loops over statuses within a single `it` block reusing the same stubbed fetch pattern — could be split into `it.each` for clearer failure attribution per status.
  • Consider using `Object.prototype.hasOwnProperty` or a type guard instead of a blind cast on `error` in src/github/labels.ts for extra type safety, consistent with any guard used in ensurePullRequestLabel if one exists.
  • In test/unit/github-labels.test.ts, using `it.each([403, 500])` for the re-throw test would give clearer per-status failure output than looping inside one test.
Flagged checks (non-blocking)
  • Contributor trust — Contributor flagged for review
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #6192
Related work ⚠️ 2 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 78 registered-repo PR(s), 27 merged, 6 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bohdansolovie; Gittensor profile; 78 PR(s), 6 issue(s).
Gate result ✅ Passing No configured blocker found.
Improvement ✅ Minor risk: clean · value: minor
Review context
Contributor next steps
  • Start here: Review top overlaps.
  • Then work through the remaining 2 steps in the Signals table above.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask 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.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://gittensory.aethereal.dev/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 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.

  • Re-run LoopOver review

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.34%. Comparing base (653b621) to head (ea2c0ea).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6211   +/-   ##
=======================================
  Coverage   95.34%   95.34%           
=======================================
  Files         600      600           
  Lines       47308    47310    +2     
  Branches    15085    15086    +1     
=======================================
+ Hits        45105    45107    +2     
  Misses       1477     1477           
  Partials      726      726           
Flag Coverage Δ
shard-1 43.82% <75.00%> (-0.06%) ⬇️
shard-2 36.59% <50.00%> (+0.12%) ⬆️
shard-3 32.10% <0.00%> (+0.01%) ⬆️
shard-4 33.91% <50.00%> (-0.14%) ⬇️
shard-5 31.64% <100.00%> (+<0.01%) ⬆️
shard-6 45.29% <75.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/github/labels.ts 100.00% <100.00%> (ø)

@bohdansolovie bohdansolovie marked this pull request as ready for review July 15, 2026 21:35
@bohdansolovie bohdansolovie requested a review from JSONbored as a code owner July 15, 2026 21:35
@superagent-security superagent-security Bot added the contributor:flagged Contributor flagged for review by trust analysis. label Jul 15, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

🚨 Contributor flagged. Click here for more info: Superagent Dashboard

@bohdansolovie

Copy link
Copy Markdown
Contributor Author

CI is fully green now (including codecov/patch — all modified lines covered). The earlier panel that flagged codecov at 75% was from a mid-run status before shards finished uploading.

Ready for re-review whenever convenient.

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LoopOver approves — the gate is satisfied and CI is green.

@JSONbored JSONbored merged commit 1056e8c into JSONbored:main Jul 15, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor:flagged Contributor flagged for review by trust analysis. gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(github): removePullRequestLabel swallows every error, not just the documented 404

2 participants