Deterministic workflows, replay and activity arguments

Hello, the following code produces a different input parameter for the activity while replaying the workflow. I expected this code to produce a non-deterministic error. Why am I wrong?

public class ReplayTest {
  @RegisterExtension
  public static final TestWorkflowExtension testWorkflowExtension =
      TestWorkflowExtension.newBuilder()
          .setWorkflowTypes(
              ReplayWorkflowImpl.class
          )
          .setActivityImplementations(new ReplayActivitiesImpl())
          .build();

  @Test
  void replay_non_deterministic(WorkflowClient client, ReplayWorkflow wf) {

    var execution = WorkflowStub.fromTyped(wf).start();
    WorkflowStub.fromTyped(wf).getResult(String.class);

    try {
      var history = client.fetchHistory(execution.getWorkflowId());
      WorkflowReplayer.replayWorkflowExecution(
          history,
          ReplayWorkflowImpl.class);
      fail("Should throw exception");
    } catch (Exception e) {
      assertThat(e.getMessage()).contains("error=io.temporal.worker.NonDeterministicException");
    }

  }

  @WorkflowInterface
  public interface ReplayWorkflow {
    @WorkflowMethod
    String start();
  }

  @ActivityInterface
  public interface ReplayActivities {
    @ActivityMethod
    String echo(String string);
  }

  public static class ReplayActivitiesImpl implements ReplayActivities{
    @Override
    public String echo(String string) {
      return string;
    }
  }

  public static class ReplayWorkflowImpl implements ReplayWorkflow {
    ReplayActivities activities = Workflow.newActivityStub(
            ReplayActivities.class,
            ActivityOptions.newBuilder()
                .setStartToCloseTimeout(Duration.ofSeconds(1))
                .build());

    @Override
    public String start() {
      var uuid = UUID.randomUUID().toString();
      System.out.println("BEFORE " + uuid);
      var result = activities.echo(uuid);
      System.out.println("AFTER " + result);
      return ts;
    }

  }

}

Change in activity / child workflow inputs are not compared during replay, during replay the originally recorded inputs in event history are just used, the activity is not invoked again.

Thanks for the clarification. I understand that the consequences of using randomUUID() (“bad” workflow code) in the example above could never be discovered by a Replay-Test, unless this value would determine the activity’s execution. So, if I changed the example’s workflow method like below the test could fail:

    @Override
    public String start() {
      var random = new Random();
      var i = random.nextInt(101);
      if(i >= 50) {
        System.out.println("Activity executed (i = %s)".formatted(i));
        activities.echo(String.valueOf(i));
      } else {
        System.out.println("Activity NOT executed (i = %s)".formatted(i));
      }
      return "success";
    }