Conversation
viam-server strips the frame system out of the dependency lists it sends a module, so Module._get_dependencies now hands every resource the machine's frame system itself, the way the Go module SDK does. Reconfigure goes through add_resource, so one change covers both paths. The seed is skipped when the module runs without a parent. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A Python modular resource is constructed with
(config, dependencies)and never sees the parentRobotClient.Module._get_dependenciesonly resolves the dependency strings viam-server sends, and viam-server deliberately stripsframesystemand$framesystemfrom moduleValidateresults (rdkmodule/modmanager/manager.go, RSDK-12124). So a Python module has no way to reach the frame system. Go seeds$framesysteminto every resource's dependencies inmodule/resources.gogetDependenciesForConstruction, on both construction and reconfigure.Depends on #1271 (
FrameSystemservice and client).Change
Module._get_dependenciesconnects to the parent, then seeds the mapping withFrameSystem.get_resource_name("$framesystem")pointing at the parent'sFrameSystemClient(via theget_servicespecial case from RSDK-14588) before resolving the server sent dependencies.reconfigure_resourcegoes throughadd_resource, so one change covers both paths.VIAM_NO_MODULE_PARENTcase.FrameSystem.from_dependenciesdocstring now promises the seed.examples/complex_module/README.mdgains a short section showingFrameSystem.from_dependencies(dependencies)in a constructor.Behavior note: adding a resource with zero dependencies previously never touched the parent. It now does, matching Go, where
m.parentis always set by the time a resource is constructed. The module test fixture mocks_connect_to_parentfor that reason, and tests that need a parent setmodule.parentthemselves as before.Tests
tests/test_module.py:test_add_resource_seeds_frame_system: viam-server sends onlyrdk:component:arm/arm1, the constructor still receives$framesystemnext to it,FrameSystem.from_dependenciesreturns a workingFrameSystemClient, and areconfigure_resourceround trip keeps the same client.test_no_frame_system_without_parent: no parent, no seed.The mock
MyGizmonow records the dependencies it was constructed with so the tests can inspect them.make lint,pyrightandmake testpass (909 passed, 5 skipped).Jira: RSDK-14589
🤖 Generated with Claude Code