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