fix(modbus): review r2 - region+address keys always win; string-only means no keys

N2: pre-#741 rows carry region/address beside an addressString with no marker
(the old driver never read the string, the old model preserved it as an
unknown key). The r1 rule resolved those from the string - a silent remap or
BadNodeIdUnknown on upgrade. The driver now loads from region+address whenever
both are present (classic, editor-pinned, pre-lane); only a blob with NO keys
is string-only and resolved through the parser. This is safe because the model
no longer stamps keys onto a string-only tag. The model distinguishes
string-only / legacy-string-beside-keys / pinned, and the editor hint says so.
Test matrix over every persisted shape (keys only, pre-lane keys+string,
pre-lane stamped HR/0+string, string only, marker+keys, marker no keys) under
every family; the pre-lane row also through a model save and a CSV
export->import.
n5: a typed CSV address cell is an authored address - it drops addressString
and the marker (new CsvTypedColumn.ClearsKeys) instead of being discarded.
n6: Validate skips the region/dataType/byteOrder enum checks on a string-only
tag (the driver ignores them). n7: docs/v2/modbus-addressing.md restates the
key-presence rule.

Refs #741
Claude-Session: https://claude.ai/code/session_01Ub9hGmYLQvn9XETzw7CMsT
This commit is contained in:
Joseph Doherty
2026-10-22 16:23:37 -04:00
parent 1f82ecfc0d
commit 0200619322
7 changed files with 157 additions and 45 deletions
+13 -9
View File
@@ -243,15 +243,19 @@ than asking users to rewrite spreadsheets.
## Address strings, families and region/type rules (#741)
- A tag's `addressString` is resolved through `ModbusAddressParser` with the
**driver's** `Family` / `MelsecSubFamily`. When the AdminUI editor resolves
it ("Resolve with driver family") it persists the resolved
`region`/`address`/type fields plus `"addressResolved": true`; those pinned
fields are then authoritative, so a later family change never remaps the
tag. A blob with an **unmarked** `addressString` (CSV / API authoring) is
always resolved from the string — any `region`/`address` beside it is
ignored, so it can never collapse onto HR[0]. Editing a resolved field by
hand drops the string.
- **Whenever a tag carries both `region` and `address`, those keys are its
address** — a classic tag, an editor-pinned tag, and a pre-#741 row that
carried an `addressString` beside its keys (the old driver never read the
string) all load from the keys, exactly as before, and a family change never
remaps them. Only a **string-only** blob (an `addressString` with NO
`region`/`address` — CSV / API authoring) is resolved through
`ModbusAddressParser` with the **driver's** `Family` / `MelsecSubFamily`; the
AdminUI never stamps default keys onto it, so it cannot collapse onto HR[0],
and a family that cannot parse it refuses the tag (BadNodeIdUnknown).
- The editor's "Resolve with driver family" persists the resolved
`region`/`address`/type fields plus `"addressResolved": true` (the pinned
state). Editing a resolved field by hand — in the editor or a typed CSV
address cell — drops the string and the marker.
- Coils / DiscreteInputs carry only Bool. A bit-region tag persisted with a
register `dataType` (the pre-#741 editor saved `Int16`) is coerced to Bool,
never refused. A register region with `Bool` is refused (use