fix: resolve pyright errors in egress.py
Lint and Type Check / lint (push) Failing after 7m2s
test / unit (pull_request) Successful in 39s
test / integration (pull_request) Failing after 49s

- Add explicit type annotations to _route_to_yaml_fields return type and fields dict
- Add type: ignore for path_allowlist iteration which has object type

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-06-03 23:27:10 -04:00
parent 1bd676de06
commit 873d75f852
+3 -3
View File
@@ -216,14 +216,14 @@ def egress_token_env_map(
return out
def _route_to_yaml_fields(r: Route) -> dict:
def _route_to_yaml_fields(r: Route) -> dict[str, object]:
"""Return the addon-visible fields for one route.
Single authoritative mapping between EgressRoute (host-side) and
egress_addon_core.Route (sidecar-side). When a field is added to
the addon's Route that must appear in the YAML, add it here and
in egress_addon_core._parse_one together."""
fields: dict = {"host": r.host}
fields: dict[str, object] = {"host": r.host}
if r.auth_scheme and r.token_env:
fields["auth_scheme"] = r.auth_scheme
fields["token_env"] = r.token_env
@@ -252,7 +252,7 @@ def egress_render_routes(
lines.append(f' token_env: "{f["token_env"]}"')
if "path_allowlist" in f:
lines.append(" path_allowlist:")
for p in f["path_allowlist"]:
for p in f["path_allowlist"]: # type: ignore
lines.append(f' - "{p}"')
return "\n".join(lines) + "\n"