Skip to content

Pulse Contracts — Test Corpus

Golden examples used by CI to verify that:

  • Every event in telemetry/v0.1.0.yaml has at least one valid payload.
  • Every action in actions/v0.1.0.yaml has at least one valid dispatch payload.
  • Common failure modes are covered by an invalid/ example.

Used by:

  • validate.py (cross-contract validator) — verifies all valid/*.json deserialize against the contract field schemas.
  • Rust ingest unit tests — parse each events/valid/*.json via codegen'd types.
  • Snapshot tests on Telemetry → Rust struct codegen.

Layout

test-corpus/
├── events/
│   ├── valid/
│   │   └── app.<event>.json             — full payload of a valid event, base fields included
│   └── invalid/
│       └── app.<event>.<reason>.json    — payload that should fail ingest for <reason>
└── actions/
    └── valid/
        └── <action_type>.json           — example ActionDispatchRequest body

Event JSON shape

Matches Event schema from openapi.yaml plus a _expected block for tests:

json
{
  "event_type": "app.startup",
  "schema_hash": "b3:0000…",
  "emitted_at": "2026-05-19T10:00:00Z",
  "source": "client",
  "consent_token": "(opaque, base64url; tests use a fixed test-key signature)",
  "fields": { ... event-specific ... },
  "_expected": {
    "ingest_status": "accepted",
    "purpose_used": "analytics.usage",
    "rejection_reason": null
  }
}

_expected is stripped before submission to ingest; it's metadata for test harness.