diff --git a/tooling/economy-db/import_economics.py b/tooling/economy-db/import_economics.py index be7c80887..3c055fb19 100755 --- a/tooling/economy-db/import_economics.py +++ b/tooling/economy-db/import_economics.py @@ -1374,7 +1374,9 @@ def populate_atlas_city_names_corps(conn: sqlite3.Connection, dry_run: bool) -> # Try to find a matching atlas_city_names row in the same system body_ids_in_sys = sys_body_ids.get(headquarters_system, set()) match_id: int | None = None - for body_id in body_ids_in_sys: + # sorted() for determinism: on a name collision across bodies in the + # same system, set iteration order is not stable (D-010 #4). + for body_id in sorted(body_ids_in_sys): key = (body_id, city_name.lower()) if key in existing: match_id = existing[key]