Skip to content
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

WIP: fix directory targets with empty subdirs #11226

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ElectreAAS
Copy link
Collaborator

@ElectreAAS ElectreAAS commented Dec 18, 2024

This PR is related to... a lot of things actually.

For some context, let's take this test file from #11116 & #11117:
Why isn't the empty directory output/child restored from cache like output/file?

I'm not really sure, and the original author of this piece of code (rleshchinskiy) doesn't seem very active in this project at this time.
What I am sure of is that breaking the logic of collect is easy to do accidentally, but that at least fixes one problem.

Debugging this is tricky, as a lot of tests fail with a cryptic

Error: Is a directory
-> required by _build/default/a
[1]

I'll note however that the problems likely originates in either #9407, #9470, or #9535.

@ElectreAAS ElectreAAS changed the title WIP: directory targets with empty subdirs WIP: fix directory targets with empty subdirs Dec 18, 2024
@ElectreAAS
Copy link
Collaborator Author

cc-ing the entire planet for good measure, but don't feel obligated to participate (it's the holiday season after all 😃)

@maiste @rgrinberg @rleshchinskiy @snowleopard @moyodiallo @mefyl @ejgallego

@ElectreAAS
Copy link
Collaborator Author

ElectreAAS commented Dec 21, 2024

Belated update before the holidays:
I changed the internal representation of targets (Targets.Produced.t) to be hierarchical - it felt like the right move to detect broken logic, and was mentioned in the comments as something to be done at some point.
From that change I saw that the 'empty-dir' test passed, but a whole lot of other tests didn't. I thought I could work backwards from that to a point where all would pass, but the explanation was harsh: I had broken the caching mechanism, and the only reason the 'empty-dir' test passed was because nothing was cached and everything was rerun 🤦.
When I finally fixed everything else, obviously the 'empty-dir' test didn't pass (the cache worked like it did before my changes, wow!).
At this point in time I have pushed my changes, and they don't break anything, but also don't fix anything...
My hunch now is that this traversal only stores files as metadata, which means that this entries list only contains metadata about files, which means they're the only things getting restored. I tried making a of_files_plus_dirs to be used at that call site, but couldn't get it to work so far. Also I don't know how to generate digests of empty directories to actually store them in metadata...

Hope this progress report isn't too arcanic for reviewers 🙂

@maiste maiste added the shared-cache Shared artefacts cache label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
shared-cache Shared artefacts cache
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants