Record why a v1 household failed to copy to v2

未关闭
#4,221 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
57/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
python

调研方向

Start with _log_copy_operation in policyengine_api/services/household_mirroring.py and compare the household copy records with the policy copy records that use LegacyPolicyTranslationReason. Trace how translation failures and v2 household document rule failures are categorized, keeping personal data out of logged reasons. Done means failed records use the requested message and include the exception type and a fixed reason code for translation failures.

由索引模型根据 Issue 内容生成。

描述

The record logged when a v1 household fails to copy to v2 does not say why the copy failed, so the cause of the failures in #4194 can't be read from the logs.

What happens

_log_copy_operation in policyengine_api/services/household_mirroring.py writes one v1_household_mirror_operations record per copy:

  • The message is V1 household immediate copy completed for every outcome, including outcome error at severity ERROR.
  • A failure records only its broad failure_category (translation, integrity, database, configuration or unexpected). A translation failure records nothing about which part of the v1 household could not be translated. The exception's message can't be logged as it is: several messages hold the household's names, such as legacy person '<name>' belongs to multiple benunits records.

#4194 is an error group of these records on POST /<country_id>/household (3 of 6 production requests on 2026-11-05). Each record says only that a copy failed in some category.

Expected

  • A failed copy's record says V1 household immediate copy failed.
  • It records the exception's type (error_type) and, for a translation failure, a fixed reason code without personal data (failure_reason), as the policy copy records already do (LegacyPolicyTranslationReason). A translation whose result breaks a v2 household document rule, such as a person who belongs to no record of one entity collection, records that rule's reason.
主要语言
Python
星标
18
派生
33
平均合并
2 天 15 小时
30 天内合并 PR
110

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

PolicyEngine/policyengine-api 的其他 Issue

查看 PolicyEngine/policyengine-api 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。