Fix/mooclet priors rebased#3093
Open
danoswaltCL wants to merge 10 commits intorelease/6.4from
Open
Conversation
Closed
Contributor
There was a problem hiding this comment.
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_typesto modelpriorandcurrent_posteriorsasRecord<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.):getpriorFieldValidatorsshould begetPriorFieldValidators(and likewisecreatepriorForm/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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Apologies for giant PR, i got carried away
--
--
--

--