fix(ablegacy): libplctag refuses MicroLogix function files locally instead of a comms fault (#592)
v2-ci / unit-tests (push) Has been cancelled

libplctag 2.6.0 cannot parse RTC/HSC/... names; tag creation failed with
PLCTAG_ERR_BAD_PARAM, which the status translation reported as BadConnection:
evicted handle, degraded health, counted toward marking a healthy device down.
The libplctag runtime now refuses function-file addresses before creating a
native tag (Unsupported -> BadNotSupported, health untouched), matching native.
Docs: function files are unsupported on both transports, not "unverified".

Claude-Session: https://claude.ai/code/session_01GT67AD99zQQqpLCVm3p7xk
This commit is contained in:
Joseph Doherty
2026-11-13 01:00:47 -05:00
parent 422ed50b9c
commit eec87d3f74
7 changed files with 136 additions and 19 deletions
+17 -8
View File
@@ -118,9 +118,15 @@ physical inputs and may reject the write.
- **MicroLogix function files (#245).** `RTC`, `HSC`, `DLS`, `MMI`, `PTO`, `PWM`, `STI`, `EII`, `IOS`, `BHI`
(single fixed instance — no file number — with a `.SUBELEMENT`; no bit index) parse on MicroLogix devices only.
`AbLegacyFunctionFile.SubElementType` carries the sub-element catalogue (flags → Boolean, words → Int32; unknown
members default to Int32). ⚠️ **Wire-unverified on both transports:** there is no capture and no simulator
coverage; the libplctag path passes the name through and the native transport has no file-type code for them, so
it refuses the tag as `Unsupported` (`BadNotSupported` to the client; see Wire evidence).
members default to Int32). ⚠️ **Neither transport can read them — they author and deploy, but every read and
write answers `BadNotSupported`.** The native transport has no file-type code for them, and libplctag 2.6.0's
`parse_pccc_file_type` has no function-file letters: `RTC` parses as an R file followed by a non-digit, `HSC`/`EII`
fall to its default case, so tag creation fails locally with `PLCTAG_ERR_BAD_PARAM` and nothing reaches the wire.
Until 2026-11-13 the libplctag adapter reported that as a **comms fault** (`BadCommunicationError`, evicted handle,
degraded health, counted toward marking a healthy device down); it now refuses the address before creating a tag
(`LibplctagLegacyTagRuntime.Refusal`), health untouched, the same answer native gives (#592). So this is a
missing capability, not an unverified one: a real-controller read would show nothing new. Supporting them means
a native PCCC encoding for function files (a feature decision); libplctag removal (P6) loses nothing here.
- **Indirect addressing (#247 parse, #646 runtime).** `N7:[N7:0]` (word from another address) and `N[N7:0]:5` (file
from another address) parse, one level deep (the inner address must be direct, and carries the family's octal rule).
At runtime the driver reads the inner address first (same runtime factory, so libplctag and Native alike), requires
@@ -187,8 +193,8 @@ Native routing: SLC500/MicroLogix/PLC-5 are direct; `logixpccc` uses Unconnected
- **Known limits of Native** (why it is opt-in):
- ⚠️ **Real-hardware evidence is one MicroLogix 1400** (Z-33323, 2026-10-09) — see
[Wire evidence](#wire-evidence-native-pccc): S (incl. `S:0`), N, F, B, T, C, R, ST, O, I reads, T/C/R
sub-elements and status bits, and N/F/B-bit writes all correct. **L and A files, function files, SLC 5/05,
PLC-5 and `logixpccc` are unverified.** Opt in per driver after checking it against the real controller.
sub-elements and status bits, and N/F/B-bit writes all correct. **L and A files, SLC 5/05,
PLC-5 and `logixpccc` are unverified; function files are unsupported on both transports.** Opt in per driver after checking it against the real controller.
- ⚠️ **Status-bit writes are refused** — `T4:0.DN`, `T4:0.TT`, `T4:0.EN`, `C5:0.CU`, `C5:0.DN`, `R6:0.EN`
and the rest return **`BadNotSupported`** whatever the tag's authored data type (the refusal keys on the
address); nothing is written to the PLC; health is unchanged. The driver answers the refusal **before it
@@ -255,7 +261,9 @@ such as `O:0/3` is refused ahead of the parent-word read-modify-write) and the r
sent, health unchanged (`LibplctagLegacyTagRuntime.WriteRefusal`, asked through `IAbLegacyTagFactory.WriteRefusal`, the
same plumbing as the native refusal). Those writes never worked on libplctag, so nothing is lost; the native
transport (opt-in) does write `S`/`O`/`I`. T/C status bits libplctag parses itself keep their pre-existing write behaviour (note above).
Not tested on hardware: L and A files (no press has them), function files, PLC-5, SLC, `logixpccc`.
Not tested on hardware: L and A files (no press has them), PLC-5, SLC, `logixpccc`. Function files are not
supported by either transport (refused locally, nothing sent — see the function-file note above), so there is
nothing to test on hardware.
Simulator evidence:
@@ -265,7 +273,8 @@ Simulator evidence:
| N-file write (`N7:5`) | capture `slc500-write-n7` + native `AbLegacyReadSmokeTests` write/read round trip (SLC 500) |
| F-file read (`F8`) | one capture, `slc500-read-f8` (codec parity only; no native F write on a wire) |
| S (incl. `S:0`), B, T, C, R, ST, O, I | **real MicroLogix 1400 (above)**; L and A: none |
| MicroLogix function files (RTC/HSC/...), PLC-5 octal I/O | **none** — parsed only; native refuses function files as Unsupported |
| MicroLogix function files (RTC/HSC/...) | **not supported** — parsed and deployable; both transports refuse them before the wire (`BadNotSupported`, health untouched) |
| PLC-5 octal I/O | **none** — parsed only |
| Bit-within-word write (`B3:0/5`) | `ab_server` SLC500 + MicroLogix, both transports (`AbLegacyBitWriteTests`): the driver RMWs the parent word, only the addressed bit changes (the parent-word read-modify-write is not atomic against ladder writes to the same word). PLC-5 native refuses it (`BadNotSupported`, #571) |
| Indirect addressing (`N7:[N7:0]`) | `ab_server` N-file, both transports (#646) - resolved by the driver, the transport sees the composed address |
| T/C/R sub-elements (`.PRE`/`.ACC`/`.LEN`/`.POS`, status bits) | **real MicroLogix 1400 (above)** |
@@ -273,7 +282,7 @@ Simulator evidence:
### Native known gaps
- ⚠️ **One real controller.** A MicroLogix 1400 (Z-33323) passed reads across S/N/F/B/T/C/R/ST/O/I and N/F/B-bit
writes; SLC 5/05, PLC-5, `logixpccc`, L/A files and function files are unverified. See
writes; SLC 5/05, PLC-5, `logixpccc` and L/A files are unverified; function files are unsupported (both transports). See
[Wire evidence](#wire-evidence-native-pccc).
- **PLC-5 native is N-file reads only.** Every other file type and all PLC-5 writes are refused before the
wire and reach the client as `BadNotSupported` (handle kept, health unchanged; #571 closed). Native is opt-in