Program: 6498
Project: 6498
Buggy source:
private void recordCompletedWorkflow(final Id.Workflow id,String pid){
  final RunRecordMeta run=getRun(id,pid);
  if (run == null) {
    return;
  }
  Id.Application app=id.getApplication();
  ApplicationSpecification appSpec=getApplication(app);
  if (appSpec == null || appSpec.getWorkflows() == null || appSpec.getWorkflows().get(id.getId()) == null) {
    return;
  }
  WorkflowSpecification workflowSpec=appSpec.getWorkflows().get(id.getId());
  Map<String,WorkflowNode> nodeIdMap=workflowSpec.getNodeIdMap();
  final List<WorkflowDataset.ProgramRun> programRunsList=new ArrayList<>();
  for (  Map.Entry<String,String> entry : run.getProperties().entrySet()) {
    if (!("String_Node_Str".equals(entry.getKey()) || "String_Node_Str".equals(entry.getKey()))) {
      WorkflowActionNode workflowNode=(WorkflowActionNode)nodeIdMap.get(entry.getKey());
      ProgramType programType=ProgramType.valueOfSchedulableType(workflowNode.getProgram().getProgramType());
      Id.Program innerProgram=Id.Program.from(app.getNamespaceId(),app.getId(),programType,entry.getKey());
      RunRecordMeta innerProgramRun=getRun(innerProgram,entry.getValue());
      programRunsList.add(new WorkflowDataset.ProgramRun(entry.getKey(),entry.getValue(),programType,innerProgramRun.getStopTs() - innerProgramRun.getStartTs()));
    }
  }
  txnlWorkflow.executeUnchecked(new TransactionExecutor.Function<WorkflowStatsDataset,Void>(){
    @Override public Void apply(    WorkflowStatsDataset dataset){
      dataset.workflowDataset.write(id,run,programRunsList);
      return null;
    }
  }
);
}

Fixed version (ground truth):
private void recordCompletedWorkflow(final Id.Workflow id,String pid){
  final RunRecordMeta run=getRun(id,pid);
  if (run == null) {
    return;
  }
  Id.Application app=id.getApplication();
  ApplicationSpecification appSpec=getApplication(app);
  if (appSpec == null || appSpec.getWorkflows() == null || appSpec.getWorkflows().get(id.getId()) == null) {
    return;
  }
  boolean workFlowNodeFailed=false;
  WorkflowSpecification workflowSpec=appSpec.getWorkflows().get(id.getId());
  Map<String,WorkflowNode> nodeIdMap=workflowSpec.getNodeIdMap();
  final List<WorkflowDataset.ProgramRun> programRunsList=new ArrayList<>();
  for (  Map.Entry<String,String> entry : run.getProperties().entrySet()) {
    if (!("String_Node_Str".equals(entry.getKey()) || "String_Node_Str".equals(entry.getKey()))) {
      WorkflowActionNode workflowNode=(WorkflowActionNode)nodeIdMap.get(entry.getKey());
      ProgramType programType=ProgramType.valueOfSchedulableType(workflowNode.getProgram().getProgramType());
      Id.Program innerProgram=Id.Program.from(app.getNamespaceId(),app.getId(),programType,entry.getKey());
      RunRecordMeta innerProgramRun=getRun(innerProgram,entry.getValue());
      if (innerProgramRun.getStatus().equals(ProgramRunStatus.COMPLETED)) {
        programRunsList.add(new WorkflowDataset.ProgramRun(entry.getKey(),entry.getValue(),programType,innerProgramRun.getStopTs() - innerProgramRun.getStartTs()));
      }
 else {
        workFlowNodeFailed=true;
        break;
      }
    }
  }
  if (workFlowNodeFailed) {
    return;
  }
  txnlWorkflow.executeUnchecked(new TransactionExecutor.Function<WorkflowStatsDataset,Void>(){
    @Override public Void apply(    WorkflowStatsDataset dataset){
      dataset.workflowDataset.write(id,run,programRunsList);
      return null;
    }
  }
);
}