Exercise 3: Demonstrating the Fixed-Depth Limitation — Possible Solution ==================================================================== SETUP ------------------------------ A real chain five levels deep is created, e.g.: "Programming" (level 1, no parent) -> "Web Development" (level 2) -> "Frameworks" (level 3) -> "React" (level 4) -> "React Fundamentals" (level 5). Fetching the deepest page (level 5) through this chapter's own include clause: include: { parent: { include: { parent: true } } } WHAT GETS LOADED ------------------------------ This include reaches exactly three levels: the page itself (level 5, "React Fundamentals"), its parent (level 4, "React"), and its grandparent (level 3, "Frameworks"). Level 3's own parent field is NOT included at all in this query, so pageWithAncestors.parent.parent.parent is undefined - not because "Web Development" doesn't exist, but simply because the query never asked Prisma to fetch it. THE RESULT ------------------------------ flattenAncestors() correctly walks as far as the data actually goes - it produces a breadcrumb of only three entries (Frameworks, React, React Fundamentals), silently missing "Programming" and "Web Development" entirely. There's no error anywhere in the process; the breadcrumb is simply, quietly wrong for any page stored deeper than three levels. WHY THIS WORKS AS AN ANSWER ------------------------------ It uses a real page genuinely five levels deep (not a hypothetical), correctly traces exactly how far the three-level include actually reaches, and correctly identifies the failure as silent and undetectable rather than a crash - directly demonstrating this chapter's own claim that no ORM in this series can express unbounded self-referencing depth without a raw recursive SQL query, since the fix here would require adding yet another hardcoded include level, not removing the limitation entirely.