Skip to content

fix: 存储分类识别 ID 规范化前的裸 ObjectId 路径 - #196

Merged
makewheels merged 1 commit into
masterfrom
fix/legacy-id-storage-category
Aug 24, 2026
Merged

fix: 存储分类识别 ID 规范化前的裸 ObjectId 路径#196
makewheels merged 1 commit into
masterfrom
fix/legacy-id-storage-category

Conversation

@makewheels

Copy link
Copy Markdown
Owner

背景

Attempt v3 迁移(migrate_attempt_entities.py --execute)已在生产执行:99 个嵌入 attempt 全部独立化,111 个 OSS 对象复制并逐字节校验通过,双读业务字段零差异。

但迁移后审计发现 wrongReferenced=194:ID 规范化(u_/ps_ 前缀)之前创建的历史用户/会话,其 v3 目标路径的用户/会话段是裸 ObjectId,managed_category 将其误判为 legacy-practice-path

影响

  • 数据本身无损:这些对象均被独立 attempt 引用,不会被 orphan 清理误删;
  • 但 cleanup 阶段的收敛自检(wrongReferenced=0 否则 RuntimeError)永远无法通过,阻塞三阶段迁移收口。

变更

  • managed_category 对用户/会话段同时接受 u_/ps_ 前缀与 24 位 hex ObjectId;结构校验(月份段、attempts/pa_/recordings|speech 段)不变;
  • 单测补两条用例:裸 ObjectId 的 v3 结构识别为 attempt-v3;裸 ObjectId 但缺 attempts/pa_ 段仍为 legacy-practice-path

验收

  • 单测通过;
  • 部署后生产复跑校验:独立 attempt 的 recording/speech key 全部归类 attempt-v3wrongReferenced 仅剩嵌入数组的旧引用(cleanup 删除嵌入后归 0)。

历史用户/会话的 OSS 路径段是裸 ObjectId(无 u_/ps_ 前缀),
managed_category 把它们误判为 legacy-practice-path,导致
Attempt v3 迁移后的 cleanup 收敛自检(wrongReferenced=0)无法通过。
结构符合 v3(attempts/pa_ 段齐全)的旧 ID 路径应识别为 attempt-v3。
@makewheels
makewheels merged commit 99a488f into master Aug 24, 2026
4 checks passed
@makewheels
makewheels deleted the fix/legacy-id-storage-category branch August 24, 2026 15:51
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.

1 participant