Skip to content

test: Add a browser contract test service that uses the HTTP SSE client - #360

Merged
joker23 merged 14 commits into
mainfrom
skz/sdk-3443/contract-test-capabilities
Dec 1, 2026
Merged

joker23 merged 14 commits into
mainfrom
skz/sdk-3443/contract-test-capabilities

Conversation

@joker23

@joker23 joker23 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds apps/flutter_web_contract_test_service, a contract test service that runs the Flutter SDK in headless Chrome. The SDK streams with the HTTP-based SSE client through eventSource: SSEClient.http. The browser native EventSource cannot send a request body or report an HTTP error. This is the only contract test run that covers usePost and HTTP error handling for streaming on web.
  • The contract test harness speaks REST, and a browser cannot listen for requests. So bin/adapter.dart runs on the Dart VM, serves the REST API, starts Chrome, and relays each request to a Flutter web app over a websocket. The same design is used by the JS browser SDK contract tests.
  • The browser reports its capabilities when it connects. It declares client-use-post and client-event-source-http-errors because it always uses the HTTP-based SSE client. It also declares context-type and polling-gzip, which pass on web.
  • Adds browser-contract-tests to the CI workflow (FDv1 and FDv2 runs), and the client-web-contract-tests and client-web-contract-tests-fdv2 melos scripts.
  • The suppression files start from the lists of the JS browser SDK fetch event source runs, and each file states where it differs. Both lists skip the kind: null context type test, as the existing Flutter service does.
  • Adds the missing harness step to the README of the existing contract test service.

Notes

  • auto-env-attributes is not declared, as in the JS browser SDK. Hooks are not mapped yet.
  • The mapping code in lib/src/entity.dart repeats code from the existing service. That service uses generated types that need dart:io, so it cannot share them yet.

Note

Overview
Adds apps/flutter_web_contract_test_service, a new contract-test path that runs the Flutter client SDK in headless Chrome with eventSource: SSEClient.http, so harness coverage includes usePost and HTTP streaming error behavior that the native browser EventSource cannot exercise.

The harness still speaks REST, so a VM adapter (bin/adapter.dart) exposes the REST API, serves the web build, launches Chrome, and relays requests over a WebSocket to a minimal Flutter web entity (lib/main.dart / lib/src/entity.dart) that runs the SDK and reports capabilities including client-use-post and client-event-source-http-errors.

CI gains a browser-contract-tests job (FDv1 v2 and FDv2 v3 harness runs, adapter restart between suites, adapter log artifacts). melos.yaml adds client-web-contract-tests and client-web-contract-tests-fdv2. FDv1/FDv2 suppression lists document web/CORS/tag differences vs the JS browser SDK lists. The existing VM contract service README documents how to run the harness locally.

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

@joker23
joker23 added this pull request to stack #361 November 2, 2026 20:17
@joker23 joker23 closed this Nov 2, 2026
@joker23
joker23 force-pushed the skz/sdk-3443/contract-test-capabilities branch from 6dd55ca to 458d103 Compare November 2, 2026 21:58
@joker23 joker23 reopened this Nov 2, 2026
@joker23 joker23 changed the title fix: Advertise streaming capabilities only when the SSE client supports them test: Add a browser contract test service that uses the HTTP SSE client Nov 2, 2026
@joker23
joker23 force-pushed the skz/sdk-3443/contract-test-capabilities branch 14 times, most recently from dd2985a to 84ee448 Compare November 5, 2026 22:53
@joker23
joker23 marked this pull request as ready for review November 6, 2026 18:06
@joker23
joker23 requested a review from a team as a code owner November 6, 2026 18:06
devin-ai-integration[bot]

This comment was marked as resolved.

cursor[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@joker23
joker23 force-pushed the skz/sdk-3443/contract-test-capabilities branch 5 times, most recently from ce1d5df to 68dc044 Compare November 10, 2026 20:44

@cursor cursor Bot 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.

Risk: medium.

Automated risk review (dry run): Medium

This PR would not be automatically approved. Human approval required.

Why: The diff changes .github/workflows/ci.yml (CI workflow definitions are never Low) and adds a browser contract-test harness; Cursor Bugbot also completed unsuccessfully with an unresolved finding. Human review is needed and no reviewers were assigned.

If you disagree with this review, share this PR in #feedback-agent-approvals or submit a changes-requested review explaining why.

Open in Web View Automation 

Sent by Cursor Approval Agent: Dry-Run PR Approver

@joker23
joker23 force-pushed the skz/sdk-3443/contract-test-capabilities branch 2 times, most recently from a80f522 to 1c3da1e Compare November 23, 2026 18:41
cursor[bot]

This comment was marked as resolved.

@cursor cursor Bot 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.

Risk: medium. Not approved (Rule 3: Approve only allowed workflow changes). This PR adds a new browser-contract-tests job in .github/workflows/ci.yml, which is more than an action or runtime version bump; Cursor Bugbot also completed unsuccessfully with an unresolved finding. Human review is needed and no reviewers were assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver

@joker23
joker23 force-pushed the skz/sdk-3443/contract-test-capabilities branch from 1c3da1e to dd7583e Compare November 23, 2026 21:11

@cursor cursor Bot 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.

Risk: medium. Not approved (Rule 3: Approve only allowed workflow changes). This PR adds a new browser-contract-tests job in .github/workflows/ci.yml, which is more than an action or runtime version bump, and the change is above the low-risk approval threshold. Human review is needed and no reviewers were assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver

@joker23
joker23 force-pushed the skz/sdk-3443/contract-test-capabilities branch from dd7583e to 310249c Compare November 25, 2026 17:55

@cursor cursor Bot 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.

Risk: medium. Not approved (Rule 3: Approve only allowed workflow changes). This PR adds a new browser-contract-tests job in .github/workflows/ci.yml, which is more than an action or runtime version bump, and it is above the low-risk approval threshold. Human review is needed and no reviewers were assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver

Comment thread .github/workflows/ci.yml Resolved
@joker23
joker23 force-pushed the skz/sdk-3443/contract-test-capabilities branch from e33b189 to 78fe223 Compare December 1, 2026 14:32
@joker23
joker23 force-pushed the skz/sdk-3443/contract-test-capabilities branch from 78fe223 to 3cf5c33 Compare December 1, 2026 14:48
@joker23
joker23 merged commit b78844f into main Dec 1, 2026
12 checks passed
@joker23
joker23 deleted the skz/sdk-3443/contract-test-capabilities branch December 1, 2026 14:56
joker23 added a commit that referenced this pull request Dec 1, 2026
<!-- TERMAG_PR_BODY_BEGIN -->
## Summary
On web, the default diagnostic events path was the analytics path, so
diagnostic events were posted to `/events/bulk/<credential>`. It is now
`/events/diagnostic/<credential>`, matching the JS browser SDK. PR #380
fixed the event processor URI choice but left this path wrong.

The browser contract service now declares the `diagnostic-events`
capability, so the v3 harness runs the new `events/diagnostic events`
test against it.

Stacked on #360, which adds the browser contract service this PR
extends.
<!-- TERMAG_PR_BODY_END -->

<!-- termag: box=i-0a22178dd5f8d553f project=launchdarkly task=fix -->
<sub>Opened from termag</sub>

<!-- devin-review-badge-begin -->

---

<a
href="https://app.devin.ai/review/launchdarkly/flutter-client-sdk/pull/414"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> **Web clients** were posting diagnostic events to the analytics bulk
URL (`/events/bulk/<credential>`) because
`DefaultEventPaths.getDiagnosticEventsPath` in `js_config.dart` matched
the analytics path. It now returns
**`/events/diagnostic/<credential>`**, aligning with the JS browser SDK
(and fixing the gap left after PR #380’s URI selection work).
> 
> The **Flutter web contract test service** advertises the
**`diagnostic-events`** capability so the v3 harness can run the
diagnostic events contract test against the browser adapter.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
d61e3c3. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants