Files
wehub-resource-sync 4b6817381b
Benchmark image — build + push to ECR (any adapter) / build + push (push) Waiting to run
CI / quality (ubuntu-latest) (push) Waiting to run
CI / test (tools-runtime) (push) Waiting to run
CI / test (e2e-general) (push) Waiting to run
CI / test (cli-runtime) (push) Waiting to run
CI / test (e2e-provider-and-openclaw) (push) Waiting to run
CI / test (integrations-and-misc) (push) Waiting to run
CI / coverage-report (push) Blocked by required conditions
CI / test-kubernetes (push) Waiting to run
CI / should-run-thorough (push) Waiting to run
CI / test-thorough (cloudwatch-demo) (push) Blocked by required conditions
CI / test-thorough (flink-ecs) (push) Blocked by required conditions
CI / test-thorough (upstream-lambda) (push) Blocked by required conditions
CI / test-thorough (prefect-ecs-fargate) (push) Blocked by required conditions
CodeQL / Analyze (python) (push) Waiting to run
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Blocked by required conditions
Release / publish-release (push) Blocked by required conditions
Release / publish-main-release (push) Blocked by required conditions
Release / prepare (push) Waiting to run
Release / verify (push) Blocked by required conditions
Release / build-python-dist (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Blocked by required conditions
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Waiting to run
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:10:45 +08:00

60 lines
2.3 KiB
Python

"""Auto-discover and import every per-integration verifier module so the
``@register_verifier`` decorators fire at import time.
Verifier modules live next to the integration they verify:
``integrations.<name>.verifier``.
Adding a new verifier is one new file in the owning integration package. No
edits to a central import list are required — this loader walks the integration
tree.
``integrations.verification`` is intentionally not scanned as an integration
package. It is the shared registry/decorator API imported by vendor-local
verifier modules.
Public surface: :func:`register_all_verifiers`. Callers invoke it once
during startup (``integrations.verify`` and the test suite both do).
Re-invocation is safe: the registry's ``register_verifier`` decorator
replaces existing entries silently.
"""
from __future__ import annotations
import importlib
import pkgutil
import integrations as _integrations_pkg
_VERIFIER_SUBMODULE = "verifier"
# ``integrations.verification`` is shared verifier infrastructure, not a vendor
# integration package with its own ``verifier.py`` module to discover.
_SKIP_INTEGRATION_PACKAGES = frozenset({"verification", "__pycache__"})
def _load_integration_local_verifiers() -> None:
"""Import every ``integrations.<name>.verifier`` module that exists.
Iterates ``integrations`` one level deep and attempts a verifier import only
for package integrations. A ``ModuleNotFoundError`` for the verifier
submodule is skipped; import failures inside an existing verifier still
surface.
"""
for module_info in pkgutil.iter_modules(_integrations_pkg.__path__):
if not module_info.ispkg or module_info.name in _SKIP_INTEGRATION_PACKAGES:
continue
candidate = f"{_integrations_pkg.__name__}.{module_info.name}.{_VERIFIER_SUBMODULE}"
try:
importlib.import_module(candidate)
except ModuleNotFoundError as err:
# Distinguish "no verifier.py here" (expected) from "verifier.py
# exists but its own imports failed" (a real error we must surface).
if err.name != candidate:
raise
def register_all_verifiers() -> None:
"""Import every integration verifier module so its ``@register_verifier``
decorator fires. Idempotent.
"""
_load_integration_local_verifiers()