-
Notifications
You must be signed in to change notification settings - Fork 279
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
do not automatically create a global configuration file/dirs when it is not found #3223
Conversation
Ok this turns out a lot more fragile than I anticipated. The following test is very useful in understanding how so: |
25bc742
to
3886e4f
Compare
… it's missing, fix setup of tests that involve writing a global config file
3886e4f
to
5c089e5
Compare
I've modified the configuration code so that the config file (and the potentially missing parent dirs) is only created when and if we attempt to write to it (for instance via the CLI |
Switching to draft, I need to make sure that |
I believe the config system is much too complicated and hardly maintainable since it's already very hard to change such a tiny "implementation detail". I intend to attempt a refactor of the whole configuration system at some point. If that happens, I'll be using this as resource (some tests I wrote might be still usable then). |
We did just change the config system, so ... let's let it cool a little bit before any refactorings. Before we undertake any refactorings (which I think, formally, are not supposed to have any API changes or differences to end user / public APIs, I think?) we need to identify what we want to accomplish, and I really think we need to start thinking about "How does this improve things?" beyond code clarity. Code clarity is important! Making things simpler is good! But it's also potentially really invasive, and it's also something that can be draining of attention, and a bit overwhelming. So let's talk through before undertaking another big one. |
I have two main reasons for wanting to do this. Code clarity isn't one. 1 - Isolation As a result yt config set data_dir_path /my/path takes a few seconds, while what it accomplishes can clearly be done in a mere micro seconds. 2 - Maintainability
That's right. I don't intend to break api at any point.
Agreed, there's been a lot going on in this part of the code between the 3.6 and the 4.0 releases, so I'm definitely not going to touch it further before the big release. I'm convinced there's a very clear way to rebuild this that would fix the problems I'm concerned with, but it's not a priority, though I keep bumping into them so I'll attempt something eventually :) |
closing for now, I give up on finding a tidy solution to fix just this problem and maybe I'll propose a clean refactor in the future. |
PR Summary
this is an implementation of the change I proposed in #3045
I wouldn't be surprised that the naive approach breaks a test or two, but maybe it won't. If it does, I hope it will still be easy to fix the places where we currently can't recover from a state where the config file simply doesn't exist, if any.