code: def test_metric_stepsync(relay_server, user, publish_util, mock_run):
      history = []
      history.append(
          dict(
              step=0,
              data=dict(
                  a1=1,
              ),
          )
      )
      history.append(dict(step=1, data=dict(s1=2)))
      history.append(
          dict(
              step=2,
              data=dict(
                  a1=3,
              ),
          )
      )
      history.append(dict(step=3, data=dict(a1=5, s1=4)))
      history.append(dict(step=3, data=dict(s1=6)))
      history.append(
          dict(
              step=4,
              data=dict(
                  a1=7,
              ),
          )
      )
      history.append(dict(step=5, data=dict(a1=9, s1=8)))
  
      m0 = pb.MetricRecord(name="s1")
      m1 = pb.MetricRecord(name="a1", step_metric="s1")
      m1.options.step_sync = True
  
      metrics = _make_metrics([m0, m1])
  
      run = mock_run(use_magic_mock=True)
      with relay_server() as relay:
          publish_util(run=run, history=history, metrics=metrics)
  
      summary = relay.context.get_run_summary(
          run.id, include_private=True
      )
      history = relay.context.get_run_history(run.id)
  
      assert summary["s1"] == 8
      assert summary["a1"] == 9
      assert summary["_step"] == 5
  
      history_val = history[history["a1"].notnull()].reset_index(
          drop=True
      )
      assert history_val.a1.tolist() == [1, 3, 5, 7, 9]
      assert history_val.s1[1:].tolist() == [2, 4, 6, 8]
  
imports: from wandb.proto import wandb_internal_pb2
label_desc: Use image node_id 12 for calling a global function with example usage: test_metric_stepsync(relay_server, user, publish_util, mock_run) without return types