Skip to content

feat: add FEATURE_FLAG_DOTAI_CONFIG_UI and implement legacy guard to support dotAI configuration redesign - #37222

Merged
KevinDavilaDotCMS merged 5 commits into
mainfrom
36826-dotai-provider-configuration-ui--add-feature-flag
Aug 26, 2026
Merged

feat: add FEATURE_FLAG_DOTAI_CONFIG_UI and implement legacy guard to support dotAI configuration redesign#37222
KevinDavilaDotCMS merged 5 commits into
mainfrom
36826-dotai-provider-configuration-ui--add-feature-flag

Conversation

@KevinDavilaDotCMS

@KevinDavilaDotCMS KevinDavilaDotCMS commented Aug 25, 2026

Copy link
Copy Markdown
Contributor
2026-08-25.14-46-15.mov

Why DotAiConfigDetailLegacyComponent exists

This is not a new screen — it's a verbatim restoration of what DotAiConfigDetailComponent looked like before #37048 (the "Provider Config" JSON editor on the left + "Example JSON" reference on the right), pulled from the commit right before #37048 overwrote it (git show 2a161f6^:.../dot-ai-config-detail.component.ts, where 2a161f6 is #37048's merge commit).

#37048 redesigned DotAiConfigDetailComponent in place, so the old UI no longer exists anywhere in the tree except git history. Since this redesign now ships behind FEATURE_FLAG_DOTAI_CONFIG_UI (default false), simply falling back to the generic Apps config screen when the flag is off would have been a regression for existing customers — that's not the screen they use today for dotAI. Restoring the pre-#37048 component as a separate file (DotAiConfigDetailLegacyComponent, selector dot-ai-config-detail-legacy) preserves their exact current experience: same markup, same EXAMPLE_CONFIG, same DotAiService.getConfig/saveConfig calls against /completions/config, which are unchanged and still live.

dot-apps.routes.ts picks between the two via canMatch: flag on → DotAiConfigDetailComponent (new capability-cards UI); flag off/default → DotAiConfigDetailLegacyComponent (this one), so nothing changes for customers who haven't opted in.

This PR fixes: #36826

@KevinDavilaDotCMS KevinDavilaDotCMS linked an issue Aug 25, 2026 that may be closed by this pull request
13 tasks
@github-actions github-actions Bot mentioned this pull request Aug 25, 2026
13 tasks
@github-actions github-actions Bot added Area : Backend PR changes Java/Maven backend code Area : Frontend PR changes Angular/TypeScript frontend code labels Aug 25, 2026
@claude

claude Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Claude finished @KevinDavilaDotCMS's task in 1m 31s —— View job


Code Review

Reviewed the full diff against origin/main. The five prior automated-review findings are all resolved. Two new resilience concerns worth a look, both non-blocking.

New Issues

  • 🟡 Medium: dot-ai-config-detail-match.guard.ts:20 — The guard returns getFreshFeatureFlag(...) directly, and getKey() (dot-properties.service.ts:26) has no error handling. If the /api/v1/configuration/config call fails transiently, the canMatch observable errors rather than emitting false. An errored CanMatchFn observable makes the Router raise a NavigationError and cancel navigation — it does not fall through to the legacy route below it. So a transient config-API hiccup breaks the dotAI screen entirely (neither new nor legacy UI loads), where previously (no guard) the route always matched. Consider catchError(() => of(false)) so a failed check degrades to the legacy screen instead of aborting navigation. Fix this →

  • 🟡 Medium: dot-properties.service.ts:120normalizeFlagValue coerces FEATURE_FLAG_NOT_FOUND → true. That convention fits flags meant to default on, but FEATURE_FLAG_DOTAI_CONFIG_UI is meant to default off (show legacy). If the endpoint ever returns NOT_FOUND for this key, the guard yields true and renders the new UI — the opposite of the intended safe default and the "no change for existing customers" goal. The new test at dot-properties.service.spec.ts:213 locks in this NOT_FOUND → true behavior.

    • Assumption: the key is whitelisted (ConfigurationResource.java) and committed as false in dotmarketing-config.properties, so in normal operation the API returns false and this path isn't hit — hence Medium, not higher.
    • What to verify: confirm the config API always returns this whitelisted key so NOT_FOUND can't surface for it; if it can, the guard should treat unknown/failed as false for this default-off flag.

Resolved

  • dotmarketing-config.properties:885 / FeatureFlagName.java:104 — stale comment now correctly names DotAiConfigDetailLegacyComponent as the off-flag fallback.
  • dot-ai-config-detail-legacy.component.scss — added and wired via styleUrls.
  • dot-ai-config-detail-legacy.component.ts:64-67 — signals renamed to the $ convention ($loading/$app/$configJson/$saving).
  • dot-ai-config-detail-legacy.component.html:1 — explicit loading / loaded / error branches; no blank render path.
  • dot-properties.service.spec.ts:190-229getFreshFeatureFlag() now covered (coercion parity, NOT_FOUND, cache bypass).

Note: ChangeDetectionStrategy.Eager at dot-ai-config-detail-legacy.component.ts:71 is used consistently across the dot-apps portlet, so it's a repo convention here, not an issue.
· branch 36826-dotai-provider-configuration-ui--add-feature-flag

rjvelazco
rjvelazco previously approved these changes Aug 25, 2026
nicobytes
nicobytes previously approved these changes Aug 25, 2026
@nicobytes
nicobytes requested a lite review from Copilot August 25, 2026 19:54
dario-daza
dario-daza previously approved these changes Aug 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new FEATURE_FLAG_DOTAI_CONFIG_UI feature flag and uses an Angular canMatch guard to route dotAI config traffic to either the redesigned dotAI config page (flag on) or a restored legacy dotAI JSON editor page (flag off), preserving existing customer behavior by default.

Changes:

  • Introduces FEATURE_FLAG_DOTAI_CONFIG_UI across backend + frontend (defaults to false) and exposes it through the configuration API.
  • Adds DotPropertiesService.getFreshFeatureFlag() and a canMatch guard so route matching reflects flag flips without requiring a full reload.
  • Restores the pre-#37048 dotAI config UI as DotAiConfigDetailLegacyComponent and adds route fallthrough to it when the flag is disabled.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
dotCMS/src/main/resources/dotmarketing-config.properties Adds default value + documentation for the new dotAI config UI feature flag
dotCMS/src/main/java/com/dotcms/rest/api/v1/system/ConfigurationResource.java Whitelists/exposes the new feature flag via /api/v1/configuration/config
dotCMS/src/main/java/com/dotcms/featureflag/FeatureFlagName.java Adds backend constant for FEATURE_FLAG_DOTAI_CONFIG_UI
core-web/libs/dotcms-models/src/lib/shared-models.ts Adds frontend enum entry for FEATURE_FLAG_DOTAI_CONFIG_UI
core-web/libs/data-access/src/lib/dot-properties/dot-properties.service.ts Adds uncached feature-flag fetch (getFreshFeatureFlag) and refactors normalization
core-web/apps/dotcms-ui/src/app/portlets/dot-apps/dot-apps.routes.ts Adds canMatch routing split + legacy fallback routes for dotAI create/edit
core-web/apps/dotcms-ui/src/app/portlets/dot-apps/components/dot-ai-config-detail/dot-ai-config-detail-match.guard.ts Implements canMatch guard driven by FEATURE_FLAG_DOTAI_CONFIG_UI
core-web/apps/dotcms-ui/src/app/portlets/dot-apps/components/dot-ai-config-detail/dot-ai-config-detail-match.guard.spec.ts Adds Jest coverage for the new match guard behavior
core-web/apps/dotcms-ui/src/app/portlets/dot-apps/components/dot-ai-config-detail/dot-ai-config-detail-legacy.component.ts Restores legacy dotAI JSON editor component (TS) for off-flag experience
core-web/apps/dotcms-ui/src/app/portlets/dot-apps/components/dot-ai-config-detail/dot-ai-config-detail-legacy.component.html Restores legacy dotAI JSON editor template (HTML)

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread dotCMS/src/main/resources/dotmarketing-config.properties Outdated
…tate handling and error display; introduce SCSS for layout management
@KevinDavilaDotCMS

Copy link
Copy Markdown
Contributor Author

Addressed all 5 review comments from the automated review (commit 89ae034):

  1. Stale comment — fixed the property/javadoc comment on FEATURE_FLAG_DOTAI_CONFIG_UI (dotmarketing-config.properties + FeatureFlagName.java); it now correctly says the off-flag fallback is DotAiConfigDetailLegacyComponent, not the generic Apps config screen.
  2. Missing .scss — added dot-ai-config-detail-legacy.component.scss and wired it via styleUrls, per the repo's file-structure standard.
  3. Signal $ prefix — renamed the legacy component's signals to the repo convention ($app, $configJson, $saving).
  4. Blank render path — added an explicit $loading state so the template now handles loading / loaded / error instead of rendering blank while $app() is null.
  5. Missing test coverage — added unit tests for getFreshFeatureFlag() in dot-properties.service.spec.ts: value coercion parity with getFeatureFlag(), NOT_FOUND handling, and confirming it bypasses featureFlagCache.

Verified locally: dotcms-ui build, ESLint on all changed files, and Jest (dot-properties service spec + full dot-apps suite) — all green, no regressions.

nicobytes
nicobytes previously approved these changes Aug 25, 2026
dario-daza
dario-daza previously approved these changes Aug 25, 2026
@KevinDavilaDotCMS
KevinDavilaDotCMS added this pull request to the merge queue Aug 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 25, 2026
@KevinDavilaDotCMS
KevinDavilaDotCMS added this pull request to the merge queue Aug 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 25, 2026
@KevinDavilaDotCMS
KevinDavilaDotCMS added this pull request to the merge queue Aug 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 26, 2026
@KevinDavilaDotCMS
KevinDavilaDotCMS added this pull request to the merge queue Aug 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 26, 2026
wezell and others added 2 commits August 25, 2026 21:57
Merge Group Test / Frontend Unit Tests runs nx affected lint-test
(-Pvalidate), which diffs against origin/main (core-web/pom.xml
git.origin.branch). The shallow fetch-depth:1 checkout added for
#37178 has no origin/main ref, so the job fails:

  fatal: ambiguous argument 'origin/main': unknown revision

which cancels every other job in the merge group. Fetch just that
ref, shallow, before the lint-test step runs.

Refs #37178
…on-ui--add-feature-flag' into 36826-dotai-provider-configuration-ui--add-feature-flag
@KevinDavilaDotCMS
KevinDavilaDotCMS dismissed stale reviews from dario-daza and nicobytes via 72536b3 August 26, 2026 03:00
@KevinDavilaDotCMS
KevinDavilaDotCMS requested a review from a team as a code owner August 26, 2026 03:00
@github-actions github-actions Bot added Area : CI/CD PR changes GitHub Actions/workflows and removed AI: Safe To Rollback labels Aug 26, 2026

@wezell wezell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Trying to merge again

@wezell
wezell added this pull request to the merge queue Aug 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 26, 2026
@KevinDavilaDotCMS
KevinDavilaDotCMS added this pull request to the merge queue Aug 26, 2026
Merged via the queue into main with commit f4230f6 Aug 26, 2026
85 of 95 checks passed
@KevinDavilaDotCMS
KevinDavilaDotCMS deleted the 36826-dotai-provider-configuration-ui--add-feature-flag branch August 26, 2026 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area : Backend PR changes Java/Maven backend code Area : CI/CD PR changes GitHub Actions/workflows Area : Frontend PR changes Angular/TypeScript frontend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

dotAI: Provider Configuration UI

6 participants