fix: a site with more than 1000 nav entries could not build - #52
Merged
Conversation
Scriban caps a loop at 1000 iterations by default -- a sandbox guard aimed at templates from untrusted authors. The theme's own nav loop is subject to it, so once a site had more than 1000 pages in its navigation the render threw "Exceeding number of iteration limit `1000` for loop statement" and the entire build failed. Not a degraded nav: no output at all. Found while generating a large corpus for an unrelated investigation; a 1501-page site could not be built. That is well inside what this generator targets -- the README's own motivation is a site with hundreds of posts. Lift the limit for the render context. The templates here ship with the theme rather than arriving from a site author, so the guard is protecting against a threat that does not exist in this pipeline, at the cost of a hard ceiling on site size. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
A site with more than ~1000 pages in its navigation cannot be built at all:
Scriban's
TemplateContextdefaults toLoopLimit = 1000— a sandbox guard for templates supplied by untrusted authors.TemplateEngineconstructs its context with defaults, so the theme's own nav loops (nav_activeand the recursiverender_navinmain.html) inherit it. Past 1000 entries the render throws and the build produces no output — it doesn't degrade, it fails.That ceiling is well inside what this generator targets; the README's own motivation is a site with hundreds of posts. I hit it building a 1501-page corpus for an unrelated investigation.
The templates here ship with the theme rather than arriving from a site author, so the guard defends against a threat this pipeline doesn't have, while imposing a hard cap on site size. Lifted for the render context.
Type of change
Checklist
dotnet format Netdocs.slnx --verify-no-changespassesdotnet build Netdocs.slnx -c Releasesucceedsdotnet test Netdocs.slnx -c Releasepasses (512, +2 new)docs-site/docs/**— no documented behaviour changes; this only removes a ceilingVerification
Notes for reviewers
RecursiveLimit(default 100) is deliberately left alone — it bounds nav depth rather than width, real nav nesting is nowhere near it, and raising it trades a clear error for a stack overflow.🤖 Generated with Claude Code