{
  "topologyId": "top_m3_hardware_loop",
  "projectId": "prj_m3_hardware_loop",
  "environment": "dev",
  "contract": {
    "name": "M3 hardware trusted loop local contract smoke",
    "signal": "box-simu-1 DO1 -> box-simu-2 DI1",
    "mode": "local-direct-call",
    "databaseWriteRequired": false,
    "realHardwareRequired": false,
    "cloudApiRequired": false
  },
  "services": {
    "boxes": [
      {
        "serviceId": "hwlab-box-simu",
        "boxId": "boxsimu_1",
        "aliases": ["box-simu-1"],
        "projectId": "prj_m3_hardware_loop",
        "gatewaySessionId": "gws_gwsimu_1",
        "live": true,
        "resource": {
          "resourceId": "res_boxsimu_1",
          "projectId": "prj_m3_hardware_loop",
          "gatewaySessionId": "gws_gwsimu_1",
          "boxId": "boxsimu_1",
          "resourceType": "simulator_endpoint",
          "name": "box-simu-1 simulator endpoint",
          "state": "available",
          "environment": "dev",
          "metadata": {
            "serviceId": "hwlab-box-simu",
            "simulatorName": "box-simu-1",
            "ports": ["DO1", "DI1"],
            "propagation": "patch-panel-only"
          },
          "createdAt": "2026-05-21T00:00:00.000Z",
          "updatedAt": "2026-05-21T00:00:00.000Z"
        },
        "ports": {
          "DO1": {
            "port": "DO1",
            "direction": "output",
            "value": false,
            "source": "local",
            "updatedAt": "2026-05-21T00:00:00.000Z"
          },
          "DI1": {
            "port": "DI1",
            "direction": "input",
            "value": false,
            "source": "local",
            "updatedAt": "2026-05-21T00:00:00.000Z"
          }
        },
        "constraints": {
          "crossDevicePropagation": "patch-panel-only",
          "localLoopbackEnabled": false
        },
        "updatedAt": "2026-05-21T00:00:00.000Z"
      },
      {
        "serviceId": "hwlab-box-simu",
        "boxId": "boxsimu_2",
        "aliases": ["box-simu-2"],
        "projectId": "prj_m3_hardware_loop",
        "gatewaySessionId": "gws_gwsimu_2",
        "live": true,
        "resource": {
          "resourceId": "res_boxsimu_2",
          "projectId": "prj_m3_hardware_loop",
          "gatewaySessionId": "gws_gwsimu_2",
          "boxId": "boxsimu_2",
          "resourceType": "simulator_endpoint",
          "name": "box-simu-2 simulator endpoint",
          "state": "available",
          "environment": "dev",
          "metadata": {
            "serviceId": "hwlab-box-simu",
            "simulatorName": "box-simu-2",
            "ports": ["DO1", "DI1"],
            "propagation": "patch-panel-only"
          },
          "createdAt": "2026-05-21T00:00:00.000Z",
          "updatedAt": "2026-05-21T00:00:00.000Z"
        },
        "ports": {
          "DO1": {
            "port": "DO1",
            "direction": "output",
            "value": false,
            "source": "local",
            "updatedAt": "2026-05-21T00:00:00.000Z"
          },
          "DI1": {
            "port": "DI1",
            "direction": "input",
            "value": false,
            "source": "local",
            "updatedAt": "2026-05-21T00:00:00.000Z"
          }
        },
        "constraints": {
          "crossDevicePropagation": "patch-panel-only",
          "localLoopbackEnabled": false
        },
        "updatedAt": "2026-05-21T00:00:00.000Z"
      }
    ],
    "gateways": [
      {
        "serviceId": "hwlab-gateway-simu",
        "gatewayId": "gwsimu_1",
        "aliases": ["gateway-simu-1"],
        "projectId": "prj_m3_hardware_loop",
        "live": true,
        "session": {
          "gatewaySessionId": "gws_gwsimu_1",
          "projectId": "prj_m3_hardware_loop",
          "serviceId": "hwlab-gateway-simu",
          "gatewayId": "gwsimu_1",
          "endpoint": "http://127.0.0.1:7201",
          "status": "connected",
          "environment": "dev",
          "startedAt": "2026-05-21T00:00:00.000Z",
          "lastSeenAt": "2026-05-21T00:00:00.000Z",
          "labels": {
            "simulator": "true"
          }
        },
        "boxes": ["res_boxsimu_1"],
        "updatedAt": "2026-05-21T00:00:00.000Z"
      },
      {
        "serviceId": "hwlab-gateway-simu",
        "gatewayId": "gwsimu_2",
        "aliases": ["gateway-simu-2"],
        "projectId": "prj_m3_hardware_loop",
        "live": true,
        "session": {
          "gatewaySessionId": "gws_gwsimu_2",
          "projectId": "prj_m3_hardware_loop",
          "serviceId": "hwlab-gateway-simu",
          "gatewayId": "gwsimu_2",
          "endpoint": "http://127.0.0.1:7202",
          "status": "connected",
          "environment": "dev",
          "startedAt": "2026-05-21T00:00:00.000Z",
          "lastSeenAt": "2026-05-21T00:00:00.000Z",
          "labels": {
            "simulator": "true"
          }
        },
        "boxes": ["res_boxsimu_2"],
        "updatedAt": "2026-05-21T00:00:00.000Z"
      }
    ],
    "patchPanel": {
      "patchPanelStatusId": "pps_m3_hardware_loop",
      "projectId": "prj_m3_hardware_loop",
      "gatewaySessionId": "gws_gwsimu_1",
      "wiringConfigId": "wir_m3_do1_di1",
      "serviceId": "hwlab-patch-panel",
      "state": "active",
      "environment": "dev",
      "activeConnections": [
        {
          "fromResourceId": "res_boxsimu_1",
          "fromPort": "DO1",
          "toResourceId": "res_boxsimu_2",
          "toPort": "DI1"
        }
      ],
      "observedAt": "2026-05-21T00:00:00.000Z",
      "metadata": {
        "propagation": "patch-panel-only",
        "connectionCount": 1,
        "signal": "box-simu-1 DO1 -> box-simu-2 DI1"
      }
    }
  },
  "wiringConfig": {
    "wiringConfigId": "wir_m3_do1_di1",
    "projectId": "prj_m3_hardware_loop",
    "gatewaySessionId": "gws_gwsimu_1",
    "name": "M3 simulated DO1 to DI1 patch wiring",
    "status": "active",
    "connections": [
      {
        "from": {
          "resourceId": "res_boxsimu_1",
          "port": "DO1"
        },
        "to": {
          "resourceId": "res_boxsimu_2",
          "port": "DI1"
        },
        "mode": "exclusive"
      }
    ],
    "constraints": {
      "propagation": "patch-panel-only",
      "localLoopbackSubstituteAllowed": false
    },
    "createdAt": "2026-05-21T00:00:00.000Z",
    "updatedAt": "2026-05-21T00:00:00.000Z"
  },
  "directCall": {
    "operationId": "op_m3_hardware_loop_smoke",
    "traceId": "trc_m3_hardware_loop_smoke",
    "source": {
      "boxAlias": "box-simu-1",
      "resourceId": "res_boxsimu_1",
      "port": "DO1",
      "value": true
    },
    "target": {
      "boxAlias": "box-simu-2",
      "resourceId": "res_boxsimu_2",
      "port": "DI1",
      "expectedValue": true
    },
    "expected": {
      "accepted": true,
      "propagatedBy": "hwlab-patch-panel",
      "deliveryCount": 1,
      "observedAt": "2026-05-21T00:00:01.000Z"
    }
  },
  "expectedAuditEvent": {
    "auditId": "aud_m3_hardware_loop_smoke",
    "traceId": "trc_m3_hardware_loop_smoke",
    "actorType": "system",
    "actorId": "sys_m3_hardware_loop_smoke",
    "action": "hardware.loop.smoke",
    "targetType": "wiring_config",
    "targetId": "wir_m3_do1_di1",
    "projectId": "prj_m3_hardware_loop",
    "gatewaySessionId": "gws_gwsimu_1",
    "operationId": "op_m3_hardware_loop_smoke",
    "serviceId": "hwlab-patch-panel",
    "environment": "dev",
    "outcome": "succeeded",
    "metadata": {
      "databaseWriteRequired": false,
      "directCall": true,
      "source": "box-simu-1 DO1",
      "target": "box-simu-2 DI1",
      "propagation": "patch-panel-only"
    },
    "occurredAt": "2026-05-21T00:00:01.000Z"
  },
  "constraints": {
    "patchPanelIsOnlyCrossDeviceChannel": true,
    "boxSimuLocalLoopbackForCrossDeviceSync": false,
    "realDevHardwareMutationAllowed": false,
    "cloudApiImplementationMutationAllowed": false
  },
  "dryRunHints": {
    "cliTarget": "fixtures/mvp/m3-hardware-loop/topology.json",
    "expectedServices": ["hwlab-box-simu", "hwlab-gateway-simu", "hwlab-patch-panel"],
    "command": "node scripts/m3-hardware-loop-smoke.mjs"
  }
}
