-
Notifications
You must be signed in to change notification settings - Fork 409
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
Observable change of execution order was introduced in #946 if two matches write same file #1000
Comments
Result of git bisect:
The bug was therefore introduced in #946 |
The bug is independent on whether the threaded runtime is used or not. If I remove the |
We discovered a bug in the new scheduler for hakyll: jaspervdj/hakyll#1000 For this reason, we are reverting back to hakyll version 4.16.0.0 and disable the threaded runtime.
I was able to reproduce this easily, thanks for the excellent instructions. The issue seems in this snippet in match "messages/*/*/index.md" $
version "nav" $ do
route $ setExtension "html"
compile getResourceBody
match "messages/*/*/index.md" $ do
route $ setExtension "html"
compile $ do
files <- getExampleFiles
thisMessage <- For both versions, we have a Deleting it from the first one fixed the issue for me -- we don't actually want the --- a/message-index/site.hs
+++ b/message-index/site.hs
@@ -57,7 +57,6 @@ main = hakyll $ do
match "messages/*/*/index.md" $
version "nav" $ do
- route $ setExtension "html"
compile getResourceBody
match "messages/*/*/index.md" $ do I think it's confusing behaviour and I would prefer Hakyll to throw an error if you write to the same file twice; so I will leave this open to track that. |
Thanks, I have haskellfoundation/error-message-index#461 up. So the error is on our side, and we just could not observe the erroneous result before since we relied on a specific execution order that we shouldn't have depended on. Edit: And I changed the title to reflect the fact that it is not a bug in hakyll :) |
In my sites I create a "recent" version of the files, which I iterate to produce "recent posts" lists. match "posts/*" $ version "recent" $ do
route $ setExtension "html"
compile ... I use the Is there a way to set the nominal route without writing the file and triggering this new warning? Suggestions or alternative approaches welcome! |
@frasertweedale It depends on what you're trying to do. If it's about selecting a subset of the posts, you shouldn't need a different version for this. You can do something like If the content of the file needs to be different (e.g because it's included in a list), you can do this by saving a snapshot at that time: https://github.com/jaspervdj/jaspervdj/blob/4d519d5d21c38c8896d3ddf6067aad006d82a0ec/src/Main.hs#L66 Otherwise... maybe I would try adding a new Sorry to have broken your website! |
@jaspervdj thanks for the pointers. I resolved it by creating a new Context for retrieving the route of the associated "no version" identifier: urlFieldNoVersion :: String -> Context a
urlFieldNoVersion key = field key $ \i -> do
let ident = setVersion Nothing (itemIdentifier i)
empty' = fail $ "No route url found for item " <> show ident
fmap (maybe empty' toUrl) $ getRoute ident I add it to the context: <> urlFieldNoVersion "url0" and updated the template: $for(posts)$
<li>
- <a href="$url$">$fancyTitle$</a>
+ <a href="$url0$">$fancyTitle$</a>
</li>
$endfor$
edit: ah, but the atom feed links are still broken, because the shipped templates use edit 2: this too I have now resolved, by re-snapshotting the content from the "recent" item in the compiler for the no-version, then updating the atom Rules to load those snapshots, which have routes and therefore the edit 3: here's the full diff, in case it is useful to someone: frasertweedale/blog-fp@8eb6866 |
It is a bit difficult to summarize the problem in the description, but I have provided a reproducer below. The problem is that
hakyll
does not produce the correct build results upon the first invocation, but if we force the rebuild of the problematic files (by usingsite watch
and changing something in the file), then hakyll produces the correct result.The bug seems to have been introduced between
4.15.1.1
which does not exhibit the bug, and4.16.1.0
which exhibits the bug. I will try to do agit bisect
to identify the commit which is responsible.Related Issue: haskellfoundation/error-message-index#459
How to reproduce
fa5adac344b3c6659ed2af89488ef5bdf404a9d9
which useshakyll ^>= 4.16.1.0
in its cabal file.message-index
subdirectory and executingcabal run -- site watch
messages/GHCup-00110/index.md
, for example by changing the title or removing one of the other fields.When comparing two versions it is important to clean the
_cache
directory between runs. It is otherwise possible that the faulty version reuses the cache from a run of the correct version, and you can no longer observe the error.The text was updated successfully, but these errors were encountered: