[fix][prompt] fix ut map -> list problem#363
Merged
caijialin0626 merged 1 commit intomainfrom Dec 24, 2025
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #363 +/- ##
=======================================
Coverage 69.41% 69.41%
=======================================
Files 616 616
Lines 57881 57881
=======================================
Hits 40179 40179
Misses 14765 14765
Partials 2937 2937
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
wanglizhi
approved these changes
Dec 24, 2025
ming845378603
approved these changes
Dec 24, 2025
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.
What type of PR is this?
fix
Check the PR title
• [x] This PR title match the format: [][] . For example: [fix][backend] flaky fix
• [x] The description of this PR title is user-oriented and clear enough for others to understand.
• [x] Add documentation if the current PR requires user awareness at the usage level.
• [x] This PR is written in English. PRs not in English will not be reviewed.
PR Title: [fix][prompt] fix unit test flakiness in SaveDraft with snippets
(Optional) Translate the PR title into Chinese
修复 SaveDraft 中 snippets 相关单元测试的不稳定问题
(Optional) More detailed description for this PR
en:
Fixed flaky unit test in TestManageRepoImpl_SaveDraft/create_draft_with_snippets that was failing intermittently due to order dependency when converting map to slice. The test was asserting specific array indices for relations, but Go map iteration order is undefined, causing non-deterministic test results.
Solution:
• Replaced index-based assertions with content-based verification using a map lookup
• Maintained all existing validation logic while eliminating order dependency
• Added descriptive error messages for better debugging
zh:
修复了 TestManageRepoImpl_SaveDraft/create_draft_with_snippets 中的不稳定测试问题,该测试因为 map 转 slice 时的顺序依赖而间歇性失败。测试代码断言特定的数组索引对应关系,但 Go 的 map 迭代顺序是未定义的,导致测试结果不确定。
解决方案:
• 将基于索引的断言替换为基于内容的验证,使用 map 查找
• 保持所有现有验证逻辑的同时消除了顺序依赖
• 添加了描述性错误信息以便更好地调试