[test][page-templates] Cover client-side pageEmbed cycle / self-embed / depth guard #31
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
From review of #17 (merged to develop).
The cycle / self-embed / depth guard (
PAGE_EMBED_MAX_DEPTH = 5) lives only on the client inapps/client/src/features/editor/components/page-embed/page-embed-view.tsxandpage-embed-ancestry-context.tsx. The server returns a single level and does not recurse (see the note inpage-template.controller.ts: enforced CLIENT-side only), so this guard is the only protection against runaway nested rendering — and it is currently untested.Client test infra exists (vitest + RTL). Add unit tests for:
chain/hostPageIdconstruction in the provider;isCycle(ancestor already in chain, and self-embed at top level viahostPageId === sourcePageId);isTooDeep(chain length >= max depth);page-embed-picker.tsx).Severity: high (correctness + anti-DoS).