fix(drivers): flip runtime tag parsers to strict enum parsing (#457) #465
Reference in New Issue
Block a user
Delete Branch "fix/457-runtime-parsers-strict"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #457 (archreview R2-11 Phase C).
Flips all six equipment-tag parsers (Modbus/S7/AbCip/AbLegacy/TwinCAT/Focas) from lenient to strict enum parsing. A present-but-invalid (typo'd) enum now rejects the tag at the runtime resolver —
TryParsefalse ->EquipmentTagRefResolver.TryResolvefalse -> driver surfacesBadNodeIdUnknown— instead of silently defaulting to a wrong-widthGood.Mechanism: new
TagConfigJson.TryReadEnumStrict<TEnum>(root, name, fallback, out value)— absent => fallback, valid => parsed, invalid => returns false. The six parsers swap theirReadEnumOrDefaultcalls for it (Modbus flips all three enum fields region/dataType/byteOrder; the rest flip dataType). The lenientReadEnumOrDefaultprimitive stays for any future lenient caller.Acceptance item 1 (fleets deploy clean under
Errormode): this is the operator rollout step — a fleet that deploys clean underDeployment:TagConfigValidationMode=Errorhas, by construction, no typo'd enums and is safe on the flip. TheError-mode deploy gate is unchanged and unit-proven (AdminOperationsActorTagConfigGateTests).Regression coverage (item 2):
*EquipmentTagParserStrictnessTestsinverted fromFreeze_typo_*(froze lenient) toTypo_*_rejects_the_tag+Valid_*_still_parses.TagConfigJsonTests.TryReadEnumStrict_rejects_only_invalidmatrix.AbCipEquipmentTagTests.Driver_read_of_a_typod_dataType_ref_surfaces_BadNodeIdUnknowndrives the realAbCipDriver.ReadAsyncthrough resolve->status.Golden parity corpus has no typo'd enums (no-op there). Full solution builds clean; all six driver suites + Core.Abstractions + parity + deploy-gate tests green.