Skip to content

Fix/mooclet priors rebased#3093

Open
danoswaltCL wants to merge 10 commits intorelease/6.4from
fix/mooclet-priors-rebased
Open

Fix/mooclet priors rebased#3093
danoswaltCL wants to merge 10 commits intorelease/6.4from
fix/mooclet-priors-rebased

Conversation

@danoswaltCL
Copy link
Copy Markdown
Collaborator

@danoswaltCL danoswaltCL commented Apr 30, 2026

Apologies for giant PR, i got carried away

  • Adds a proper entry for priors per condition in the design page
  • Removes priors from overview and upsert experiment modal
  • Adds Reward Feedback Table improvements to show count, priors, posteriors, and estimated weight
  • Estimated weight is a new feature itself, the language of the tooltip explains it:
    --
Screenshot 2026-04-24 at 5 16 59 PM -- Screenshot 2026-04-24 at 5 17 25 PM

--

Screenshot 2026-04-24 at 5 17 56 PM -- Screenshot 2026-04-24 at 5 18 10 PM -- Screenshot 2026-04-24 at 5 18 23 PM -- Screenshot 2026-04-24 at 5 20 31 PM

--
Screenshot 2026-04-24 at 5 21 38 PM

--

@danoswaltCL danoswaltCL requested review from bcb37, Copilot and zackcl and removed request for bcb37 and Copilot April 30, 2026 15:32
@danoswaltCL danoswaltCL mentioned this pull request Apr 30, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Mooclet TS-configurable experiments to support per-condition priors, display prior/posterior counts and an estimated Thompson-sampling “weight” in the UI, and wires up a new modal for editing priors.

Changes:

  • Update shared upgrade_types to model prior and current_posteriors as Record<string, …> and extend rewards-summary rows with prior/posterior/estimated-weight fields.
  • Add a frontend “Edit condition prior” modal and integrate it into the experiment conditions section (plus i18n strings).
  • Add backend logic to fetch TS policy parameters and compute an estimated Thompson weight per condition for the rewards summary response.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
packages/types/src/index.ts Re-export Prior / CurrentPosteriors for downstream usage.
packages/types/src/Mooclet/index.ts Extend rewards-summary row type; remove total and add prior/posterior/estimated-weight fields.
packages/types/src/Mooclet/MoocletTSConfigurablePolicyParametersDTO.ts Change prior to per-key record and add current_posteriors record.
packages/frontend/projects/upgrade/src/assets/i18n/en.json Add labels/tooltips for priors, posteriors, and estimated weight + prior modal strings.
packages/frontend/projects/upgrade/src/app/shared/services/common-dialog.service.ts Add dialog open helper for the new “edit condition prior” modal.
packages/frontend/projects/upgrade/src/app/features/dashboard/experiments/pages/.../ts-configurable-reward-count-table.component.ts Add columns + tooltip generation for estimated weight.
packages/frontend/projects/upgrade/src/app/features/dashboard/experiments/pages/.../ts-configurable-reward-count-table.component.html Render prior/posterior columns and estimated-weight column with tooltip.
packages/frontend/projects/upgrade/src/app/features/dashboard/experiments/pages/.../ts-configurable-reward-count-table.component.scss Adjust table column sizing/formatting for the new columns.
packages/frontend/projects/upgrade/src/app/features/dashboard/experiments/pages/.../enrollment-condition-expandable-row.component.scss Add hidden-column styling for mooclet-specific table behavior.
packages/frontend/projects/upgrade/src/app/features/dashboard/experiments/pages/.../enrollment-condition-expandable-row.component.html Hide weight header/cell content for mooclet experiments.
packages/frontend/projects/upgrade/src/app/features/dashboard/experiments/pages/.../experiment-conditions-table.component.ts Add prior input + editPrior output; switch displayed columns for mooclet experiments.
packages/frontend/projects/upgrade/src/app/features/dashboard/experiments/pages/.../experiment-conditions-table.component.html Add prior success/failure columns and edit button for priors.
packages/frontend/projects/upgrade/src/app/features/dashboard/experiments/pages/.../experiment-conditions-table.component.scss Add prior/prior-edit column sizing/alignment.
packages/frontend/projects/upgrade/src/app/features/dashboard/experiments/pages/.../experiment-conditions-section-card.component.ts Wire conditions-section prior editing into dialog + experiment update.
packages/frontend/projects/upgrade/src/app/features/dashboard/experiments/pages/.../experiment-conditions-section-card.component.html Pass prior into table and bind prior-edit event.
packages/frontend/projects/upgrade/src/app/features/dashboard/experiments/modals/upsert-experiment-modal/.../ts-configurable-policy-parameters-form.component.ts Remove prior fields from the TS-configurable upsert form.
packages/frontend/projects/upgrade/src/app/features/dashboard/experiments/modals/upsert-experiment-modal/.../ts-configurable-policy-parameters-form.component.html Remove prior inputs from the TS-configurable upsert form UI.
packages/frontend/projects/upgrade/src/app/features/dashboard/experiments/modals/edit-condition-prior-modal/edit-condition-prior-modal.component.ts New modal component for editing per-condition priors.
packages/frontend/projects/upgrade/src/app/features/dashboard/experiments/modals/edit-condition-prior-modal/edit-condition-prior-modal.component.html Modal UI for editing successes/failures priors per condition.
packages/frontend/projects/upgrade/src/app/features/dashboard/experiments/modals/edit-condition-prior-modal/edit-condition-prior-modal.component.scss Styling for the prior-edit modal table/inputs.
packages/frontend/projects/upgrade/src/app/core/experiments/store/experiments.model.ts Remove TS-configurable overview labels for global prior fields.
packages/frontend/projects/upgrade/src/app/core/experiments/mooclet-helper.service.ts Remove flat prior fields and add validators for the new prior editor.
packages/frontend/projects/upgrade/src/app/core/experiments/mooclet-helper.service.spec.ts Update tests to reflect removal of global prior fields.
packages/frontend/projects/upgrade/src/app/core/experiments/experiments.service.ts Add store update helper to persist per-condition prior changes.
packages/backend/test/unit/services/MoocletRewardsService.test.ts Update expected reward summaries to new shape (no total, add prior/posterior fields).
packages/backend/test/unit/services/MoocletExperimentService.test.ts Update tests for per-condition prior keyed by version IDs + version-condition maps.
packages/backend/src/api/services/MoocletRewardsService.ts Fetch policy params for rewards summary and compute estimated Thompson weights.
packages/backend/src/api/services/MoocletExperimentService.ts Translate prior/current_posteriors keys between conditionCodes and versionIds.
Comments suppressed due to low confidence (1)

packages/frontend/projects/upgrade/src/app/core/experiments/mooclet-helper.service.ts:230

  • Method naming is inconsistent with the rest of the service (getTSConfigurableFieldValidators, etc.): getpriorFieldValidators should be getPriorFieldValidators (and likewise createpriorForm/openEditConditionpriorModal, etc.). Keeping standard camelCase improves readability and avoids accidental mismatches in call sites.
  /**
   * Get field validators for per-condition prior success/failure inputs used in the prior editor.
   */
  getpriorFieldValidators(): Record<string, ValidatorFn[]> {
    const priorDefault = 1;
    return {
      successes: [
        Validators.required,
        Validators.min(priorDefault),
        Validators.max(DEFAULT_MAX_NUMBER_INPUT),
        CommonFormHelpersService.integerValidator(),
      ],
      failures: [
        Validators.required,
        Validators.min(priorDefault),
        Validators.max(DEFAULT_MAX_NUMBER_INPUT),
        CommonFormHelpersService.integerValidator(),
      ],
    };

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/backend/src/api/services/MoocletExperimentService.ts
Comment thread packages/backend/src/api/services/MoocletRewardsService.ts
Comment thread packages/backend/src/api/services/MoocletRewardsService.ts
Comment thread packages/backend/src/api/services/MoocletRewardsService.ts
Comment thread packages/backend/src/api/services/MoocletExperimentService.ts
Comment thread packages/backend/src/api/services/MoocletRewardsService.ts
@danoswaltCL danoswaltCL requested a review from bcb37 May 1, 2026 15:14
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.

2 participants