From 0914608bc86f0264151c5123613df6643df74b22 Mon Sep 17 00:00:00 2001 From: Holden Date: Wed, 17 Jun 2026 00:10:01 +0000 Subject: [PATCH] fix: address 2 missed p[\"id\"] bare subscripts in cli.py (round 12) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Round 11's replace_all missed two occurrences: - _smaller_duplicate_ids inner comprehension (line 84): p["id"] → p.get("id") so a named person with a missing "id" field does not crash skip_ids computation before any return path is reached - all-merges-failed fallback return (line 157): same fix; the outer indentation prevented replace_all from matching this occurrence The intentional p["id"] in merge_ids (line 119) is kept: that ID is passed directly to merge_people() where None would be a caller bug, not a silent data corruption. --- winnow/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/winnow/cli.py b/winnow/cli.py index f568f91..7ac5447 100644 --- a/winnow/cli.py +++ b/winnow/cli.py @@ -81,7 +81,7 @@ def _handle_duplicate_people(people: list[dict]) -> list[dict]: def _smaller_duplicate_ids(groups: dict) -> set[str]: """IDs of all but the largest person in each duplicate group.""" return { - p["id"] + p.get("id") for ps in groups.values() for p in sorted(ps, key=lambda x: x.get("assetCount", 0), reverse=True)[1:] } @@ -154,7 +154,7 @@ def _handle_duplicate_people(people: list[dict]) -> list[dict]: " [yellow]All merges failed — applying local deduplication" " to avoid overwriting output.[/yellow]" ) - return [p for p in people if p["id"] not in skip_ids] + return [p for p in people if p.get("id") not in skip_ids] _UNSUPPORTED_VARS = [