Skip to content

feat(dataconnect): Implemented Data Connect service client and comprehensive test suite#955

Merged
mk2023 merged 9 commits into
winefrom
prosecco
Jul 6, 2026
Merged

feat(dataconnect): Implemented Data Connect service client and comprehensive test suite#955
mk2023 merged 9 commits into
winefrom
prosecco

Conversation

@mk2023

@mk2023 mk2023 commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Feat: Implemented the foundational Firebase Data Connect Python SDK architecture (for Milestone 2) and their respective unit/integration tests:

This PR introduces a comprehensive test suite for the firebase_admin.dataconnect module. The tests cover:

  • ConnectorConfig class behavior and validation.
  • DataConnect class initialization.
  • The dataconnect.client() factory function, including caching logic.
  • The internal _DataConnectService client management.

This PR also includes the implementation of the core Data Connect module (firebase_admin/dataconnect.py), designed to maintain architectural parity with the Node.js Admin SDK while leveraging idiomatic Python patterns:

  • ConnectorConfig: Implemented as an immutable frozen dataclass (@dataclass(frozen=True)) with strict input validation that raises idiomatic ValueError exceptions. Because it is frozen, Python automatically generates value-based hashing (__hash__), enabling clean object lookup.
  • DataConnect: Implemented the primary client class with clean property accessors (.app and .config).
  • _DataConnectService & client(): Built instance caching integrated directly into Python's Firebase App service lifecycle (_utils.get_app_service), ensuring duplicate calls return cached instances.

@mk2023 mk2023 requested a review from stephenarosaj June 26, 2026 22:04
@mk2023 mk2023 self-assigned this Jun 26, 2026

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces the new dataconnect module, including the ConnectorConfig and DataConnect classes, along with a comprehensive test suite. However, the implementation is currently incomplete and will fail the tests. Specifically, the DataConnect class is missing the public app and config properties, the client function is left as a stub, and the _DataConnectService class is completely missing. Additionally, the validation in ConnectorConfig needs to be updated to explicitly check for string types to prevent invalid types from bypassing the checks.

Comment thread firebase_admin/dataconnect.py
Comment thread firebase_admin/dataconnect.py Outdated
Comment thread firebase_admin/dataconnect.py
@stephenarosaj

Copy link
Copy Markdown

it's important that PR/CL titles and descriptions are detailed enough so that reviewers (or future viewers) have the context they need to understand your changes

will you check out go/cl-descriptions for some guidance and examples, and then add an updated description and title for the PR?

@mk2023 mk2023 changed the base branch from wine-m1 to wine June 29, 2026 18:10
@mk2023 mk2023 changed the title Prosecco feat(fdc): Added unit tests for ConnectorConfig, DataConnect Initialization, Data Connect client factory, and _DataConnectService Jun 29, 2026
Comment thread firebase_admin/dataconnect.py
Comment thread firebase_admin/dataconnect.py
Comment thread firebase_admin/dataconnect.py Outdated
Comment thread firebase_admin/dataconnect.py Outdated
Comment thread firebase_admin/dataconnect.py
Comment thread tests/test_data_connect.py Outdated
Comment thread tests/test_data_connect.py Outdated
Comment thread tests/test_data_connect.py Outdated
Comment thread tests/test_data_connect.py Outdated
Comment thread tests/test_data_connect.py Outdated
@mk2023 mk2023 changed the title feat(fdc): Added unit tests for ConnectorConfig, DataConnect Initialization, Data Connect client factory, and _DataConnectService feat(dataconnect): Added unit tests for ConnectorConfig, DataConnect Initialization, Data Connect client factory, and _DataConnectService Jun 29, 2026
@mk2023 mk2023 changed the title feat(dataconnect): Added unit tests for ConnectorConfig, DataConnect Initialization, Data Connect client factory, and _DataConnectService feat(dataconnect): Implemented Data Connect service client and comprehensive test suite Jun 30, 2026
@mk2023 mk2023 requested a review from itsrakhil June 30, 2026 20:56

@itsrakhil itsrakhil 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.

LGTM

@stephenarosaj stephenarosaj 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.

looks gr8 - requested a few changes, mostly style or nits with one comment about code duplication

Comment thread tests/test_data_connect.py
Comment thread tests/test_data_connect.py
Comment thread tests/test_data_connect.py Outdated
Comment thread tests/test_data_connect.py Outdated
Comment thread tests/test_data_connect.py
Comment thread firebase_admin/dataconnect.py Outdated
Comment thread tests/test_data_connect.py
Comment thread tests/test_data_connect.py Outdated
@mk2023 mk2023 requested a review from lahirumaramba July 2, 2026 00:14

@lahirumaramba lahirumaramba left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you! Looks great! I added a few comments.

Comment thread firebase_admin/dataconnect.py
Comment thread firebase_admin/dataconnect.py Outdated
Comment thread tests/test_data_connect.py Outdated
Comment thread firebase_admin/dataconnect.py Outdated
Comment thread firebase_admin/dataconnect.py
Comment thread tests/test_data_connect.py Outdated
mk2023 added 7 commits July 6, 2026 11:07
…d docstrings/synatx

Refactored test suite to use module-level BASE_CONFIG and added parameterized client caching tests.
…ervice architecture

Implemented ConnectorConfig dataclass, DataConnect client instance, _DataConnectService caching layer, and public client() factory function. Fixed mock recursion in test_client_successful using lambda delegation in test_data_connect.py.
…est suite structure

Removed duplicate client factory caching tests, moved app service loader test to unit test class, added connector property validation, and formatted parameter lists.
Added missing copyright headers and improved docstrings with proper formatting in dataconnect.py. Moved TestDataConnectServiceIntegration from tests/test_data_connect.py into a dedicated integration test file under integration/test_data_connect.py.
@stephenarosaj stephenarosaj changed the base branch from wine to main July 6, 2026 18:53
@stephenarosaj stephenarosaj changed the base branch from main to wine July 6, 2026 18:53
Comment thread integration/test_data_connect.py Outdated
mk2023 added 2 commits July 6, 2026 12:41
…st_data_connect.py

Moved TestDataConnectServiceIntegration back to tests/test_data_connect.py and removed integration/test_data_connect.py.
…rkflow

Renamed TestDataConnectServiceIntegration to TestDataConnectServiceWorkflow in tests/test_data_connect.py to clarify that it is an in-memory unit/functional test rather than a network integration test.

@lahirumaramba lahirumaramba left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

As we discussed offline, this requires a tech writer review before merging to the main branch.

@stephenarosaj stephenarosaj 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.

LGTM (forgot to add before final review from Lahiru)

@mk2023 mk2023 merged commit c84ce6f into wine Jul 6, 2026
15 checks passed
@mk2023 mk2023 deleted the prosecco branch July 6, 2026 23:01
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.

4 participants