fix(github): guard backfill GraphQL helpers' repoFullName parsing - #9351
Conversation
Follows JSONbored#9276, which fixed 8 files / 12 cases and left these 4 files / 5 cases still red on main (and therefore red on every open PR). Each diagnosed to its introducing commit; two are real source gaps, two are stale sibling tests a deliberate behavior change never updated. SOURCE fixes: - selfhost/metrics.ts: register two counters emitted since JSONbored#9243 and JSONbored#9245 but never added to DEFAULT_METRIC_META, so renderMetrics() emitted them as bare undocumented samples with no HELP/TYPE — exactly what that drift guard exists to catch. Both commits even name the counter in their own body text; a pure registration miss, not a behavior decision. TEST fixes (source verified correct in both cases): - selfhost-pg-retention: the fake Postgres still matched the pre-JSONbored#9083 ctid semi-join, so every DELETE fell through to rowCount 0. JSONbored#9083 deliberately moved retention to an index-backed PK range delete with ORDER BY (the fix for prune-retention blowing its timeout and stalling permanently); it updated the SQLite twin but not the Postgres one. Regex now captures whichever key column is in play, keeping BOTH the mapped-PK and ctid-fallback paths exercised. - salvageability: JSONbored#9085 made an absent blocker confidence degrade to CONFIDENCE_WHEN_UNSTATED (0.5) instead of 1.0, so it is sub-floor against the 0.93 default and the low-confidence hold owns the case. It renamed both sibling assertions in rules.test.ts but missed this third consumption site. Both calls kept — they are the only coverage of the default-floor arm and the nullish-confidence arm respectively. - worker-entry-boundary: false positive, not a real dependency leak. The check grepped whole-file text, so JSONbored#9230's user-facing string "crossed the visual-diff threshold" failed a green tree over a sentence, in a file worker-reachable since JSONbored#4120 that imports none of these deps. Narrowed to scan module specifiers (reusing the file's own parseImportSpecifiers) — the only way a Node-only dep can actually reach the bundle. Added a discriminating test so it cannot pass vacuously; verified by injecting a real `import sharp` and confirming it fails, naming the file and specifier.
|
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 #9351 +/- ##
==========================================
+ Coverage 75.38% 75.91% +0.53%
==========================================
Files 275 277 +2
Lines 58023 59546 +1523
Branches 6181 8758 +2577
==========================================
+ Hits 43739 45206 +1467
- Misses 14014 14021 +7
- Partials 270 319 +49
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-27 14:30:19 UTC
Review summary Nits — 4 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.
|
f27a356 to
e36563c
Compare
fetchLiveCiAggregateViaGraphQl, fetchLivePullRequestReviewDecision, and fetchLiveReviewThreadBlockers parsed repoFullName with a bare split/truthiness check, so extra segments and whitespace-padded slugs reached GraphQL queries. Add a local parseBackfillRepoFullName helper mirroring JSONbored#8311's segment-count and whitespace guard, preserving each call site's fail-soft return contract. Closes JSONbored#9317
e36563c to
0e7c9d9
Compare
Summary
fetchLiveCiAggregateViaGraphQl,fetchLivePullRequestReviewDecision, andfetchLiveReviewThreadBlockersinsrc/github/backfill.tsparsedrepoFullNamewith a baresplit(/)+ truthiness check. Extra path segments (owner/repo/extra) and whitespace-padded slugs (owner/ repo,owner/repo) therefore reached GraphQL query strings — the same failure mode#8311closed forapp.ts/comments.ts.Adds a local
parseBackfillRepoFullNamehelper mirroring the segment-count + whitespace guard used inlabels.ts/assignees.ts/pr-actions.ts, reused by all three call sites. Each function keeps its existing fail-soft return contract (null/undefined/[]).Test plan
test/unit/graphql-status-rollup.test.ts:fetchLiveCiAggregateViaGraphQlrejects extra-segment and whitespace-padded slugs before any GraphQL calltest/unit/backfill-2.test.ts:fetchLivePullRequestReviewDecisionreturnsundefinedfor the same malformed shapestest/unit/backfill-2.test.ts:fetchLiveReviewThreadBlockersreturns[]for the same malformed shapessalvageability,selfhost-pg-retention) pass locallyCloses #9317