deploy(#52): DelmiaReceiver child-name fix applied on DEV + QA (Z28061 excluded)

CvdReactor.ProcessRecipeDownload now addresses Children["DelmiaReceiver"] on DEV vd03
and QA vq03/vq04. Redeployed DEV Z28062 + Z28061Sim, QA Z28062-Z28069; Z28061 left
stale on both tiers (shared with another team, no slot agreed). Traced read-only call
on Z28062 (ReadyFlag False): the pre-fix 'DelmiaRecv.ReadyFlag not found' warning is
gone after the fix.

apply.sh: every CLI call passes --url/--username/--password explicitly (an env-only
SCADABRIDGE_URL silently reached DEV), plus SB_EXPECT (refuse unless the expected
instances exist = tier proof) and SB_SKIP (never deploy the listed instances).

Record: docs/deployment/deployment-records/2026-11-15-gate-52-delmiareceiver-fix.md

Claude-Session: https://claude.ai/code/session_01GT67AFKC45MBz1wPZnVbX8
This commit is contained in:
Joseph Doherty
2026-11-15 17:25:37 -05:00
parent 6489c9fc0f
commit 125db03232
2 changed files with 79 additions and 3 deletions
@@ -8,6 +8,10 @@ set -euo pipefail
# SCADABRIDGE_USERNAME=... SCADABRIDGE_PASSWORD=... \
# bash apply.sh <check|apply|rollback> <52|131> [--no-deploy]
#
# SB_SKIP=Z28061,Other optional: instances never deployed by this script (left stale; deploy them later).
# SB_EXPECT=Z28062,... optional: refuse to write unless every listed instance exists on this central —
# proves the URL reached the intended tier (2026-11-15: an env-only URL silently hit DEV).
#
# check READ-ONLY. Prints, per target script, whether the live body is the ORIGINAL (deployed
# 2026-11-12), the FIXED body, or something else, and whether each instance is stale.
# apply Guarded update: refuses unless the live body is byte-identical to original/<script>.cs
@@ -27,6 +31,7 @@ HERE="$(cd "$(dirname "$0")" && pwd)"
REPO="$(cd "$HERE/../../../.." && pwd)"
export SB_CLI="${SB_CLI:-$REPO/src/ZB.MOM.WW.ScadaBridge.CLI/bin/Debug/net10.0/scadabridge}"
export SB_URL="${SCADABRIDGE_URL:?set SCADABRIDGE_URL}" SB_HERE="$HERE"
export SB_SKIP="${SB_SKIP:-}" SB_EXPECT="${SB_EXPECT:-}"
export SB_MODE="${1:?check|apply|rollback}" SB_GATE="${2:?52|131}" SB_NODEPLOY="${3:-}"
: "${SCADABRIDGE_USERNAME:?set SCADABRIDGE_USERNAME}" "${SCADABRIDGE_PASSWORD:?set SCADABRIDGE_PASSWORD}"
@@ -38,8 +43,15 @@ MODE, GATE, NODEPLOY = os.environ["SB_MODE"], os.environ["SB_GATE"], os.environ[
TARGET = {"52": ("CvdReactor", "ProcessRecipeDownload"), "131": ("TestMesMachine", "AlarmStatus")}[GATE]
KEY = f"{TARGET[0]}.{TARGET[1]}"
# Every call names the central AND the credentials explicitly (2026-11-15): with only env vars the CLI fell back
# to its configured default central. The values come from the environment; they are passed to the child process,
# never printed.
AUTH = ["--url", URL, "--username", os.environ["SCADABRIDGE_USERNAME"], "--password", os.environ["SCADABRIDGE_PASSWORD"]]
SKIP = {x.strip() for x in os.environ.get("SB_SKIP", "").split(",") if x.strip()}
EXPECT = {x.strip() for x in os.environ.get("SB_EXPECT", "").split(",") if x.strip()}
def cli(*args, timeout=300):
r = subprocess.run([CLI, *args, "--url", URL, "--format", "json"], capture_output=True, text=True, timeout=timeout)
r = subprocess.run([CLI, *args, *AUTH, "--format", "json"], capture_output=True, text=True, timeout=timeout)
if r.returncode != 0:
raise SystemExit(f"FAILED {' '.join(args[:3])}: {(r.stderr or r.stdout).strip()[:600]}")
return json.loads(r.stdout) if r.stdout.strip() else None
@@ -48,6 +60,13 @@ def body(kind): return open(os.path.join(HERE, kind, KEY + ".cs"), encoding="utf
ORIG, FIXED = body("original"), body("fixed")
META = json.load(open(os.path.join(HERE, "original", KEY + ".meta.json"), encoding="utf-8"))
all_insts = cli("instance", "list")
names = sorted(i["uniqueName"] for i in all_insts)
print(f"{URL}: instances on this central: {', '.join(names)}")
missing = EXPECT - set(names)
if missing:
raise SystemExit(f"REFUSED: expected instance(s) {sorted(missing)} not on {URL} — wrong tier?")
tmpl = next((t for t in cli("template", "list") if t["name"] == TARGET[0] and not t.get("parentTemplateId")), None)
if tmpl is None:
print(f"{URL}: no base template {TARGET[0]} — nothing to do for #{GATE}"); sys.exit(0)
@@ -57,7 +76,7 @@ if script is None:
print(f"{URL}: template {TARGET[0]} has no own script {TARGET[1]}"); sys.exit(0)
live = script.get("code") or ""
state = "ORIGINAL" if live == ORIG else "FIXED" if live == FIXED else "UNKNOWN"
insts = [i for i in cli("instance", "list") if i["templateId"] == tmpl["id"]]
insts = [i for i in all_insts if i["templateId"] == tmpl["id"]]
print(f"{URL}: {KEY} template={tmpl['id']} script={script['id']} live body = {state}")
for i in insts:
d = cli("instance", "diff", "--id", str(i["id"]))
@@ -68,7 +87,7 @@ if MODE == "check":
want, need = (FIXED, "ORIGINAL") if MODE == "apply" else (ORIG, "FIXED")
if live == want:
print(" already in the target state — no script update")
if not any(cli("instance", "diff", "--id", str(i["id"])).get("isStale") for i in insts):
if not any(cli("instance", "diff", "--id", str(i["id"])).get("isStale") for i in insts if i["uniqueName"] not in SKIP):
print(" every instance current — nothing to deploy"); sys.exit(0)
elif state != need:
raise SystemExit(f" REFUSED: live body is {state}, expected {need}. Diff it against {HERE} before touching it.")
@@ -95,6 +114,8 @@ else:
if NODEPLOY:
print(" --no-deploy: instances left stale; deploy them yourself"); sys.exit(0)
for i in insts:
if i["uniqueName"] in SKIP:
print(f" SKIP {i['uniqueName']} (SB_SKIP): left on its current deployment"); continue
r = cli("instance", "deploy", "--id", str(i["id"]))
print(f" deploy {i['uniqueName']}: {json.dumps(r)[:200]}")
PY
@@ -0,0 +1,55 @@
# 2026-11-15: #52 `CvdReactor.ProcessRecipeDownload` child-name fix, DEV vd03 + QA vq03/vq04 (Z28061 excluded)
**Owner go:** 2026-11-15, "yeah" to applying #52 (DEV first, then QA). **Z28061 is excluded on both tiers**: another team uses it and no redeploy slot has been agreed.
**Change:** one line in template `CvdReactor` (id 1), script `ProcessRecipeDownload` (id 4): `Children["DelmiaRecv"]` becomes `Children["DelmiaReceiver"]`. The body is `deploy-prep/2026-11-12-gates-52-131/fixed/CvdReactor.ProcessRecipeDownload.cs`. Every other script field is re-sent from `original/CvdReactor.ProcessRecipeDownload.meta.json` and read back unchanged.
**Scope:** management API only, through the ScadaBridge CLI (built from `main`) run from the Mac.
- No binary, no migration, no service restart, no WinRM. Only the redeployed instance actors restarted.
- Not touched: Z28061 (template change only; its deployment was left alone), every other template, script and instance, OtOpcUa, mxaccessgw, HistorianGateway and Overview.
**Tooling change (`apply.sh`, same commit):** every CLI call now passes `--url`, `--username` and `--password` explicitly. Earlier on 2026-11-15, an env-only `SCADABRIDGE_URL` pointing at QA had silently reached **DEV**, because the CLI fell back to its configured default central. Two optional guards were added:
- `SB_EXPECT=<names>` refuses to run unless the listed instances exist on the central, which proves the tier. The full instance list is printed first.
- `SB_SKIP=<names>` never deploys the listed instances. They are left stale.
## Functional check (read-only)
The call is `flow-debug run-script --instance-id 2 --script ProcessRecipeDownload --params '{}'` on **Z28062**, made only after confirming `DelmiaReceiver.ReadyFlag` is **False / Good**. In that state, the script returns before its `try` block, so nothing is written to the PLC.
- The returned text is the same before and after: `Receiver ready flag not set to true`. That is the correct answer when the real flag is False, so the text alone does not prove the fix.
- The evidence is the trace instead. **Before** the fix, the run logged `WARN runtime GetAttribute: attribute 'DelmiaRecv.ReadyFlag' not found on instance 'Z28062'`. This is the #52 defect: a null child, so the hard-coded text came back regardless of the real flag. **After** the fix, the warning is gone, and the script read the existing `DelmiaReceiver.ReadyFlag`.
- Not exercised: the download path with `ReadyFlag` True. It writes `RecipeDownloadFlag` and the recipe fields to the receiver and waits on `RecipeProcessedFlag`. Running it needs a planned recipe download.
- On QA, **Z28063 has `DelmiaReceiver.ReadyFlag` True**. A call there would take the write path, so it was **not** called. Its first real `DelmiaRecipeDownload` will now take the download path, which it did not before.
## DEV vd03 (`http://wonder-app-vd03.zmr.zimmer.com:8085`, DisableLogin)
| Step | Result |
|---|---|
| Tier proof | Instances: SBTEST01, SBTEST02, Z28061, Z28061Sim, Z28062, ZIPSEN. This is DEV's set |
| `check 52` | Live body **ORIGINAL**. Z28061, Z28061Sim and Z28062 not stale (deployed 2026-10-28) |
| Negative control | The trace logs `DelmiaRecv.ReadyFlag' not found` |
| `apply 52` (`SB_SKIP=Z28061`) | Script 4 updated; metadata read back unchanged. Deployed **Z28061Sim** (deployment 97) and **Z28062** (98). Z28061 skipped |
| `check 52` after | Body **FIXED**. Z28061Sim and Z28062 not stale (22:23:20–21Z). **Z28061 `stale=True`**, as intended |
| Trace after | RouteCall and ScriptRun Delivered, with the same ResultText and **no `not found` warning** |
## QA vq03/vq04 (active central **vq04** `:8085`, login `multi-role`)
**The active central is vq04.** `/health/active` returns vq03 503 and vq04 200. On 2026-11-13 it was vq03. Live flow-debug runs are refused on the standby (`STANDBY_NODE`), so every QA call went to vq04. Reads and writes go through the active node either way.
| Step | Result |
|---|---|
| Safety re-check (22:24Z) | The 8 instances to redeploy: `CycleRunning` False/False on both sides, FurnaceTemp 23–25 °C. All SAFE. Open batches: Z28063 L 29049, Z28065 R 29020, Z28068 L 29081 |
| Tier proof | Instances: WarmCanary, Z28061–Z28069, ZIPSEN. This is QA's set |
| `check 52` | Live body **ORIGINAL**. All 9 CvdReactor instances not stale (deployed 2026-11-06) |
| Negative control | Z28062 trace logs `DelmiaRecv.ReadyFlag' not found` |
| `apply 52` (`SB_SKIP=Z28061`) | Script 4 updated; metadata read back unchanged. Deployed **Z28062–Z28069** (deployments 233–240). Z28061 skipped |
| `check 52` after | Body **FIXED**. Z28062–Z28069 not stale (22:24:33–37Z). **Z28061 `stale=True`** |
| Trace after | Z28062: RouteCall and ScriptRun Delivered, with **no `not found` warning** |
| Post-redeploy | All 8 instances 244/244 attributes Good. `CycleRunning` False. The open batches and current steps are unchanged (Z28063 L 29049/step 2, Z28065 R 29020/step 2, Z28068 L 29081/step 6). `ReadyFlag` values unchanged |
## Follow-up
**Z28061 still runs the old script on both tiers.** It shows `stale=True` and still carries the #52 defect. Redeploy it once the other team agrees a slot. The tracking issue is in Gitea (#52 follow-up). The command is either `instance deploy --id 1` (explicit `--url`), or `apply.sh apply 52` without `SB_SKIP`, which is a no-op for the script and deploys only the stale instances.
## Rollback
Per tier: `SCADABRIDGE_URL=<central> SCADABRIDGE_USERNAME=… SCADABRIDGE_PASSWORD=… SB_SKIP=Z28061 bash apply.sh rollback 52`. It refuses unless the live body is FIXED. It writes the original body back, and the instances redeploy onto it.