Files
danyang-match/docs/governance/config-register.md
T
WorkBuddy 438b38d121 V1.0.1 配置与规则纠偏:照片上限配置化+强校验 / 活体开关闭环 / 推荐阈值快照+规则版本化 / governance 三表+漂移审计
根治三类工程治理问题(技术默认值≠产品规则、配置存在但未闭环、文档代码漂移):
- PROFILE-001:profile.photo.maxCount(默认6未确认)+ ProfilePolicy + 服务器端 FOR UPDATE
  并发强校验(PHOTO_LIMIT_EXCEEDED,拒绝先于 S3 不留孤儿)+ 前端 mergeAppConfig 嵌套键修复
- CFG-001/IDENTITY-001:IdentityPolicy + GET /verification/liveness-status 真实判定点
  (默认关不阻断,开则 enhancedVerified 变化,消除假开关)+ 删死 seed livenessVerification.enabled
- MATCH-001:阈值60定为技术默认(消解 PENDING 矛盾)+ V050 recommendation_records.threshold_snapshot
  规则版本化 + 删死重复配置类 MatchConfig
- DOC-001:新增 docs/governance/(config-register/open-questions/decision-register/
  hardcoded-rule-audit/config-drift-audit)
- TEST-001:新增守卫 PhotoLimitGuardTest(8)/IdentityLivenessGuardTest(5)/
  RecommendationThresholdSnapshotGuardTest(4),均经负向注入可红

全量回归 733/0/0/3(基线717+17新增-1删死测试);UI 契约门禁 18/18;STATUS 升 rc.21
2026-09-21 02:05:15 +08:00

5.7 KiB
Raw Blame History

配置登记表 — config-register.md

版本:V1.0.1 配置与规则纠偏基线 · 生效:2026-09-20 · owner:WorkBuddy 代码载体:FeatureFlagConfig(feature flag,前缀 features)/ MatchRuleConfigProperties(前缀 match)/ ProfileProperties(前缀 profile)/ AccountConfig(前缀 account) 一致性守卫:FeatureFlagPersistenceGuardTest、MatchRuleConfigPropertiesTest、EntityMigrationParityTest、MigrationValidationTest

核心纪律(AGENTS.md #12 + V1.0.1 纠偏):技术默认值 ≠ 产品正式确认规则。 未确认的数量/阈值/时间/比例/权重/开关,一律按 DEFAULT + CONFIG 管理,禁止作为 LOCKED 业务规则写死; 所有配置必须有唯一 canonical key,禁止同一业务含义存在多套 key(seed / yml / 字段 / 前端各写一套)。


一、分类图例

分类 含义 是否可硬编码
LOCKED 产品负责人已确认的业务/安全硬约束 原则上不可随意变更
DEFAULT 当前技术实现默认值,可经配置/ADR 替换 不应散落硬编码
CONFIG 需配置化管理的业务参数/开关 禁止写死
TBD 产品尚未正式确认 禁止当成产品规则
FUTURE 明确不属于当前 V1 范围 不实现主链路
LEGAL_VERIFY 上线前需依最新官方/法律要求核验 不得自行假设

二、配置登记表

canonical 配置键 实现键(yml / flag 字段) 分类 当前默认值 产品正式确认 是否可配置 代码载体 / 说明
identity.liveness.enabled features.livenessEnabled(flag 字段 livenessEnabled;yml features.liveness-enabled) CONFIG / TBD false 否 是 FeatureFlagConfig + IdentityPolicy;活体不是 V1 强制规则;默认关闭不阻断实名主流程;打开后经 GET /verification/liveness-status 真实驱动 enhancedVerified(FF-LIVENESS-002)。fail-safe:配置缺失默认 false。
identity.liveness.provider features.livenessProvider(yml features.liveness-provider) CONFIG / TBD none 否 是 FeatureFlagConfig;none=尚未接入合规第三方,人脸 Provider 选型未定(OQ-IDENTITY-001)。
profile.photo.maxCount profile.photo.max-count CONFIG / TBD 6 否 是 ProfileProperties + ProfilePolicy;6 仅为技术默认;服务器端 PhotoService.ensureWithinPhotoLimit(FOR UPDATE 并发安全)强制校验;前端经 GET /app/config → businessLimits.maxProfilePhotos 动态读取,不再写死。
matching.recommendation.minScore match.default-score-threshold CONFIG / TBD 60 否 是 MatchRuleConfigProperties + MatchingPolicy;60 仅为技术默认,非产品确认(消解 PENDING :43 vs :75 矛盾);引擎/资格判定读配置;推荐记录 V050 起写 threshold_snapshot 支持追溯。
matching.rule.version match.rule-version CONFIG 1 否 是 MatchRuleConfigProperties;写入 recommendation_records.rule_version,与阈值快照配合构成规则版本。
matching.daily.limit match.default-daily-limit CONFIG 6 是(每日 6 人,见 decision-register) 是 MatchRuleConfigProperties。
matching.cooldown.days match.default-cooldown-days CONFIG 180 是(Pass 冷却 180 天) 是 MatchRuleConfigProperties。
matching.weights.*(10 维) match.*-weight(age 15 / region 15 / marital 10 / children 10 / education 5 / height 5 / marriagePlan 15 / settlement 10 / lifestyle 10 / interest 5) CONFIG / TBD 见左 否 是 MatchRuleConfigProperties;yml 未覆盖,全用类内默认;打分公式仍为 V1 占位(见 audit 未来项)。
matching.local-eligibility.required match.local-eligibility-required CONFIG false 否 是(仅 docker yml) 本地资格是否作为推荐硬性门禁;默认关。
account.data-retention.months account.data-retention-months LOCKED 36 是(2026-09-19 产品确认下限 36 个月) 是 AccountConfig;注销后保留期下限,到期人工审核匿名化(V049)。
account.feature-flags.*(活动/红娘/图片聊天/申诉/转介/互选/专项 开关) features.* CONFIG 见 FeatureFlagConfig 部分 是 FeatureFlagConfig;feature_flag_overrides(V048)持久化覆盖。
idempotency.ttl 应用层 idempotency_records(TTL 默认 86400s) CONFIG / LEGAL_VERIFY 86400s 否 是 幂等去重窗口;开放第三方时需决定是否按调用方分级(OQ,见 open-questions)。

三、已消除的 key 漂移(本轮)

漂移 处置
seed livenessVerification.enabled vs 实现键 livenessEnabled(两套 key 同义) 已删 demo-seed-final.sql 的死 seed 行;canonical 名 identity.liveness.enabled 映射到唯一实现键 livenessEnabled(见上表)。
MatchConfig(shared/config)与 MatchRuleConfigProperties(match/config)同前缀 match 双 bean 已删 死类 MatchConfig(0 业务引用),统一读 MatchRuleConfigProperties。
前端 mergeAppConfig 平铺合并 → 服务端嵌套 businessLimits.* 从不生效 已修 显式节-键映射,maxProfilePhotos 等真正下发到前端。

最后更新: 2026-09-20 — V1.0.1 配置与规则纠偏:登记 identity.liveness.enabled / profile.photo.maxCount / matching.recommendation.minScore 三项 canonical 键,消除 liveness 双 key 与 MatchConfig 重复。