Repository navigation
feat(events): version contract event schemas, add catalogue, and shape tests - #88
Open
ranjeet150 wants to merge 1 commit into
Open
ranjeet150 wants to merge 1 commit into
ranjeet150 wants to merge 1 commit into
Conversation
…e tests - Add EVENT_SCHEMA_VERSION = 1 to audit-registry, payment-router, and usage-meter - Include schema version in every event topic tuple: * audit-registry: CallerAllowed, CallerRevoked, AttestationRecorded, AttestationSuperseded * payment-router: EscrowOpened, PartialReleased, Claimed, Disputed, DisputeResolved, EscrowClosed, SettlementFailed, SettlementRecovered, DeadLettered * usage-meter: RegistrySet, PolicySet, UsageRecorded - Document full event catalogue and schema compatibility policy in docs/event-catalogue.md - Add generator script scripts/generate_event_catalogue.py with CI verification flag (--check) - Add exact event shape and topic regression tests across all three contract test suites - Link event catalogue in README.md Closes FinesseStudioLab#78
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 of Changes
Events are a public interface. Once an indexer, export pipeline, or partner consumes them, altering a topic or reordering a data payload silently breaks downstream consumers without compile-time warnings.
This PR implements event schema versioning, documents the complete catalogue, establishes evolution and compatibility policies, and adds exact shape assertion regression tests.
Key Changes
Schema Versioning Across All Events:
pub const EVENT_SCHEMA_VERSION: u32 = 1;inaudit-registry,payment-router, andusage-meter.#[topic] pub version: u32as the leading topic across every event topic tuple:CallerAllowed,CallerRevoked,AttestationRecorded,AttestationSupersededEscrowOpened,PartialReleased,Claimed,Disputed,DisputeResolved,EscrowClosed,SettlementFailed,SettlementRecovered,DeadLetteredRegistrySet,PolicySet,UsageRecordedversion: EVENT_SCHEMA_VERSION.Event Catalogue & Compatibility Specification:
docs/event-catalogue.mdcontaining the complete catalogue: event name, emitting entrypoint, topic tuple, and detailed data payload layout with types and field descriptions.README.md.Automated Generator Script:
scripts/generate_event_catalogue.pyto parse#[contractevent]definitions from Rust code and verify or regenerate documentation with--checkflag for CI integration.Exact Shape Assertion Regression Tests:
test_event_shapes_and_versioningsuites in each crate (audit-registry/src/test.rs,payment-router/src/test.rs,usage-meter/src/test.rs).Closes #78