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
Problems with Page.source_filename
, Page.iter_source_filenames
with alternatives are enabled
#959
Closed
Conversation
This file contains 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
dairiki
force-pushed
the
bug.siblings-dependency-tracking
branch
2 times, most recently
from
December 13, 2021 04:01
4d7a523
to
2752049
Compare
When alts are enabled, Page.source_file was being generated based on the page.alt. This is not correct, since the alt-specific file may not exists. E.g. if there is only a `contents.lr`, for `alt="en"` `source_file` was returning the non-existent file `contents+en.lr`. In general, `.source_filename` and `.iter_source_filenames` should return only extant source filenames. Dependency tracking for the blog pages of the example site is not working. They get rebuilt every build. This has something to do with the `Siblings` virtual source object for the blog pages not listing the correct source filenames due to the issue with Page.source_file described above.
dairiki
force-pushed
the
bug.siblings-dependency-tracking
branch
from
December 13, 2021 16:50
2752049
to
720cd74
Compare
Refactor to add _source_filenames in lieu of _source_alts system field.
There's no point in storing the huge long string containing multiple file names and hashes in the build state db.
dairiki
force-pushed
the
bug.siblings-dependency-tracking
branch
from
December 13, 2021 23:58
720cd74
to
69141a9
Compare
4 tasks
Some of the assumptions I made in this PR are incorrect. Primarily: I now believe that Closing in favor of #1007 |
2 tasks
dairiki
added a commit
to dairiki/lektor
that referenced
this pull request
Feb 27, 2023
This exercises the issue with dependencies on VirtualSourceObjects when alts are enable that is described in lektor#1007 and lektor#959.
dairiki
added a commit
that referenced
this pull request
Mar 8, 2023
* test(builder): add test for virtual source dependency tracking issue This exercises the issue with dependencies on VirtualSourceObjects when alts are enable that is described in #1007 and #959. * The identity of VirtualSourceObjects depends on their alt. * refactor: make VirtualSourceInfo a dataclass * refactor: add is_changed method to FileInfo and VirtualSourceInfo * test: exclude pure virtual methods from coverage testing
dairiki
added a commit
to dairiki/lektor
that referenced
this pull request
Sep 11, 2023
* test(builder): add test for virtual source dependency tracking issue This exercises the issue with dependencies on VirtualSourceObjects when alts are enable that is described in lektor#1007 and lektor#959. * The identity of VirtualSourceObjects depends on their alt. * refactor: make VirtualSourceInfo a dataclass * refactor: add is_changed method to FileInfo and VirtualSourceInfo * test: exclude pure virtual methods from coverage testing
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.
In playing around to look at another issue, I noticed that when building the example project, the blog pages are always rebuilt, even if they have not been changed.
I.e.
Then, do it again. Since no source has been changed, nothing should be rebuilt. But:
The blog posts are always rebuilt.
Issue(s) Resolved
I believe the root cause of this is that
Page.source_filename
is, in some cases, returning bogus values — specificallythe name of non-existing files. E.g. if only a
contents.lr
exists,.source_filename
still returnscontents+de.lr
for thealt="de"
version of the page. Since this is used for dependency tracking, things break if this points to a non-existing file.Looking further, I think that
SourceObject.source_filename
is, or should be deprecated in favor ofSourceObject.iter_source_filenames
. Again, since this is used for dependency tracking, we usually (always?) care about all the source files, not just the "primary" one.Related Issues / Links
Not sure.
Description of Changes