fix: address 2 missed p[\"id\"] bare subscripts in cli.py (round 12)

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.
This commit is contained in:
2026-06-17 00:10:01 +00:00
parent 2182c87c40
commit 0914608bc8
+2 -2
View File
@@ -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 = [