Skip to content

Conversation

@joker23
Copy link
Contributor

@joker23 joker23 commented Jan 26, 2026

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

sdk-1765

Describe the solution you've provided

  • added boilerplate contrast test service to react universal workspace
  • currently the implementation is not suppose to pass any tests, the plan is to start enabling tests as we feature complete

Describe alternatives you've considered

I think this pattern of opening a ws bridge would be used in many other places (especially for client sdks). If this implementation goes well, then we should think about moving some of the tooling to the packages/tooling directory.

Additional context

Add any other context about the pull request here.


Note

Sets up a new React Universal SDK contract test app and integrates it into the repo.

  • Adds packages/sdk/react-universal/contract-tests Next.js entity with WebSocket client (app/websocket.ts) and minimal page (app/layout.tsx) for communicating with the existing adapter; includes build/dev configs, Playwright headless browser helper, and start script
  • Registers the new workspace in root package.json; updates packages/sdk/react-universal/tsconfig.json to exclude contract-tests; adds ESLint ignore for react-universal/contract-tests
  • Updates browser contract test README to use http://localhost:8000 for the harness URL

Ports: adapter REST 8000, adapter WS 8001, React entity 8002. Capabilities response is currently stubbed in websocket.ts.

Written by Cursor Bugbot for commit 9f20078. This will update automatically on new commits. Configure here.

@joker23 joker23 requested a review from a team as a code owner January 26, 2026 21:36
@joker23 joker23 force-pushed the skz/sdk-1765/react-contract-test-init branch from 92037b6 to 4052111 Compare January 26, 2026 21:36
@github-actions
Copy link
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25394 bytes
Compressed size limit: 26000
Uncompressed size: 124693 bytes

@github-actions
Copy link
Contributor

github-actions bot commented Jan 26, 2026

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 171249 bytes
Compressed size limit: 200000
Uncompressed size: 797978 bytes

@github-actions
Copy link
Contributor

github-actions bot commented Jan 26, 2026

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 18984 bytes
Compressed size limit: 20000
Uncompressed size: 98086 bytes

@github-actions
Copy link
Contributor

github-actions bot commented Jan 26, 2026

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 23264 bytes
Compressed size limit: 25000
Uncompressed size: 80869 bytes

</body>
</html>
);
}
Copy link

Choose a reason for hiding this comment

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

Next.js layout missing required children prop

Medium Severity

The layout.tsx component is missing the required children prop that Next.js App Router layouts must accept and render. Without this prop, any page content added to this app in the future won't be rendered, and the layout won't properly wrap its content. The function signature needs to accept { children } and render it inside the body.

Fix in Cursor Fix in Web


disconnect() {
this._ws?.close();
}
Copy link

Choose a reason for hiding this comment

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

Disconnect triggers reconnection instead of closing cleanly

Medium Severity

The disconnect() method calls this._ws?.close(), which triggers the onclose handler that unconditionally schedules a reconnection via setTimeout. When the React component unmounts and calls disconnect() during cleanup, this will paradoxically trigger a new connection attempt 1 second later. The class has no mechanism to distinguish intentional disconnection from unexpected connection loss.

Additional Locations (1)

Fix in Cursor Fix in Web

@@ -0,0 +1,64 @@
// eslint-disable no-console
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -0,0 +1,42 @@
#!/usr/bin/env node
Copy link
Contributor Author

Choose a reason for hiding this comment

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

"packageManager": "yarn@3.4.1",
"scripts": {
"install-playwright-browsers": "playwright install --with-deps chromium",
"start:adapter": "yarn workspace browser-contract-test-adapter run start",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NOTE: I am using the adapter directly from the browser contract test... I think this is okay, probably should work on extracting this ws bridge to a common private module

@@ -0,0 +1,24 @@
'use client';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

stubbed for now

@joker23 joker23 force-pushed the skz/sdk-1765/react-contract-test-init branch from 4052111 to 3adff85 Compare January 26, 2026 21:46
@joker23 joker23 changed the title test: add contrast test boilerplate to react universal test: add contract test boilerplate to react universal Jan 26, 2026
@joker23 joker23 force-pushed the skz/sdk-1765/react-contract-test-init branch from 3adff85 to 9f20078 Compare January 28, 2026 16:48
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@@ -0,0 +1,64 @@
// eslint-disable no-console
Copy link

Choose a reason for hiding this comment

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

Invalid eslint directive syntax does nothing

Low Severity

The comment // eslint-disable no-console uses incorrect syntax. For file-wide disables, ESLint requires block comment syntax: /* eslint-disable no-console */. The single-line comment format only works with eslint-disable-next-line. While the directory is in .eslintrc.js ignorePatterns making this comment redundant anyway, the incorrect syntax is misleading.

Fix in Cursor Fix in Web

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