Skip to content

feat: propagate FDv1 fallback directive from FDv2 polling and streaming sources#538

Open
beekld wants to merge 4 commits into
mainfrom
beeklimt/SDK-2379-2
Open

feat: propagate FDv1 fallback directive from FDv2 polling and streaming sources#538
beekld wants to merge 4 commits into
mainfrom
beeklimt/SDK-2379-2

Conversation

@beekld
Copy link
Copy Markdown
Contributor

@beekld beekld commented May 23, 2026

Summary

Each FDv2 source now inspects the X-LD-FD-Fallback response header (value "true", case-insensitive) and stamps FDv2SourceResult.fdv1_fallback on every emitted result. The orchestrator does not yet consume the flag — that comes in a follow-up.

Design notes

  • fdv1_fallback is hoisted from per-variant (was on ChangeSet, Interrupted, TerminalError, Goodbye) to a top-level field on FDv2SourceResult. The flag is a property of the HTTP response, not of the result kind. Touches every existing construction site (mechanical: drop trailing false arg, the top-level default does the rest).
  • Streaming synchronizer holds a latest_fdv1_fallback_ bool on State. Each OnResponse overwrites it from the incoming headers, so a fresh response without the directive clears it. Events between two responses share the flag from the most recent response.

Test plan

  • New fdv2_polling_impl_test.cpp covers propagation across all variants + value comparison
  • New streaming tests cover wiring + clearing on subsequent response
  • Full server + SSE suites green

Note

Medium Risk
Changes the FDv2 source result contract and how sync responses are interpreted ahead of orchestrator fallback logic; mistakes could mis-signal FDv1 downgrade, but behavior is not yet wired to switching data modes.

Overview
FDv2 sources now surface a server-driven FDv1 fallback signal on every FDv2SourceResult. The fdv1_fallback flag moves from nested variant payloads to a single top-level field (default false), reflecting that it comes from the HTTP response, not the result kind.

Polling reads X-LD-FD-Fallback (value true, case-insensitive) from poll HTTP headers and sets fdv1_fallback on 304/200 outcomes and HTTP error paths; transport-level failures without a response still leave it false.

Streaming registers an SSE on_response hook, keeps latest_fdv1_fallback_ from the most recent response headers (cleared when a later response omits the header), and applies it in Notify to all delivered results—including errors after a directive.

Tests were updated for the new shape; new coverage exercises polling and streaming propagation. Orchestrator behavior is unchanged in this PR—the flag is stamped only for a follow-up to consume.

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

@beekld beekld force-pushed the beeklimt/SDK-2379-2 branch 2 times, most recently from d795752 to 12b23ec Compare May 28, 2026 20:18
@beekld beekld force-pushed the beeklimt/SDK-2379 branch from a404f05 to 2c40df6 Compare May 28, 2026 23:21
@beekld beekld force-pushed the beeklimt/SDK-2379-2 branch 2 times, most recently from 762768c to 57d4dfb Compare May 29, 2026 21:12
Base automatically changed from beeklimt/SDK-2379 to main May 29, 2026 21:16
@beekld beekld force-pushed the beeklimt/SDK-2379-2 branch from 57d4dfb to c95b74a Compare May 29, 2026 21:18
@beekld beekld marked this pull request as ready for review May 29, 2026 21:20
@beekld beekld requested a review from a team as a code owner May 29, 2026 21:20
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