chore: replace archived hamba/avro with confluent-avro-go - #414
Merged
Conversation
hamba/avro is archived and unmaintained. Confluent maintains a fork (github.com/confluentinc/confluent-avro-go) that continues the v2 line and powers confluent-kafka-go's Schema Registry Avro serde — the same client library xk6-kafka ships, keeping wire behavior aligned. The fork is a drop-in replacement: codec_union.go, resolver.go, config.go, decoder.go and encoder.go are byte-identical to hamba v2.31.0; schema.go differs only by the import rename, and reader.go only by an endianness-safety fix. This change is the import-path swap (v2.31.0 -> v2.32.0) plus doc reference updates; no behavior changes. Also evaluated twmb/avro (v1.9.0): a capable rewrite with schema evolution, OCF, single-object encoding and native float64 coercion, but adopting it would require rewriting the conversion layer and re-verifying union semantics, for features xk6-kafka does not use.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hamba/avro is archived and unmaintained. This PR swaps it for confluent-avro-go (v2.32.0), Confluent's maintained fork that continues the hamba v2 line and powers confluent-kafka-go's own Schema Registry Avro serde — the same Kafka client library xk6-kafka ships, so our wire behavior stays aligned with Confluent's serde by construction.
Due diligence: fork vs hamba v2.31.0 (our pinned version)
File-by-file diff of the two modules:
codec_union.go,resolver.go,config.go,decoder.go,encoder.goschema.goreader.gobinary.LittleEndian)Our Avro test suite encodes the full behavioral contract (wrapped union maps,
int.datediscriminators, nullable-union bare slices, resolver decode envelopes, logical types, bytes/fixed conversion) and passes unchanged.Alternatives considered
twmb/avro (v1.9.0, actively maintained): a modern rewrite with schema evolution (
Resolve/CheckCompatibility), OCF, single-object encoding, schema-aware JSON, and nativefloat64→int32coercion that could eventually replace ourconvertFloat64ToIntForIntegerFieldslayer. However, it has a completely different API (SchemaNodeintrospection, different union defaults and branch naming), so adopting it means rewriting and re-verifying the entire conversion layer for features xk6-kafka does not use today. It also started in Jan 2026 with a single maintainer, whereas the fork is battle-tested hamba code under corporate maintenance.Changes
go.mod:github.com/hamba/avro/v2 v2.31.0→github.com/confluentinc/confluent-avro-go/v2 v2.32.0avro.go,schema_registry.goand the three Avro test files (package name isavroin both — no code changes)Verification
go build ./...,go vet, gofmt/goimports clean,golangci-lint run: 0 issuesCGO_ENABLED=1 go test ./... -raceagainst a live Kafka + Schema Registry: passNo behavior changes; not a breaking change.