refactor(wizard): split integration health validators into grouped modules#958
Conversation
Greptile SummaryThis PR splits the monolithic One point worth noting: Confidence Score: 5/5Safe to merge; all findings are P2 style/documentation concerns with no runtime impact. The refactoring is structurally sound — the public API surface is fully preserved, all tests pass, and the module split follows clear grouping logic. The two findings (undocumented library swap in validate_slack_webhook and weak compatibility test) are P2 quality suggestions that do not affect correctness or production behavior. app/cli/wizard/integration_validators/http_probe_validators.py (undisclosed requests→httpx swap) and tests/cli/wizard/test_integration_health.py (compatibility test coverage). Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["app.cli.wizard.integration_health\n(stable public facade / __all__)"]
A --> B["integration_validators/\nclient_validators.py\n(Grafana, Datadog, Honeycomb,\nCoralogix, AWS, Sentry,\nGitLab, Vercel, Alertmanager,\nOpsGenie, BetterStack)"]
A --> C["integration_validators/\nhttp_probe_validators.py\n(Slack, Notion, Jira,\nGoogle Docs, Discord)"]
A --> D["integration_validators/\nmcp_validators.py\n(GitHub MCP, OpenClaw)"]
B & C & D --> E["integration_validators/\nshared.py\nIntegrationHealthResult"]
E --> F["app.integrations.github_mcp\nGitHubMCPValidationResult"]
|
c91d6df to
9277017
Compare
|
@VaibhavUpreti |
| class IntegrationHealthResult: | ||
| """Result of validating an optional integration.""" | ||
|
|
||
| ok: bool |
There was a problem hiding this comment.
shared.py imports GitHubMCPValidationResult from a concrete integration module, which means every consumer of IntegrationHealthResult silently pulls in the GitHub MCP import chain. The field is only meaningful for one validator. Consider using object | None (or a Protocol) here and letting mcp_validators.py own the typed field, or move GitHubMCPValidationResult into shared.py to keep the dependency explicit in the right layer.
| ok=False, detail="Jira credentials invalid. Check email and API token." | ||
| ) | ||
| if resp.status_code == 404: | ||
| return IntegrationHealthResult( |
There was a problem hiding this comment.
validate_google_docs_integration belongs in client_validators.py. It uses GoogleDocsClient (a service client), not a raw HTTP probe — the only reason it's here is that the original file had it adjacent to Notion/Jira. The module docstring says 'HTTP-probe validators'; this function violates that contract and will confuse the next person deciding where to put a new validator.
| def test_legacy_integration_health_import_surface_still_exports_validators() -> None: | ||
| module = import_module("app.cli.wizard.integration_health") | ||
|
|
||
| assert hasattr(module, "validate_slack_webhook") |
There was a problem hiding this comment.
Spot-checking one symbol out of 18 exported gives false confidence. Assert against the full all list so a future refactor can't silently drop exports: assert set(module.all) == {all 18 names}.
|
Hi @muddlebee, addressed all 3 points in the latest push:
All tests + lint/type checks pass. |
|
thank you looks good. I will wait additional reviews, @VaibhavUpreti @hamzzaaamalik @yashksaini-coder |
|
Looked at this locally and ran the tests. It's a clean refactor integration_health.py becomes a re-export façade, validators move into 3 grouped modules, tests pass. Spot-checked every validator body against the old file: 13 are byte-identical, the other 5 only have cosmetic tweaks (hoisting import httpx to the top of the file, renaming e to err for consistency, an em-dash → -- in one comment). No behaviour change. Other things I checked: Every place in the codebase that imports from integration_health still works — all 19 symbols are re-exported and the new compat test guards that. LGTM, approve and merge. |
|
🎯 Bullseye. @7vignesh opened a PR, kept the vibes clean, and got it merged. Absolute cinema. 🎬 👋 Join us on Discord - OpenSRE : hang out, contribute, or hunt for features and issues. Everyone's welcome. |

Fixes #873
Describe the changes you have made in this PR -
This PR refactors
app/cli/wizard/integration_health.pyinto smaller, grouped validator modules while preserving the stable public import surface.What changed:
Split validators into focused modules under
app/cli/wizard/integration_validators/:client_validators.py— 11 validators backed by service clients (Grafana, Datadog, Honeycomb, Coralogix, AWS, Sentry, GitLab, Vercel, Alertmanager, OpsGenie, BetterStack)http_probe_validators.py— 5 HTTP-based validators (Slack webhook, Notion, Jira, Google Docs, Discord)mcp_validators.py— 2 MCP validators (GitHub MCP, OpenClaw)shared.py—IntegrationHealthResultdataclass__init__.py— Module markerKept
app/cli/wizard/integration_health.pyas the stable public API by re-exporting all validators and the result type, so external imports remain unchanged.Updated test monkeypatch targets to point at new implementation modules while maintaining backward-compatible public function imports in tests.
Added compatibility test that verifies validators are still accessible through the legacy public module path.
Test updates:
app.cli.wizard.integration_healthNo validator behavior changed; this is a pure refactoring for maintainability.
Demo/Screenshot for feature changes and bug fixes -
Validation run for this change:
python -m pytest tests/cli/wizard/test_integration_health.py— 31 passedpython -m ruff check app/cli/wizard/integration_health.py app/cli/wizard/integration_validators tests/cli/wizard/test_integration_health.pypython -m ruff format --check app/cli/wizard/integration_health.py app/cli/wizard/integration_validators tests/cli/wizard/test_integration_health.pypython -m mypy app/cli/wizard/integration_health.py app/cli/wizard/integration_validators(no issues)Code Understanding and AI Usage
Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?
Yes, I used AI assistance (GitHub Copilot)
If you used AI assistance:
Explain your implementation approach:
The refactoring grouped validators by their implementation style (client-backed, HTTP-probe, MCP) for clarity and separation of concerns, while maintaining a stable re-export surface so that all external callers and test imports remain unaffected. The monkeypatch paths were updated to target the actual implementation modules rather than the re-export surface, ensuring test isolation and precise mocking.
Checklist before requesting a review