feat(services): register workflow-native driver keys in field registry

Workflow reconciliation (see previous commit) showed the 20261022
state variable really stores person identity under driver{i}ID /
driver{i}Phonenumber (x2), while the API get_info group keys
(sfzmhm{i}/sjhm{i}) have zero references in any workflow version -
the legacy group read always returned empty for workflow-produced data.

- registry: +4 keys (driver1/2ID, driver1/2Phonenumber) in
  human1/human2 groups, SENSITIVE, documented as synonymous with
  sfzmhm{i}/sjhm{i}; 24 -> 28 specs
- driver{i}License deliberately NOT registered: the sandbox reads
  state.hphm{i} and only renames the output for confirmation prompts -
  it is not a state key, set_info rejects it as unknown (workflow
  never consumes it)
- intentional diff documented: acdhuman1/2 group output now includes
  the driver keys (legacy FastGPT output did not) - fixes the legacy
  'workflow person data unreadable by group' gap; synonym merging
  (driver1ID vs sfzmhm1) deferred pending caller confirmation
- tests: registry size 28, driver keys present with sensitive level,
  License alias excluded

Verified: 230 unit tests
This commit is contained in:
Eric Wang
2026-10-22 23:40:27 +08:00
parent 11131885a6
commit 20e151b097
3 changed files with 44 additions and 7 deletions
+14 -3
View File
@@ -19,10 +19,10 @@ from src.services.fields_registry import (
def test_registry_covers_all_three_groups():
"""注册表完整覆盖 acd/human1/human2 三个分组(作业 6-3)。"""
assert set(GROUP_KEYS) == set(FieldGroup)
assert len(FIELD_REGISTRY) == 24
assert len(FIELD_REGISTRY) == 28
assert len(GROUP_KEYS[FieldGroup.ACD]) == 8
assert len(GROUP_KEYS[FieldGroup.HUMAN1]) == 8
assert len(GROUP_KEYS[FieldGroup.HUMAN2]) == 8
assert len(GROUP_KEYS[FieldGroup.HUMAN1]) == 10
assert len(GROUP_KEYS[FieldGroup.HUMAN2]) == 10
def test_person_fields_include_full_set():
@@ -33,6 +33,17 @@ def test_person_fields_include_full_set():
assert f"{suffix}{index}" in group_keys
def test_workflow_native_driver_keys_registered():
"""workflow 20261022 state 原生人员键(对账发现)已登记,
与 API 契约键同义并存;driver1License 是 sandbox 输出别名而非
state 键,不登记。"""
for index in (1, 2):
assert f"driver{index}ID" in FIELD_REGISTRY
assert f"driver{index}Phonenumber" in FIELD_REGISTRY
assert FIELD_REGISTRY[f"driver{index}ID"].sensitive is SensitiveLevel.SENSITIVE
assert f"driver{index}License" not in FIELD_REGISTRY
def test_registry_metadata_recorded():
"""每个字段都记录类型、可写性、敏感级别(作业 6-4)。"""
for spec in FIELD_REGISTRY.values():