dotCMS / dotCMS/core

Experiments Portlet — migration: delete the old per-page experiments UI and remove the flag

Open
#37,008 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

dotCMS : Experiments Team : Falcon Type : Refactoring
Dominant language
Java
Stars
970
Forks
486
Avg merge
3d 33m
Merged PRs (30d)
170

Description

Description

The epic's strategy is: build the new portlet complete, then migrate and delete the old one. This is the issue where the duplication ends. It is filed up front — together with the rest of the epic — so "delete old later" is a scheduled step, not a wish that never happens.

This is deliberately the only issue that rewrites/removes existing code at scale.

Entry condition: every "port" row of the functional-parity inventory verified working in the new portlet on the dev/QA instance, and the E2E suite (#37006) green. Nothing is deleted before its replacement is verified.

Delete
  • The old per-page UI in libs/portlets/dot-experiments/portlet/src/lib/: dot-experiments-shell/, dot-experiments-list/ (including the drawer create component), dot-experiments-configuration/, dot-experiments-reports/, dot-experiments-analytic-app-misconfiguration/, the old shared/ tree, and the old lib.routes.ts (dotExperimentsRoutes).
  • With them go: the three @ngrx/component-store stores, the 10 hardcoded router.navigate(['/edit-page/…']) calls, and the window.location.href-parsing getUrl() — no decoupling refactor needed; the code that holds them disappears.
Rewire
  • UVE entry point permanently targets the new flow; remove FEATURE_FLAG_EXPERIMENTS_PORTLET — the entry-point flag introduced by #37005 — its withFlags wiring, its FeaturedFlags entry, its ConfigurationResource allow-list entry, and its explicit false in dotmarketing-config.properties.
  • Do not remove FEATURE_FLAG_EXPERIMENTS. Despite the name, it is not a frontend flag: it is the backend kill-switch for the whole Experiments feature, read by ConfigExperimentUtil.isExperimentEnabled() and gating experiment JS injection (ExperimentWebAPIImpl:338) and experiment resolution during page render (HTMLPageAssetRenderedAPIImpl:176,239). Removing it would stop experiments from serving to visitors. It keeps its name, meaning, default and consumers. The unused enum entry FeaturedFlags.LOAD_FRONTEND_EXPERIMENTS = 'FEATURE_FLAG_EXPERIMENTS' (shared-models.ts:28) never gained a consumer and can be deleted here — the property cannot.
  • Update libs/portlets/edit-ema/portlet/src/lib/lib.routes.ts:117 (the lazy import of dotExperimentsRoutes) and the nav spec dot-ema-shell.component.spec.ts:117-120 to the new routes.
  • Promote site-wide/ to the lib root; the components copied into site-wide/shared/ become the only copies.
Clean up
  • Move the chart colors in libs/dotcms-models/src/lib/dot-experiments.model.ts:204-215 behind a lazy getter, removing the import-time getComputedStyle(document.body) and the spec stubs #36989 added.
  • Remove i18n keys used only by the deleted screens.
  • Remove AllowedActionsByExperimentStatus keys that no longer have a consumer (verify — the matrix itself stays; the new portlet reads it).

Acceptance Criteria

  • Entry condition documented as met: parity checklist signed off on dev/QA; #37006 green.
  • The old tree and dotExperimentsRoutes are gone; pnpm nx build dotcms-ui and all specs pass.
  • UVE experiments entry lands in the new flow with no flag involved; FEATURE_FLAG_EXPERIMENTS_PORTLET and its consumers are removed.
  • FEATURE_FLAG_EXPERIMENTS and its backend consumers are untouched; experiments still serve to site visitors after the migration.
  • No import of @ngrx/component-store remains under libs/portlets/dot-experiments/.
  • dot-experiments.model.ts no longer runs getComputedStyle at import time.
  • The whole E2E suite passes (the FEATURE_FLAG_EXPERIMENTS_PORTLET-off regression spec is retired with that flag).
  • Grep proof in the PR: no edit-page/… navigation remains under the experiments lib.

Priority

Low until Screens 1-3 + UVE land; then it is the closing step of the epic.

Additional Context

  • Depends on: #36989, #37003, #37004, #37005, #37006, #37007.
  • Out of scope: registering the portlet for customers (UpgradeTask + starter bump) — separate decision, gated on #36823's permission filtering being in the build.
  • Verify: pnpm nx lint|test portlets-dot-experiments-portlet · pnpm nx test portlets-edit-ema-portlet · pnpm nx test dotcms-ui --testPathPattern=app.routes · pnpm nx build dotcms-ui · npx playwright test --grep @experiments

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

First verify the parity checklist and #37006, then inspect the old tree under libs/portlets/dot-experiments/ and the routes in edit-ema/lib.routes.ts:117. Run the listed portlet, dotcms-ui, build, and Playwright checks while removing the old routes and flag wiring. Done means the old tree and flag are gone, backend FEATURE_FLAG_EXPERIMENTS consumers remain untouched, and all checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
playwright, typescript
Domain
build-system, frontend, testing-qa
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
22/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.