Scope
Port Bun corpus position 3984, js/third_party/grpc-js/test-metadata.test.ts (29 active tests).
Required contracts
- validate and normalize metadata keys
- require strings for ordinary keys and Buffers for
-binkeys - reject non-ASCII ordinary values
- implement set/add/remove/get/getMap
- clone metadata without sharing binary buffers
- merge without mutating the source
- convert to and from HTTP/2 headers, including base64 binary values
- preserve validation/conversion causes with operation, key, and source-module stack context
Verification
- all 29 focused upstream tests pass without unsupported cases
- permanent diagnostics cover validation context and binary clone isolation
- existing gRPC, SQL adapter, and third-party gates remain green