-
Notifications
You must be signed in to change notification settings - Fork 12
refactor!: move files and add infrastructure for system-level utils #128
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
Conversation
32a2142
to
b1ad0be
Compare
That is a hefty PR, but with good intentions, IMHO. I will take the time to review it thoroughly, but while I do this, I have a couple of questions:
|
[Quick Update]I've solved the merge conflicts and tested from a user perspective, and everything works as intended. Also, the test suite still works seamlessly. With these big changes where much code is moved between places, I like to start with this to ensure that the refactoring didn't change the system's "external behavior" as it should (of course, if unit test coverage was good, this process would be much more reliable and quick 🥲). I will start looking at the refactoring itself, even though I have a good high-level grasp of it due to solving conflicts and navigating the reformed codebase. My takeThis first step towards refactoring the architecture moved the project into cleaner organization, IMHO, and the I am just worried about the the two points I've raised in my previous comment about using Anyway, will make a thorough review ASAP. P.S.: Great work! |
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.
Don't know why I thought it would be hard to review this change, but it ended up being really fast. I just have a single comment about the commit message in "binary
exists" where it should be together ("binary_exists
").
Besides that, I thought it was strange to remove App::new()
, but it does makes sense as it was only used for testing purposes.
In this sense, I reinforce that the only matters that are hanging are the ones I've commented before about the mod.rs
and lore
being public or not. Obs.: On the mod.rs
note, if we choose to go this way, shouldn't we do this for everything (for example, with lore::lore_session
).
It's my fault for being so hard to review. I got distracted when fixing one thing after the other that I forgot to split things into different commits which would have made it much easier to review. Sorry about that.
Yep, the official Rust book doesn't recommend using
Ah, that is what I thought it was for too but then I wondered why it would not have been written as a separate library crate. I'm not 100% on this but if we use
Whoops, nice catch! Will ammend the message.
Yes, I was surprised clippy hadn't complained about this earlier. It was only after the refactoring that it started warning me.
Yes, I hadn't touched any of the |
b1ad0be
to
97e038d
Compare
Hey, @ivinjabraham, and thank you for the response and update. Below is my reply to your points. For the sake of brevity (which by now you know I don't have any 🙃), the points that I didn't answered are because I totally agree or have no comments about. Replies
No worries! I was saying it as a "justification" for needing more time to review this. It is normal for changes to grow big and commits atomicity sometimes gets obscured. Your PR wasn't hard difficult to review at all 😉
Personally, I share the same vision as you in this matter. I understand the argument that having lots of In any case, I would like to hear the opinions of @OJarrisonn and @lorenzoberts on this matter. I know we already discussed this in the past, but given this new context, what do you guys think? Next steps on my endI wish to wait for our fellow contributors response before making any definitive move, but I am really convinced of this. In the meantime, I will resolve the new potential merge conflicts introduced due to the new PR merges and assert everything is working nice. UPDATE: I will also take the liberty of |
I'll always stand my ground against Btw, why just 1 commit? From your bullet list, it seems like each point could be a commit on its own |
Thank you so much for the attention, @OJarrisonn!
I agree with it being ambiguous. We face the same issue with the files of same name inside
However (next reply)...
If this indeed is deprecated in the sense that rustlang will drop the support to it, then there is no discussion and we should avoid using Nevertheless, I confess that I am getting a really mixed view on this matter as both have brought valid sources vouching for either side, and I also found mixed opinions in my research. I could've sworn that Rust The Book mentioned the use of
This is true, nice catch! My bad, I got caught up in the discussion of the decisions and didn't add these "high-level" review comments. @ivinjabraham, indeed we can split this commit into dedicated ones for each bullet point with the removal of If you need help splitting a commit, you can ping me and I will give you on how to do this (in my way, as there is many ways of doing things in git). Surely there are tutorials online, but I don't mind explaining how I do it. |
I agree we should use the updated convention if As for splitting it up, is there an easier method than unstaging the work and using |
Additionally, `lore` was removed as public API. The discusison for this can be found in kworkflow#128. And imports (of modules, external crates and std create) now follow the recommended order. Using `mod.rs` allows for a cleaner directory as we can avoid having a file for each module in the root directory. This makes it easier to identify the important files and represents the compartmentalization of the code better. Signed-off-by: Ivin Joel Abraham <ivinjabraham@gmail.com>
97e038d
to
946c95a
Compare
`lore` was originally intended to serve as a library. However, in kworkflow#128, it was decided to package it as a separate project instead of sideloading alongside the `patch-hub` crate. Signed-off-by: Ivin Joel Abraham <ivinjabraham@gmail.com>
946c95a
to
1d34e5e
Compare
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.
Hi, @ivinjabraham, and thank you for the update!
As I mentioned in the previous comments, I agree with the idea and implementation for each of the 4 parts of the PR. Splitting the change is important (even more so with breaking refactors) for us to keep a good git history.
However, the middle commits about the infrastructure layer and removal of lore break compilation. Splitting a big change into smaller commits is sometimes complicated, so I understand that sometimes we get confused with which part should go to commit A or B 😄
Because commit 3 essentially modifies imports of lore
, I think the root is that some things that should be on commit 2 are on commit 4 and vice-versa, i.e., you've made a mistake in splitting these two. One example is removing the binary_exists()
function in commit 2 and substituting its calls to which::which()
in commit 4.
There is one more complicator to this PR: the merged changes between when this was opened and now. Some recently merged PRs (one even by you) introduced some breaking changes for this PR...
Commit 1
Commit 1 about moving the test_samples
dir looks legit to me, so I merged it into the unstable branch 👍
My suggestion about the rest of the PR
Make a git rebase --interactive
and edit each commit. Make sure the compilation is working (both for bin and tests). Focus on stabilizing the current commit first, then fixing the conflicts that appear with each git rebase --continue
;
Pull the latest upstream unstable, do a git rebase unstable
, and incorporate the new upstream changes by solving the conflicts.
Conclusion
Sorry for being strict here. This is a breaking change to the codebase, so it is important to be really careful. Again, this isn't a pushback on the merit of the PR, as I am already sold on the idea and implementation.
`lore` was originally intended to serve as a library. However, in kworkflow#128, it was decided to package it as a separate project instead of sideloading alongside the `patch-hub` crate. Additionally, `Patch::new` was detected as unused code and was removed. Signed-off-by: Ivin Joel Abraham <ivinjabraham@gmail.com>
1d34e5e
to
af70952
Compare
`lore` was originally intended to serve as a library. However, in kworkflow#128, it was decided to package it as a separate project instead of sideloading alongside the `patch-hub` crate. Additionally, `Patch::new` was detected as unused code and was removed. Signed-off-by: Ivin Joel Abraham <ivinjabraham@gmail.com>
af70952
to
71fb824
Compare
`lore` was originally intended to serve as a library. However, in kworkflow#128, it was decided to package it as a separate project instead of sideloading alongside the `patch-hub` crate. Additionally, `Patch::new` was detected as unused code and was removed. Signed-off-by: Ivin Joel Abraham <ivinjabraham@gmail.com>
89c082c
to
5a6319b
Compare
`lore` was originally intended to serve as a library. However, in kworkflow#128, it was decided to package it as a separate project instead of sideloading alongside the `patch-hub` crate. Additionally, `Patch::new` was detected as unused code and was removed. Signed-off-by: Ivin Joel Abraham <ivinjabraham@gmail.com>
5a6319b
to
99b5238
Compare
`lore` was originally intended to serve as a library. However, in kworkflow#128, it was decided to package it as a separate project instead of sideloading alongside the `patch-hub` crate. Additionally, `Patch::new` was detected as unused code and was removed. Signed-off-by: Ivin Joel Abraham <ivinjabraham@gmail.com>
`lore` was originally intended to serve as a library. However, in kworkflow#128, it was decided to package it as a separate project instead of sideloading alongside the `patch-hub` crate. Additionally, `Patch::new` was detected as unused code and was removed. Signed-off-by: Ivin Joel Abraham <ivinjabraham@gmail.com>
99b5238
to
a4ce681
Compare
I think I've fixed it now! I had to squash some latest changes on unstable that were missing since |
167d77b
to
deba389
Compare
External utilities are moved to a separate directory called `infrastructure`. This includes logging and terminal functions. Some of which were contained in a `utils.rs` file. The contents of that file are now neatly sorted into either `terminal.rs`, `logging.rs` or `macros.rs` Signed-off-by: Ivin Joel Abraham <ivinjabraham@gmail.com>
`lore` was originally intended to serve as a library. However, in kworkflow#128, it was decided to package it as a separate project instead of sideloading alongside the `patch-hub` crate. Additionally, `Patch::new` was detected as unused code and was removed. Signed-off-by: Ivin Joel Abraham <ivinjabraham@gmail.com>
Using `mod.rs` allows for a cleaner directory as we can avoid having a file for each module in the root directory. This makes it easier to identify the important files and represents the compartmentalization of the code better. Additionally, imports (of modules, external crates and std create) in files now follow the recommended order. Signed-off-by: Ivin Joel Abraham <ivinjabraham@gmail.com>
a4ce681
to
2092284
Compare
`lore` was originally intended to serve as a library. However, in kworkflow#128, it was decided to package it as a separate project instead of sideloading alongside the `patch-hub` crate. Additionally, `Patch::new` was detected as unused code and was removed. Signed-off-by: Ivin Joel Abraham <ivinjabraham@gmail.com> Reviewed-by: David Tadokoro <davidbtadokoro@usp.br> Signed-off-by: David Tadokoro <davidbtadokoro@usp.br>
Hey @ivinjabraham, finally deep tested and gave a long thought (again) about this PR. IMHO, I still think this cleans a LOT the file hierarchy and the downside (many Thank you so much for the effort given here, the patience, and the protectiveness in bringing this idea, given that it is normally frowned upon at face value (I was on this boat). Change merged into the unstable branch 👍 |
This is a particularly large commit aiming to clean up the current codebase without code changes. Primarily achieves the following:
src/test_samples
out ofsrc
as it is not code.infrastructure
layer, which is for utilities that manage external dependencies such as logging.mod.rs
inside module directories to clear up the crate root from havingapp.rs
,handler.rs
and so on.std
imports, then internal crate imports and parent module imports.lore
was previously made public API; I'm not sure why. This has been removed.The utility function
binary
exists was also inlined instead.After the following changes,
utils.rs
just hadloading_screen!
left, and since we also had a globallog_on_error!
macro, I've renamedutils.rs
tomacros.rs