Sweep module-reference and module-anatomy for reconfigure removal#5002
Conversation
Follow-up to viamrobotics#5001. These two pages still taught the `new` → `reconfigure` pattern, documented a Go `Resource` interface that no longer exists, and recommended deprecated helper traits. - `module-reference.md`: - Lifecycle: rewrite steps 7 and 9 to describe close-and-rebuild on config change instead of "constructor calls Reconfigure" and a standalone Reconfigure step. - Go `Resource` interface: remove the `Reconfigure` method (dropped from the interface in rdk #5811, 2026-04-14). - Helper traits table: drop `TriviallyReconfigurable` and `AlwaysRebuild` (both deprecated). - Python `Resource interfaces`: delete the standalone "Reconfigure" section and update the Constructor example comment. - Python and Go defaults table: reframe around rebuild-by-default with Python's `Reconfigurable` protocol as the only in-place opt-in. - Common gotchas: replace "Always call Reconfigure from your constructor" and "Prefer Reconfigure over AlwaysRebuild" with a single "Put config-reading in the constructor" gotcha. - `module-anatomy.md`: - Rewrite the prose that explained Go's `AlwaysRebuild` vs. `Reconfigure` choice (Reconfigure is gone). - Replace the Python `new` → `reconfigure` example with inline config-reading in `new`. Also fixes a pre-existing `async def new` typo (`new` is a classmethod, not async).
✅ Deploy Preview for viam-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR updates the module authoring reference docs to align with current SDK behavior after removal of Reconfigure/reconfigure as the default pattern, emphasizing rebuild-on-config-change and constructor-based config parsing.
Changes:
- Updates module lifecycle guidance to describe close-and-rebuild behavior on config changes.
- Removes the outdated Go
Resource.Reconfiguremethod from the documented interface and drops deprecated helper traits. - Refactors Python examples to parse config/resolve dependencies in
newand removes the standalone Pythonreconfiguresection.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
docs/build-modules/module-reference.md |
Rewrites lifecycle + defaults/traits tables and removes obsolete Go/Python reconfigure guidance. |
docs/build-modules/module-anatomy.md |
Updates constructor/reconfiguration prose and rewrites the Python example to read config in new. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 9. When the user changes configuration, `viam-server` closes the existing | ||
| resource instance and calls `AddResource` again with the new config. The | ||
| constructor runs a second time. This must complete within the per-resource | ||
| configuration timeout (default: 2 minutes, configurable with |
There was a problem hiding this comment.
The lifecycle description says that on config change viam-server closes the resource and calls AddResource again, but later in this same page the ModuleService RPC table still describes ReconfigureResource as updating an existing resource. Please make these sections consistent (either document that ReconfigureResource is unused/deprecated for modules, or update the lifecycle steps to match the RPC actually used). Also, “constructor runs a second time” reads like a one-time event—consider wording like “runs again on every config change.”
| 9. When the user changes configuration, `viam-server` closes the existing | |
| resource instance and calls `AddResource` again with the new config. The | |
| constructor runs a second time. This must complete within the per-resource | |
| configuration timeout (default: 2 minutes, configurable with | |
| 9. When the user changes configuration, `viam-server` reconfigures the | |
| existing resource with the new config. Any reconfiguration logic for that | |
| resource runs again on every config change. This must complete within the | |
| per-resource configuration timeout (default: 2 minutes, configurable with |
|
🔎💬 Inkeep AI search and chat service is syncing content for source 'Viam Docs' |

Summary
Follow-up to #5001. The module-reference and module-anatomy pages still taught the
new→reconfigurepattern, documented a GoResourceinterface that no longer exists, and recommended deprecated helper traits. This PR makes both pages coherent with current SDK behavior.Context (same as #5001): Python
EasyResource.reconfigurewas removed (viam-python-sdk #1030). GoResource.Reconfigurewas removed from the interface (rdk #5811).AlwaysRebuildandTriviallyReconfigurableare deprecated. Guidance now: config changes rebuild the resource; read config in the constructor.Files changed:
build-modules/module-reference.md:Reconfigure" and a standalone Reconfigure step.Resourceinterface definition — remove theReconfigure(ctx, deps, conf) errormethod. This was factually wrong: the method was dropped from the interface in rdk #5811 (2026-04-14). Fixing an incorrect API signature in a reference page was the main reason to sweep here rather than narrow-fix.TriviallyReconfigurableandAlwaysRebuild(both deprecated).Reconfigurableprotocol shown as the only in-place opt-in.Reconfigurefrom your constructor" and "PreferReconfigureoverAlwaysRebuild" with a single "Put config-reading in the constructor" gotcha. These two callouts directly contradicted the current pattern.build-modules/module-anatomy.md:AlwaysRebuildvs.Reconfigurechoice (Reconfigure is gone).new→reconfigureworked example with inline config-reading innew. Also fixes a pre-existingasync def newtypo (newis a classmethod, not an async method) that slipped in at some earlier point.Net: 52 deletions, 28 additions. Vale clean.
make build-prodsucceeds.Test plan
Reconfigurableprotocol) is accurate in the defaults tableResourceinterface definition matches current rdk main (post-#5811)Still out of scope (future PRs)
build-modules/write-a-cpp-module.md:323— C++ page with Python snippet (may warrant its own C++-focused pass since rdk #5879 also dropped Reconfigure from the C++ generator)reference/services/motion/_index.md:108andvision/object-detection/act-on-detections.md:144— brokensuper().reconfigure(...)calls that will now raiseAttributeError