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

GnoDev - Conflicting Package Resolution Between Personal Repo and Examples Folder #2665

Open
Molaryy opened this issue Aug 7, 2024 · 5 comments

Comments

@Molaryy
Copy link
Contributor

Molaryy commented Aug 7, 2024

Description

I was preparing to create a PR to the examples folder with a project from my personal repository. I copied the contents of my realm and package into examples/gno.land/r in the main repository. In my code, I decided to change a type from int to uint64 because the value will never be below 0 in the package that I copied to the examples folder.

To test the changes, I made the necessary updates in my personal repository and used gnodev to check the results. However, I encountered an issue where gnodev sometimes picked up the old version of the package from the examples folder instead of the updated one from my repository. This led to errors that I had already resolved in my repository, causing confusion as I didn't realize gnodev was using the code from the examples folder.

After discussing with Leon and investigating further, I realized that gnodev was conflicting between the two packages due to the same name, causing it to sometimes pick the outdated package.

It would be helpful if gnodev could analyze the current package/realm and, if it finds a package with the same name in the examples folder, issue a warning. This would prevent confusion and ensure the correct package is used.

@leohhhn
Copy link
Contributor

leohhhn commented Aug 8, 2024

@gfanton remember when we discussed this? It has claimed its first victim

@deelawn
Copy link
Contributor

deelawn commented Aug 13, 2024

@Molaryy can you see if it works if you use gnodev's -root flag to point to the directory containing the examples/ folder with the changed realm code you want to load?

@leohhhn
Copy link
Contributor

leohhhn commented Aug 14, 2024

@deelawn the issue is a bit different;

By default, gnodev loads the examples folder. Say, this contains p/demo/avl.

Then, a user might open up a completely different folder outside of the local copy of the monorepo, and create a package with the pkgpath p/demo/avl, and running gnodev . to deploy it, thus creating a conflict. The issue here is that gnodev does not handle this case very clearly, ie the load order is not explicit to the user. The issue @Molaryy had was that he was changing his code in one of the two places, but gnodev was watching the other one, where the code was not being changed.

@gfanton
Copy link
Member

gfanton commented Aug 23, 2024

I see. I'm currently working on changing the way packages will be loaded in gnodev by implementing a lazy loading approach. First, to only load needed packages, which will improve reload speed (by a lot). Secondly, to be able to choose a different backend. For example, not targeting the example folder but a chain itself. I will keep what you describe in mind and find a way to avoid confusion as much as possible.

@leohhhn
Copy link
Contributor

leohhhn commented Sep 10, 2024

@gfanton for this specific case, I think that if the user specifies a local path for a package to be loaded, that one should take precedence over the gnohome one. Also, there should be a clear message to the user that a duplicate pkgpath was found, and that the specified path was loaded instead of the gnohome one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
Development

No branches or pull requests

4 participants