diff --git a/patbond-user/src/main/java/com/patbond/patbond/user/analytics/EventDictionary.java b/patbond-user/src/main/java/com/patbond/patbond/user/analytics/EventDictionary.java index e97bdce..ec513e0 100644 --- a/patbond-user/src/main/java/com/patbond/patbond/user/analytics/EventDictionary.java +++ b/patbond-user/src/main/java/com/patbond/patbond/user/analytics/EventDictionary.java @@ -5,8 +5,9 @@ import java.util.Set; import java.util.regex.Pattern; /** - * Event dictionary v1 (report 13 §4, auth funnel) plus the two additions this - * ticket requires (page_viewed / health_record_action — flagged in report 19). + * Event dictionary v1 (report 13 §4, auth funnel) plus page_viewed (report 19). + * ADR-013: health_record_action removed (client zero-reference, v2 events will + * be specific per action when M2 second wave lands). * Unknown event names reject the whole event; props outside the per-event * whitelist are stripped (kept event, counted warning); props whose KEY * matches the privacy red-line pattern (report 13 §5.2.4) reject the event. @@ -34,9 +35,8 @@ public final class EventDictionary { Map.entry("auth_session_restore_succeeded", Set.of("durationMs", "usedRefresh")), Map.entry("auth_session_restore_failed", Set.of("failureReason", "errorCode", "httpStatus")), - // Ticket additions beyond dictionary v1 (see report 19): - Map.entry("page_viewed", Set.of("pageName", "referrer")), - Map.entry("health_record_action", Set.of("recordType", "actionType")) + // Report 19 遗留项 §2: + Map.entry("page_viewed", Set.of("pageName", "referrer")) ); public static boolean isKnownEvent(String eventName) { diff --git a/patbond-user/src/test/java/com/patbond/patbond/user/analytics/EventDictionaryTest.java b/patbond-user/src/test/java/com/patbond/patbond/user/analytics/EventDictionaryTest.java new file mode 100644 index 0000000..7969445 --- /dev/null +++ b/patbond-user/src/test/java/com/patbond/patbond/user/analytics/EventDictionaryTest.java @@ -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(); + } +}