fix(stale_repositories): fix 8 logical bugs causing false positives - #6610
Open
Liu-meng-hao wants to merge 1 commit into
Open
fix(stale_repositories): fix 8 logical bugs causing false positives#6610Liu-meng-hao wants to merge 1 commit into
Liu-meng-hao wants to merge 1 commit into
Conversation
- Fix time.Duration 31ms bug by using int numberOfYears with explicit cast - Strip URL RawQuery/Fragment via url.Parse before regex validation - Use regex capture groups to safely extract owner/repo (replace strings.ReplaceAll) - Only treat 404/410 as dead links (not >=400, avoids 403 rate-limit false positives) - Gracefully abort on 401/403 via EachWithBreak aborted signal - Upgrade http:// to https:// for all GitHub API constants - Add defer resp.Body.Close() to all HTTP requests - Add noRecentCommits suffix to close issue dedup loop Fixes avelino#6279
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
Automated Quality ChecksSkipped — this PR does not modify This is expected for maintenance, documentation, or workflow PRs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes the false positive dead-link / stale repository reports produced by the weekly automated check in
stale_repositories_test.go.The script had several accumulated logical bugs that caused it to report hundreds of perfectly valid repositories as "dead" or "stale" every week, creating noise for maintainers and unnecessary Issue spam.
Fixes #6279
Root Causes & Fix Summary
numberOfYearstyped astime.Duration= 1 nanosecond; the 1-year window was evaluated as ~31.5ms → every repository appeared "stale"intwith explicit casttime.Duration(numberOfYears) * 365 * 24 * time.Hour#actor-model) not skipped after regex mismatch → fed into GitHub API → 400 → false "dead link"url.Parseto strip RawQuery/Fragmentstrings.ReplaceAll(href, "https://github.com", "")corrupted URLs where repo names contained the substringFindStringSubmatchto safely extractownerandrepo>= 400treated as dead links → 403 rate-limit responses flagged normal repos as dead404 / 410now map to the dead-link conditionaborted boolreturn value; caller exitsEachWithBreakand still creates the Issue with the already-collected resultshttp://api.github.comconstant (security + modern proxy/network incompatibility)https://(consistent with other constants)createIssue/getAllFlaggedRepositories/ both checkers leaked TCP connections (missingresp.Body.Close())defer resp.Body.Close()across every HTTP responsenoRecentCommitssuffix was missing fromgetRepositoriesFromBody(), breaking Issue deduplication for the "1 year without commits" classstrings.ReplaceAllline in the dedup functionRequired links
N/A — This PR is an internal CI script bug fix, not a new package addition.
The PR does not modify
README.md, so package-level quality checks do not apply.Pre-submission checklist