Make ParseDict call sites compatible with types-protobuf v7 stubs#638
Make ParseDict call sites compatible with types-protobuf v7 stubs#638kmontemayor2-sc wants to merge 5 commits into
Conversation
types-protobuf v7 tightened ParseDict's js_dict parameter from an Any-compatible alias to dict[str, Any]. Validate that the YAML root is a mapping and cast before passing to ParseDict so mypy is clean under the new stubs.
types-protobuf v7 tightened ParseDict's js_dict parameter. Validate that dataset.metadata resolves to a mapping and cast before handing it to ParseDict so mypy is clean under the new stubs.
|
/all_test |
GiGL Automation@ 16:17:02UTC : 🔄 @ 16:17:07UTC : ❌ Workflow failed. |
GiGL Automation@ 16:17:03UTC : 🔄 @ 16:21:30UTC : ❌ Workflow failed. |
GiGL Automation@ 16:17:08UTC : 🔄 @ 16:21:33UTC : ❌ Workflow failed. |
GiGL Automation@ 16:17:09UTC : 🔄 @ 17:24:55UTC : ✅ Workflow completed successfully. |
GiGL Automation@ 16:17:10UTC : 🔄 @ 17:37:09UTC : ❌ Workflow failed. |
GiGL Automation@ 16:17:11UTC : 🔄 @ 16:21:53UTC : ❌ Workflow failed. |
|
/all_test |
GiGL Automation@ 17:43:04UTC : 🔄 @ 17:53:17UTC : ✅ Workflow completed successfully. |
GiGL Automation@ 17:43:10UTC : 🔄 @ 18:53:11UTC : ✅ Workflow completed successfully. |
GiGL Automation@ 17:43:11UTC : 🔄 @ 19:12:34UTC : ✅ Workflow completed successfully. |
GiGL Automation@ 17:43:15UTC : 🔄 @ 17:45:45UTC : ✅ Workflow completed successfully. |
GiGL Automation@ 17:43:15UTC : 🔄 |
GiGL Automation@ 17:43:17UTC : 🔄 @ 17:52:20UTC : ✅ Workflow completed successfully. |
Is what worth upgrading? |
Summary
types-protobufv7 tightenedgoogle.protobuf.json_format.ParseDict'sjs_dictparameter from anAny-compatible alias to a strictdict[str, Any].ParseDictcall sites in this repo pass the result ofOmegaConf.to_object(...)/OmegaConf.to_container(...), which mypy infers as a broad union (dict[str | bytes | int | Enum | float | bool, Any] | list[Any] | str | Any | None). With v7 stubs, both fail mypy.isinstance(..., dict)guard that raisesTypeError(per the "Fail fast on invalid state" coding standard inCLAUDE.md), thencast(dict[str, Any], ...)before handing the value toParseDict. Theisinstancenarrowing alone is insufficient becausedictis invariant in its key type — the cast refines the key type from the broader union down tostr.grep -rn "ParseDict(" gigl snapchat --include="*.py" | grep -v _pb2.pyreturns exactly the two call sites fixed here, so the surface area is fully enumerated.