Skip to content

Commit c1c4995

Browse files
committed
test(gtm): unit tests + fix unreachable gtm_only_firing status
Adds 50 unit tests covering: - All pure-function parsers in gtm/read.py: _params_dict, _summarize_filter (including negate-flag rendering), _resolve_trigger (custom + built-in IDs), _trigger_group_member_ids, _element_visibility_summary (case-insensitive selectorType), _parse_trigger (type-specific dispatch), _parse_variable. - audit_event_coverage status determination — one test per status code (ok, no_tag_no_fire, tag_paused, tag_active_but_not_firing, ok_auto_collected, ga4_fires_no_tag, gtm_only_firing, gtm_only_not_firing, auto_event_only, ga4_only). - Insight generation for the four most common gap categories: missing tag, paused tag, dynamic-event tag, custom HTML tag. - Matrix shape contracts: required keys, container summary, GA4 error short-circuit, alphabetical event sort. Tests caught a real bug: the `ok` status was matched on `in_gtm AND any_active_tag AND ga4_fires` without requiring `in_codebase`, making `gtm_only_firing` (intended semantics: \"event fires from a GTM tag but isn't in the codebase, possibly stale\") unreachable. Fixed by adding `in_codebase` to the `ok` condition. No user-facing surface area change for events that ARE in the codebase — only events not in the codebase but with active firing tags are affected, and they now correctly route to gtm_only_firing instead of the over-eager ok. 234 tests pass (was 184 baseline + 50 new from this commit).
1 parent 440e695 commit c1c4995

2 files changed

Lines changed: 645 additions & 1 deletion

File tree

src/adloop/crossref.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ def audit_event_coverage(
634634
ga4_fires = ga4_count > 0
635635
is_auto = event in _GA4_AUTO_EVENTS
636636

637-
if in_gtm and any_active_tag and ga4_fires:
637+
if in_codebase and in_gtm and any_active_tag and ga4_fires:
638638
status = "ok"
639639
elif in_codebase and not in_gtm and ga4_fires and is_auto:
640640
status = "ok_auto_collected"

0 commit comments

Comments
 (0)