fix: use slash as flag that an object is a CID#217
Merged
achingbrain merged 2 commits intomasterfrom Oct 19, 2022
Merged
Conversation
This was referenced Oct 18, 2022
As per #212 making `asCID` enumerable breaks tests where modules don't handle self-referential data properly. As proposed in #213 this swaps `cid.CID === cid` for `cid['/'] === cid.bytes` as a mechanism to tell consumers that the object in question is a `CID` which lets them write CBOR with the correct tags, for example. Fixes #212 Closes #213
0f19b43 to
e40defc
Compare
rvagg
approved these changes
Oct 19, 2022
Member
rvagg
left a comment
There was a problem hiding this comment.
works for me (although I'm being slowly worn down over these and it's a bit disheartening to see all of the historical compatibility cruft building up in these)
Gozala
requested changes
Oct 19, 2022
Contributor
Gozala
left a comment
There was a problem hiding this comment.
Provided some feedback on this PR. With those comments addressed, I'm fine with these changes. That said I would prefer to spend a bit more time discussing / considering alternatives.
achingbrain
commented
Oct 19, 2022
| assert.strictEqual(cid2.asCID, cid2) | ||
| sender.close() | ||
| receiver.close() | ||
| assert.strictEqual(cid2['/'], cid2.bytes) |
Member
Author
There was a problem hiding this comment.
Moved the assertion to the end so if it fails, we still shut the message channel down and the process doesn't hang forever.
Member
Author
|
@Gozala all done I think! |
github-actions bot
pushed a commit
that referenced
this pull request
Oct 19, 2022
## [10.0.2](v10.0.1...v10.0.2) (2022-10-19) ### Bug Fixes * use slash as flag that an object is a CID ([#217](#217)) ([1cec619](1cec619)), closes [#212](#212) [#213](#213) ### Trivial Changes * **no-release:** rename varint test file so it is run ([#209](#209)) ([e32fe47](e32fe47)) * remove unnecessary dev deps ([#218](#218)) ([a43ffff](a43ffff))
|
🎉 This PR is included in version 10.0.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As per #212 making
asCIDenumerable breaks tests where modules don't handle self-referential data properly.As proposed in #213 this swaps
cid.CID === cidforcid['/'] === cid.bytesas a mechanism to tell consumers that the object in question is aCIDwhich lets them write CBOR with the correct tags, for example.Fixes #212
Closes #213