-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
lib.fileset
: Representation for empty file sets without a base path
#257351
Conversation
lib.fileset.unions []
worklib.fileset
: Representation for empty file sets without a base path
I'm not sure about the approach here. I understand that having a value to represent |
The motivation comes from this example, which should work: toSource {
root = ./foo;
fileset = intersect ./foo ./.;
} If Extending that, this should also succeed without an error: toSource {
root = ./foo;
fileset = intersect ./foo ./bar;
} though this would give an empty result, but that's as one would expect. (this will definitely have to go into the design document) |
I'd rather have a working abstraction than a leaky (broken) one that is "extra readable". |
Agreed that the combination of Only then it seems inevitable to produce a special kind of value for @roberth: Fully agreed. A particularly involved implementation is still better with a well-articulated rationale. |
The base path is mostly an invisible implementation detail, users shouldn't have to know about it. The only interaction of it with the user is in this error message:
This error should only be thrown when it's relevant, meaning when there could be some file outside the
Comparatively, |
34dde44
to
5141148
Compare
I now updated this to use Furthermore, I added a section to the design document explaining why such a value is needed and the problem with alternatives. Valentin also confirmed in a meeting that he agrees with this being needed. I think this is ready to be merged, and unless there are any complaints in the next couple days I'll merge this myself. |
5141148
to
5ab7764
Compare
`unions []` now works! Notably the new empty value without a base is not exposed in the interface. I don't know of any use case for it.
5ab7764
to
4f35f00
Compare
In PM's @fricklerhandwerk made the suggestion to call it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One off-topic suggestion. LGTM!
@@ -41,9 +41,16 @@ An attribute set with these values: | |||
- `_type` (constant string `"fileset"`): | |||
Tag to indicate this value is a file set. | |||
|
|||
- `_internalVersion` (constant `2`, the current version): | |||
- `_internalVersion` (constant `3`, the current version): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be in a file like fileset/internal/README.md
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I view lib/fileset/README.md
as the internal contributor documentation, where I think this makes sense to have. It's not part of the public interface, but you need to know about it to contribute, which can mean to change the internals
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should link to the user docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now done in #258832 (already merged myself)
Description of changes
Changes the internal fileset structure to also be able to represent empty file sets without any base path. This can then be used as the return value of
unions []
.Once the
lib.fileset.intersect
combinator from the full WIP combinators is added, this will also be suitable as a return value for e.g.intersect /foo /bar
.Notably the new empty singleton value is not exposed in the interface, because I don't know of any use case for it. It could be added later if a use case emerges.
This work is sponsored by Antithesis ✨
Things done