Skip to content

[High] AsyncAPI Specification and Versioned WebSocket Protocol #456

Description

@james2177

Description:
Formally specify the WS protocol (messages, subscriptions, replay, errors) in AsyncAPI, validate all inbound/outbound messages against it at runtime in non-production, and add protocol version negotiation.

Problem Statement & Context:
The WS protocol has grown (subscriptions, filters, replay) but lives only in code. Integrators reverse-engineer it and any change risks silent breakage.

Scope & Acceptance Criteria:

  • docs/asyncapi.yaml covering all message types; served at /docs/ws.
  • Sec-WebSocket-Protocol: vortex.v1 negotiation; unknown versions rejected with close code 1002.
  • Runtime schema validation (dev/test) and CI check that emitted messages conform.
  • Types generated for the SDK from the spec.
  • Out of scope: breaking protocol changes.

Implementation Guidelines:

  1. Key Files/Modules: src/intents/intents.gateway.ts, new docs/asyncapi.yaml, scripts/generate-client.ts.
  2. Design/Architecture: Spec as source of truth; zod/ajv validators generated or hand-mirrored with CI parity test.
  3. Edge Cases/Constraints: Clients without subprotocol default to v1 for compatibility.
  4. Testing: Contract test asserting every message in test/ws-gateway.e2e-spec.ts validates.

Definition of "Done": Common DoD.

Resources:


Common Definition of "Done" (applies in addition to the criteria above):

  • Code written, tested, and documented (TSDoc on public APIs, README/runbook/ADR updates where behaviour changes).
  • All acceptance criteria met; npm run lint, npm run typecheck, npm test, npm run test:e2e pass in CI.
  • PR follows .github/PULL_REQUEST_TEMPLATE, uses a Conventional Commit title (enforced by commitlint), includes test output / metrics screenshots, and references the issue.
  • New env vars are added to .env.example variants and src/config/env.validation.ts (the check:env-drift script must pass).
  • Reviewed and approved by at least one CODEOWNER.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions