Skip to content

Commit faf86cf

Browse files
Coverage: guard missing proto overrides + remove navigation (#5126) (#5143)
1 parent 029968d commit faf86cf

3 files changed

Lines changed: 24 additions & 36 deletions

File tree

.github/workflows/sdk_protos_map.csv

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -296,21 +296,6 @@ motion,DoCommand,,do_command,DoCommand,,doCommand
296296
motion,GetResourceName,,get_resource_name,Name,,name
297297
motion,Close,,close,Close,,
298298

299-
## Navigation
300-
navigation,GetMode,,get_mode,Mode,,getMode
301-
navigation,SetMode,,set_mode,SetMode,,setMode
302-
navigation,GetLocation,,get_location,Location,,getLocation
303-
navigation,GetWaypoints,,get_waypoints,Waypoints,,getWayPoints
304-
navigation,AddWaypoint,,add_waypoint,AddWaypoint,,addWayPoint
305-
navigation,RemoveWaypoint,,remove_waypoint,RemoveWaypoint,,removeWayPoint
306-
navigation,GetObstacles,,get_obstacles,Obstacles,,getObstacles
307-
navigation,GetPaths,,get_paths,Paths,,getPaths
308-
navigation,GetProperties,,get_properties,Properties,,getProperties
309-
## HACK: proto for these (and/or inherited in Go SDK), manually mapping:
310-
navigation,Reconfigure,,,Reconfigure,,
311-
navigation,DoCommand,,do_command,DoCommand,,doCommand
312-
navigation,GetResourceName,,get_resource_name,Name,,name
313-
navigation,Close,,close,Close,,
314299

315300
## SLAM
316301
slam,GetPosition,,get_position,Position,,getPosition

.github/workflows/update_sdk_methods.py

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
## at runtime if desired:
2424
components = ["arm", "base", "board", "button", "camera", "encoder", "gantry", "generic_component", "gripper",
2525
"input_controller", "motor", "movement_sensor", "power_sensor", "sensor", "servo", "switch", "audio_in", "audio_out"]
26-
services = ["base_remote_control", "data_manager", "discovery", "generic_service", "mlmodel", "motion", "navigation", "slam", "vision", "world_state_store"]
26+
services = ["base_remote_control", "data_manager", "discovery", "generic_service", "mlmodel", "motion", "slam", "vision", "world_state_store"]
2727
app_apis = ["app", "billing", "data", "dataset", "data_sync", "mltraining"]
2828
robot_apis = ["robot"]
2929

@@ -279,11 +279,6 @@
279279
"name": "MotionServiceClient",
280280
"methods": []
281281
},
282-
"navigation": {
283-
"url": "https://raw.githubusercontent.com/viamrobotics/api/main/service/navigation/v1/navigation_grpc.pb.go",
284-
"name": "NavigationServiceClient",
285-
"methods": []
286-
},
287282
"slam": {
288283
"url": "https://raw.githubusercontent.com/viamrobotics/api/main/service/slam/v1/slam_grpc.pb.go",
289284
"name": "SLAMServiceClient",
@@ -936,7 +931,7 @@ def write_markdown(type, names, methods):
936931
## Replace underscores, and convert generic_component to just generic:
937932
resource_adjusted = resource.replace('generic_component', 'generic').replace('_','-')
938933
proto_anchor_link = '/dev/reference/apis/components/' + resource_adjusted + '/#' + proto_link
939-
elif type == 'service' and resource in ['base_remote_control', 'motion', 'navigation', 'slam', 'vision']:
934+
elif type == 'service' and resource in ['base_remote_control', 'motion', 'slam', 'vision']:
940935
proto_anchor_link = '/dev/reference/apis/services/' + resource.replace('base_remote_control', 'base-rc') + '/#' + proto_link
941936
elif type == 'service' and resource == 'data_manager':
942937
proto_anchor_link = '/dev/reference/apis/services/data/#' + proto_link
@@ -966,20 +961,28 @@ def write_markdown(type, names, methods):
966961
## first sentence:
967962

968963

969-
with open(proto_override_file, 'r') as f:
970-
file_contents = f.read().strip()
971-
file_contents = regex.sub(r'\{\{\%.*\%\}\}.*\{\{\% \/[a-b].* \%\}\}', '', file_contents, flags=regex.DOTALL)
972-
search_result = file_contents.split('.\n', 1)[0].strip().replace("\n", " ")
973-
974-
## If the proto description contains any MD links, strip them out:
975-
search_result = regex.sub(r'\[([A-Za-z0-9\.\(\)\-\_\`\s]*)\]\([A-Za-z0-9\.\:\/\-\_\#]*\)', r'\1', search_result)
976-
977-
## If the proto description is missing a trailing period, or we stripped it off during the above matching, append
978-
## (restore) the period character:
979-
if not search_result.endswith('.'):
980-
proto_description_first_sentence = search_result + '.'
981-
else:
982-
proto_description_first_sentence = search_result
964+
if os.path.isfile(proto_override_file):
965+
with open(proto_override_file, 'r') as f:
966+
file_contents = f.read().strip()
967+
file_contents = regex.sub(r'\{\{\%.*\%\}\}.*\{\{\% \/[a-b].* \%\}\}', '', file_contents, flags=regex.DOTALL)
968+
search_result = file_contents.split('.\n', 1)[0].strip().replace("\n", " ")
969+
970+
## If the proto description contains any MD links, strip them out:
971+
search_result = regex.sub(r'\[([A-Za-z0-9\.\(\)\-\_\`\s]*)\]\([A-Za-z0-9\.\:\/\-\_\#]*\)', r'\1', search_result)
972+
973+
## If the proto description is missing a trailing period, or we stripped it off during the above matching, append
974+
## (restore) the period character:
975+
if not search_result.endswith('.'):
976+
proto_description_first_sentence = search_result + '.'
977+
else:
978+
proto_description_first_sentence = search_result
979+
else:
980+
## No proto description override file (for example a proto whose
981+
## docs section was removed); leave the description blank instead
982+
## of crashing on the missing file, but warn so a genuinely
983+
## missing override (an authoring gap) is still surfaced.
984+
print(f"WARNING: {type} {resource} {proto} has no proto description override file ({proto_override_file}); leaving description blank")
985+
proto_description_first_sentence = ''
983986

984987
## Write out this proto's entry to this resource's table_file:
985988
if resource != 'movement_sensor':

static/include/services/apis/overrides/protos/world_state_store.close.md renamed to static/include/services/apis/overrides/protos/world_state_store.Close.md

File renamed without changes.

0 commit comments

Comments
 (0)