From 6f2d1160d2048cdeb369006a6e939841a10f386c Mon Sep 17 00:00:00 2001 From: Brandon Shrewsbury Date: Thu, 2 Jul 2026 09:47:35 -0600 Subject: [PATCH] Stop coverage check crashing on proto methods missing from an SDK scrape (#5126) `make coveragetest` (update_sdk_methods.py --coverage) crashed with KeyError: 'CurrentInputs' in write_markdown: a proto RPC can map to an SDK method that the SDK's own resource doc page does not surface. gripper gained GetCurrentInputs/GoToInputs (real proto RPCs, already documented in the Python and TypeScript references), but in Go they are inherited via framesystem.InputEnabled and rendered on that interface's page, not gripper's, so the per-resource Go scrape does not find them and the unguarded methods['go'][type][resource][go_method_name] access raised KeyError. Guard the mapped-method lookup: if the scraper did not find the mapped method for a given SDK, treat that SDK as not having it so the proto still documents in the SDKs that do surface it, instead of crashing. Verified by running the generator locally: it now completes for gripper (no KeyError) and the coverage check runs to completion. Note: with the crash gone, the coverage check now surfaces pre-existing coverage gaps that the crash had been masking (for example get_status listed unused across several components). Those are the check working as intended and are separate coverage-mapping decisions. Refs #5126 --- .github/workflows/update_sdk_methods.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/update_sdk_methods.py b/.github/workflows/update_sdk_methods.py index e4ea5aa66d..4a7cb26e41 100755 --- a/.github/workflows/update_sdk_methods.py +++ b/.github/workflows/update_sdk_methods.py @@ -857,6 +857,23 @@ def write_markdown(type, names, methods): flutter_method_name = row.split(',')[5].rstrip() typescript_method_name = row.split(',')[6].rstrip() + ## A proto RPC can map to an SDK method that the SDK's own + ## resource doc page does not surface -- for example gripper's + ## CurrentInputs/GoToInputs, which are inherited via + ## framesystem.InputEnabled and documented on that interface's + ## page, not the gripper page. If the scraper did not find the + ## mapped method for a given SDK, treat that SDK as not having + ## it so the proto still documents in the SDKs that do surface + ## it, instead of raising a KeyError. + if py_method_name and "python" in sdks and py_method_name not in methods['python'][type].get(resource, {}): + py_method_name = '' + if go_method_name and "go" in sdks and go_method_name not in methods['go'][type].get(resource, {}): + go_method_name = '' + if flutter_method_name and "flutter" in sdks and flutter_method_name not in methods['flutter'][type].get(resource, {}): + flutter_method_name = '' + if typescript_method_name and "typescript" in sdks and typescript_method_name not in methods['typescript'][type].get(resource, {}): + typescript_method_name = '' + if py_method_name and "python" in sdks: methods['python'][type][resource][py_method_name]["used"] = True if go_method_name and "go" in sdks: