-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overlapping cascade
rules are applied in nondeterministic order
#12594
Comments
can i work on this |
@nick2432 this issue isn't very straight forward, so I would prefer to do this myself. |
can you suggest any other good first issue or simple issue? |
I believe I'm encountering similar behavior. |
bep
added a commit
to bep/hugo
that referenced
this issue
Jan 22, 2025
bep
added a commit
to bep/hugo
that referenced
this issue
Jan 22, 2025
bep
added a commit
to bep/hugo
that referenced
this issue
Jan 22, 2025
bep
added a commit
to bep/hugo
that referenced
this issue
Jan 22, 2025
bep
added a commit
to bep/hugo
that referenced
this issue
Jan 22, 2025
bep
added a commit
to bep/hugo
that referenced
this issue
Jan 22, 2025
bep
added a commit
to bep/hugo
that referenced
this issue
Jan 22, 2025
bep
added a commit
to bep/hugo
that referenced
this issue
Jan 22, 2025
bep
added a commit
to bep/hugo
that referenced
this issue
Jan 23, 2025
bep
added a commit
to bep/hugo
that referenced
this issue
Jan 23, 2025
bep
added a commit
to bep/hugo
that referenced
this issue
Jan 23, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If multiple
cascade
rules match the same page, they are applied in arbitrary order according to Go map iteration order, resulting in nondeterminstic builds and extremely confusing behavior.Context
I wanted to create a
/drafts/
section on my site, with the behavior that posts there would be published to production so I could share them for review, but would only be listed locally, to discourage stumbling across them.After some experimentation, I determined that the following
content/drafts/_index.md
appeared to work as desired; I speculated that overlapping cascade rules were applied in a "first-match-wins" order.However, the above only mostly works; I soon discovered that sometimes posts would be excluded from the page list in development.
The bug
It turns out that rules are applied in an arbitrary order, according to Go map iteration order. In practice -- for my build of hugo -- this results in mostly consistent behavior, which is what made the behavior so confusing.
Reproducer
I've pushed a minimal demo to github:
You can see that links are generated and included in the page list most of the time, but that typically 1-3 pages are dropped. Go deliberately injects entropy into the map iteration order, but apparently in this case it is mostly deterministic.
Comment
The issue can be worked around in user sites by eliminating overlapping
cascade
rules -- e.g. I have worked around usingHowever, I still regard this behavior as a bug due to how profoundly confusing and unexpected it is.
cascade:
rules are present in the source as a list, and so IMO it's very reasonable to expect them to be processed in that order.What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes
The text was updated successfully, but these errors were encountered: