Skip to content

test: 稳定渠道亲和性测试缓存键(上游 #8009) - #174

Merged
woncc merged 1 commit into
mainfrom
cursor/upstream-issue-172-34003e9c2-20261105
Nov 5, 2026
Merged

woncc merged 1 commit into
mainfrom
cursor/upstream-issue-172-34003e9c2-20261105

Conversation

@woncc

@woncc woncc commented Nov 5, 2026

Copy link
Copy Markdown

🔗 关联任务 / Related Issue

Closes #172

上游:QuantumNous@34003e9

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix)
  • ✨ 新功能 (New feature)
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

📝 变更描述 / Description

原样 cherry-pick 上游补丁,仅修改 service/channel_affinity_usage_cache_test.go。三个测试改用测试名和原子递增序号生成缓存键,消除低精度时钟下重复运行碰撞、统计累计的问题;保留全部断言及 fork 运行时行为。

本次移植与验证由 Codex AI 辅助完成。git 身份 woncc 与仓库历史主要贡献者一致;仍明确披露 AI 辅助。

📸 运行证明 / Proof of Work

  • GOMAXPROCS=2 RAYON_NUM_THREADS=2 GOWORK=off go test -p=2 ./service/ -run '^TestObserveChannelAffinityUsageCacheByRelayFormat_' -count=20 -v:退出 0,三个目标测试各通过 20 次,service 0.085s。
  • git diff HEAD^ HEAD --check:通过;gofmt -l service/channel_affinity_usage_cache_test.go:无输出。
  • 上游与候选 stable patch-id 均为 02ba87e3c33fff81534743e749e10fc83caa97b3。
  • Linux amd64 / Go 1.27.2;未实测 Windows,未跑全量 service 或数据库矩阵。仅测试标识变化,不涉及数据库行为或计费逻辑。

✅ 提交前检查项 / Checklist

  • 人工确认: 待独立审阅;不代替人工确认
  • 非重复提交: fork 中按上游 SHA 查询未发现已打开的对应 PR
  • 新功能关联 Issue: 不适用
  • 事前沟通: 不适用
  • 功能范围: 仅测试缓存键
  • 非透传: 不涉及转发行为
  • 范围聚焦: 单一授权文件
  • 本地验证: 命令与结果如上
  • 安全合规: 无凭据变更

Replace wall-clock identifiers with an atomic sequence and test names so repeated Windows runs cannot share usage-cache entries.

Verification: latest main baseline failed with cumulative counts; patched affinity tests passed -count=20; full service suite and go vet passed.

Signed-off-by: sstar16 <[email protected]>
(cherry picked from commit 34003e9)
@woncc
woncc merged commit f2f658b into main Nov 5, 2026
@woncc
woncc deleted the cursor/upstream-issue-172-34003e9c2-20261105 branch December 2, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[上游/现在能解] 34003e9c2 test: stabilize channel affinity cache keys (#8009)

2 participants