fix(stale_repos): resolve false positive 400 errors and fix 1-year duration bug - #6609
fix(stale_repos): resolve false positive 400 errors and fix 1-year duration bug#6609Liu-meng-hao wants to merge 4 commits into
Conversation
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
Automated Quality ChecksRequired checks❌ Repo link: missing from PR body
Forge link: https://github.com/your-org/your-project ❌ Go Report Card: missing from PR body
goreportcard.com: https://goreportcard.com/report/github.com/your-org/your-project Popular options: Codecov, Coveralls. Integrate one with your CI to track coverage automatically.
These checks are automated and do not replace maintainer review. See CONTRIBUTING.md for full guidelines. PR Diff ValidationContent checks✅ Description: ends with punctuation Warnings
Automated diff validation — does not replace maintainer review. |
…some-go into fix/ignore-anchor-links
Note to maintainers: This PR contains TWO distinct fixes:
stale_repositories_test.go(file:stale_repositories_test.go)README.md)Both changes are logically related to CI reliability improvements. They are kept in one PR for reviewer convenience, but please let me know if you'd prefer them split into separate PRs.
Description (1/2): CI Script Bug Fix —
stale_repositories_test.goThis PR addresses the false positive dead-link reports mentioned in automated CI runs and fixes several underlying logical bugs in the
stale_repositories_test.goscript.Fixes #6279
Root Causes & Key Changes
1. Fatal 1-year commit check bug (
time.Durationissue)Changed
numberOfYearstointand explicitly cast during multiplication. Previouslytime.Duration(1) * 365 * 24 * time.Hourevaluated to ~31.5ms, marking every repository stale.2. False-positive 400 errors (Anchor links & Query params)
Used standard
url.Parseto stripRawQueryandFragmentbefore validation. Switched to Regex capture groups (FindStringSubmatch) to safely extractowner/repo, preventing malformed API requests likehttps://api.github.com/repos#actor-model.3. Rate Limits (403) differentiated from Dead Links (404/410)
Explicitly mapped only
404and410to dead links. For401/403(rate limits), the script logs and gracefully aborts the scan viaEachWithBreak, preserving already-collected stale repos.4. CI stability & tech debt cleanup
http://→https://for GitHub API constantsdefer resp.Body.Close()to all HTTP requests (prevent TCP connection leaks)noRecentCommitsconstant togetRepositoriesFromBodyfor issue dedup closureDescription (2/2): README Security Category Alphabetical Fix
Corrects the alphabetical order of two items in the Security section:
acme-proxy(hyphen, ASCII 45) → should precede →acmetool(letter 't', ASCII 116)Per CONTRIBUTING.md alphabetical ordering rules. No new packages added.
Required links
Pre-submission checklist
Repository requirements (N/A: no new packages added)
go.modfile and at least one SemVer release.Pull Request content
Category quality
(No addition — only reordered 2 existing packages in Security, which has 62 items total.)