Use zc95's serial no. info in fw >=2.0#94
Conversation
📝 WalkthroughWalkthroughThe ZC95 version response now includes an optional serial number. The device factory derives deterministic identities from serial numbers, reuses existing known devices, persists new known devices when applicable, and adds unit coverage for fallback, reuse, persistence, and failure paths. ChangesZC95 known-device identity
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Zc95DeviceFactory
participant ProtocolHandler
participant Settings
participant NameGenerator
Zc95DeviceFactory->>ProtocolHandler: Fetch device version and pattern list
Zc95DeviceFactory->>Settings: Look up serial-derived KnownDevice
Settings-->>Zc95DeviceFactory: Return existing device or no match
Zc95DeviceFactory->>NameGenerator: Generate name for a new device
Zc95DeviceFactory->>Settings: Persist KnownDevice when SerialNo exists
Zc95DeviceFactory-->>Zc95DeviceFactory: Construct Zc95Device
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/unit/device/protocol/zc95/zc95DeviceFactory.spec.ts`:
- Around line 89-90: Update the assertions in
tests/unit/device/protocol/zc95/zc95DeviceFactory.spec.ts at lines 89-90,
108-110, and 140-141 to use PeripheralDevice properties deviceId and deviceName
instead of getDeviceId and getDeviceName, preserving the existing expected
values.
- Around line 89-90: Update the assertions in the device factory test to access
the existing deviceId and deviceName getter properties instead of getDeviceId
and getDeviceName, while preserving the expected transportDeviceId and Generated
Name values.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b5aff874-ba04-4406-921b-11ce5a3a6176
📒 Files selected for processing (3)
src/device/protocol/zc95/zc95DeviceFactory.tssrc/device/protocol/zc95/zc95MessageFactory.tstests/unit/device/protocol/zc95/zc95DeviceFactory.spec.ts
Summary by CodeRabbit
New Features
Bug Fixes