wangjia
|
a307c6ca2c
|
fix(test): codes-lib 迁移往返测试改用 m.Migrate(21) 显式定位版本
Deploy Server / deploy-server (push) Failing after 41s
TestCodesLibMigrateRoundTrip 硬编码 6 次 Steps(-1),假设 000027 是迁移栈顶;本功能
加了 000028_routing_profiles 后 6 步落在版本 22、跳过了 000022 down,导致断言失败。
根因不是迁移 SQL(000022 up/down 正确、codes-lib 表无 FK——推翻了 FK 假设),而是
测试的脆弱步数计数被新增迁移打乱。改用 m.Migrate(21) 显式降到 000022 down 之后的
边界,不受栈顶新增迁移影响。全仓 go test ./... 恢复 0 FAIL。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A79VtQA1BwTuQN1ThpvYpo
|
2026-07-29 07:08:56 +08:00 |
|
wangjia
|
a62a2b1797
|
fix(server/pay): promo 限购 settle 侧幂等复查 + 000027 部分唯一索引(TOCTOU)
ci-pangolin / Lint — shellcheck (pull_request) Successful in 11s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (pull_request) Successful in 25s
ci-pangolin / Cleartext Scan — Android 禁明文 (pull_request) Successful in 19s
ci-pangolin / OpenAPI Sync Check (pull_request) Successful in 41s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (pull_request) Successful in 20s
ci-pangolin / Codegen Drift — token 生成物未漂移 (pull_request) Successful in 4s
ci-pangolin / DS-flow — 原型/跨端同源/代码色单源闸 (pull_request) Successful in 5s
ci-pangolin / Go — build + test (pull_request) Failing after 14s
ci-pangolin / E2E Smoke — L4 进程级端到端 (pull_request) Failing after 11s
ci-pangolin / Go — integration (mysql/redis testcontainers) (pull_request) Failing after 4m44s
ci-pangolin / Golden — 视觉回归 (全量:components/auth/desktop/tablet) (pull_request) Failing after 20s
ci-pangolin / Flutter — analyze + test (pull_request) Failing after 11m55s
CreateOrder 下单时的 HasPaidPurchase 只是裸 SELECT 无锁,并发/多挂起单可绕过
promo SKU「每账号限购一次」。两层修:
① webhook.go settle 在锁行、开通前对 item.Promo 的 SKU 复查一次(排除本单),
命中说明另一笔同 user+SKU 订单已抢先 settle,跳过发放(不二次 +N 天)、
仍 ack(否则 pay 无限重投)。新增 store.HasPaidPurchaseExcludingTx /
MarkDuplicatePromoTx——重复单标记 canceled 而非 paid,避免自撞下面的
唯一索引、也避免整笔 500 触发死循环重投。
② migration 000027(sqlite):部分唯一索引 ux_pay_promo_paid ON
pay_purchases(user_id, sku) WHERE status='paid' AND sku='pro_month_promo',
兜底防止任何路径把同一用户的 promo 单二次写成 paid。mysql 8 不支持部分
索引,000027 mysql 侧是 no-op 占位(仅对齐编号),该场景 mysql 只靠①的
应用层复查兜底——两库防线强度不同,已在迁移文件与代码注释中记录。
副作用:新增迁移把 sqlite 迁移顶点从 26 推到 27,同步更新
internal/store/sqlite_migrate_test.go 的版本断言,以及
internal/store/codes_lib_migrate_test.go 手动 Steps(-1) 序列(补一步跳过
000027,才能精确落在 000022 边界,这条测试是硬编码步数的)。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
2026-07-13 15:53:56 +08:00 |
|
wangjia
|
21a30aa4c8
|
feat(server/migrate): 000026 notices 表 + users.notices_read_at 已读水位
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P9G7E3wmAYL9KeYCVZVsqu
|
2026-07-13 13:32:23 +08:00 |
|
wangjia
|
07c339c18e
|
feat(server/devices): users.max_devices_override 单用户设备上限覆盖(NULL走套餐默认)+ 迁移000025
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (pull_request) Successful in 23s
ci-pangolin / Cleartext Scan — Android 禁明文 (pull_request) Successful in 16s
ci-pangolin / OpenAPI Sync Check (pull_request) Successful in 39s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (pull_request) Successful in 19s
ci-pangolin / Flutter — analyze + test (pull_request) Successful in 36s
ci-pangolin / Codegen Drift — token 生成物未漂移 (pull_request) Successful in 3s
ci-pangolin / DS-flow — 原型/跨端同源/代码色单源闸 (pull_request) Successful in 4s
ci-pangolin / Go — build + test (pull_request) Failing after 13s
ci-pangolin / E2E Smoke — L4 进程级端到端 (pull_request) Failing after 10s
ci-pangolin / Go — integration (mysql/redis testcontainers) (pull_request) Failing after 5m8s
ci-pangolin / Golden — 视觉回归 (全量:components/auth/desktop/tablet) (pull_request) Failing after 19s
ci-pangolin / Lint — shellcheck (pull_request) Failing after 13m37s
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P9G7E3wmAYL9KeYCVZVsqu
|
2026-07-13 10:15:07 +08:00 |
|
wangjia
|
9b858c5224
|
feat(server/migrate): 000024 邀请奖励表 + subscriptions.source 扩 invite/task
|
2026-07-13 06:59:52 +08:00 |
|
wangjia
|
85140edf1c
|
feat(server): 迁移 000021 pay_purchases 台账 + subscriptions.source 扩 pay
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
|
2026-07-10 20:46:13 +08:00 |
|
wangjia
|
7a4c9b97d0
|
fix(server): migrate down 兼容 codes 库自建表(先 DROP 再改名回)+ 真实接线回环测试(#codes-lib)
Reviewer 复现:cmd/migrate up 接线 ApplyCodesLibMigrations 后,codes 库自建的
codes/codes_batches/codes_audit_log/codes_schema_migrations 四张表不受
golang-migrate 追踪;000020 的 down 脚本做 legacy_codes -> codes 改名回时,
撞上库自建的同名 codes 表,报 "table already exists" 硬失败。
000020 的 sqlite/mysql down 脚本改名前先 DROP TABLE IF EXISTS 掉库自建四张表,
并注明:down = 完整回滚「rename + 库建表」组合,库表数据随 down 销毁属预期
(权威数据仍在 legacy_* 表,回填是后续任务,回填落地后 down 语义需重新审视)。
新增 TestCodesLibMigrateRoundTrip 走真实接线路径(MigrateUp ->
ApplyCodesLibMigrations -> 单步撤销 000020 断言 legacy 复原/库表清空 ->
撤销回去 -> 再跑 ApplyCodesLibMigrations 验幂等 -> 全量 store.MigrateDown 即
cmd/migrate down 的真实调用路径,确认不再硬失败)。先用 git stash 掉修复验证
测试能精确复现 reviewer 报的 "table already exists" 报错(RED),再恢复修复
转绿(GREEN)。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
|
2026-07-10 14:06:01 +08:00 |
|
wangjia
|
5a9b5f1d8e
|
feat(server): cmd/migrate up 接入 codes 库自建迁移(ApplyCodesLibMigrations)(#codes-lib)
顺带修 000020 sqlite 索引名冲突:ALTER TABLE RENAME 不会带着重命名索引,
legacy_codes 上遗留的 idx_codes_status 与 codes 库自己迁移里同名索引撞名,
一并改成 idx_legacy_codes_status(up/down 对称)。
|
2026-07-10 13:55:14 +08:00 |
|