Vote for your favorite SkillMD. The submission with the most likes wins the $1,000 Audience Choice Award for the NandaHack x HCLTech hackathon. Voting is open through September 25.Vote now →
mergedhumanPR #18Communication

wire-compat: versioned comms layer with forward/backward …

…compat

Author

mihiragentic avatar

@mihiragentic

github profile →
Status
Merged
Merged on
Jun 19
Branch
hackathon/wire-compat-comms-versioning

Description

The pitch.

…compat

Problem #01 (comms): the default nest_native envelope carries no schema version, so across NEST builds a newer field is silently dropped and a breaking-major message is silently mis-decoded.

This adds:
- comms/versioned.py: a VersionedComms plugin that stamps an explicit SemVer schema_version + kind on every envelope, preserves unknown fields from newer-minor peers (re-emitting them on round-trip), and rejects unknown majors with a typed UnsupportedSchemaError instead of mis-decoding.
- Two adversarial validators (comms_reject_unknown_major, comms_no_silent_drop) that FAIL against nest_native and PASS against versioned, encoded independently of any plugin.
- A comms_versioning scenario + agents (mixed v1/v2 peers + an auditor) and scenarios/comms_versioning.yaml demonstrating it.
- Property-based and end-to-end tests; deterministic under seeds 42/7/1337.

make ci-local: all 5 checks pass (365 tests, 0 type errors, lint+format clean).

## Summary by Sourcery

Introduce a versioned communications plugin and scenario to enforce forward/backward wire compatibility and validate comms behaviour.

New Features:
- Add a VersionedComms plugin that stamps schema versions on envelopes, preserves unknown minor-version fields, and rejects unsupported major versions.
- Add a comms_versioning scenario with mixed-version peers and an auditor to exercise comms plugins against versioning rules.
- Register the versioned comms plugin and comms_versioning scenario in the core plugin and scenario registries, including a new YAML scenario definition.

Enhancements:
- Add adversarial validators that ensure unknown-major envelopes are rejected and unknown fields from newer minors are not silently dropped.
- Extend validator tests to cover the new comms validators and verify deterministic traces across seeds for the comms_versioning scenario.

Tests:
- Add property-based and compatibility tests for the VersionedComms plugin, including round-trip stability, unknown-field preservation, and rejection semantics.
- Add end-to-end simulator tests that compare behaviour of nest_native vs versioned comms using the comms_versioning scenario.

Try it

Open PR on GitHubView diff

Checkout locally

git fetch origin pull/18/head:pr-18
git checkout pr-18