Skip to content

Fix datasource list status for known engines#159

Merged
martyna-mindsdb merged 1 commit into
mindsdb:mainfrom
robertmonka:fix/datasource-list-status
May 15, 2026
Merged

Fix datasource list status for known engines#159
martyna-mindsdb merged 1 commit into
mindsdb:mainfrom
robertmonka:fix/datasource-list-status

Conversation

@robertmonka
Copy link
Copy Markdown
Contributor

When an engine definition is available, validate required fields before treating an empty credentials map as incomplete. This lets known engines without required fields appear as saved instead of incomplete.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 13, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@entelligence-ai-pr-reviews
Copy link
Copy Markdown

entelligence-ai-pr-reviews Bot commented May 13, 2026

EntelligenceAI PR Summary

Fixes incorrect 'saved' status display for datasources with a defined engine and non-'choice' auth method when required fields are missing.

  • Modified handle_list_data_sources in anton/commands/datasource/manage.py
  • Moved engine_def-based required field validation check to execute before the generic empty-fields fallback check
  • Ensures missing required fields are correctly detected regardless of auth method type

Confidence Score: 5/5 - Safe to Merge

Safe to merge — this PR fixes datasource list status handling for known engines and has been assessed with no identified issues, logic concerns, or security problems. The automated review found the code to be clean with zero critical, significant, or medium-severity findings. No pre-existing unresolved comments are present, and the change appears well-scoped to its stated purpose of correcting status reporting for known database engines.

Key Findings:

  • No logic bugs, null-pointer risks, or incorrect conditional branches were detected in the datasource status resolution logic.
  • No security concerns, missing validations, or data integrity issues were identified in the engine status handling code.
  • The PR is narrowly scoped to fixing a specific status display bug for known engines, reducing the risk of unintended side effects across the datasource listing flow.

@robertmonka
Copy link
Copy Markdown
Contributor Author

Additional context for reviewers:

This is a small display/status fix in handle_list_data_sources. The previous ordering treated an empty credentials map as incomplete before considering the datasource engine definition. That made the generic empty-fields fallback win even when the engine definition was available and could provide a more precise answer.

What changed:

  • For known non-choice engines, required fields are evaluated first.
  • Missing required fields still show incomplete.
  • Engines with no missing required fields can show saved, even when the stored fields map is empty.
  • Unknown engines and choice auth engines keep the existing empty-fields fallback behavior.

This is intentionally limited to the status calculation in anton/commands/datasource/manage.py; it does not change vault storage, connection setup, or credential loading.

@torrmal torrmal requested a review from martyna-mindsdb May 13, 2026 08:02
@robertmonka
Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@robertmonka
Copy link
Copy Markdown
Contributor Author

recheck

@robertmonka robertmonka force-pushed the fix/datasource-list-status branch 2 times, most recently from c96c565 to 3972c70 Compare May 13, 2026 20:55
Comment thread tests/test_datasource.py Outdated
assert reg.get("mysql") is not None
assert reg.get("mysql").display_name == "MySQL"

def test_builtin_optima_api_template(self):
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.

The existing tests are testing how the registry parses templates, not whether a specific template has the right values. But the test_builtin_optima_api_template test is just checking that the YAML was typed correctly, which isn't something we test for other datasources. Rather, if every new datasource added a test like this, the file would grow a lot without real value, because the file already gets validated by test_validate_file_returns_engines and test_all_engines_sorted.

Could you remove this test?

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.

Done, removed test_builtin_optima_api_template. The generic datasource registry/parser tests remain in place.

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.

Thanks. I see that you removed the datasource template from the datasources.md file as well, although I suggested removing just from the tests.

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.

You are right, I removed it from datasources.md as well to keep this PR focused only on the status handling fix.

For context, that datasource is for connecting to an API I wrote for Comarch Optima, which is a popular ERP system in Poland. If you think this datasource belongs in the built-in sources, I can add it back in a separate, dedicated PR with the relevant context.

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.

That sounds good. Sure, please feel free to create a new PR adding the template for this datasource.

@robertmonka robertmonka force-pushed the fix/datasource-list-status branch 2 times, most recently from 5d5d1f5 to 02a1c36 Compare May 14, 2026 13:32
Add the WebArm Comarch Optima API built-in datasource template and cover its parsed metadata in datasource tests. Keep known-engine status handling ahead of the generic empty-fields fallback so known engines report saved or incomplete correctly.
@robertmonka robertmonka force-pushed the fix/datasource-list-status branch from 02a1c36 to e218f27 Compare May 14, 2026 19:50
@martyna-mindsdb martyna-mindsdb added this pull request to the merge queue May 15, 2026
Merged via the queue into mindsdb:main with commit 31572cd May 15, 2026
2 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants