Skip to content

[SSE] Add Spector coverage for id, retry, and reconnection #11572

Description

@JoshLove-msft

Description

The SSE id and retry fields are standard parts of the SSE protocol with defined parsing and behavior. Clients should handle them unconditionally; services should not need to declare them using TypeSpec decorators.

Current SSE Spector coverage exercises event and data, but does not establish expected behavior for event IDs, reconnection delays, or resumption through Last-Event-ID.

Expected scenarios

Add language-neutral Spector scenarios covering:

  • Receiving an event containing id, event, and data fields.
  • Receiving a valid retry field containing ASCII digits.
  • Ignoring an invalid retry field.
  • Ignoring an id field containing U+0000 NULL.
  • Reconnecting after the stream closes and sending the most recently received event ID in the Last-Event-ID request header.

The reconnection scenario can be scoped separately if Spector or generated clients do not currently own automatic reconnection behavior.

Emitter expectations

Emitter-specific tests should verify how event IDs are exposed and how retry/reconnection behavior is implemented. These fields should remain SSE envelope metadata and must not be included in the typed data payload.

Relevant specification

Server-Sent Events are defined by the WHATWG HTML Living Standard:

Additional context

This coverage gap was identified while implementing C# SSE streaming support for #10738.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions