Skip to content

test: harden protocol provider contracts - #44

Merged
wolfiesch merged 5 commits into
mainfrom
codex/protocol-provider-contract-tests-pr
Jul 18, 2026
Merged

test: harden protocol provider contracts#44
wolfiesch merged 5 commits into
mainfrom
codex/protocol-provider-contract-tests-pr

Conversation

@wolfiesch

@wolfiesch wolfiesch commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

What this changes

  • Add a versioned golden corpus for exact outbound frames, normalized inbound events, JSON text inputs, and malformed messages.
  • Declare the complete normalized server-event vocabulary and validate every provider declaration before transport startup.
  • Run the pinned OMP server fixtures through the provider boundary and fail closed if a provider returns an undeclared event.
  • Exercise the same corpus with a deliberately different test provider to prove the client path is not tied to omp-app/1 fields.

This strengthens the protocol middle layer without changing the upstream OMP wire format or adding automatic protocol negotiation.

How you verified it

  • pnpm check passed after rebasing onto current main.
  • 37 focused client provider tests passed.
  • 4 focused protocol server-event tests passed.
  • GitHub CI passed core, tooling, Android debug, and the final verify gate.
  • git diff --check passed.

Checklist

  • pnpm check passes (release contract, provenance, lint, typecheck)
  • pnpm test passes; new behavior has a test that fails without this change
  • Any pasted logs or screenshots are redacted: no secrets, tokens, pairing codes, or private paths
  • Ported code (T3 Code / OMP) follows the provenance rules in THIRD_PARTY_NOTICES.md

Copilot AI review requested due to automatic review settings July 18, 2026 11:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the protocol-provider boundary by making the normalized server-event contract explicit (a fixed vocabulary), validating provider declarations up-front, and running golden corpora/fixtures through the provider interface to ensure exact wire ↔ normalized-event behavior stays stable.

Changes:

  • Introduces an exhaustive, immutable OMP_SERVER_EVENT_KINDS vocabulary (and OmpServerFrame excluding the client-only pair.start) and threads it through protocol/client types.
  • Adds provider validation (immutability/duplicates/unknown kinds) and a runtime “fail closed” check when a provider returns an undeclared server event.
  • Adds golden corpus + canonical fixture-driven tests to lock down outbound frames, normalized inbound events (object + JSON text), and invalid inputs.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/protocol/test/server-event.test.ts Adds assertions that the shared server-event vocabulary is complete, unique, and frozen.
packages/protocol/src/server-event.ts Defines OmpServerFrame and exports frozen OMP_SERVER_EVENT_KINDS derived from an exhaustive type-checked map.
packages/protocol/src/index.ts Narrows decodeServerFrame’s return type to OmpServerFrame and re-exports server-event utilities.
packages/protocol/src/desktop-ipc.ts Updates renderer frame types to use OmpServerFrame.
packages/client/test/protocol-provider.test.ts Adds a regression test that the client becomes fatal if a provider emits an undeclared event.
packages/client/test/protocol-provider-registry.test.ts Adds corpus-driven provider tests and registry validation tests for event-kind declarations.
packages/client/test/protocol-provider-corpus.ts New helper to load/validate/run a versioned “golden corpus” against a provider.
packages/client/test/protocol-provider-corpus.test.ts New tests for corpus schema validation and coverage enforcement.
packages/client/test/protocol-provider-conformance.ts Extends conformance suite to require declared immutable server-event vocabulary and enforce membership.
packages/client/test/protocol-provider-canonical-fixtures.test.ts New test that decodes upstream app-wire canonical fixtures and asserts vocabulary coverage.
packages/client/test/fixtures/protocol/README.md Documents the purpose and maintenance rules for protocol corpora fixtures.
packages/client/test/fixtures/protocol/omp-app-v1-corpus.json New pinned golden corpus for omp-app/1 outbound/inbound/invalid examples.
packages/client/src/projection.ts Updates projection frame typing to use OmpServerFrame.
packages/client/src/omp-protocol-provider.ts Extends provider contract with serverEventKinds.
packages/client/src/omp-protocol-provider-registry.ts Adds provider validation (kinds non-empty, frozen, unique, known) before registry use.
packages/client/src/omp-client-runtime.ts Routes inbound raw messages through provider-declaration validation (decodeProviderServerEvent).
packages/client/src/omp-client-frames.ts Adds decodeProviderServerEvent guard and uses it before dispatch.
packages/client/src/omp-app-v1-protocol-provider.ts Declares serverEventKinds for the pinned omp-app/1 provider.
docs/adr/009-protocol-provider-boundary.md Updates ADR consequences to include golden corpora and runtime event-kind declaration/validation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/client/src/omp-client-frames.ts
@wolfiesch
wolfiesch merged commit 3e28ec0 into main Jul 18, 2026
4 checks passed
@wolfiesch
wolfiesch deleted the codex/protocol-provider-contract-tests-pr branch July 18, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants