fix(lookup): partition dedup by name instead of group
ROW_NUMBER() was partitioning by `group`, collapsing all 12 US/* timezones (which share group="United States") down to a single record. Partitioning by `name` correctly deduplicates by timezone identity while still preserving the object > account > global override hierarchy. Priority-only list now returns the expected 72 entries. Adds a regression test asserting all 12 US/* timezones are present in the full list. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -75,13 +75,35 @@ def test_lookup_resolve(lu_type, query):
|
||||
print_result(f"GET /{lu_type}/resolve?q={query}", False, str(e))
|
||||
return False
|
||||
|
||||
US_TIMEZONES = [
|
||||
"US/Alaska", "US/Arizona", "US/Central", "US/East-Indiana",
|
||||
"US/Eastern", "US/Hawaii", "US/Indiana-Starke", "US/Michigan",
|
||||
"US/Mountain", "US/Pacific", "US/Pacific-New", "US/Samoa",
|
||||
]
|
||||
|
||||
def test_timezone_us_dedup():
|
||||
"""Regression: PARTITION BY `name` fix — all 12 US/* zones must appear."""
|
||||
label = "time_zone US/* deduplication (regression)"
|
||||
data = test_lookup_list("time_zone")
|
||||
if data is None:
|
||||
return
|
||||
names = {item.get("name") for item in data}
|
||||
missing = [tz for tz in US_TIMEZONES if tz not in names]
|
||||
if missing:
|
||||
print_result(label, False, f"Missing: {missing}")
|
||||
else:
|
||||
print_result(label, True, f"All 12 US/* timezones present ({len(data)} total)")
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(f"🚀 Starting V3 Lookup E2E Suite ({BASE_URL})\n")
|
||||
start_suite = time.time()
|
||||
|
||||
|
||||
# 1. Basic Lists (Phase 1)
|
||||
test_lookup_list("country")
|
||||
|
||||
|
||||
print("\n--- Regression: US/* timezone deduplication ---")
|
||||
test_timezone_us_dedup()
|
||||
|
||||
print("\n--- Testing Priority Only ---")
|
||||
test_lookup_list("time_zone", only_priority=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user