checkout: Handle equivalent remotes in dicts

Bug: b/369718402
Change-Id: I061127a825357333a10680d4438806c915111cbd
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/254016
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Reviewed-by: Ted Pudlik <tpudlik@google.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
diff --git a/recipe_modules/checkout/api.py b/recipe_modules/checkout/api.py
index d60d572..5151db3 100644
--- a/recipe_modules/checkout/api.py
+++ b/recipe_modules/checkout/api.py
@@ -22,11 +22,12 @@
 import collections
 import contextlib
 import re
-from typing import TYPE_CHECKING
+from typing import Any, TypedDict, TYPE_CHECKING, Sequence
 import urllib
 import xml.etree.ElementTree
 
 import attrs
+from google.protobuf import json_format
 from PB.go.chromium.org.luci.buildbucket.proto import (
     build as build_pb,
     common as common_pb,
@@ -38,7 +39,6 @@
 from recipe_engine import recipe_api
 
 if TYPE_CHECKING:  # pragma: no cover
-    from typing import Any, Sequence
     from recipe_engine import config_types
 
 PIGWEED_REMOTE = 'https://pigweed.googlesource.com/pigweed/pigweed'
@@ -1548,10 +1548,18 @@
             parts.pop(-1)
         return f'checkout {parts[-1]}'
 
-    def load_equivalent_remotes(self, equivalent_remotes_proto):
+    class EquivalentRemotes(TypedDict):
+        remotes: list[str]
+
+    def load_equivalent_remotes(
+        self,
+        equivalent_remotes_input: list[EquivalentRemotes],
+    ):
         equivalent_remotes = {}
-        for remotes in equivalent_remotes_proto:
-            new_remotes = [self.m.sso.sso_to_https(x) for x in remotes.remotes]
+        for remotes in equivalent_remotes_input:
+            new_remotes = [
+                self.m.sso.sso_to_https(x) for x in remotes['remotes']
+            ]
             for remote in new_remotes:
                 assert remote not in equivalent_remotes
                 equivalent_remotes[remote] = new_remotes
@@ -1599,7 +1607,7 @@
         ctx.root = root or self.m.path.start_dir / 'co'
 
         ctx.equivalent_remotes = self.load_equivalent_remotes(
-            options.equivalent_remotes
+            json_format.MessageToDict(options).get('equivalentRemotes', []),
         )
 
         with self.m.step.nest(checkout_name) as pres: