Skip to content

Conversation

@danoswaltCL
Copy link
Collaborator

@danoswaltCL danoswaltCL commented Dec 11, 2025

  • Adds a ts-configurable form in add/edit experiment modal
  • Adds a bulleted list capability to the overview details component
  • Implements bulleted list for moocletPolicyParameters when detected
  • Mooclet Helper Service to delegate mooclet related logic as much as possible
  • Adds Reward Feedback card under Enrollment Data in Data Tab, which is essentially the current_posteriors data

@amurphy-cl open to any wordsmithing of the language

image image ![Uploading image.png…]()

@zackcl

This comment was marked as resolved.

@zackcl

This comment was marked as resolved.

@danoswaltCL

This comment was marked as resolved.

@danoswaltCL danoswaltCL requested a review from zackcl December 16, 2025 16:21
@zackcl

This comment was marked as resolved.

@danoswaltCL

This comment was marked as resolved.

@zackcl

This comment was marked as resolved.

@zackcl

This comment was marked as resolved.

@zackcl

This comment was marked as resolved.

@danoswaltCL

This comment was marked as resolved.

let message = `[Algorithm Change] Assignment algorithm changed from ${oldAlgorithm} to ${experiment.assignmentAlgorithm}.`;
message += wasMooclet && 'Will delete old Mooclet resources after successful update.';
message += isNowMooclet && 'Will create new Mooclet resources as part of update.';

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem: && operator doesn't work as expected for string concatenation. If wasMooclet is true, it evaluates to the string, but if false, it adds false to the message. Fix:

let message = `[Algorithm Change] Assignment algorithm changed from ${oldAlgorithm} to ${experiment.assignmentAlgorithm}.`;
if (wasMooclet) message += ' Will delete old Mooclet resources after successful update.';
if (isNowMooclet) message += ' Will create new Mooclet resources as part of update.';

// }
// return await this.updateUpgradeExperiment(manager, params);
// });
// }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider removing this commented code.

// when transitioning away from Mooclet, delete the old refs after successful experiment update
if (params.moocletRefToDelete) {
await this.moocletExperimentRefRepository.delete(params.moocletRefToDelete.id);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem: The deletion uses moocletExperimentRefRepository.delete() directly instead of using the transaction manager. This means the deletion may not be part of the transaction and could cause:

  • Orphaned refs if the transaction rolls back after deletion
  • Loss of atomicity

Fix:

if (params.moocletRefToDelete) {
  await manager.delete(MoocletExperimentRef, params.moocletRefToDelete.id);
}

}

// when transitioning to Mooclet, create the Mooclet resources
if (this.isMoocletExperiment(updatedExperiment.assignmentAlgorithm)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double Deletion Risk in Algorithm Change Flow

Location: MoocletExperimentService.ts:1507-1535 The code deletes mooclet resources in two places:

  1. Inside syncUpdateWithMoocletAlgorithmTransition transaction (line 185) - deletes UpGrade DB ref
  2. Outside transaction in handlePotentialMoocletAssignmentAlgorithmChange (line 1515) - deletes external Mooclet API resources

Issue: If the external Mooclet deletion fails (line 1515), you've already deleted the UpGrade DB reference (line 185), making it impossible to retry cleanup later. This creates orphaned Mooclet API resources with no way to track them. Recommendation: Consider one of these approaches:

  • Option A: Only delete the UpGrade ref inside the transaction, move ALL external deletions outside
  • Option B: Keep a "soft delete" flag on refs to track failed cleanups
  • Option C: Add a cleanup job to handle orphaned resources

@zackcl
Copy link
Collaborator

zackcl commented Dec 17, 2025

I added a few review comments suggested by Claude. Feel free to resolve or ignore them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants