Skip to content

fix: Report one data source status for an invalid stream event - #488

Open
keelerm84 wants to merge 1 commit into
feat/9.xfrom
mk/SDK-3476/stream-invalid-event
Open

keelerm84 wants to merge 1 commit into
feat/9.xfrom
mk/SDK-3476/stream-invalid-event

Conversation

@keelerm84

@keelerm84 keelerm84 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

An FDv2 stream event with invalid JSON produced two INTERRUPTED updates.
The event handler yielded one with INVALID_DATA and re-raised, and the
SSE client gave the re-raised error to the error handler, which yielded
a second one with UNKNOWN. The data source status then reported UNKNOWN
as the last error. Any other error raised while handling an event was
also reported twice.

The event handler now only logs and re-raises. The error handler reports
the error once, and maps JSON::ParserError to INVALID_DATA, as the FDv1
stream did.


Note

Overview
Fixes duplicate data source status updates when FDv2 streaming fails while handling an SSE event. Previously on_event emitted an INTERRUPTED update (including INVALID_DATA for bad JSON), then re-raised so on_error emitted a second INTERRUPTED with UNKNOWN, which often became the reported last error.

on_event now only logs and re-raises; handle_error is the single place that yields status updates. JSON::ParserError is handled there with INVALID_DATA, matching FDv1 streaming behavior.

Specs cover handle_error for invalid JSON and an integration case that expects exactly INTERRUPTED → VALID after reconnect when the first event is malformed JSON.

Reviewed by Cursor Bugbot for commit f07f51c. Bugbot is set up for automated code reviews on this repo. Configure here.

An FDv2 stream event with invalid JSON produced two INTERRUPTED updates.
The event handler yielded one with INVALID_DATA and re-raised, and the
SSE client gave the re-raised error to the error handler, which yielded
a second one with UNKNOWN. The data source status then reported UNKNOWN
as the last error. Any other error raised while handling an event was
also reported twice.

The event handler now only logs and re-raises. The error handler reports
the error once, and maps JSON::ParserError to INVALID_DATA, as the FDv1
stream did.
@keelerm84
keelerm84 requested a review from a team as a code owner November 5, 2026 18:03

This branch has not been deployed

No deployments
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.

1 participant