Home / Market / avro schema evolution audit

avro schema evolution audit

Audit Apache Avro writer-reader schema compatibility offline with binary encoding/decoding across defaults, numeric promotions, unions, aliases, enums, and direction rules.

skill★ 508400 dlgithubCC-BY-4.0 content; MIT code; upstream exceptions applyInstall in CosmosUpstream Source

Documentation & Preview

--- name: avro-schema-evolution-audit description: "Audit Apache Avro writer-reader schema compatibility offline with binary encoding/decoding across defaults, numeric promotions, unions, aliases, enums, and direction rules." category: data risk: safe source: self source_type: self date_added: "2026-12-01" author: Koushik-Katkam tags: [avro, schema-evolution, serialization, compatibility, fastavro, testing]

---

Avro Schema Evolution Audit

Overview

Verify Apache Avro writer-reader schema evolution offline using real binary encoding and decoding (fastavro.schemaless_writer and fastavro.schemaless_reader) grounded in the Apache Avro 1.12.0 schema resolution specification. Tests concrete schema changes in both directions (old writer -> new reader and new writer -> old reader), asserts exact decoded payloads and SchemaResolutionError failures, and separates pairwise compatibility checks from transitive registry guarantees.

Distinction from existing data and event-sourcing skills:

When to Use

Prerequisites

How It Works

1. Encode and decode real Avro binary frames

  1. Parse both schemas with fastavro.parse_schema(...) so invalid JSON or unknown types raise structured parse errors (SchemaParseException / UnknownType / ValueError).
  2. Encode each sample record with fastavro.schemaless_writer(buf, writer_schema, record) and decode using fastavro.schemaless_reader(buf, writer_schema, reader_schema).

2. Test both evolution directions and union branches

Run the local verification suite in avro evolution harness:

  1. Field addition & removal:
  1. Numeric promotions & narrowing:
  1. Unions ([...]):
  1. Aliases & enums:

3. Classify compatibility honestly (never overclaim transitivity)

Represent each direction separately as PASS, FAIL, NOT_TESTED, or INVALID_INPUT (backward_status, forward_status); classification is a truthful pairwise "<backward>/<forward> (pairwise samples only)" summary:

Explicitly note:

Examples

Run the self-contained suite in avro evolution harness:

User request: "Check whether adding 'currency' and renaming 'amount' breaks our order-event Avro consumers."
Inputs: Pairwise writer/reader .avsc schemas and representative union/enum samples.
Expected result: Backward checks decode defaults and aliased fields cleanly; missing defaults and incompatible
  numeric narrowing raise SchemaResolutionError; union checks test both null and non-null branches separately;
  report labels output as pairwise sample compatibility only (not universal or transitive).

Limitations

Safety and Side Effects

Sources and related skills