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

fix: typed links LinkTargetNodePrototype should return ReferencedType #211

Merged
merged 3 commits into from
Jul 29, 2021

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Jul 26, 2021

Found in ipfs/go-ipld-git#46 integrating into go-ipfs
which wants to load typed nodes when it encounters typed links. It errors
because it's trying to load the typed node into the type of the typed link
rather than the referenced type.

ipfs/go-ipld-git#46 currently has codegen using this branch and is now working in go-ipfs doing path traversals through nested linked objects 👌.

Found in ipfs/go-ipld-git#46 integrating into go-ipfs
which wants to load typed nodes when it encounters typed links. It errors
because it's trying to load the typed node into the type of the typed link
rather than the referenced type.
Copy link
Contributor

@mvdan mvdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, we should have a test for this, because now you're making me wonder if bindnode would have made the same mistake.

Entirely reasonable if you don't have time to write a test right now, but in that case we should file an issue as a reminder :)

@rvagg
Copy link
Member Author

rvagg commented Jul 26, 2021

@mvdan 👍 I wanted to, but I burned my whole day trying to figure out how so many of the pieces fit together for the ipld-in-ipfs work that I haven't been up to speed on! Just finding this bug took an unreasonably long time that I'm sure someone more familiar would not have had to spend.. a good learning experience though!
Will pick this up tomorrow and figure out what a test would look like.

@rvagg
Copy link
Member Author

rvagg commented Jul 28, 2021

@mvdan &&/|| @warpfork can you take a look at the latest commit please? Maybe I've gone overboard here but it seemed that to test this properly I had to pull in traversal to the standard node/tests/ to traverse some typed and untyped links and confirm that they pop out from the loader in the right types. It's fine for gen/go but node/bindnode isn't happy but maybe it can't do what I'm asking it to do here so shouldn't have it in the standard list of tests in node/tests/schema.go?

@mvdan
Copy link
Contributor

mvdan commented Jul 28, 2021

A shared test is definitely right :) let me look at bindnode today, the fix might be easy. If not, I'll make bindnode's tests skip this one with a TODO.

@mvdan
Copy link
Contributor

mvdan commented Jul 28, 2021

I looked at adding support for this in bindnode for an hour, and made progress, but it needs more work. So I've stashed those changes, and instead pushed a change here to skip the new test in bindnode :) Still LGTM.

@rvagg rvagg merged commit 145d823 into master Jul 29, 2021
@rvagg rvagg deleted the rvagg/typedlinkfix branch July 29, 2021 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants