Skip to content

fix(uve): forward all page params (mode, language, persona, variant, time machine) to Page Health scanner#36184

Merged
fmontes merged 4 commits into
mainfrom
fmontes/pass-all-params-to-page-health
Jun 16, 2026
Merged

fix(uve): forward all page params (mode, language, persona, variant, time machine) to Page Health scanner#36184
fmontes merged 4 commits into
mainfrom
fmontes/pass-all-params-to-page-health

Conversation

@fmontes

@fmontes fmontes commented Jun 16, 2026

Copy link
Copy Markdown
Member

What

The UVE Page Health a11y/GEO scanner only received the page path and host_id, so dotCMS re-resolved the page against defaults — always scanning the published page in the default language/persona/variant, regardless of the state open in the editor. Users could not scan a draft before publishing, which is a primary documented benefit of the feature.

This forwards every page-resolving param onto the scanned URL so the scanner re-renders exactly what the editor is showing:

Editor-fetch-only params (clientHost, depth, url) are excluded so they don't leak to the public scanner. The default variant and default persona are dropped via normalizeQueryParams, matching the rest of the editor.

Scope

  • dot-ema-shell.component.tshandleScannerToolClick() appends the page params; new #getScannerPageParams() helper builds them from uveStore.pageParams() using the DotPageAssetKeys enum.
  • dot-ema-shell.component.spec.ts — assert all params are forwarded, editor-fetch params are excluded, and default variant/persona are dropped.

No backend changes: the scanner fetches the URL verbatim, so the params survive the round-trip.

Closes #36183

The Page Health a11y/GEO scanner only received the page path and host_id,
so dotCMS re-resolved the page against defaults — always scanning the
published page in the default language/persona/variant, ignoring the
state open in the editor.

Forward every page-resolving param onto the scanned URL: mode (so drafts
and previews scan correctly), language_id, persona, variantName, and
publishDate (Future Time Machine). Editor-fetch-only params (clientHost,
depth, url) are excluded so they don't leak to the public scanner. The
default variant and default persona are dropped via normalizeQueryParams
to keep the URL clean, matching the rest of the editor.

Closes #36183

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Claude finished @fmontes's task in 1m 19s —— View job


Rollback Safety Analysis

  • Read rollback-unsafe categories reference
  • Get full PR diff
  • Analyze diff against unsafe categories
  • Apply appropriate label

Verdict: ✅ Safe to Roll Back

All changes in this PR are confined to two frontend Angular TypeScript files:

File Change
dot-ema-shell.component.ts Adds #getScannerPageParams() helper; appends page-resolving params to scanner URL
dot-ema-shell.component.spec.ts Updates and expands unit tests

Analysis against all rollback-unsafe categories:

Category Finding
C-1 Structural Data Model No DB schema changes
C-2 Elasticsearch Mapping No ES mapping changes
C-3 Content JSON Model Version No CURRENT_MODEL_VERSION bump
C-4 DROP TABLE/COLUMN No DDL drops
H-1 One-Way Data Migration No data migrations
H-2 RENAME TABLE/COLUMN No renames
H-3 PK Restructuring No PK changes
H-4 New Field Type No new field types
H-5 Storage Provider No storage config changes
H-6 DROP PROCEDURE/FUNCTION No stored procedure changes
H-7 NOT NULL without default No schema changes
H-8 VTL Viewtool Contract No viewtool changes
M-1 Column Type Change No schema changes
M-2 Push Publishing Bundle No bundle format changes
M-3 REST/GraphQL Contract No API contract changes — only forwarding existing query params to existing scanner endpoint
M-4 OSGi Interface No OSGi changes

Rollback behavior: Rolling back to N-1 reverts to the previous scanner behavior — the scanner receives only the page path and host_id, falling back to defaults (published page, default language/persona/variant). This is a functional regression (the PR's fix is lost) but causes no data loss, no errors, and no broken state.

Label applied: AI: Safe To Rollback

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

❌ Codex Review failed — openai.gpt-5.5

The review job failed before producing output. See the run for details.

Run: #27589877061

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

🤖 Bedrock Review — deepseek.v3.2

[🟡 Medium] core-web/libs/portlets/edit-ema/portlet/src/lib/dot-ema-shell/dot-ema-shell.component.ts:357 — The comment incorrectly states that personaId is the SPA-friendly key, but the code uses PERSONA_KEY (which is com.dotmarketing.persona.id). This is a documentation mismatch that could mislead developers about the correct parameter key for backend persona handling.

[🟡 Medium] core-web/libs/portlets/edit-ema/portlet/src/lib/dot-ema-shell/dot-ema-shell.component.ts:395 — The method #getScannerPageParams() filters out empty strings, but params.publishDate could be an empty string from the store. This is fine, but note that the comment says publishDate is forwarded, yet an empty value would be omitted, which might be intentional but is not documented.

[🟡 Medium] core-web/libs/portlets/edit-ema/portlet/src/lib/dot-ema-shell/dot-ema-shell.component.ts:401 — The check persona && persona !== DEFAULT_PERSONA.identifier could fail if persona is an empty string or null/undefined. The persona variable is taken from params[PERSONA_KEY], which may not be defined, but the guard persona handles falsy values correctly.

[🟡 Medium] core-web/libs/portlets/edit-ema/portlet/src/lib/dot-ema-shell/dot-ema-shell.component.ts:406 — The check params.variantName && params.variantName !== DEFAULT_VARIANT_ID assumes params.variantName is a string. If it's null or undefined, it's correctly omitted, but the type DotPageAssetParams should be verified to ensure variantName can be nullable.

[🟡 Medium] core-web/libs/portlets/edit-ema/portlet/src/lib/dot-ema-shell/dot-ema-shell.component.spec.ts:1562 — The test 'should forward all page-resolving params...' includes a publishDate value of '2026-06-15'. Ensure the date format matches what the backend expects (ISO-like string) and that it's not a placeholder that could cause time-machine rendering issues.

[🟡 Medium] core-web/libs/portlets/edit-ema/portlet/src/lib/dot-ema-shell/dot-ema-shell.component.spec.ts:1591 — The test 'should omit the default variant from the scanned URL' uses DEFAULT_VARIANT_ID and DEFAULT_PERSONA.identifier. Verify these constants are correctly imported and match the values used in the component logic to avoid false-positive tests.


Run: #27633569135 · tokens: in: 3047 · out: 605 · total: 3652

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

This PR updates the UVE Page Health (a11y/GEO) scanner launch URL so it forwards the editor’s page-resolving state (mode, language, persona, variant, and time machine date), ensuring the scanner renders and scans the same page state the user is viewing in the editor rather than defaulting to published/default selections.

Changes:

  • Append editor page-resolving params to the scanner URL via a new helper (#getScannerPageParams()).
  • Normalize/omit default selections (default persona/variant) to keep the scanned URL clean.
  • Extend unit tests to assert forwarded params and ensure editor-fetch-only params aren’t leaked.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
core-web/libs/portlets/edit-ema/portlet/src/lib/dot-ema-shell/dot-ema-shell.component.ts Adds helper to forward page-resolving params onto the scanner URL.
core-web/libs/portlets/edit-ema/portlet/src/lib/dot-ema-shell/dot-ema-shell.component.spec.ts Adds assertions that all relevant params are forwarded and editor-only params are excluded.

The default page fixture provides language_id and mode, so the scanner
URL now carries them. Build the expected URL from the live pageParams()
rather than hardcoding values, keeping the assertion fixture-independent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The scanner URL is fetched and rendered by the dotCMS backend, not the
SPA. normalizeQueryParams() renamed the persona param to the SPA-friendly
personaId, which the backend page render ignores (it reads
com.dotmarketing.persona.id, WebKeys.CMS_PERSONA_PARAMETER) — so the scan
would silently drop the selected persona.

Build the scanner params with the backend persona key directly and drop
the default persona/variant manually instead of going through
normalizeQueryParams.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@fmontes

fmontes commented Jun 16, 2026

Copy link
Copy Markdown
Member Author

Good catch @copilot — confirmed against the backend. The scanner URL is fetched and rendered by dotCMS (VisitorAPIImpl reads request.getParameter(WebKeys.CMS_PERSONA_PARAMETER) = com.dotmarketing.persona.id), so the SPA-friendly personaId would have been silently ignored.

Fixed in 9c54843: dropped normalizeQueryParams for the scanner params and now send the persona under com.dotmarketing.persona.id directly, dropping the default persona/variant manually. Tests and JSDoc updated to assert the backend key. All four comments are addressed by this change.

Copilot AI commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Good catch @copilot — confirmed against the backend. The scanner URL is fetched and rendered by dotCMS (VisitorAPIImpl reads request.getParameter(WebKeys.CMS_PERSONA_PARAMETER) = `com.dotmarketi...

Verified — PERSONA_KEY (com.dotmarketing.persona.id) is used directly in both the implementation and the test assertions, normalizeQueryParams is gone from the scanner path, and all 1300 tests pass.

@fmontes fmontes added this pull request to the merge queue Jun 16, 2026
Merged via the queue into main with commit f3b0b4a Jun 16, 2026
67 of 68 checks passed
@fmontes fmontes deleted the fmontes/pass-all-params-to-page-health branch June 16, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : Frontend PR changes Angular/TypeScript frontend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Page Health scanner ignores UVE mode, language, persona, variant and Time Machine — always scans published page

5 participants