fix: remove redundant slice in IsGraduate and update golang.org/x/net - #479
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #479 +/- ##
==========================================
- Coverage 62.95% 62.70% -0.26%
==========================================
Files 224 230 +6
Lines 5852 6027 +175
==========================================
+ Hits 3684 3779 +95
- Misses 2051 2129 +78
- Partials 117 119 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 16 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens ID prefix checking in utils.IsGraduate to avoid panics on short/invalid IDs, and updates a few unit tests’ reflection pointer-kind checks to match the current Go toolchain expectations used by this repo.
Changes:
- Update
IsGraduateto usestrings.HasPrefix(id, "00000")instead of slicingid[:5](prevents panic on short IDs). - Update test mocks to compare
reflect.Value.Kind()againstreflect.Pointerwhen detecting pointer destinations.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/utils/id.go | Removes unsafe slicing in IsGraduate to prevent panics on invalid/short IDs. |
| pkg/db/user/get_relation_test.go | Updates reflection kind checks in mocked GORM calls to use reflect.Pointer. |
| pkg/db/friend_config/get_configs_test.go | Updates reflection kind checks in mocked GORM calls to use reflect.Pointer. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
linrongda
previously approved these changes
May 11, 2026
Member
|
ci修一下 |
linrongda
self-requested a review
May 11, 2026 13:08
Member
Author
行 |
ACaiCat
force-pushed
the
fix/isgraduate-panic
branch
from
May 11, 2026 13:23
2cd51ed to
9f94615
Compare
linrongda
approved these changes
May 11, 2026
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.
自查 PR 结构
PR 标题符合这个格式: <type>(optional scope): <description>
此 PR 标题的描述以用户为导向,足够清晰,其他人可以理解。
我已经对所有 commit 提供了签名(GPG 密钥签名、SSH 密钥签名)
这个 PR 属于强制变更/破坏性更改
这个 PR 的类型是什么?
fix
这个 PR 做了什么 / 我们为什么需要这个 PR?
IsGraduate对id切片后传入HasPrefix,导致不合法短id panicAI调用MCP时传入id不合法会丢panic,干扰上下文
Hmmm,不知道有没有必要在handler校验id长度 (?
govulncheck: 升级golang.org/x/net到v0.53.0解决GO-2026-4918漏洞
lint: 将
reflect.Ptr字段替换为reflect.Pointer(可选)这个 PR 解决了哪个/些 issue?
对 Reviewer 预留的一些提醒