Skip to content

feat(37659): frontend limited-mode UI and analytics health gate (FE) - #37957

Open
freddyDOTCMS wants to merge 3 commits into
issue-37659-analytics-experiment-flag-gatesfrom
issue-37659-analytics-experiment-flag-gates-fe
Open

freddyDOTCMS wants to merge 3 commits into
issue-37659-analytics-experiment-flag-gatesfrom
issue-37659-analytics-experiment-flag-gates-fe

Conversation

@freddyDOTCMS

@freddyDOTCMS freddyDOTCMS commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Summary

Angular/TypeScript implementation of the limited-mode UI and analytics health response mapping. Depends on the BE PR: #37690.

Analytics portlet:

  • HealthEntity type updated — adds health field (OK|NOT_CONFIGURED|CONFIGURATION_ERROR); legacy available field preserved for rollback safety
  • DotAnalyticsService.healthCheck() maps health field first, falls back to available
  • analyticsHealthGuard allows on HealthStatusTypes.OK (was AVAILABLE)
  • Resolver extracts health field from full ExperimentsHealthResponse to preserve downstream contract

Experiments portlet:

  • ExperimentsHealthResponse interface — healthCheck() now returns tier, freeExperimentUsed, warning in addition to health
  • Store: three new computed signals — isLimitedMode, isSlotUsed, showAnalyticsWarning
  • List: non-closable limited-mode banner (info/warn based on slot state); closable analytics-warning banner; Archive/End/Cancel/Abort show info toast instead of disabled state (tooltip-invisible)
  • Configure scheduling: blocked by p-blockUI in limited mode with explanatory message; scheduling cleared by effect before _start so the BE sees no dates (prevents SCHEDULED instead of RUNNING)
  • Configure footer: Start button disabled when tier=LIMITED && freeExperimentUsed=true
  • Configure header + Results header: Stop Experiment shows info toast in limited mode

Test plan

  • pnpm nx test portlets-dot-analytics-data-access — 220 tests passing
  • pnpm nx test portlets-dot-analytics — 335 tests passing
  • pnpm nx test portlets-dot-experiments-portlet — 1407 tests passing
  • Manual: switch server to FEATURE_FLAG_EXPERIMENTS=false, verify limited-mode banners and blocked actions in the Experiments portlet
  • Manual: verify Analytics portlet health guard redirects correctly for NOT_CONFIGURED and CONFIGURATION_ERROR

🤖 Generated with Claude Code

This PR fixes: #37659

Angular/TypeScript implementation of the limited-mode UI and analytics health
response mapping, consuming the new BE gate fields from issue #37659.

Analytics portlet:
- HealthEntity type updated — adds health field (OK|NOT_CONFIGURED|CONFIGURATION_ERROR);
  legacy available field preserved for rollback safety
- DotAnalyticsService.healthCheck() maps health field first, falls back to available
- analyticsHealthGuard now allows on HealthStatusTypes.OK (was AVAILABLE)
- dot-analytics-health-check.resolver extracts health field from ExperimentsHealthResponse
- 220 tests passing in portlets-dot-analytics-data-access

Experiments portlet:
- ExperimentsHealthResponse interface added to dot-experiments.service; healthCheck()
  now returns the full response (tier, freeExperimentUsed, warning) rather than just health
- Store: healthResponse replaces healthStatus in state; new computed signals isLimitedMode,
  isSlotUsed, showAnalyticsWarning drive limited-mode UI
- List component: non-closable limited-mode info/warn banner; closable analytics-warning
  banner; Archive/End/Cancel/Abort show info toast in limited mode instead of disabled state
- Configure component: scheduling section blocked (p-blockUI) in limited mode with
  informational message; scheduling cleared via effect so autosave never sends dates that
  would cause _start to return SCHEDULED; Start button disabled when slot occupied
- Configure header + Results header: Stop Experiment shows info toast in limited mode
- 1407 tests passing in portlets-dot-experiments-portlet

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@claude

claude Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @freddyDOTCMS's task in 2m 25s —— View job


Code Review — limited-mode UI & analytics health gate (FE)

New Issues

  • 🟠 High: core-web/libs/portlets/dot-experiments/portlet/src/lib/dot-experiments-configure/dot-experiments-configure.component.html:92 — Stray o character prepended to the line: o [gated]="$isGated()". Angular parses this as a bogus static attribute o on <dot-experiments-configure-scheduling> and ships it to the DOM. It compiles (so tests/build stay green) but it is clearly an unintended edit artifact and should be removed. Fix this →

  • 🟠 High: core-web/libs/portlets/dot-experiments/portlet/src/lib/dot-experiments-configure/components/dot-experiments-configure-footer/dot-experiments-configure-footer.component.ts:6 — import { map } from 'rxjs/operators' is unused — the footer builds #healthResponse with toSignal(...healthCheck(), { initialValue: null }) and never pipes map. CI runs nx affected -t lint and an unused import fails the build. (The header, results-header, and configure components all use their map import; only the footer imports it without use.) Fix this →

  • 🟡 Medium: core-web/libs/portlets/dot-experiments/portlet/src/lib/dot-experiments-configure/dot-experiments-configure.component.ts:588-597 — The doc block ending …would turn one save into a round trip. documents mirrorFormEffect, but the new clearSchedulingInLimitedModeEffect was inserted directly beneath it (with its own /** … */). The original comment now dangles detached above the wrong member. Move it back to sit directly above mirrorFormEffect.

  • 🟡 Medium: duplicate health requests on the configure screen. dot-experiments-configure.component.ts:194, …configure-footer.component.ts:75, and …configure-header.component.ts:195 each independently call inject(DotExperimentsService).healthCheck() via toSignal. Since all three render together on the configure screen, opening it fires GET /api/v1/experiments/health three times (the results screen adds two more). Consider resolving tier/freeExperimentUsed once (route resolver or the configure store) and passing it down, rather than one HTTP call per component. Not a correctness bug, but wasteful and racy if the three responses ever disagree.

  • 🟡 Medium: core-web/libs/portlets/dot-experiments/portlet/src/lib/dot-experiments-list/dot-experiments-list.component.html:36 — The showAnalyticsWarning banner lives in the @else branch, which only renders when isMisconfigured() is false, i.e. health === OK. Assumption: the warning is meant for the "Analytics App not configured" case, where health is NOT_CONFIGURED and isMisconfigured() is true — in which the misconfiguration empty-state renders instead and this banner is never seen. What to verify: confirm with the BE contract (spec: Feature-flag gates for analytics and experiment endpoints (#37659) #37690) whether warning: 'analytics_disabled' is ever returned together with health: OK; if not, this banner is unreachable.

Notes

  • The health-first / available-fallback mapping in dot-analytics.service.ts and the ExperimentsHealthResponse extension are clean and well-tested; the legacy fallback paths have explicit coverage.
  • clearSchedulingInLimitedModeEffect settles after one extra run (the $model write re-triggers the effect, but the second pass finds dates already null and no-ops) — no infinite loop. Good.

Blocking: the two 🟠 High items (stray o, unused map import) should be fixed before merge.
· issue-37659-analytics-experiment-flag-gates-fe

…igure screen

US2/AC1 — info banner in configure screen:
- Adds a non-dismissable p-message severity="info" above the configure form
  when isLimitedMode()=true, showing the limited-mode copy and 10-day cap.
- New i18n key: experiments.limited-mode.configure.info

US2/AC2 — Start confirmation dialog in limited mode:
- When tier=LIMITED and slot is free, onStart() intercepts with a
  p-confirmDialog (key: limitedModeStartConfirm) showing the spec-required
  message about one free experiment, inability to stop, and upgrade CTA.
- "Continue" dispatches startRequested(); "Cancel" dismisses with no action.
- New i18n keys: experiments.limited-mode.start.confirm.{header,message,accept}
- Adds a second p-confirmDialog to dot-experiments-configure.component.html
  with the distinct key so the limited-mode confirm does not collide with
  the existing configure-shell confirmation dialogs.
- ConfirmationService added to configure-footer spec providers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The BE now serializes ExperimentsHealthView.Tier as "full"/"limited" and
Warning as "analytics_disabled" (lowercase via @jsonvalue). Updates all
TypeScript comparisons, the ExperimentsHealthResponse interface, and test
mocks to use the lowercase values consistently across the experiments portlet.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant