Merge driver follow-ups B: MQTT ISO-8601 DateTime writes (#1044), FOCAS short payload BadTypeMismatch (#1036), AbCip alloc trims (#1032), AbLegacy address memo + bounded RMW gates + identity eviction (#1031), Sql docs (#1042/#1043)

This commit is contained in:
Joseph Doherty
2026-12-03 15:09:51 -05:00
14 changed files with 389 additions and 40 deletions
+1 -1
View File
@@ -640,7 +640,7 @@ test fixtures (`tests/.../Driver.FOCAS.Tests/Fixtures/v3/`). Client-visible chan
| What | Before | Now |
|------|--------|-----|
| `cnc_rdmacro` decimal | read at payload offset 4 — a constant `10` length field — so `#500 = 1.0` published `0.01` | `dec_val` at offset 6; `mantissa / 10^dec`. Vacant variable → `BadNoData`; fractional value on an integer tag → `BadTypeMismatch`; integer tags receive the exact whole value |
| `cnc_rdmacro` decimal | read at payload offset 4 — a constant `10` length field — so `#500 = 1.0` published `0.01` | `dec_val` at offset 6; `mantissa / 10^dec`. Vacant variable → `BadNoData`; fractional value on an integer tag → `BadTypeMismatch`; integer tags receive the exact whole value. A reply too short to decode (macro, parameter) is `BadTypeMismatch` on that tag with no health impact: the CNC answered and the session is intact (#1036, `FocasWirePayloadException`) |
| Axis positions | scaled by `cnc_getfigure` (0x00D3), which does not exist — on hardware: raw counts | scaled by each block's own `base^exponent`; undescribable block → `BadNoData` |
| Axis / spindle names | first 2 of 4 record bytes — `AA6`/`AA7` collapsed to `AA` | whole record up to the first NUL (residue after it discarded) — ⚠️ `Axes/AA_1`→`Axes/AA6` on such a machine |
| `ServoLoad` | `value / 10^base` (offset 4 is the base, 10) — always ~0 | `value / base^exponent`, a direct percentage |
+1 -1
View File
@@ -560,7 +560,7 @@ every MQTT node materialized read-only regardless of what the operator authored.
| Mode | Destination | Payload |
|---|---|---|
| **Plain** | the tag's `writeTopic` | the value as UTF-8 text (`Raw`/`Scalar`; a Boolean is `true`/`false`, lower-case — #988 M-15, it was .NET's `True`/`False`) or a bare JSON literal (`Json`) |
| **Plain** | the tag's `writeTopic` | the value as UTF-8 text (`Raw`/`Scalar`; a Boolean is `true`/`false`, lower-case — #988 M-15, it was .NET's `True`/`False`; a DateTime/DateTimeOffset is ISO-8601 UTC round-trip form, `2026-08-10T12:30:45.1230000Z`, an Unspecified kind read as UTC — #1044, it was `08/10/2026 12:30:45`) or a bare JSON literal (`Json`) |
| **Sparkplug B** | `spBv1.0/{group}/DCMD/{node}/{device}` for a device metric, `spBv1.0/{group}/NCMD/{node}` for an edge-node metric | a Sparkplug `Payload` carrying the metric **by name**, with an explicit `Datatype` and no `seq` |
Both publish with `retain: false`. A **Plain** write goes at **QoS 1** (STAB-26): the publish completes only
+8 -3
View File
@@ -236,7 +236,11 @@ row:
as one extended-protocol statement; the server rejects anything after a `;` itself. Oracle (ODP.NET)
refuses a second statement anyway. SQL Server and MySQL execute a multi-statement batch — there the
guard is the line (on SQL Server its T-SQL parse, above), and MySQL's read-only session is defence in depth
that hidden text could undo.
that hidden text could undo. **On MySQL the read-only session is NOT a boundary (#1042):** MySqlConnector
cannot disable multi-statement execution, so a statement that got past the guard runs as a batch in which a
later statement may re-enable writes for the session (or `COMMIT` out of the transaction). A MySQL / MariaDB
driver — read-only above all — must connect with a **`SELECT`-only login**; treat that grant, not the session
mode, as the only enforcement.
- None of this replaces the grant: a non-transactional side effect (an e-mail procedure, a call out to
another system, an autonomous transaction) is outside every layer — which is why a read-only driver
**must** connect with a `SELECT`-only login (see [Database login](#database-login-required)).
@@ -464,7 +468,7 @@ both and is rolled back (`BadConfigurationError`).
|---|---|
| Committed | `Good` |
| `Update` (or a non-MySQL `Upsert`) touched no row — the key is absent; nothing is inserted | `BadNoData` |
| More rows than the mode allows — the key is not unique; rolled back. The count is the **target statement's own**: on SQL Server the driver reads `@@ROWCOUNT` right after it (an `OUTPUT` parameter), because SqlClient's command-level count also sums trigger DML — an audit trigger that inserts a history row used to make every single-row write "touch 2 rows" and roll back (#987). PostgreSQL, MySQL and Oracle already report the statement alone. Odbc reports whatever its backend's driver does (an ODBC link to SQL Server keeps the trigger-summed count). | `BadConfigurationError` |
| More rows than the mode allows — the key is not unique; rolled back. The count is the **target statement's own**: on SQL Server the driver reads `@@ROWCOUNT` right after it (an `OUTPUT` parameter), because SqlClient's command-level count also sums trigger DML — an audit trigger that inserts a history row used to make every single-row write "touch 2 rows" and roll back (#987). PostgreSQL, MySQL and Oracle already report the statement alone. Odbc reports whatever its backend's driver does (an ODBC link to SQL Server keeps the trigger-summed count, #1043 — the backend is unknown so the driver cannot append `@@ROWCOUNT`, and ODBC has no output parameters outside a procedure call; to write to SQL Server use the native `SqlServer` provider, or keep the trigger from counting with `SET NOCOUNT ON` as its first statement). | `BadConfigurationError` |
| The provider could not report a row count; rolled back | `BadNotSupported` |
| Unique / primary-key violation — e.g. an `Insert` of a key that exists (SQLSTATE 23505, SQL Server 2627/2601, MySQL 1062, ORA-00001) | `BadEntryExists` |
| Another integrity rule — NOT NULL, foreign key, CHECK (SQLSTATE class 23, SQL Server 515/547, ORA-01400/02290/02291) — or a data exception: overflow, truncation, an unconvertible value (SQLSTATE class 22, SQL Server 8115/8152/245, ORA-01438/12899/01722) | `BadOutOfRange` |
@@ -509,7 +513,8 @@ The driver's own guards are not a substitute for the database's grants:
per-dialect keyword check plus an always-rolled-back (read-only where the provider has one) transaction;
none of that can stop a **non-transactional** side effect — a function that sends mail or calls out,
autonomous transactions — and on SQL Server and MySQL a statement that got past the guard would run as a
batch. Only the grant is a boundary.
batch. Only the grant is a boundary. This applies with particular force to **MySQL**, whose read-only
*session* is not a boundary either (MySqlConnector cannot disable multi-statement execution, #1042).
- **A writable driver must connect with a login limited to its write targets** — `SELECT` as above,
plus exactly what its modes need on exactly the tables / procedures its writable tags name:
`UPDATE` (Update), `INSERT` (Insert), `INSERT` + `UPDATE` (Upsert; SQL Server's `MERGE` also needs