Spaces:
Runtime error
Runtime error
|
Download docs/protocol_versioning_matrix.md from yusufcalisir/Collaborative-Fraud-Intelligence-Simulator: direct link, hf CLI and curl.
- Browser
- Download file 6.15 kB
-
https://huggingface.co/spaces/yusufcalisir/Collaborative-Fraud-Intelligence-Simulator/resolve/main/docs/protocol_versioning_matrix.md
- Command line
-
hf download hf://spaces/yusufcalisir/Collaborative-Fraud-Intelligence-Simulator/docs/protocol_versioning_matrix.md
-
curl -L -o protocol_versioning_matrix.md https://huggingface.co/spaces/yusufcalisir/Collaborative-Fraud-Intelligence-Simulator/resolve/main/docs/protocol_versioning_matrix.md
6.15 kB
π Protocol Versioning & Client Compatibility Matrix Specification
This document defines the semantic versioning scheme, gRPC header handshake protocol, REST/WebSocket schema versioning, and backward compatibility invariants for the Collaborative Fraud Intelligence (CFI) platform.
π 1. Protocol Versioning Scheme
Protocol releases strictly adhere to Semantic Versioning (SemVer 2.0.0) (MAJOR.MINOR.PATCH):
- MAJOR (
X.0.0): Breaking changes to protobuf wire formats (fl_service.proto), required parameter serialization schemas, or cryptographic primitives (e.g.v1.xtov2.x). Requires client SDK upgrades. - MINOR (
x.Y.0): Backward-compatible feature additions (e.g., new optional telemetry fields, updated drift metrics, additive database columns). - PATCH (
x.y.Z): Backward-compatible bug fixes, internal algorithmic optimizations, and performance enhancements.
π 2. Platform Compatibility Matrix
The domain compatibility bounds are enforced by VersionCompatibilityMatrix:
| Platform Version | gRPC Wire Protocol | Supported Client SDK Range | Schema Digest (SHA-256) | Lifecycle Status | Deprecation Date |
|---|---|---|---|---|---|
| v1.0.0 | 1.0.0 |
1.0.0 - 1.99.99 |
a1b2c3d4e5f60718... |
β οΈ Deprecated | 2026-10-01 |
| v1.1.0 | 1.1.0 |
1.0.0 - 1.99.99 |
e5f6g7h8i9j01234... |
β οΈ Maintenance | 2026-12-31 |
| v2.0.0 | 2.0.0 |
2.0.0 - 2.99.99 |
9988776655443322... |
β Active Production | N/A |
| v2.1.0 | 2.1.0 |
2.0.0 - 2.99.99 |
3344556677889900... |
β Active Production | N/A |
| v3.0.0 (Roadmap) | 3.0.0 |
3.0.0 - 3.99.99 |
(Planned) | π¬ Planned (PQC / zk-SNARK) | 2027-Q2 |
π€ 3. gRPC Header Handshake & Context Metadata
Every gRPC streaming request (RegisterClient, Heartbeat, StreamModelParameters) is intercepted by ProtocolVersionInterceptor to validate client protocol metadata:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β gRPC CLIENT HANDSHAKE METADATA β
ββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββ€
β METADATA KEY β EXAMPLE VALUE β VALIDATION PURPOSE β
ββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββ€
β `x-cfi-protocol-version` β `2.1.0` β SemVer compatibility β
β `x-cfi-schema-hash` β `e3b0c44298fc1c14...` β Feature schema alignment β
β `x-cfi-tenant-id` β `bank_alpha` β ContextVar routing β
β `x-cfi-mtls-fingerprint` β `SHA256:7b908f24...` β X.509 cert binding β
ββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββ
Protocol Rejection & Negotiation Semantics
The server evaluates (client_version, client_schema_hash) against the active matrix:
VersionNegotiationStatus.COMPATIBLE: Client version satisfies SemVer major alignment and falls within[min_supported_version, max_supported_version].VersionNegotiationStatus.DEGRADED_COMPATIBLE: Version matches, but client feature schema hash differs from the consortium registry (logged as a drift warning).VersionNegotiationStatus.INCOMPATIBLE: Aborts request withgrpc.StatusCode.FAILED_PRECONDITION(orOUT_OF_RANGE), directing the client node to the consortium upgrade portal.
π 4. HTTP REST & WebSocket Versioning Invariants
- Path-Based Prefix Routing:
- Production REST endpoints are namespaced under
/api/v1or/v1(e.g./api/v1/score-transaction,/api/v1/predict,/v1/webhooks/subscriptions,/v1/inference/score).
- Production REST endpoints are namespaced under
- RFC 8594 Standard Deprecation & Sunset Headers:
APIVersionLifecycleMiddlewareinbackend/app/main.pyattaches standard version lifecycle headers to all HTTP responses:X-API-Version: v1 Deprecation: Sat, 01 Jan 2026 00:00:00 GMT Sunset: Sat, 01 Jul 2026 00:00:00 GMT
- Consortium Deprecation Warning Headers:
- During rolling upgrades and migration windows, legacy endpoints signal target versions:
x-cfi-deprecation-warning: Version v2.0.0 will be retired on 2026-10-01. x-cfi-target-version: v2.1.0
- During rolling upgrades and migration windows, legacy endpoints signal target versions:
- Additive JSON Contracts:
- Pydantic models across
backend/app/presentation/routers/enforce additive field updates with default values, preventing serialization crashes in older client libraries.
- Pydantic models across
π§ͺ 5. Automated Test Verification Matrix
Protocol negotiation, SemVer comparison, and lifecycle header adherence are continuously verified:
| Test Suite | File Path | Verified Capabilities | Status |
|---|---|---|---|
| Protocol Versioning | backend/tests/unit/test_protocol_versioning.py |
SemVer parsing (1.0.0 < 2.0.0), matrix negotiation, gRPC metadata extraction |
3/3 PASSED |
| OpenAPI Contract Accuracy | backend/tests/unit/test_openapi_contract_accuracy.py |
Route schema accuracy, lifecycle headers, FinCEN export endpoints | 2/2 PASSED |