deploy(prod): CVD reactor content (Phase 7) — QA→PROD templates, API methods, BTDB, Z28061–Z28069 on site-par; mxgw SQL login + PAR NewJersey alarms

Plan docs/plans/2026-11-22-prod-cvd-content-copy.md with the QA findings, the hierarchical-name
binding remap (QA and PROD reuse Galaxy suffixes for different machines), BT checks, the run
status and the QA reactor disable. Generated inputs under docs/deploy/2026-11-22-prod-cvd-content/
(bindings, alarm-source overrides, mapping, QA export, BT preflight SQL, helper scripts; no secrets).
PROD plan §0.1a rows for the content run and the mxgw changes.

Claude-Session: https://claude.ai/code/session_01GT67AD5mc2BnaaAfY3hqqQ
This commit is contained in:
Joseph Doherty
2026-11-22 12:06:04 -05:00
parent a2c3a2157a
commit 1ab2bca41d
26 changed files with 2868 additions and 0 deletions
@@ -39,6 +39,8 @@ The Sunday run was brought forward by the owner; the soak gate (§0.2 item 3) wa
| Secrets | Keychain `zb-prod/{sb-jwt-signing-key,sb-inbound-pepper,mxgw-pepper,sb-site-par-grpc-psk,sb-site-par-localdb-key,sql-wwpdsbrw}`; on-box value dirs deleted except vp03 `_values\seed\site-psk.txt` (for the retry) |
| **Later 2026-11-20** | #59 indexes done by DBA (verified 104 = QA) → central store seeded, **centrals Running** (vp03 active, vp04 standby, Automatic); **Site `site-par` id 1** online (par-vp03 primary); mxgw key `scadabridge-prod` (Keychain `zb-prod/mxgw-apikey-scadabridge`) shared vp03→vp04; **DataConnection id 1 `MxGateway`** vp03 primary / vp04 backup, Connected; **Overview** on vp03/vp04 :5320 (5 Up, mxgw vp04 Down #60, PAR mxgw unreachable). Records: ScadaBridge cluster-config record, scadaproj `0a3c37a` |
| **site-app 22:35Z** | Second site **`site-app` / APP (Site id 2)** co-located on app-vp03 (node-a, active) / vp04 (node-b, standby), owner request; Akka 8082, site gRPC 8086, health 8084 (central keeps 8081/8083/8085); PSK `sb-grpc-psk-site-app` in the central store; **DataConnection id 2 `MxGateway`** → vp03:5120 primary / vp04:5120 backup, Connected. Overview shows site-par + site-app. Record ScadaBridge `2026-11-20-prod-site-app-colocated.md` |
| **Phase 7 CVD content 2026-11-22 16:37Z** | Templates 1–11 (CvdReactor 5), db-connection 1 `BTDB`, API methods 1–7, area 1 `CVDAisle_1`, instances Z28061–Z28069 (ids 1–9) deployed + Enabled on site-par, 244/244 Good each; `deploy artifacts --site-id 1` done 16:37:47Z; keys `MES_Key` + `delmia-notifier` (Keychain `zb-prod/sb-inbound-*`), smoke PASS on vp03 and standby vp04. Cutover (step 10) pending owner/teams. Record ScadaBridge `2026-11-22-prod-cvd-reactors-content.md` |
| **mxgw 2026-11-22 16:54–17:02Z** | All four gateways' Galaxy connection is now the SQL login `wwpdgdbro` (`db_datareader` on ZB), so `/health/ready` is 200 on all four and **#60 is no longer needed**. PAR alarms are on: `\\WONDER-PAR-VP0x\Galaxy!NewJersey`, which includes the `CVDAisle_1` and `Gas_Service` sub-areas. 7 active `HeartbeatTimeoutAlarm`s are mirrored on their own instances. vp03/vp04 keep `Galaxy!ControlSystem`, set outside this run. Worker CPU on PAR ~0%. Record: mxaccessgw `docs/deploy/2026-11-22-prod-par-e74918cc.md` |
| Not done | OTel collector; LDAP refusal probes (bogus / zero-role); alarm area; Phase 7 content; MxGateway connection re-pointed to par-vp03/par-vp04:5120 at 22:22Z (owner); Connected since the 2026-11-22 PAR mxgw install. **2026-11-22 12:31Z: every service on app-vp03/04 was restarted externally** (cause unknown, back at 12:34:30Z). An unreferenced connection is not rebuilt on site boot by design, so after any restart run `deploy artifacts --site-id 2` (site-app; done 12:43Z) until instances exist |
### 0.2 Go / no-go before anything runs on Sunday
@@ -0,0 +1,376 @@
# PROD content: copy the CVD reactor templates and inbound API methods from QA, and configure Z28061–Z28069 (plan, 2026-11-22)
Owner, 2026-11-22: "investigate the templates in use on QA scadabridge. how the tags are mapped, etc. Then generate a plan
on how to copy them to prod, copy the api methods used too, and configure the machine in the attached screenshot. note
the template instances should run on the par server cluster, the api methods can run on the central server."
The screenshot shows Galaxy `NAM / NewJersey / CVDAisle_1 / Z28061…Z28069`.
This is Phase 7 of [`2026-11-19-prod-scadabridge-mxgw-install.md`](2026-11-19-prod-scadabridge-mxgw-install.md).
**Status 2026-11-22 16:50Z: steps 0–9 DONE on PROD** (record ScadaBridge `docs/deployment/deployment-records/2026-11-22-prod-cvd-reactors-content.md`). Step 10 (cutover) is with the owner and the MES/Delmia teams. The keys are `MES_Key` with QA's grants minus IpsenMESMoveIn (so DelmiaRecipeDownload is included), and `delmia-notifier`. Delmia sends the plain `MachineCode` (`Z28063`).
Before the run, everything was read-only:
- the QA management API (lists, `get`, `bundle export`, audit query);
- QA Galaxy `ZB` over SQL as NAM\dohertj2;
- PROD Galaxy browse through vp03's gateway with the `scadabridge-prod` key (`metadata:read`);
- `bundle preview` on PROD, which does not apply anything.
The generated inputs are in [`../deploy/2026-11-22-prod-cvd-content/`](../deploy/2026-11-22-prod-cvd-content/).
## 0. Run status (2026-11-22, owner: "start the plan but wait to deploy to the par sites")
Steps 0–6 were done on the PROD central through the management API. **Nothing has been deployed to any site:**
`deploy status` shows 0 deployments, and both sites' `artifactsDeployedAt` are unchanged. Run log:
scratchpad `run/run-log.md`.
| Step | Result | IDs |
|---|---|---|
| 0 BT re-check | 9 machines + `CVD_Reactors` exist, no conflicts | n/a |
| 1 Mapping | Galaxy re-read: 108 objects, identical to `mapping.md` | n/a |
| 2 Templates | 11 imported (`--on-conflict skip`, 0 blockers) | ids 1–11; **CvdReactor = 5** |
| 3 `BTDB` db-connection | created; **`deploy artifacts` held** | id 1 |
| 4 API methods | 7 created; identical to the QA JSON | 1 MesMoveIn, 2 MesMoveOut, 3 DelmiaRecipeDownload, 4 SimpleAlarmStatusRequest, 5 MesSampleData, 6 MesIsMoveInReady, 7 MesIsMoveOutReady |
| 5 Area | `CVDAisle_1` on site-par | area 1 |
| 6 Instances | created with 244 bindings (connection 1) and 7 alarm-source overrides each; **Disabled, not deployed** | Z28063=1, Z28061=2, Z28062=3, Z28064=4, Z28065=5, Z28066=6, Z28067=7, Z28068=8, Z28069=9 |
**Held, waiting on the owner's go:**
- `deploy artifacts --site-id 1`;
- deploy and enable of the instances (steps 6/7);
- API keys (step 8);
- smoke test (step 9);
- cutover (step 10).
**QA reactors disabled 2026-11-22 16:38Z** (owner: "disable the machines in qa"):
- `instance disable` on QA ids 1, 2, 9, 11, 12, 13, 10, 14, 15 (Z28061–Z28069) all returned success; `instance list`
shows state 2 (Disabled) for all nine.
- The QA site no longer runs them: a `debug snapshot` of Z28063 returns `instanceNotFound`.
- WarmCanary (still enabled) and ZIPSEN (already disabled) were not touched.
- The last MES call to QA was at 2026-11-19 18:26Z. From now on, MES/Delmia calls to QA for these machines fail until
the callers move to PROD.
- To undo: `instance enable` + `deploy instance` for those ids on QA.
Notes from the run:
- `template validate --id 5` reports 3 errors: alarms `Left/RightMTALockout` and `MantleTempHigh` reference
`*ReactorSide.MTA_Lockout`/`MantleTemp`, which it calls "not in the flattened configuration". **QA's CvdReactor gives
the same 3 errors, yet QA deployed Z28063 successfully on 2026-11-15**, after those alarms were created (09-30 and
10-22). So this looks like a false positive in `template validate` for members of composed, derived templates; it is
not a deploy blocker. Watch the first PROD deploy anyway.
- QA's `RightMESReceiver` template is missing 14 inherited attribute rows and 2 inherited scripts. PROD's copy (id 9)
is complete. This is a QA-side defect only.
## 1. What QA runs (findings)
### 1.1 Templates (QA ScadaBridge `wonder-app-vq03:8085`, site `site-a` id 2, area `Aisle001`)
| Template | Role | Members |
|---|---|---|
| `CvdReactor` (id 1) | The machine. One instance per reactor | 16 attributes (machine UDAs: `ChlorineFlow`, `HydrogenFlow`, `TrunkPressure`, `Heartbeat*`, `LeakTest*`, `MachineCode/ID/Description`, …); 3 computed alarms; 8 scripts; 7 native alarm sources; 5 compositions |
| ↳ `LeftMESReceiver` / `RightMESReceiver` | Derived from `MESReceiver` (id 3) | 26 attributes each: `MoveIn*` and `MoveOut*` handshake tags plus `ScanStateCmd`. The base carries the `MoveIn`/`MoveOut` scripts |
| ↳ `LeftReactorSide` / `RightReactorSide` | Derived from `ReactorSide` (id 7, "Galaxy `$Reactor_Side`") | 60 attributes plus composed `LeakTest` (23 attributes) |
| ↳ `DelmiaReceiver` | Derived from `DelmiaReceiver` (id 12) | 10 attributes: `ReadyFlag`, `RecipeDownloadFlag`, `RecipeProcessedFlag`, `RecipeProcessResult[Text]`, `DownloadPath`, `WorkOrderNumber`, `PartNumber`, `JobStepNumber`, `Username` |
Not copied, because they are QA test content: `IpsenSim` + its `MESReceiver` (instance `ZIPSEN`), `WarmCanary` (the OtOpcUa
Warm monitor), and the standalone `LeakTest` base, which comes along anyway as a dependency.
**Scripts on `CvdReactor`.** All of them are `Call`-triggered: there are no timers and no value-change triggers.
- `MesMoveIn`, `MesMoveOut`, `MesIsMoveInReady`, `MesIsMoveOutReady` and `MesSampleData` parse
`<SAPID>_A|_B[_LT]` and pick `Children[side+"MESReceiver"]`.
- `ProcessRecipeDownload` uses `Children["DelmiaReceiver"]`.
- `AlarmStatus` is a stub that returns an empty list.
- `IpsenMoveIn` is legacy.
- `MesMoveOut` and `MesSampleData` also read BTDB on the site (`Database.Connection("BTDB")`, best-effort cycle data).
The computed alarms (`MantleTempHigh`, `Left/RightMTALockout`) only read values. **So a deployed instance is passive.**
It reads tags and evaluates alarms, and writes nothing to the Galaxy until an inbound API call reaches it.
### 1.2 Tag mapping
Every template attribute's data-source reference is just its own name (e.g. `ChlorineFlow`). **Every Galaxy address
comes from a per-instance connection binding** (`dataSourceReferenceOverride`) on data connection 1 `MxGateway`. The
Galaxy shape is the same in both galaxies:
```
Z2806x ($CVDReactor) → instance root attributes Z2806x.<attr>
├─ DelmiaReceiver (DelmiaReceiver_0NN) → DelmiaReceiver.<attr> DelmiaReceiver_0NN.<attr>
├─ Left ($Reactor_Side, Left_0NN) → LeftReactorSide.<attr> Left_0NN.<attr>
│ ├─ LeakTest (LeakTest_0NN) → LeftReactorSide.LeakTest.<attr> Left_0NN.LeakTest.<attr>
│ ├─ MESReceiver (MESReceiver_0NN) → LeftMESReceiver.<attr> MESReceiver_0NN.<attr>
│ ├─ Setpoints, TableAlarms → (not bound; TableAlarms feeds a native alarm source)
└─ Right (same as Left)
```
There are 244 bindings per machine: 16 root, 2×26 MES, 2×83 side (including LeakTest), and 10 Delmia.
Native alarm sources mirror Galaxy alarms by object prefix:
- `ReactorAlarms` = `Z2806x.`;
- `Left/RightSideAlarms` = `Left_0NN.`;
- `Left/RightLeakTestAlarms` = `LeakTest_0NN.`;
- `Left/RightTableAlarms` = `TableAlarms_0NN.`.
### 1.3 ⚠ PROD reuses the same tag names for different machines
QA's and PROD's Galaxies number their contained objects differently, and the numbers collide. For example:
- QA `Left_001` is Z28061's left side; PROD `Left_001` is **Z28065**'s;
- QA `MESReceiver_023` is Z28061-Left; on PROD it is Z28061-Left by coincidence, but `MESReceiver_025` is Z28062-Left on
QA and Z28069-Left on PROD.
**If QA's bindings were copied unchanged, every PROD instance would read and write another reactor's tags, with
Good quality and no error.** For that reason no instance or binding is carried over from QA. The PROD bindings were
generated by **hierarchical name** instead:
1. resolve QA `tag` → QA `Z2806x.Left.LeakTest`;
2. look up the PROD object with the same hierarchical name;
3. keep QA's reference style (`Left_0NN.LeakTest.<attr>`).
Every one of the 9×244 attributes was checked against the PROD object's attribute list; all of them exist. PROD
objects (read 2026-11-22 from the vp03 gateway):
| Instance | Left | Right | Left LeakTest | Right LeakTest | Left MESReceiver | Right MESReceiver | DelmiaReceiver | Left TableAlarms | Right TableAlarms |
|---|---|---|---|---|---|---|---|---|---|
| Z28061 | Left_005 | Right_005 | LeakTest_009 | LeakTest_010 | MESReceiver_023 | MESReceiver_024 | DelmiaReceiver_043 | TableAlarms_009 | TableAlarms_010 |
| Z28062 | Left_004 | Right_004 | LeakTest_007 | LeakTest_008 | MESReceiver_021 | MESReceiver_022 | DelmiaReceiver_042 | TableAlarms_007 | TableAlarms_008 |
| Z28063 | Left_003 | Right_003 | LeakTest_005 | LeakTest_006 | MESReceiver_019 | MESReceiver_020 | DelmiaReceiver_041 | TableAlarms_005 | TableAlarms_006 |
| Z28064 | Left_002 | Right_002 | LeakTest_003 | LeakTest_004 | MESReceiver_017 | MESReceiver_018 | DelmiaReceiver_040 | TableAlarms_003 | TableAlarms_004 |
| Z28065 | Left_001 | Right_001 | LeakTest_001 | LeakTest_002 | MESReceiver_015 | MESReceiver_016 | DelmiaReceiver_039 | TableAlarms_001 | TableAlarms_002 |
| Z28066 | Left_009 | Right_009 | LeakTest_017 | LeakTest_018 | MESReceiver_031 | MESReceiver_032 | DelmiaReceiver_047 | TableAlarms_017 | TableAlarms_018 |
| Z28067 | Left_008 | Right_008 | LeakTest_015 | LeakTest_016 | MESReceiver_029 | MESReceiver_030 | DelmiaReceiver_046 | TableAlarms_015 | TableAlarms_016 |
| Z28068 | Left_007 | Right_007 | LeakTest_013 | LeakTest_014 | MESReceiver_027 | MESReceiver_028 | DelmiaReceiver_045 | TableAlarms_013 | TableAlarms_014 |
| Z28069 | Left_006 | Right_006 | LeakTest_011 | LeakTest_012 | MESReceiver_025 | MESReceiver_026 | DelmiaReceiver_044 | TableAlarms_011 | TableAlarms_012 |
Re-run the generator before applying if the PROD Galaxy is redeployed in the meantime. Contained objects get
renumbered when they are recreated.
### 1.4 QA defects found; not copied, reported only
- **Z28061 and Z28062 carry 38 stale bindings each**, from DEV-era module names (`DelmiaRecv`,
`Left/RightDelmiaReceiver`, `*.DelmiaJobStep`, `*.PID_AlarmString`, `*.LeakTest.MESMoveIn/Out`). They point at
another machine's objects (Z28061 → Z28062's sides; Z28062 → Z28069's) and at attributes that don't exist in either
Galaxy. They are harmless, but they are noise.
- **The template's native alarm sources are hard-coded to Z28061-era QA objects**: `Z28061.`, `Left_001.`, and
`LeakTest_002.` for both LeakTest sources. **Z28063–Z28069 have no overrides, so on QA they mirror Z28061's alarms.**
Z28062's overrides are also off by one (`LeakTest_005/006`, `TableAlarms_005/006`; its real objects are
`LeakTest_004/003` and `TableAlarms_004/003`).
- `MantleTempHigh` watches only `RightReactorSide.MantleTemp` and fires on equality with `"600"`, not on ≥ 600.
It is copied as is; the owner should decide whether that is intended.
### 1.5 Inbound API methods (central)
Inbound methods always run on the central. Each one looks up `SELECT TOP 1 Code FROM dbo.Machine WHERE SAPID=@s` on
db-connection `BTDB`, then `Route.To(<Code>)` to the instance on whichever site hosts it, here site-par.
QA inbound traffic in the last 30 days (`audit query --channel ApiInbound`):
| Method | Calls (last) | Copy? |
|---|---|---|
| `MesMoveIn` | 103 by `MES_Key` (11-19) | yes |
| `MesMoveOut` | 96 by `MES_Key` (11-19) | yes |
| `SimpleAlarmStatusRequest` | 202 by `MES_Key` (11-19) | yes (returns an empty list today; `AlarmStatus` is a stub) |
| `MesIsMoveInReady` / `MesIsMoveOutReady` | test key only | yes: read-only, and used as the PROD smoke test |
| `DelmiaRecipeDownload` | none | yes: the Delmia path. PROD Delmia caller is `dnc-app-vp01` |
| `MesSampleData` | none | yes (owner may drop it) |
| `IpsenMESMoveIn` | none | **no** (recommended): legacy, superseded by `MesMoveIn`, routes to the legacy `IpsenMoveIn` script |
### 1.6 BTDB records (QA BT `wondersqlqa` = WONDER-SQL-VQ03, DB `BT`, read 2026-11-22)
`MesMoveIn` and the other methods resolve `SAPID → dbo.Machine.Code`, and `Code` must equal the ScadaBridge instance
name. The reactors' own Galaxy scripts also open batches in BT by machine code (`StartMachineBatch` and the rest).
So PROD BT needs the same records before any machine is used.
QA has one group and nine machines, and no `MachineAlarm` rows for them:
| MachineGroup | Name | Description | Parent | Members |
|---|---|---|---|---|
| `CVD_Reactors` | CVD Reactors | CVD Reactors in Parsippany, NJ | none | Z28061–Z28069 |
| Code | Name | ZTag | SAPID | Description |
|---|---|---|---|---|
| Z28061 | T5 | Z28061 | 103559 | Z28061 Table 5 |
| Z28062 | T4 | Z28062 | 103563 | CVD Reactors in Parsippany, NJ |
| Z28063 | T3 | Z28063 | 103564 | 〃 |
| Z28064 | T2 | Z28064 | 103565 | 〃 |
| Z28065 | T1 | Z28065 | 103566 | 〃 |
| Z28066 | T9 | Z28066 | 103567 | 〃 |
| Z28067 | T8 | Z28067 | 103568 | 〃 |
| Z28068 | T7 | Z28068 | 103569 | 〃 |
| Z28069 | T6 | Z28069 | 103570 | Z28069 Table 6 |
Common to all nine: TimeZone `Eastern Standard Time`, `MultipleBatch`/`MultipleCycle` 0, Active 1, `OtherData` `{}`.
`Name` is the table number. The two descriptions that differ (Z28061, Z28069) are copied as they are.
MES sends `<SAPID>_A|_B[_LT]`, e.g. `103564_A`. The inbound method uses the leading digits for the lookup, and the
machine script uses the suffix to pick the side.
**PROD BT already has these records (checked 2026-11-22).**
- **Database:** PROD BT is `wondersqlpd` = WONDER-SQL-VP03, DB `BT`. The SQL login `wonderapp` (from `~/.zshenv`,
`HISTORIAN_SQL_USER`/`_PASSWORD`) works there with `db_datareader` + `db_datawriter`, INSERT on
`Machine`/`MachineGroup`/`MachineGroupMembership`, and SELECT on `Runtime.dbo.Timezone`. NAM\dohertj2 and
NAM\adm_dohertj2 cannot log in.
- **Who created them:** marting4, on 2026-11-21 at 04:03Z: group `CVD_Reactors` (id 20) with all nine machines
(MachineID 119–127) as members.
- **Match with QA:** every field is identical to QA (Code, Name, ZTag, SAPID, Description, TimeZone, flags, Active,
OtherData, group membership, and no `MachineAlarm` rows). There are no batches yet.
- **Schema difference:** PROD BT's `MachineGroup` predates the DARS sprint-1 schema and has **no
`ParentMachineGroupID`** column. The script was corrected so it doesn't name that column.
[`../deploy/2026-11-22-prod-cvd-content/btdb/prod-bt-cvd-machines.sql`](../deploy/2026-11-22-prod-cvd-content/btdb/prod-bt-cvd-machines.sql)
is kept as a re-check:
- **Section 1** is a read-only preflight. It lists the server and database, rows that already exist, and conflicts:
a Code with a different SAPID or ZTag, a SAPID or ZTag used by another machine, or a time zone missing from
`Runtime.dbo.Timezone`.
- **Section 2** sits behind a `RETURN` guard. It inserts only what is missing, in one transaction, never updates or
deletes, and `THROW`s on any conflict.
- **Result on 2026-11-22:** section 1 was run as `wonderapp` against PROD BT and QA BT, and the transaction was rolled
back. Both show only "exists" rows (9 machines + the group) and no conflicts.
- **No insert is needed.** The BTDB Manager's config import was not usable anyway: it writes only into the BT
database it is connected to, which is DEV.
### 1.7 What PROD has today
PROD (`wonder-app-vp03:8085`) holds no templates, instances, API methods, db-connections, API keys or areas.
Sites:
- `site-par` **id 1** on par-vp03/04; data connection **id 1 `MxGateway`** → par-vp03:5120 / par-vp04:5120, Connected;
- `site-app` id 2 on the app boxes, connection id 2. **Not used here.**
### 1.8 The `BTDB` db-connection on QA, and what PROD gets
QA ScadaBridge has one db-connection, **`BTDB` (id 1)**. Its connection string is encrypted at rest. It was decrypted
on the Mac on 2026-11-22 from the QA config DB (the key ring is stored unencrypted there) and read with the password
redacted:
```
QA: Server=wondersqlqa.zmr.zimmer.com;Database=BT;User Id=wonderapp;Password=***;TrustServerCertificate=True;MultiSubnetFailover=True
PROD: Server=wondersqlpd.zmr.zimmer.com;Database=BT;User Id=wonderapp;Password=***;TrustServerCertificate=True;MultiSubnetFailover=True
```
- **Login:** `wonderapp` on PROD BT is proven (§1.6).
- **Encryption:** no `Encrypt` keyword is given. Microsoft.Data.SqlClient then defaults to encrypting, and
`TrustServerCertificate=True` skips the CA check, exactly as on QA.
- **Failover:** `MultiSubnetFailover=True` is required because `wondersqlpd` is an AG listener.
- **Name:** the connection must be named **`BTDB`**. Every inbound method and both site scripts address it by that
name (`Database.QuerySingleAsync("BTDB", …)` and `Database.Connection("BTDB")`).
- **Helper:** [`apply-btdb-connection.sh`](../deploy/2026-11-22-prod-cvd-content/apply-btdb-connection.sh) builds the
string in a 0600 temp file and passes it with `--connection-string-file`, so the password never appears on argv or
in the repo.
## 2. Import path, tested with `bundle preview` on PROD
- **Templates:** `bundle export --templates CvdReactor --include-dependencies` on QA gives 11 templates. Previewed on
PROD: **11 adds, 0 blockers**, no site or connection mappings, no QA hostnames. The bundle is stored at
`../deploy/2026-11-22-prod-cvd-content/qa-export/cvdreactor-templates.scadabundle`
(sha256 `6dcdc453…235e3`). The connection name `MxGateway` in the native alarm sources matches PROD.
- **API methods:** the bundle **is blocked**. Every method gets a blocker on `System` (from `System.Func<…>`), and
`SimpleAlarmStatusRequest` also gets one on `Array` (`Array.Empty`). The import reference scanner reads those as
missing SharedScripts or ExternalSystems. This is a false positive in ScadaBridge (issue to be filed). The workaround
is to create the methods with `api-method create`, using the definitions exported to
`qa-export/api-methods.json`. Those definitions hold scripts and schemas only; there are no keys in them.
- **Instances, bindings, API keys and the db-connection are created on PROD directly.** They are never imported from
QA.
## 3. Decisions and inputs needed before running
| # | Item | Recommendation | Blocks |
|---|---|---|---|
| C1 | **ScadaBridge `BTDB` db-connection on PROD (§1.8):** mirror QA's, with only the server changed. It is used by the central (the SAPID lookup in every inbound method) **and** by site-par (`MesMoveOut`/`MesSampleData` cycle data). Still unverified: the path from par-vp03/04 → `wondersqlpd:1433`. The centrals already reach `wondersqlpd` for the ScadaBridge config DB. | Use the same login as QA (`wonderapp`, password from `~/.zshenv`). Ask the DBA for a read-only BT login later, since the scripts only `SELECT`. Prove the PAR path with the first `MesMoveOut`/`MesSampleData` call after cutover; a failure there is best-effort and does not fail the move-out | Steps 3 and 6 |
| C2 | **PROD BT records:** ✅ already present and identical to QA (§1.6; created by marting4 2026-11-21) | Nothing to do. Step 0 only re-checks | none |
| C3 | Area on site-par | `CVDAisle_1`, matching the Galaxy. QA's name is `Aisle001` | Step 5 |
| C4 | **mxgw alarm area** (open since 11-20). Native alarm mirroring returns nothing while gateway alarms are off; computed alarms still work. | `NAM`, which covers CVDAisle_1. It is set on all four gateways, which needs a gateway restart and is its own deploy step | Native alarms only |
| C5 | **Cutover (Q9).** QA's Galaxy has its own copy of these nine reactors, on `OI_WAR_PAR_MBTCP`, and MES `MES_Key` drives them through QA ScadaBridge today. | Deploy on PROD whenever convenient (the instances are passive). **Cut over by switching the MES and Delmia callers to PROD**, one stack per machine. After that, disable the QA instances, or leave them if MES no longer calls QA | Step 9 |
| C6 | Which URL MES and Delmia call. There is no VIP in front of vp03/vp04:8085. | Owner/IT: a DNS alias or LB for the active central, or the callers fail over between both | Step 9 |
| C7 | API key names | `MES_Key` (all copied methods except Delmia) and `delmia-notifier` (`DelmiaRecipeDownload`). Hand both over out of band; never put them in chat or a repo | Step 8 |
Not needed: #60. The mxgw `galaxy-sql` 503 only affects Galaxy browse; MXAccess reads and writes work, and site-par is
Connected.
## 4. Steps (management API through the CLI, from the Mac; no WinRM; each step gets an owner go)
Use `sbp=(… --url http://wonder-app-vp03.zmr.zimmer.com:8085 --username dohertj2 --password-file <0600>)`. Pass
secrets only through `--*-file`.
0. **BTDB records (C2): re-check only.** The records already exist on PROD BT.
- Run section 1 of `btdb/prod-bt-cvd-machines.sql` as `wonderapp` on `wondersqlpd`/`BT`. Expect 9 machines and
the group as "exists", and no `CONFLICT` rows.
- Only if a row has gone missing: remove the `RETURN` guard and run the whole script. It inserts only the missing
rows.
1. **Re-validate the mapping.** Re-run the Galaxy read and generator. Stop if any PROD tag name changed since
2026-11-22.
2. **Templates.**
- `bundle preview --input cvdreactor-templates.scadabundle` must still show 11 adds and 0 blockers.
- Then `bundle import`, with conflict policy `fail`/`skip` (nothing exists).
- Verify: `template list` shows the 11, and `template validate --id <CvdReactor>` passes.
3. **BTDB db-connection (C1, §1.8).**
- Run `apply-btdb-connection.sh <sbp wrapper>`.
- `db-connection list` must show `BTDB`.
- Then run `deploy artifacts --site-id 1`, which ships the db-connection to site-par for the two site scripts that
read BT.
- The central uses it directly for the inbound methods, so they need no deploy.
- There is no built-in test-connection. The first proof is step 9: a ready-check call does the SAPID lookup
through `BTDB`.
4. **Inbound API methods (central, §1.5).**
- First run `apply-api-methods.sh <sbp wrapper> --dry`, then the same without `--dry`.
- It creates these from `qa-export/api-methods.json`, with the same script, parameter and return schemas,
timeout and trace flag as QA:
| Method | Timeout | Required parameters | Used on QA by |
|---|---|---|---|
| `MesMoveIn` | 46 s | SAPID, JobSequenceNumber, WorkOrders, OperatorName | MES (`MES_Key`) |
| `MesMoveOut` | 45 s | SAPID, WorkOrders, OperatorName | MES (`MES_Key`) |
| `SimpleAlarmStatusRequest` | 30 s | (SAPID) | MES (`MES_Key`) |
| `MesIsMoveInReady` | 30 s | SAPID | test key; read-only |
| `MesIsMoveOutReady` | 30 s | SAPID | test key; read-only |
| `MesSampleData` | 30 s | ContainerNumber | none |
| `DelmiaRecipeDownload` | 45 s | (MachineCode, …) | none; the Delmia path |
- `--include-legacy` also creates `IpsenMESMoveIn`. Leave it out unless MES confirms it still calls that method.
- Verify: `api-method list` shows all 7, and `api-method get` for each matches the QA JSON.
- All 7 route with `Route.To(<Machine.Code>)` to the instances on site-par, so they work only after step 6/7.
5. **Area.** `site area create --site-id 1 --name CVDAisle_1` (C3).
6. **Instances, one machine first.** Pick an idle one, e.g. Z28063.
- `instance create --name Z28063 --template-id <CvdReactor id> --site-id 1 --area-id <id>`.
- `instance set-bindings --id <n> --bindings "$(cat bindings/Z28063.json)"`. That is 244 entries, connection 1.
It upserts, and the instance is new.
- `instance native-alarm-source import --instance-id <n> --file alarm-sources/Z28063.csv`. That is all 7
sources, so the QA-era template defaults are never used.
- `instance diff` shows 244 bindings and 7 overrides.
- `deploy instance --id <n>`.
- **Gate:**
- `debug snapshot --id <n>`: attributes Good at the same rate as the Galaxy shows. An idle side shows some
source-Bad, so compare with the gateway read, not with 100 %.
- Spot-check 3 values against the Galaxy: a root UDA, a side attribute and a `LeakTest.*` attribute.
- site-par active node logs clean.
- QA unaffected.
7. **Remaining eight.** Same as step 6, in two batches. Then `deploy artifacts --site-id 1` is no longer needed after
restarts: the instances now reference connection 1, so it is rebuilt on boot.
8. **API keys.** `security api-key create --name MES_Key --methods MesMoveIn,MesMoveOut,SimpleAlarmStatusRequest,MesIsMoveInReady,MesIsMoveOutReady,MesSampleData`
and `--name delmia-notifier --methods DelmiaRecipeDownload`. Save each token straight to the Keychain
(`zb-prod/sb-inbound-<name>`); it is shown only once.
9. **Smoke test.** This step is read-only on the machines.
- `POST /api/MesIsMoveInReady` with `{}` → 400 `VALIDATION_FAILED`, which proves the key and the route.
- Then a real SAPID for each machine, `<SAPID>_A` and `_B` (e.g. `103564_A` for Z28063 Left; SAPIDs in §1.6) → 200 with `IsMoveInReady` true or false, matching the
Galaxy `MoveInReadyFlag`. That proves BTDB lookup → `Route.To` → site-par → correct side, **with no write.**
- `SimpleAlarmStatusRequest` → 200 with an empty list.
10. **Cutover (C5/C6), owner and MES/Delmia teams.**
- Point the MES and Delmia callers at PROD with the new keys.
- Watch the first real `MesMoveIn`/`MesMoveOut` per machine in `audit query --channel ApiInbound`, and in the
Flow Debugger.
- Then disable the QA instances, or keep QA for testing against its own Galaxy.
- **This is the point of no return for consumers. Before it, rollback means deleting the PROD content.**
11. **Records.**
- A deploy record in `ScadaBridge/docs/deployment/deployment-records/`.
- Update the PROD plan §0.1a.
- Memory note.
## 5. Rollback
- **Before step 10**, on PROD: `instance delete` ×9, then `api-method delete`, `template delete` (derived templates
before bases), `db-connection delete`, `security api-key delete`, `deploy artifacts --site-id 1`. Nothing outside
ScadaBridge's config DB changes, and QA keeps serving MES throughout.
- **After step 10:** point the callers back at QA.
- **BT records:** none to roll back. They existed before this plan (marting4, 2026-11-21) and are owned outside it.
## 6. Follow-ups to file
- ScadaBridge: the bundle import reference scanner flags `System.*` and `Array.*` in API method scripts as missing
SharedScripts/ExternalSystems. That blocks every inbound method from bundles.
- ScadaBridge QA config (§1.4): stale bindings on Z28061/Z28062; native alarm sources on Z28062–Z28069; check
`MantleTempHigh`.
- The open mxgw alarm-area decision (C4) now has a consumer.