Skip to content

test/parallel/test-v8-serdes: You probably don't want to test the exact binary V8 ValueSerializer produces #41519

Description

@marjakh

Version

No response

Platform

No response

Subsystem

No response

What steps will reproduce the bug?

The test has this subtest:

{
  const buf = Buffer.from('ff0d6f2203666f6f5e007b01', 'hex');

  const des = new v8.DefaultDeserializer(buf);
  des.readHeader();

  const ser = new v8.DefaultSerializer();
  ser.writeHeader();

  ser.writeValue(des.readValue());

  assert.deepStrictEqual(buf, ser.releaseBuffer()); <<< here
  assert.strictEqual(des.getWireFormatVersion(), 0x0d);
}

Where you're asserting that V8's ValueSerializer produces exactly this buffer when you serialize a TypedArray.

Asserting this prevents V8 from upgrading the ValueSerializer format and is generally not very useful.

The guarantee we have though is that you can still deserialize this exact data and you'll get a TypedArray, since the format is backwards-compatible.

What we don't guarantee is that if you serialize the TypedArray again, you'll get this exact buffer back. Note that the buffer contains the ValueSerializer version number (the first 0d right after ff). We don't guarantee that we don't ever upgrade the version.

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

No response

What do you see instead?

(See above)

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testIssues and PRs related to Node.js core tests and test infrastructure.v8 moduleIssues and PRs related to the node:v8 module.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions