Skip to content

Preserve recursive web scope when modernizing Content Query web parts - #1335

Open
YifengMao wants to merge 3 commits into
devfrom
yifengmao-fid-4-content-query-scope
Open

YifengMao wants to merge 3 commits into
devfrom
yifengmao-fid-4-content-query-scope

Conversation

@YifengMao

Copy link
Copy Markdown
Contributor

Summary

Preserve a non-list Content Query Web Part's configured source-web scope when converting it to Highlighted Content, instead of silently broadening an actual web URL to the entire site collection.

  • Resolve absolute, server-relative, web-relative, and supported ~site/~sitecollection URLs against the source collection, retaining complete nested-web paths.
  • Add a trailing-slash Path managed-property restriction that includes descendants. Use the Contains operator (Path:"web/"), not WebId selection or Path equality, which exclude descendants.
  • Use the source context for non-list CQWP conversion during cross-site migration. Leave list conversion, Content Search, Relevant Documents, and the shared scope helper unchanged.
  • Surface invalid or missing scopes explicitly instead of falling back to the collection.

Unsupported combinations and fidelity limits

Scoped CQWP configurations with active field filters remain unsupported: they log a warning and use the existing skip-part exception path. The page migration continues, but the unsupported part is omitted. This is not a content-preserving migration of that part.

Simply combining Path with another managed-property filter is unsafe because Highlighted Content's flat search filters use OR. An attempted native Title Contains mapping preserved the scope conjunction but failed authenticated classic/modern result comparison, so it was withdrawn. The commit history is preserved; the final tree contains only the scope correction and explicit guard.

This PR does not claim complete CQWP result, content-category, substring-predicate, or ordering equivalence. In particular, classic notebook/folder/image results can still differ from the modern content categories.

Validation

  • Debug builds passed for net10.0 and netstandard2.0; existing package/analyzer warnings remain.
  • A dedicated local verification harness using the repository's CSOM mock provider passed 64 checks covering URL/token forms, nested and root scopes, invalid input, source/destination contexts, and unsupported field-filter guards. These harness checks are not added as repository tests.
  • Direct local PnP verification through the built framework's public page transformation entry point re-migrated a retained unfiltered source and three persisted filtered-source copies to fresh targets. The loaded DLL was hash-matched to the worktree build, source hashes remained unchanged, the unfiltered query retained its non-scope settings, and filtered cases completed with the expected warning and omitted part.
  • Separate app-only search checks exercised recursive Path behavior and similarly prefixed sibling exclusion. These are API semantics checks, not interactive Highlighted Content request traces.
  • Authenticated Playwright checks performed by the coordinating validation session observed a pre-fix result opening an asset from a sibling web, while the scope-only output rendered six in-scope assets and opened source-subweb content. See all worked. The final rebuilt scope-only output retained those six rows, and all three guard pages loaded with the unsupported part absent.

The installed PowerShell module did not contain the local framework changes, so migration validation used the direct-local-library exception rather than claiming public ConvertTo-PnPPage end-to-end coverage. All original fixtures and earlier outputs were retained.

yifengmao and others added 3 commits November 16, 2026 10:48
Resolve CQWP URLs against the source collection, retain descendants with a bounded Path filter, and explicitly skip unsupported field-filter combinations rather than broadening their scope.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use the native Highlighted Content title filter so a single literal Title Contains condition is ANDed with the recursive Path scope. Retain explicit skip diagnostics for unsupported operators, fields, multiple filters, and special query values.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Browser comparison showed the native search title predicate omitted a classic substring match and returned different assets. Restore the explicit scoped-field-filter guard instead of reporting an approximate mapping as supported. Retain the verified recursive CQWP scope fix.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.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

None yet

Development

Successfully merging this pull request may close these issues.

2 participants