-
Notifications
You must be signed in to change notification settings - Fork 14
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
base64Binary literals may not deserialise correctly with classic-level #152
Comments
I have a suite of "compliance" tests, like system tests, in which one sub-suite uses asymmetric cryptography to sign and verify messages between clones. That involves storing public keys in the data. All those tests fail because the public keys are corrupted when retrieved. That's what led me to write the quadstore test included in the ticket. No other tests fail – they whizz through! In more raw terms, I write this:
but get back this:
|
I'd be more than happy to look into this myself, if you like! |
Hello! Apologies for the latency, got married this weekend :). I'm still looking into this regression, for which we need specific tests. Before my break I did manage to discover that this seems to be related to any term that serializes to a string longer than a specific amount of chars. The type of the term itself appears to make no difference. |
Here's two
The array even changes in length (!!!). Weird. |
This doesn't happen with the it('Should serialize and deserialize a single generic literal term having length of 2048', async function () {
const { store: { dataFactory: factory }, prefixes } = this;
const term = factory.literal(''.padStart(2048, 'abab'));
const value = new Uint16Array(4);
const serialized = termWriter.write(value, 0, term, prefixes);
const value_8 = viewUint16ArrayAsUint8Array(value, 0, value.length);
// I/O to/from backend here
const value_16 = viewUint8ArrayAsUint16Array(value_8);
const deserialized = termReader.read(serialized, 0, value_16, 0, factory, prefixes);
should(deserialized.equals(term)).be.true();
}); |
This also doesn't happen when reproducing the steps for (de)serializing a single quad: it('Should serialize and deserialize a quad having terms longer than 127 chars', async function () {
const { store: { dataFactory: factory, separator }, prefixes } = this;
const quad = factory.quad(
factory.namedNode('http://ex.com/s'),
factory.namedNode('http://ex.com/p'),
factory.literal(''.padStart(128, 'abab')),
factory.namedNode('http://ex.com/g'),
);
const value = new Uint16Array(16);
const prefix = `SPOG${separator}`;
const termNames = ['subject', 'predicate', 'object', 'graph'];
const serialized = quadWriter.write(prefix, value, 0, quad, termNames, prefixes);
const value_8 = viewUint16ArrayAsUint8Array(value, 0, value.length);
const value_16 = viewUint8ArrayAsUint16Array(value_8);
const deserialized = quadReader.read(serialized, prefix.length, value_16, 0, termNames, factory, prefixes);
console.log(deserialized);
should(deserialized.equals(quad)).be.true();
}); |
@gsvarovsky could you please test again with version |
m-ld-js Unit tests all pass awesome work. 🫡 |
All right! Will add some more tests and publish a patch version. Thank you for flagging this, it was a major regression. |
Version |
e.g.:
does not deserialise correctly when retrieved in classic-level.
Test case (patch to existing
quadstore.prototype.get.js
test):The text was updated successfully, but these errors were encountered: