feat(loader): company overlay as VirtualTags mirroring the galaxy mirror + verify --require-good

This commit is contained in:
Joseph Doherty
2026-06-07 04:59:51 -04:00
parent dce6f83488
commit 5655b75fe6
2 changed files with 162 additions and 58 deletions
+26 -12
View File
@@ -113,22 +113,36 @@ Defaults target docker-dev; override via flags or env:
Besides the galaxy-native mirror, the tool can load the **Northwind company
shape** (`filling / line-1 / rinser-01 / speed-rpm`) as a second, **Equipment**-kind
namespace (`nw-uns`, in cluster `MAIN`) from `../company-uns.json`. This needs
OtOpcUa `master` ≥ the Equipment-namespace structure milestone
(`febe462…9a67ebc`), which materialises Equipment `Tag`/`VirtualTag` rows on
deploy and added a **headless deploy** endpoint.
namespace (`nw-uns`, in cluster `MAIN`) from `../company-uns.json`. Each company
signal is a **VirtualTag** (+ a `Script`) whose script simply mirrors the live
galaxy-mirror tag for that signal:
```csharp
return ctx.GetTag("TestMachine_001.TestDouble").Value;
```
so the company shape carries live **VALUES** driven off the same Galaxy source — no
driver, no `BadWaitingForInitialData` once the galaxy mirror is up. The `ctx.GetTag`
literal is the signal's `source.fullTagReference`; the engine's `DependencyExtractor`
harvests it and subscribes the VirtualTag to that galaxy-mirror tag. This needs
OtOpcUa `master` ≥ the Equipment-namespace VirtualTag materialisation milestone (WS-3),
which materialises `VirtualTag`/`Script` rows on deploy and added the **headless
deploy** endpoint.
```bash
./.venv/bin/python otopcua_uns.py populate-equipment # 3 areas / 8 lines / 40 equipment / 1036 signals
./.venv/bin/python otopcua_uns.py populate-equipment # 3 areas / 8 lines / 40 equipment / 1036 VirtualTags
curl -s -X POST http://localhost:9200/api/deployments -H 'X-Api-Key: docker-dev-deploy-key' # headless deploy
./.venv/bin/python otopcua_uns.py verify-equipment --expect 1036 # browse the company tree (nw-area-* scope)
./.venv/bin/python otopcua_uns.py verify-equipment --expect 1036 --require-good 1036 --wait # structure + live values
```
UNS folders carry the friendly **DisplayName** (`filling`); the BrowseName/NodeId
stay the stable logical Id (`nw-area-filling`) — standard OPC UA. **Structure-only:**
the company leaves materialise as `BadWaitingForInitialData` — live **values** in
the company shape are the next OtOpcUa milestone (driver/VirtualTag source), tracked
in `OtOpcUa/docs/plans/2026-06-06-equipment-namespace-materialization-scope.md` (WS-3).
The galaxy-native mirror (`populate`) still carries live values.
stay the stable logical Id (`nw-area-filling`) — standard OPC UA. **No driver:** the
company signals are VirtualTags (which link to Equipment + a Script, not a driver); a
placeholder `nw-uns-modbus` driver is kept only because an Equipment namespace is
expected to have one, but no `Tag` binds to it. `verify-equipment --require-good N`
reads each leaf's value and asserts at least N are Good (default `0` = structure-only,
back-compat); `--wait` polls until the deploy + change-triggered evaluations land.
Tracked in `OtOpcUa/docs/plans/2026-06-06-equipment-namespace-materialization-scope.md` (WS-3).
`clean` removes both the mirror tags and the company overlay.
`clean` removes both the mirror tags and the company overlay (the `VirtualTag` +
`Script` rows, in FK-safe order, plus the namespace/driver/equipment/areas/lines).