testchimp-runner-core 0.0.29 → 0.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -394,7 +394,7 @@ export class ExecutionService {
394
394
  }
395
395
 
396
396
  this.log('Starting AI repair with parsed steps...');
397
- updatedSteps = await this.repairStepsWithAI(steps, repairPage, repairFlexibility, model);
397
+ updatedSteps = await this.repairStepsWithAI(steps, repairPage, repairFlexibility, model, request.jobId);
398
398
  } else {
399
399
  // Start browser initialization and script parsing in parallel for faster startup
400
400
  this.log('Initializing repair browser and parsing script...');
@@ -414,7 +414,7 @@ export class ExecutionService {
414
414
  }
415
415
 
416
416
  this.log('Starting AI repair with parsed steps...');
417
- updatedSteps = await this.repairStepsWithAI(steps, repairPage, repairFlexibility, model);
417
+ updatedSteps = await this.repairStepsWithAI(steps, repairPage, repairFlexibility, model, request.jobId);
418
418
  }
419
419
 
420
420
  // Always generate the updated script
@@ -581,7 +581,8 @@ export class ExecutionService {
581
581
  steps: (ScriptStep & { success?: boolean; error?: string })[],
582
582
  page: any,
583
583
  repairFlexibility: number,
584
- model: string
584
+ model: string,
585
+ jobId?: string
585
586
  ): Promise<(ScriptStep & { success?: boolean; error?: string })[]> {
586
587
  let updatedSteps = [...steps];
587
588
  const maxTries = 3;
@@ -624,6 +625,23 @@ export class ExecutionService {
624
625
  this.log(`Step ${i + 1} executed successfully: ${step.description}`);
625
626
  this.log(`Step ${i + 1} success status set to: ${step.success}`);
626
627
 
628
+ // Report successful step execution
629
+ this.log(`DEBUG: About to check callback - progressReporter=${!!this.progressReporter}, onStepProgress=${!!this.progressReporter?.onStepProgress}, jobId=${jobId}`);
630
+ if (this.progressReporter?.onStepProgress && jobId) {
631
+ this.log(`DEBUG: Firing onStepProgress callback for step ${i + 1}`);
632
+ await this.progressReporter.onStepProgress({
633
+ jobId,
634
+ stepNumber: i + 1,
635
+ description: step.description,
636
+ code: step.code,
637
+ status: 'SUCCESS_STEP_EXECUTION' as any,
638
+ wasRepaired: false
639
+ });
640
+ this.log(`DEBUG: onStepProgress callback completed for step ${i + 1}`);
641
+ } else {
642
+ this.log(`DEBUG: Skipping callback - conditions not met`);
643
+ }
644
+
627
645
  // Add this step's code to the execution context for future steps (for variable tracking)
628
646
  executionContext += step.code + '\n';
629
647
  i++; // Move to next step
@@ -797,12 +815,39 @@ Use these vision insights to inform your repair strategy.`;
797
815
  updatedSteps[i].success = true;
798
816
  updatedSteps[i].error = undefined;
799
817
  this.log(`Step ${i + 1} marked as successful after MODIFY repair`);
818
+
819
+ // Report repaired step
820
+ if (this.progressReporter?.onStepProgress && jobId) {
821
+ this.log(`DEBUG: Reporting repaired step ${i + 1}:`);
822
+ this.log(` description: ${updatedSteps[i].description}`);
823
+ this.log(` code: ${updatedSteps[i].code}`);
824
+ await this.progressReporter.onStepProgress({
825
+ jobId,
826
+ stepNumber: i + 1,
827
+ description: updatedSteps[i].description,
828
+ code: updatedSteps[i].code,
829
+ status: 'SUCCESS_STEP_EXECUTION' as any,
830
+ wasRepaired: true
831
+ });
832
+ }
800
833
  } else if (repairAction.operation === StepOperation.INSERT) {
801
834
  // For INSERT: mark the newly inserted step as successful
802
835
  const insertIndex = repairAction.insertAfterIndex !== undefined ? repairAction.insertAfterIndex + 1 : i + 1;
803
836
  if (updatedSteps[insertIndex]) {
804
837
  updatedSteps[insertIndex].success = true;
805
838
  updatedSteps[insertIndex].error = undefined;
839
+
840
+ // Report inserted step
841
+ if (this.progressReporter?.onStepProgress && jobId) {
842
+ await this.progressReporter.onStepProgress({
843
+ jobId,
844
+ stepNumber: insertIndex + 1,
845
+ description: updatedSteps[insertIndex].description,
846
+ code: updatedSteps[insertIndex].code,
847
+ status: 'SUCCESS_STEP_EXECUTION' as any,
848
+ wasRepaired: true
849
+ });
850
+ }
806
851
  }
807
852
  } else if (repairAction.operation === StepOperation.REMOVE) {
808
853
  // For REMOVE: no step to mark as successful since we removed it
@@ -899,6 +899,7 @@ export class ScenarioWorker extends EventEmitter {
899
899
 
900
900
  generatedScript = generateTestScript(testName, steps, undefined, hashtags);
901
901
  this.log(`[ScenarioWorker] Generated script length: ${generatedScript.length}`);
902
+ this.log(`[ScenarioWorker] Script starts with: ${generatedScript.substring(0, 150)}...`);
902
903
 
903
904
  // Perform final cleanup pass to remove redundancies and make minor adjustments
904
905
  this.log(`[ScenarioWorker] Performing final script cleanup...`);
package/src/types.ts CHANGED
@@ -176,6 +176,7 @@ export interface ScriptExecutionRequest {
176
176
  model?: string;
177
177
  headless?: boolean; // defaults to false (headed)
178
178
  deflake_run_count?: number; // defaults to 1
179
+ jobId?: string; // Optional job ID for progress tracking
179
180
 
180
181
  // Optional: Provide existing browser/page/context (for server-side usage)
181
182
  // If not provided, runner-core will create its own