refactor(devices): store hardware identity as hw_family / hw_revision

The firmware moved its NVS identity keys from hw_type / hw_version to
hw_family / hw_revision (NvsMigration.cpp), and the NVS generator, cloudflash
and the device models already used the new names. Firestore device docs and
the manufacturing code still wrote and read hw_type / hw_version, so the
device API's hw_family / hw_revision were always "" (0 of 14 docs had them)
and the console used two names for one value.

Device docs now use the firmware's names (schema v1.1.0, decision D2 in the
bellsystems-schema repo). The apps don't read these fields, so no app change.

- Manufacturing batch-create writes hw_family / hw_revision; the inventory
  API exposes hw_family / hw_revision (filters: ?hw_family= / ?hw_families=).
  Reads fall back to hw_type / hw_version so docs not yet migrated still work.
- devices/firestore_v1.py renames hw_type / hw_version on read and write and
  rejects a hw_family that isn't a code (e.g. "Bell Plus"): when the console
  generates NVS from it, the firmware builds its OTA URL from that value.
- Inventory, provisioning, onboarding and overview pages use the new names.

Unchanged on purpose: the firmware catalog and flash assets
(/api/firmware/{hw_type}/..., hw_type_override) — a separate store and the
URL devices call; same values, only the variable name differs. The public
cloudflash response keeps its hw_type field (public contract).

Data migration (rename + fix 3 display-label values) runs from the
bellsystems-schema repo AFTER this is deployed: the currently deployed
console still reads hw_type.

Verified: 118 backend tests pass; frontend builds; ESLint errors in
ProvisioningWizard.jsx (7) are pre-existing and unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-08 21:02:20 +02:00
co-authored by Claude Opus 5.5
parent 5ab87fa9f0
commit 2e3d7ba062
11 changed files with 79 additions and 57 deletions
@@ -250,8 +250,8 @@ const TABLE_COLUMNS = [
render: (d) => friendlyName(d) || <span style={{ color: 'var(--color-text-muted)' }}>—</span>,
},
{
key: 'hw_type', label: 'Board Type', sortable: true,
render: (d) => d.hw_type || <span style={{ color: 'var(--color-text-muted)' }}>—</span>,
key: 'hw_family', label: 'Board Type', sortable: true,
render: (d) => d.hw_family || <span style={{ color: 'var(--color-text-muted)' }}>—</span>,
},
{
key: 'mfg_status', label: 'Status',
@@ -301,14 +301,14 @@ function DevicePicker({ onSelect }) {
}
if (boardTypes.length > 0) {
const boardTypeSet = new Set(boardTypes)
list = list.filter((d) => boardTypeSet.has(d.hw_type))
list = list.filter((d) => boardTypeSet.has(d.hw_family))
}
const q = search.trim().toLowerCase()
if (q) {
list = list.filter((d) => {
if ((d.serial_number || '').toLowerCase().includes(q)) return true
if ((friendlyName(d) || '').toLowerCase().includes(q)) return true
if ((d.hw_type || '').toLowerCase().includes(q)) return true
if ((d.hw_family || '').toLowerCase().includes(q)) return true
if ((d.customer_name || '').toLowerCase().includes(q)) return true
if ((d.users || []).some((u) => (u.display_name || '').toLowerCase().includes(q) || (u.email || '').toLowerCase().includes(q))) return true
return false
@@ -640,7 +640,7 @@ const PlanStep = forwardRef(function PlanStep({ device, onDeviceUpdated }, ref)
const startIso = startDateStr ? `${startDateStr}T00:00:00Z` : new Date().toISOString()
// PUT /devices/{id} returns the DeviceInDB shape, which doesn't line up
// field-for-field with the DeviceInventoryItem shape the rest of the wizard
// uses (e.g. hw_type vs hw_family) — merge in just the two fields Configure
// uses — merge in just the two fields Configure
// actually needs rather than replacing the whole device object.
const updated = await api.put(`/devices/${device.id}`, {
device_subscription: {
@@ -1975,7 +1975,7 @@ function DeviceWorkspace({ device, onDeviceUpdated, onDone, onChangeDevice }) {
return (
<Card
title={device.serial_number}
subtitle={`${friendlyName(device) || device.hw_type || '—'} · ${device.mfg_status}`}
subtitle={`${friendlyName(device) || device.hw_family || '—'} · ${device.mfg_status}`}
action={<Button variant="ghost" size="sm" onClick={onChangeDevice}>Change Device</Button>}
>
<div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--space-6)' }}>