-
-
Notifications
You must be signed in to change notification settings - Fork 2
with_codec should reject array OID collisions #173
Description
with_array_type rejects array_oid values that collide with registered scalar codecs (_text_codecs and _binary_codecs), but with_codec doesn't perform the reverse check against array OIDs. This produces silently unreachable dead codecs in two scenarios:
-
Built-in array OID as scalar codec:
CodecRegistry.with_codec(1007, SomeCodec)?succeeds because OID 1007 isn't in_text_codecsor_binary_codecs(it's handled via_ArrayOidMap). Butdecode()always takes the array path first for OID 1007, so the scalar codec is never reached. -
Custom array OID as scalar codec:
CodecRegistry.with_array_type(9000, 600)?.with_codec(9000, SomeCodec)?succeeds because OID 9000 is in_custom_array_element_oids, not in the codec maps. Again,decode()takes the array path first.
with_codec should check _ArrayOidMap.is_array_oid(oid) and _custom_array_element_oids.contains(oid) and error on collision, matching the symmetry of with_array_type.
Found during review of #172.