Files
bisheng/scripts/performance
LineWalker 214080dd74 feat(F015-v2.5.1): 部门定时校对 + SSO 换型 relink + 冲突告警(T01-T15)
- 新建 11 Python 模块:
  - ReconcileConf(core/config)
  - OrgReconcileService(6h 校对核心编排,Redis SETNX 锁,11 步)
  - DepartmentRelinkService(external_id_map / path_plus_name 双策略)
  - RelinkConflictStore(Redis HASH + 7d TTL)
  - RemoteDeptDiffer(F009 reconciler 的 ts-annotated 薄包装 + crosses_tenant 派生)
  - TsConflictReporter(weekly + daily escalation 聚合)
  - 3 Celery tasks:reconcile_all_organizations / report_ts_conflicts_weekly / daily_escalation
  - Pydantic schemas/relink.py
  - API endpoints/relink.py + resolve-conflict
- 扩展 8 模块:
  - errcode/sso_sync.py +5 错误码 19314-19318(MMM=193 与 F014 共享)
  - settings.py 注册 ReconcileConf + 3 beat 条目
  - department.py 加 aget_active_by_source_path_name / aupdate_external_id /
    aget_user_ids_by_department DAO
  - org_sync.py 加 event_type/level/external_id/source_ts 列 + idx_conflict_lookup +
    aget_all_active / acreate_event / acount_recent_conflicts /
    aget_conflicts_since / aget_latest_event
  - http_middleware.py TENANT_CHECK_EXEMPT_PATHS 加 relink 两路径
  - api/router.py 挂载 relink_router
  - conftest.py / table_definitions.py 同步 F015 新字段 + 索引
- Alembic 迁移 v2_5_1_f015_reconcile_log_fields(幂等 upgrade/downgrade)
- 8 测试文件约 60 条用例(SQLite + AsyncMock 模式)覆盖 AC-01..AC-13 + INV-T12/T8/T7/T2
- 文档:tasks.md + ac-verification.md + locust 性能占位(AC-08 发版前跑)

AC-11 关键:同 ts Gateway-upsert + Celery-remove 冲突走 remove-wins 路径,
写 audit_log.action='dept.sync_conflict' + event_type='ts_conflict' 事件行
+ 19317 warn,统一由 DepartmentDeletionHandler(CELERY_RECONCILE) 触发孤儿处理。

本地已通过 py_compile;pytest 待 114 远程或 CI 跑。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 09:09:41 +08:00
..