Skip to content

feat(commissioning): persist SpecificationVersion, SoftwareVersion, and SerialNumber#66

Merged
p0fi merged 5 commits into
mainfrom
worktree-issue-50-persist-device-info
Apr 24, 2026
Merged

feat(commissioning): persist SpecificationVersion, SoftwareVersion, and SerialNumber#66
p0fi merged 5 commits into
mainfrom
worktree-issue-50-persist-device-info

Conversation

@p0fi
Copy link
Copy Markdown
Owner

@p0fi p0fi commented Apr 24, 2026

Closes #50

Summary

  • CommissioningResult — added SpecificationVersion uint32, SoftwareVersion uint32, SerialNumber string
  • readDeviceInfo — reads attributes 0x0009 (SoftwareVersion), 0x000F (SerialNumber), 0x0015 (SpecificationVersion) from the Basic Information cluster; errors stay non-fatal so pre-1.3 and serial-less devices commission without issue
  • store.Node — three new fields with omitempty JSON tags; old Bolt records decode without error
  • buildNodeFromResult — copies all three fields through (covers commission code, commission ip, and commission ble)
  • basicinformation.FormatSpecVersion — new helper in a non-generated file that decodes 0x01030000"1.3", dropping trailing zero components
  • matter @N treeFormatRichTree and buildD2Script now show Matter spec version, firmware version, and serial number; any field that is zero/empty is omitted

Test plan

  • TestReadDeviceInfo_NewAttributes — verifies all three attributes are read and surfaced in the result
  • TestReadDeviceInfo_MissingAttributes — verifies commissioning succeeds and fields stay zero/empty when the device doesn't expose them
  • TestFormatSpecVersion — 6 table-driven cases covering zero, 1.3, 1.4, 1.0, and multi-component versions
  • mise run test passes (all 12 test packages)
  • mise run lint passes

🤖 Generated with Claude Code

Copy link
Copy Markdown

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

Adds persistence and display of additional Basic Information attributes captured during commissioning, enabling richer node metadata in the store and tree outputs.

Changes:

  • Extend commissioning flow to read and carry through SpecificationVersion, SoftwareVersion, and SerialNumber.
  • Persist the new fields on store.Node (with omitempty) and propagate them into tree rendering data.
  • Add basicinformation.FormatSpecVersion helper and tests; enrich tree (rich + D2) output with spec/FW/SN when present.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/store/types.go Add persisted node fields for spec version, software version, and serial number.
internal/commissioning/flow.go Read three additional Basic Information attributes into CommissioningResult.
internal/commissioning/flow_test.go Add tests covering presence/absence behavior for the new attributes.
internal/clusters/basicinformation/specversion.go Add helper to format packed SpecificationVersion into a human-readable string.
internal/clusters/basicinformation/specversion_test.go Add table-driven tests for FormatSpecVersion.
cli/commission.go Copy new commissioning result fields into store.Node.
cli/tree.go Populate tree rendering data with the new node fields.
cli/output/tree.go Display Matter spec version, FW version, and serial number in rich tree output (when present).
cli/output/tree_d2.go Display Matter spec version, FW version, and serial number in D2/SVG output (when present).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/clusters/basicinformation/specversion.go Outdated
Comment thread internal/commissioning/flow_test.go Outdated
p0fi and others added 3 commits April 24, 2026 14:24
…nd SerialNumber (#50)

Read the three new Basic Information attributes during commissioning and
persist them to the node store. The tree output now shows Matter spec
version, firmware version, and serial number alongside the existing
vendor/product lines, omitting fields that are absent or zero so pre-1.3
and serial-less devices are unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…racy

- Correct FormatSpecVersion doc comment: minor is always included, only
  trailing zero patch is omitted.
- Replace global readErr in TestReadDeviceInfo_MissingAttributes with
  per-attribute readOverrides for the three optional attributes, so the
  test accurately simulates a device that exposes mandatory attributes
  but not SoftwareVersion/SerialNumber/SpecificationVersion.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@p0fi p0fi force-pushed the worktree-issue-50-persist-device-info branch from 98238f0 to 3c68d87 Compare April 24, 2026 12:24
p0fi and others added 2 commits April 24, 2026 14:36
Rename labels for clarity (Product → Product ID, Matter → Spec Version,
Serial → Serial Number) and pad all labels to a fixed width so values
line up in a single column.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@p0fi p0fi merged commit ebfdc82 into main Apr 24, 2026
4 checks passed
@p0fi p0fi deleted the worktree-issue-50-persist-device-info branch April 24, 2026 12:45
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.

Persist SpecificationVersion, SoftwareVersion, and SerialNumber during commissioning

2 participants