feat(worker): #1970 AI 标签 backfill 支持 force 重打降级记录 #1989
Reference in New Issue
Block a user
Delete Branch "feat/1970-force-backfill-downgraded-tags"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
背景
#1987 修复 Celery 任务注册、DOUBAO_VISION_MODEL 配置正确后,此前视觉 API 失败写入的降级记录
{"inherited_tags": [...]}(非 NULL)不会被 backfill 捞起(find_untagged只匹配ai_tags IS NULL),tag 任务本身也按幂等跳过,存量降级片段永远无法补全真实 AI 标签(含 has_text)。改动
find_untagged(limit, include_downgraded=False):force 模式下用ai_tags['has_text'].as_string() IS NULL(→ JSON/JSONB->>'has_text')同时匹配 NULL 记录和缺 has_text 键的降级记录;has_text=true/false的完整记录始终排除。tag_atom_clip_task(atom_clip_id, force=False):force=True 时放行缺 has_text 的降级记录并覆盖写入;完整标签始终跳过保持幂等。backfill_atom_clip_tags(..., force=False):透传kwargs={"force": ...}给 tag 任务。用法
Celery 调用(管理员/运维):
验证
兼容性
force 默认 False,默认行为完全不变(仅 ai_tags IS NULL)。
DOUBAO_VISION_MODEL 修复后,此前视觉 API 失败写入的 {'inherited_tags': [...]} 降级记录(非 NULL)不会被默认 backfill 捞起, tag 任务也按幂等跳过。 - find_untagged 加 include_downgraded:用 ai_tags['has_text'].as_string() IS NULL 同时匹配 NULL 与缺 has_text 键的降级记录(json/jsonb 通用, has_text=true/false 的完整记录排除) - tag_atom_clip_task / backfill_atom_clip_tags 加 force 参数, backfill 透传 kwargs={'force': ...} - 7 个回归测试(任务层测试兼容旧测试 sys.modules 注入 MagicMock 的污染)🚀 预览环境已部署
🗑️ 预览环境已清理
PR #1989 已关闭或合并,对应的预览环境已被清理。