Summary
validate_integration.py currently warns when an integration uses an explicit config path with Integration.load(...), for example:
instagram = Integration.load(os.path.join(os.path.dirname(__file__), "config.json"))
The warning says:
Integration should use 'Integration.load()' to load the integration
This is a false positive for multi-file integrations that intentionally pass an explicit config.json path.
Current behavior
In scripts/validate_integration.py, _check_main_python_file() concatenates all Python file contents and checks for the literal substring:
if 'Integration.load()' not in all_content:
self.add_warning("Integration should use 'Integration.load()' to load the integration")
That means:
Integration.load() passes
Integration.load("config.json") warns
Integration.load(os.path.join(...)) warns
- a comment or string containing
Integration.load() could satisfy the check
INTEGRATION_CHECKLIST.md already documents this limitation as expected for multi-file integrations, but the validator output is still confusing during PR review.
Proposed fix
Update the validator to detect an actual AST call to Integration.load(...), accepting both no-arg and explicit-path forms:
Integration.load()
Integration.load("config.json")
Integration.load(config_path)
Integration.load(os.path.join(os.path.dirname(__file__), "config.json"))
Suggested approach:
- Import
ast in scripts/validate_integration.py.
- Keep collecting Python files as today.
- Replace the literal substring check with a helper that parses each file and looks for:
ast.Call(
func=ast.Attribute(
value=ast.Name(id="Integration"),
attr="load",
)
)
- Change the warning text to reference
Integration.load(...), not only Integration.load().
Test cases to add
Integration.load() should not warn.
Integration.load(os.path.join(os.path.dirname(__file__), "config.json")) should not warn.
- A comment/string containing
Integration.load() without an actual call should still warn.
Docs to update
Update:
scripts/docs/validate_integration.md
INTEGRATION_CHECKLIST.md
The docs should say the validator accepts Integration.load(...) calls, including explicit config-path forms used by multi-file integrations.
Context
This came up while reviewing Autohive-AI/autohive-integrations PR #327 for the Instagram integration SDK v2 upgrade. Instagram is a multi-module integration with an actions/ subfolder and uses an explicit config path to avoid runtime config resolution issues outside pytest's patched Integration.load() behavior.
Summary
validate_integration.pycurrently warns when an integration uses an explicit config path withIntegration.load(...), for example:The warning says:
This is a false positive for multi-file integrations that intentionally pass an explicit
config.jsonpath.Current behavior
In
scripts/validate_integration.py,_check_main_python_file()concatenates all Python file contents and checks for the literal substring:That means:
Integration.load()passesIntegration.load("config.json")warnsIntegration.load(os.path.join(...))warnsIntegration.load()could satisfy the checkINTEGRATION_CHECKLIST.mdalready documents this limitation as expected for multi-file integrations, but the validator output is still confusing during PR review.Proposed fix
Update the validator to detect an actual AST call to
Integration.load(...), accepting both no-arg and explicit-path forms:Suggested approach:
astinscripts/validate_integration.py.Integration.load(...), not onlyIntegration.load().Test cases to add
Integration.load()should not warn.Integration.load(os.path.join(os.path.dirname(__file__), "config.json"))should not warn.Integration.load()without an actual call should still warn.Docs to update
Update:
scripts/docs/validate_integration.mdINTEGRATION_CHECKLIST.mdThe docs should say the validator accepts
Integration.load(...)calls, including explicit config-path forms used by multi-file integrations.Context
This came up while reviewing
Autohive-AI/autohive-integrationsPR #327 for the Instagram integration SDK v2 upgrade. Instagram is a multi-module integration with anactions/subfolder and uses an explicit config path to avoid runtime config resolution issues outside pytest's patchedIntegration.load()behavior.