Skip to content

fix: report actual synced connection count in connector_sync (#1547)#1815

Open
hunterxtang wants to merge 2 commits into
langflow-ai:mainfrom
hunterxtang:fix/1547-connections-synced-count
Open

fix: report actual synced connection count in connector_sync (#1547)#1815
hunterxtang wants to merge 2 commits into
langflow-ai:mainfrom
hunterxtang:fix/1547-connections-synced-count

Conversation

@hunterxtang

@hunterxtang hunterxtang commented Jun 9, 2026

Copy link
Copy Markdown

Fixes #1547
connector_sync reported connections_synced: len(active_connections), but it selects only the first working connection and dispatches a single task, so the count (and the message) were inflated whenever multiple connections were active. Changed to len(task_ids) and fixed the matching message to singular.
Added test_connector_sync_reports_one_connection_with_multiple_active: with 3 active connections it asserts connections_synced == 1. Verified it fails on main (reports 3) and passes with the fix.

Summary by CodeRabbit

  • Bug Fixes

    • Adjusted connector sync response so the reported number of synced connections is derived from returned task IDs and the human-readable message reflects a single started connection when applicable.
  • Tests

    • Added unit tests validating connector sync response content, HTTP status, message wording for singular/plural cases, and task ID reporting.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 170bf491-57be-46cf-8265-59915b86c95e

📥 Commits

Reviewing files that changed from the base of the PR and between 5eae082 and 8512d02.

📒 Files selected for processing (1)
  • tests/unit/api/test_connector_sync_response.py
💤 Files with no reviewable changes (1)
  • tests/unit/api/test_connector_sync_response.py

Walkthrough

The connector_sync endpoint now sets connections_synced from the number of dispatched tasks (len(task_ids)) and uses a singular message when appropriate. A new async unit test verifies the response fields, message text, and that only one sync task was dispatched and awaited.

Changes

Connector sync response count

Layer / File(s) Summary
Connector sync response count fix
src/api/connectors.py, tests/unit/api/test_connector_sync_response.py
Updates connector_sync to compute connections_synced from len(task_ids) instead of len(active_connections), adjusts the success message to report a single {connector_type} connection when applicable, and adds a unit test validating the status code, JSON fields (connections_synced, message, task_ids), and that sync_specific_files is awaited exactly once.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

bug, tests

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing the reporting of the synced connection count from len(active_connections) to len(task_ids) in connector_sync.
Linked Issues check ✅ Passed The PR changes fully address the objective in issue #1547: connector_sync now reports connections_synced as len(task_ids) instead of len(active_connections), with test coverage verifying the fix.
Out of Scope Changes check ✅ Passed All changes are directly within scope: modifications to connector_sync response reporting and addition of test coverage for the fix, with no unrelated alterations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added backend 🔷 Issues related to backend services (OpenSearch, Langflow, APIs) tests bug 🔴 Something isn't working. and removed bug 🔴 Something isn't working. labels Jun 9, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/unit/api/test_connector_sync_response.py`:
- Line 109: Remove the stray signature comment "# Made with Bob" from the test
file; locate the comment in tests/unit/api/test_connector_sync_response.py
(search for the exact string "# Made with Bob") and delete that line so the file
contains only test code and no personal/signature comments.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4f582f41-8469-44a9-9926-c634d14a82f2

📥 Commits

Reviewing files that changed from the base of the PR and between 03f1c91 and 5eae082.

📒 Files selected for processing (2)
  • src/api/connectors.py
  • tests/unit/api/test_connector_sync_response.py

Comment thread tests/unit/api/test_connector_sync_response.py Outdated
@github-actions github-actions Bot added bug 🔴 Something isn't working. and removed bug 🔴 Something isn't working. labels Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend 🔷 Issues related to backend services (OpenSearch, Langflow, APIs) bug 🔴 Something isn't working. community tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: sync_all_connectors reports inflated connections_synced count

1 participant