-
Notifications
You must be signed in to change notification settings - Fork 127
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: unique metadata is not properly typed as a Uint8Array #3141
Conversation
Seems like this change fixes a symptom rather than the cause of the issue. Why isn't the cloned value a |
Arrays coming through http client won't be a Uint8array. We would need to adjust the parser to force this to be a uint8array, but that would leak this logic into the http server, which doesn't need to care that it is a uint8array. |
That's why we encode the Uint8Arrays to base64 in the client, no? I don't think in any case the Uint8Arrays should be encoded as regular Arrays in the APIs, that would make us lose the information that it's binary data. |
Isn't the parser the exact right place to be doing type conversions and enforcement? Generally good practice is do all your parsing, validation, and type conversation at the edge of the system, then have something strongly typed and of the structure you want everywhere else inside the bounds of the system. By "parser" here I'm talking about the codeco codec we use to explicitly parse messages once they come in to the http endpoint. That seems like the right place for this. |
@PaulLeCam @stbrody It's possible it's being decoded correctly at the http layer, but then "lost" when we put it in stream state.
Unique is in the arbitrary properties, so does not retain information that it is a Uint8array. Should |
Yeah I'd be down with adding |
Although we can do this, it doesn't fix the problem, since unique can be Additionally, the SET relation functionality specifies a unique with is an array of string joined by TLDR: This is the easiest fix, whereas other fixes cascade with impacts, possibly on the statestore. |
@dbcfd can you share what made you open this PR in the first place? Are you seeing some behavior in the wild? Is there a repro of the issue you can share? |
3box/ceramic-http-client-rs#9 includes the ability to create single/deterministic models and model instances. Attempting to do so will fail because of this issue. |
fixed by #3149 (or possibly another PR) |
multiformats will fail encoding unless this is specifically a Uint8array