refactor: 移除 EventDictionary 的 health_record_action(ADR-013)
CI / backend-test (push) Successful in 7m19s

- health_record_action 从白名单直接移除(客户端零引用,废弃零成本)
- M2 事件按字典 v2(具体事件名,iteration-2/06)随第二波接口纵切落地;
  不复活通用 actionType 设计(多套指标共享分母污染)
- v1 auth 漏斗事件 + page_viewed(遗留 §2)为当前完整白名单
- 新增 EventDictionaryTest:锁定移除后白名单边界,回归防护

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-07 14:35:31 +08:00
parent 0eae1c9bec
commit 58576f8ebc
2 changed files with 36 additions and 5 deletions
@@ -0,0 +1,31 @@
package com.patbond.patbond.user.analytics;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Locks the dictionary's whitelist boundaries: ADR-013 removed the
* health_record_action placeholder (client zero-reference); v1 auth funnel
* events plus page_viewed remain the complete set until dictionary v2 lands
* with M2's second wave.
*/
class EventDictionaryTest {
@Test
void healthRecordActionIsRemovedPerAdr013() {
assertThat(EventDictionary.isKnownEvent("health_record_action")).isFalse();
}
@Test
void v1EventsAndPageViewedRemainKnown() {
assertThat(EventDictionary.isKnownEvent("auth_register_started")).isTrue();
assertThat(EventDictionary.isKnownEvent("auth_login_succeeded")).isTrue();
assertThat(EventDictionary.isKnownEvent("page_viewed")).isTrue();
}
@Test
void unknownEventHasEmptyAllowedProps() {
assertThat(EventDictionary.allowedProps("health_record_action")).isEmpty();
}
}