Skip to content

Sweep module-reference and module-anatomy for reconfigure removal#5002

Merged
shannonbradshaw merged 3 commits intoviamrobotics:mainfrom
shannonbradshaw:shannonbradshaw/fix-module-reference-anatomy-reconfigure
Apr 21, 2026
Merged

Sweep module-reference and module-anatomy for reconfigure removal#5002
shannonbradshaw merged 3 commits intoviamrobotics:mainfrom
shannonbradshaw:shannonbradshaw/fix-module-reference-anatomy-reconfigure

Conversation

@shannonbradshaw
Copy link
Copy Markdown
Collaborator

@shannonbradshaw shannonbradshaw commented Apr 21, 2026

Summary

Follow-up to #5001. The module-reference and module-anatomy pages still taught the newreconfigure pattern, documented a Go Resource interface 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.reconfigure was removed (viam-python-sdk #1030). Go Resource.Reconfigure was removed from the interface (rdk #5811). AlwaysRebuild and TriviallyReconfigurable are deprecated. Guidance now: config changes rebuild the resource; read config in the constructor.

Files changed:

build-modules/module-reference.md:

  • Lifecycle steps 7 and 9 — rewrite to describe close-and-rebuild on config change instead of "constructor calls Reconfigure" and a standalone Reconfigure step.
  • Go Resource interface definition — remove the Reconfigure(ctx, deps, conf) error method. 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.
  • Helper traits table — drop TriviallyReconfigurable and AlwaysRebuild (both deprecated).
  • Python Resource interfaces — delete the standalone "Reconfigure" section; update the Constructor example comment to reflect "runs on initial creation and on every config change."
  • Python and Go defaults table — reframe around rebuild-by-default, with Python's Reconfigurable protocol shown 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. These two callouts directly contradicted the current pattern.

build-modules/module-anatomy.md:

  • Rewrite the prose that explained Go's AlwaysRebuild vs. Reconfigure choice (Reconfigure is gone).
  • Replace the Python newreconfigure worked example with inline config-reading in new. Also fixes a pre-existing async def new typo (new is a classmethod, not an async method) that slipped in at some earlier point.

Net: 52 deletions, 28 additions. Vale clean. make build-prod succeeds.

Test plan

  • Verify Netlify deploy preview renders both pages without broken links
  • Naveed confirms the Python in-place reconfigure description (via Reconfigurable protocol) is accurate in the defaults table
  • Alden confirms the Go Resource interface definition matches current rdk main (post-#5811)
  • Confirm the two deleted best-practice callouts aren't linked from elsewhere in docs

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:108 and vision/object-detection/act-on-detections.md:144 — broken super().reconfigure(...) calls that will now raise AttributeError

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).
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 21, 2026

Deploy Preview for viam-docs ready!

Name Link
🔨 Latest commit 6084ed8
🔍 Latest deploy log https://app.netlify.com/projects/viam-docs/deploys/69e7ef70e343af0009699ba6
😎 Deploy Preview https://deploy-preview-5002--viam-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 46 (🟢 up 9 from production)
Accessibility: 99 (no change from production)
Best Practices: 83 (🔴 down 9 from production)
SEO: 89 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@viambot viambot added the safe to build This pull request is marked safe to build from a trusted zone label Apr 21, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.Reconfigure method from the documented interface and drops deprecated helper traits.
  • Refactors Python examples to parse config/resolve dependencies in new and removes the standalone Python reconfigure section.

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.

Comment on lines +50 to +53
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
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.”

Suggested 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

Copilot uses AI. Check for mistakes.
@shannonbradshaw shannonbradshaw merged commit 1acbc1c into viamrobotics:main Apr 21, 2026
12 checks passed
@github-actions
Copy link
Copy Markdown

🔎💬 Inkeep AI search and chat service is syncing content for source 'Viam Docs'

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

Labels

safe to build This pull request is marked safe to build from a trusted zone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants