Skip to content

The agent that grows with you

test(upgrade): skip only known optional-extra SDKs in the HEAD-module import probe

Teknium84edf214d77f
diff --git a/tests/e2e/core/upgrade/test_upgrade_path.py b/tests/e2e/core/upgrade/test_upgrade_path.py
index 91c93031d26..30a4ada5c32 100644
--- a/tests/e2e/core/upgrade/test_upgrade_path.py
+++ b/tests/e2e/core/upgrade/test_upgrade_path.py
@@ -134,6 +134,11 @@ from pathlib import Path
root, base = Path(sys.argv[1]), sys.argv[2]
cfg = tomllib.load(open(root / "pyproject.toml", "rb"))
tops = [p for p in cfg["tool"]["setuptools"]["packages"]["find"]["include"] if "*" not in p]
+# Import name -> the optional extra that ships it. Only these may be absent from a HEAD-added
+# module's imports; any other missing module (a core dependency, a typo) is a real failure.
+OPTIONAL_SDKS = {"acp": "acp"}
+extras = cfg["project"].get("optional-dependencies", {})
+assert set(OPTIONAL_SDKS.values()) <= set(extras), f"stale OPTIONAL_SDKS extras: {OPTIONAL_SDKS}"
added = subprocess.run(["git", "-C", str(root), "diff", "--name-only", "--diff-filter=A", base, "HEAD", "--",
*[f"{t}/*.py" for t in tops]], capture_output=True, text=True).stdout.split()
added = [a[:-3].replace("/", ".") for a in added if "/tests/" not in a and not a.endswith("__init__.py")][:3]
@@ -143,8 +148,8 @@ for name in tops + ["hermes_cli.main", "run_agent", "hermes_state"] + added:
mod = importlib.import_module(name)
except BaseException as exc:
missing = (getattr(exc, "name", None) or "").split(".")[0]
- if name in added and isinstance(exc, ModuleNotFoundError) and missing and missing not in tops:
- continue # an optional extra's SDK (e.g. acp); a stale finder misses the module itself
+ if name in added and isinstance(exc, ModuleNotFoundError) and missing in OPTIONAL_SDKS:
+ continue # an optional extra's SDK; a stale finder misses the module itself, not an SDK
bad.append(f"{name}: {type(exc).__name__}: {exc}")
continue
where = Path(getattr(mod, "__file__", None) or str(list(getattr(mod, "__path__", [""]))[0])).resolve()