feat(tia): devices from a TIA hardware export (AML), no connector needed #1100

Open
sharang wants to merge 2 commits from feat/tia-aml into main
pull from: feat/tia-aml
Owner

Closes #1097 (part of epic #1095). Do not merge yet: the AML format follows AutomationML's "Automation Project Configuration" recommendation, not yet a real TIA export. Merge after Sharang's demo-project export has been checked against it.

What it does

  • A customer uploads TIA Portal's own hardware export ("CAx-Daten exportieren", .aml) as a PLC project. A file named *.aml is read as PlcFormat::TiaAml whatever format was picked, so the dashboard needs no new option.
  • Reader (pipeline/plc/aml.rs):
    • CAEX 2.15 and 3.0, elements matched by local name;
    • decoded with the shared reader (BOM / UTF-16); 64 MiB cap; DTDs refused;
    • each InternalElement with a TypeIdentifier of OrderNumber:… or GSD:…, its FirmwareVersion winning over the identifier's version, labelled station / name;
    • BuiltIn is not filtered blind; decide from the real export.
  • Upload:
    • refused with 422/413 and a code (not_aml, no_devices, too_large);
    • devices kept on the artifact, the same model as #1096;
    • a new export replaces only an earlier one of the same file name, so stations exported one by one stay side by side.
  • Scan: notes devices it cannot match (DevicesUnmatched).
  • Dashboard: TIA refusals get their own wording (tia_refused: marker). Before, any 422 was worded as a supplier-SBOM refusal.
  • Docs: "Siemens TIA Portal hardware export (AML)" in docs/guide/plc.md, with a warning that it isn't yet checked against a real export.

Fixes found while rendering 56 devices locally

  1. The Steuerungen page saved exported devices as hand-entered ones. Any add, firmware change or remove wrote its whole list, which since #1096 includes exported devices, into target.devices. This is live on stage since #1096, not on prod.
    • DeviceCheck now carries exported_in.
    • The page saves only entered devices.
    • An exported device shows "Aus dem TIA-Export ; ändert sich mit dem nächsten Export." instead of the edit buttons.
  2. Upper-case X: it is part of real order numbers (6AV2124-0GC01-0AX0), so all HMIs were dropped as "wildcards". Now only a lower-case x (-0Axx) marks a catalog wildcard.

Checked

  • Unit tests: AML parsing (both CAEX versions, refusals), the identifier with an upper-case X, device checks.
  • Integration test: upload refusal, format by name, same-name replacement, two stations side by side, the device list with exported_in.
  • New tests/tia_scan.rs: a real scan of a target with a TIA export and an AML. Both exports' devices land in the SBOM as siemens-device, and the run notes the unmatched GSD device, the unanalysed block and the protected block. This also covers #1096's scan path, which had no test.
  • Local render with a 3-station AML (56 items):
    • 55 matched; the rail scrolls sideways;
    • the exported device shows its source line and no buttons;
    • adding one controller by hand saves only that one.
  • Clippy with CI flags is clean (core, agent, dashboard server and web); fmt is clean.

Open (for #1098/#1099, mockup): at 50+ modules the rail is long. Grouping by station belongs to the states and fleet mockups.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9

Closes #1097 (part of epic #1095). **Do not merge yet:** the AML format follows AutomationML's "Automation Project Configuration" recommendation, not yet a real TIA export. Merge after Sharang's demo-project export has been checked against it. **What it does** - A customer uploads TIA Portal's own hardware export ("CAx-Daten exportieren", `.aml`) as a PLC project. A file named `*.aml` is read as `PlcFormat::TiaAml` whatever format was picked, so the dashboard needs no new option. - Reader (`pipeline/plc/aml.rs`): - CAEX 2.15 and 3.0, elements matched by local name; - decoded with the shared reader (BOM / UTF-16); 64 MiB cap; DTDs refused; - each `InternalElement` with a `TypeIdentifier` of `OrderNumber:…` or `GSD:…`, its `FirmwareVersion` winning over the identifier's version, labelled `station / name`; - `BuiltIn` is not filtered blind; decide from the real export. - Upload: - refused with 422/413 and a code (`not_aml`, `no_devices`, `too_large`); - devices kept on the artifact, the same model as #1096; - a new export replaces only an earlier one **of the same file name**, so stations exported one by one stay side by side. - Scan: notes devices it cannot match (`DevicesUnmatched`). - Dashboard: TIA refusals get their own wording (`tia_refused:` marker). Before, any 422 was worded as a supplier-SBOM refusal. - Docs: "Siemens TIA Portal hardware export (AML)" in docs/guide/plc.md, with a warning that it isn't yet checked against a real export. **Fixes found while rendering 56 devices locally** 1. **The Steuerungen page saved exported devices as hand-entered ones.** Any add, firmware change or remove wrote its whole list, which since #1096 includes exported devices, into `target.devices`. This is live on stage since #1096, not on prod. - `DeviceCheck` now carries `exported_in`. - The page saves only entered devices. - An exported device shows "Aus dem TIA-Export <file>; ändert sich mit dem nächsten Export." instead of the edit buttons. 2. **Upper-case X:** it is part of real order numbers (`6AV2124-0GC01-0AX0`), so all HMIs were dropped as "wildcards". Now only a lower-case `x` (`-0Axx`) marks a catalog wildcard. **Checked** - **Unit tests:** AML parsing (both CAEX versions, refusals), the identifier with an upper-case X, device checks. - **Integration test:** upload refusal, format by name, same-name replacement, two stations side by side, the device list with `exported_in`. - **New `tests/tia_scan.rs`:** a real scan of a target with a TIA export and an AML. Both exports' devices land in the SBOM as `siemens-device`, and the run notes the unmatched GSD device, the unanalysed block and the protected block. This also covers #1096's scan path, which had no test. - **Local render** with a 3-station AML (56 items): - 55 matched; the rail scrolls sideways; - the exported device shows its source line and no buttons; - adding one controller by hand saves only that one. - Clippy with CI flags is clean (core, agent, dashboard server and web); fmt is clean. **Open (for #1098/#1099, mockup):** at 50+ modules the rail is long. Grouping by station belongs to the states and fleet mockups. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang added 2 commits 2026-12-01 14:51:34 +00:00
A customer uploads TIA Portal's own hardware export ("CAx-Daten
exportieren", .aml) as a PLC project; a file named *.aml is read as one
whatever format was picked (#1097).

- The CAEX file is read after AutomationML's "Automation Project
  Configuration" recommendation: device items with a TypeIdentifier
  (OrderNumber:… or GSD:…) and FirmwareVersion, labelled with their
  station. Not yet checked against a real TIA export.
- Refused on upload with a code (not_aml, no_devices, too_large); the
  dashboard words TIA refusals on their own, no longer as SBOM ones.
- A new export replaces only an earlier one of the same file name, so
  stations exported one by one stay side by side.
- The scan notes devices it cannot match.

Fixes on the way:
- an upper-case X is part of real order numbers (6AV2124-0GC01-0AX0);
  only a lower-case x marks a catalog wildcard (HMIs were dropped);
- the Steuerungen page saved its whole list, exported devices included,
  into the hand-entered ones on any edit; the device list now says which
  export a device comes from, and only entered devices are saved or
  edited.

Tests: AML parsing, upload refusal/replacement/devices, and a scan-level
test of a TIA export plus an AML (SBOM entries and run notes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
docs(plc): the TIA hardware export (AML) upload
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 5m33s
CI / Check (pull_request) Successful in 23m20s
5c695fcf8f
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang force-pushed feat/tia-aml from 9cf0e493ad to 5c695fcf8f 2026-12-01 14:51:34 +00:00 Compare
All checks were successful
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 5m33s
CI / Check (pull_request) Successful in 23m20s
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/tia-aml:feat/tia-aml
git checkout feat/tia-aml
Sign in to join this conversation.