Skip to content

RSDK-14589 Seed $framesystem into module dependencies - #1272

Draft
JohnN193 wants to merge 1 commit into
RSDK-14588-framesystem-servicefrom
RSDK-14589-seed-framesystem-dependency
Draft

JohnN193 wants to merge 1 commit into
RSDK-14588-framesystem-servicefrom
RSDK-14589-seed-framesystem-dependency

Conversation

@JohnN193

Copy link
Copy Markdown
Member

Problem

A Python modular resource is constructed with (config, dependencies) and never sees the parent RobotClient. Module._get_dependencies only resolves the dependency strings viam-server sends, and viam-server deliberately strips framesystem and $framesystem from module Validate results (rdk module/modmanager/manager.go, RSDK-12124). So a Python module has no way to reach the frame system. Go seeds $framesystem into every resource's dependencies in module/resources.go getDependenciesForConstruction, on both construction and reconfigure.

Depends on #1271 (FrameSystem service and client).

Change

  • Module._get_dependencies connects to the parent, then seeds the mapping with FrameSystem.get_resource_name("$framesystem") pointing at the parent's FrameSystemClient (via the get_service special case from RSDK-14588) before resolving the server sent dependencies. reconfigure_resource goes through add_resource, so one change covers both paths.
  • The seed is skipped when there is no parent, which is the VIAM_NO_MODULE_PARENT case.
  • FrameSystem.from_dependencies docstring now promises the seed.
  • examples/complex_module/README.md gains a short section showing FrameSystem.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.parent is always set by the time a resource is constructed. The module test fixture mocks _connect_to_parent for that reason, and tests that need a parent set module.parent themselves as before.

Tests

tests/test_module.py:

  • test_add_resource_seeds_frame_system: viam-server sends only rdk:component:arm/arm1, the constructor still receives $framesystem next to it, FrameSystem.from_dependencies returns a working FrameSystemClient, and a reconfigure_resource round trip keeps the same client.
  • test_no_frame_system_without_parent: no parent, no seed.

The mock MyGizmo now records the dependencies it was constructed with so the tests can inspect them.

make lint, pyright and make test pass (909 passed, 5 skipped).

Jira: RSDK-14589

🤖 Generated with Claude Code

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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant