Skip to content

Data Source Connectors: Propagate error and misc - #1284

Open
sats-23 wants to merge 12 commits into
IBM:mainfrom
sats-23:DCImpl7
Open

Data Source Connectors: Propagate error and misc#1284
sats-23 wants to merge 12 commits into
IBM:mainfrom
sats-23:DCImpl7

Conversation

@sats-23

@sats-23 sats-23 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor
  1. Cleanup removed failed_files from init_schema
  2. Removed last_sync_error from connectors table
  3. Async auth validation on every PUT/POST call on connectors which updates the connectors table
    --This error is never overwritten by a sync tick failure error message (highlighting root cause being wrong creds)
    --Only correct creds via another PUT request can clear the previous auth failure message
  4. Updated proposal
  5. Increased UT coverage
  6. Used the secret as per catalog deployment
  7. Rebrand connectors response into simple ID and name

return settings.digitize.connector.encryption_key_path


async def _probe_connector_credentials(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a makeshift solution to async update the DB (for failed creds).
This still does not provide direct validation to the end-user when a PUT/POST on connector is done

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.

I am not fully convinced this is really needed, because in case of POST the immediate sync operation will do this and report this failure anyway.
And for PUT this would be done in next sync which would be 5 mins later.
But somehow after seeing this, I m thinking why not trigger the sync immediately after PUT as well like POST, if someone updates the connector, I feel they would like the sync to happen immediately wdyt?
If we do that, this probing is not needed.

@sats-23
sats-23 marked this pull request as ready for review August 19, 2026 06:13
sats-23 added 10 commits August 21, 2026 10:28
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
@sats-23
sats-23 force-pushed the DCImpl7 branch 2 times, most recently from 72685cb to 22e9438 Compare August 21, 2026 06:10
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
return settings.digitize.connector.encryption_key_path


async def _probe_connector_credentials(

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.

I am not fully convinced this is really needed, because in case of POST the immediate sync operation will do this and report this failure anyway.
And for PUT this would be done in next sync which would be 5 mins later.
But somehow after seeing this, I m thinking why not trigger the sync immediately after PUT as well like POST, if someone updates the connector, I feel they would like the sync to happen immediately wdyt?
If we do that, this probing is not needed.

f"Scheduler registration failed for {connector_id!r}: {sched_exc}",
exc_info=True,
)
raise

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.

These kind of empty raise statements needs to be updated with a prefix message saying on what operation and situation, this specific exception is raised. Please take care of all the plain raise statements wrt to the connector changes added.

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.

This applies to other endpoint handlers as well.
Also please ensure to log them before raising

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.

@manalilatkar @Niharika0306
I think similar behaviour need to be taken care in extract and translate service as well.
Please see whether you can address them in your upcoming PRs

Inherits from str so values can be compared directly against DB strings.
"""

CREDENTIAL_ERROR_MSG = "Authentication failed: unable to connect with the provided credentials"

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.

this should be used on auth issues faced during sync operation as well

total_files INTEGER NOT NULL DEFAULT 0,
new_files INTEGER NOT NULL DEFAULT 0,
removed_files INTEGER NOT NULL DEFAULT 0,
failed_files INTEGER NOT NULL DEFAULT 0,

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.

can you help me remember why are we removing failed_files?

if total_files is not None:
values["total_files"] = total_files
if error is not None:
if error is not _UNSET:

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.

can you not simply do this by removing this if?
what ever is passed for error arg needs to be set as is.
So when an error exists currently, if its cleared in next run, the error passed here would be none, which can be set as is. wdyt?

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

It would be great, if you can produce possible error cases and how the connector and sync log's error fields looks like.

@@ -129,7 +180,7 @@ async def create_connector(body: ConnectorCreateRequest):
# id or name already exists

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.

I think we also discussed to log the exceptions before raising, can you please take care in all the occurrences?

if not found:
return False
db_manager.update_connector_after_sync(connector_id, status=status, last_sync_at=now)
db_manager.update_connector_after_sync(

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.

It's better to rephrase the error message of a last sync when we update it on connector to depict that it s from the last sync.

if batch_failed:
raise RuntimeError(
f"One or more batches failed to ingest for connector {connector_id!r}; "
"connector marked as out of sync"

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.

This is going to be a user facing error message, can we please rephrase accordingly?
Something like: One or more documents failed to sync. See more details on digitize jobs <f"Connector-{connector_name}-{sync_seq}-*>

f"Scheduler registration failed for {connector_id!r}: {sched_exc}",
exc_info=True,
)
raise

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.

This applies to other endpoint handlers as well.
Also please ensure to log them before raising

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