Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,17 @@ jobs:
linux:
name: linux · lint + tests
runs-on: ubuntu-latest
env:
ARGUS_VERTICALS_REPO: ${{ github.workspace }}/.integration/argus-verticals
steps:
- uses: actions/checkout@v4
- name: Check out paired Store providers
uses: actions/checkout@v4
with:
repository: Argus-AiTeam/argus-verticals
ref: 7194d773092d653a6aa03da1631ee37e51937c6e
path: .integration/argus-verticals
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: '22.12.0'
Expand All @@ -34,8 +43,8 @@ jobs:
- name: Install
# The project's own dev extra, rather than a hand-listed subset that
# drifts. The community verticals (argus-verticals) and their heavy
# scientific stack are not installed here: this suite tests the
# framework and its seven built-in verticals only.
# scientific stack are not installed here. The pinned source checkout
# is consumed only by the existing isolated Store integration tests.
run: |
python -m pip install --upgrade pip
python -m pip install -e '.[dev,qr,trial]'
Expand All @@ -45,6 +54,8 @@ jobs:
run: |
npm ci
npm run build
- name: Install the bounded Store reference simulator
run: sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends iverilog
- name: Test
run: python -m pytest -q -n auto

Expand Down
5 changes: 5 additions & 0 deletions argus/apps/cli/_verticals.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def _print_table(rows: list[dict[str, Any]]) -> None:
widths = [max(len(str(cell)) for cell in column) for column in zip(_LIST_COLUMNS, *table)]
for line in (_LIST_COLUMNS, *table):
print(" ".join(str(cell).ljust(width) for cell, width in zip(line, widths)).rstrip())
for row in rows:
for key in ("runtime_issues", "install_issues"):
if row.get(key):
print(f"{row['name']} {key}: {'; '.join(row[key])}", file=sys.stderr)


def _cmd_list(args: argparse.Namespace) -> int:
Expand Down Expand Up @@ -71,6 +75,7 @@ def _cmd_info(args: argparse.Namespace) -> int:
"name", "kind", "purpose", "purpose_zh", "version", "installed_version", "enabled",
"update_available", "requires", "shared", "python_requirements", "missing_python",
"tags", "routing_path", "size_bytes", "used_by", "actions", "managed_by_host",
"runtime_issues", "install_issues",
):
value = row.get(key)
rendered = ", ".join(map(str, value)) if isinstance(value, list) else value
Expand Down
105 changes: 96 additions & 9 deletions argus/verticals/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@
_SHA256 = re.compile(r"^[a-f0-9]{64}$")
_ARCHIVE_FILE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._+-]*\.zip$")
_REQUIREMENT_NAME = re.compile(r"^\s*([A-Za-z0-9][A-Za-z0-9._-]*)")
_FEATURE_NAME = re.compile(r"^[a-z][a-z0-9-]*$")
_ARGUS_FEATURE_APIS = {
"composable-workflow-profiles": ("argus.core.vertical_contract", ("VerticalContract.compose_workflow",)),
"vertical-routing-paths": ("argus.verticals._registry", ("validate_routing_path",)),
"host-round-evidence": (
"argus.engineer.round_evidence",
("RoundEvidence", "RoundEvidenceRequest", "register_round_evidence_provider", "collect_round_evidence"),
),
}
#: Distribution names whose importable module is spelled differently.
_MODULE_ALIASES = {
"pyyaml": "yaml", "scikit-learn": "sklearn", "pillow": "PIL", "opencv-python": "cv2",
Expand Down Expand Up @@ -313,9 +322,19 @@ def disabled_names(root: str | Path | None = None) -> set[str]:


def enabled_entries(root: str | Path | None = None) -> dict[str, dict[str, Any]]:
"""Installed and not disabled by this user."""
"""Installed, enabled by this user and compatible with declared runtime features."""
disabled = disabled_names(root)
return {name: entry for name, entry in installed(root).items() if name not in disabled}
present = installed(root)
result = {}
for name, entry in present.items():
if name in disabled:
continue
issues = runtime_issues(present, name)
if issues:
log.warning("store vertical %r is incompatible: %s", name, "; ".join(issues))
else:
result[name] = entry
return result


def _file_signature(path: Path) -> tuple[int, int, int] | None:
Expand Down Expand Up @@ -486,6 +505,15 @@ def _string_list(value: object, *, where: str, pattern: re.Pattern[str] | None =
return list(value)


def _argus_features(value: object, *, where: str) -> list[str]:
if not isinstance(value, list):
raise VerticalStoreError(f"{where}.argus_features must be a list of strings")
features = _string_list(value, where=f"{where}.argus_features", pattern=_FEATURE_NAME)
if len(set(features)) != len(features):
raise VerticalStoreError(f"{where}.argus_features must be distinct")
return features


def _validate_entry(name: str, raw: object, *, local_source: bool) -> dict[str, Any]:
where = f"catalog vertical {name!r}"
if not isinstance(raw, dict):
Expand Down Expand Up @@ -569,6 +597,7 @@ def _validate_entry(name: str, raw: object, *, local_source: bool) -> dict[str,
"size_bytes": size_bytes,
"api_version": api_version,
"min_argus": str(raw.get("min_argus") or ""),
"argus_features": _argus_features(raw.get("argus_features", []), where=where),
"maintainers": _string_list(raw.get("maintainers"), where=f"{where}.maintainers"),
"archive": {"file": file_name, "url": url, "sha256": sha256, "size": size},
}
Expand Down Expand Up @@ -731,6 +760,43 @@ def _is_current(entry: dict[str, Any], spec: dict[str, Any]) -> bool:
return entry.get("version") == spec["version"] and entry.get("sha256") == spec["archive"]["sha256"]


def runtime_issues(verticals: dict[str, dict[str, Any]], name: str) -> list[str]:
"""Check declared framework APIs across dependencies without importing plugin code."""
issues = []
try:
order = _closure({"verticals": verticals}, [name])
requirements = {
member: _argus_features(verticals[member].get("argus_features", []), where=member)
for member in order
}
except VerticalStoreError as exc:
return [str(exc)]
for member, features in requirements.items():
api_version = verticals[member].get("api_version", 1)
if api_version != 1:
issues.append(f"{member}: vertical API version {api_version} is not supported by this Argus")
for feature in features:
api = _ARGUS_FEATURE_APIS.get(feature)
if api is None:
issues.append(f"{member}: unsupported Argus feature {feature!r}; select a compatible runtime")
continue
module_name, symbols = api
try:
module = importlib.import_module(module_name)
except ModuleNotFoundError as exc:
if exc.name != module_name and not module_name.startswith(f"{exc.name}."):
raise
issues.append(f"{member}: requires Argus feature {feature!r}; missing {module_name}")
continue
for symbol in symbols:
value: Any = module
for part in symbol.split("."):
value = getattr(value, part, None)
if not callable(value):
issues.append(f"{member}: requires Argus feature {feature!r}; missing {module_name}.{symbol}")
return issues


# --------------------------------------------------------------------------- #
# Archives
# --------------------------------------------------------------------------- #
Expand Down Expand Up @@ -920,6 +986,8 @@ def _place(
"shared": list(spec["shared"]),
"paths": list(spec["paths"]),
"routing_path": list(spec.get("routing_path", [])),
"argus_features": list(spec["argus_features"]),
"api_version": spec["api_version"],
}
for tree in spec["shared"]:
owners = data["shared"].setdefault(tree, {"owners": [], "sha256s": {}})
Expand Down Expand Up @@ -1159,8 +1227,6 @@ def _install_one(
step: Callable[[float, str], None],
) -> None:
name = spec["name"]
if spec["api_version"] != 1:
raise VerticalStoreError(f"{name}: vertical API version {spec['api_version']} is not supported by this Argus")
store = store_root(root)
_sweep_staging(store)
try:
Expand Down Expand Up @@ -1233,6 +1299,9 @@ def _begin_install(
if _is_current(present[name], spec):
raise VerticalStoreError(f"{name} {spec['version']} is already current")
order = _closure(catalog, [name])
issues = runtime_issues(catalog["verticals"], name)
if issues:
raise VerticalStoreError("; ".join(issues))
todo = [
member for member in order
if member == name or member not in present or not _is_current(present[member], catalog["verticals"][member])
Expand Down Expand Up @@ -1274,9 +1343,14 @@ def update(
def set_enabled(name: str, enabled: bool, root: str | Path | None = None) -> dict[str, Any]:
"""Flip ``name`` for this user only: the overlay changes, the host's registry never does."""
name = _valid_name(name)
entry = installed(root).get(name)
present = installed(root)
entry = present.get(name)
if entry is None:
raise UnknownVerticalError(f"{name} is not installed")
if enabled:
issues = runtime_issues(present, name)
if issues:
raise VerticalStoreError("; ".join(issues))
with _user_locked(root):
disabled = disabled_names(root)
if enabled:
Expand Down Expand Up @@ -1481,6 +1555,9 @@ def preinstall(
cleaned = _valid_name(name)
need = _preinstall_need(cleaned, root, catalog)
if need is None:
issues = runtime_issues(installed(root), cleaned)
if issues:
raise VerticalStoreError("; ".join(issues))
logger.info("vertical %s is installed and current under %s", cleaned, store_root(root))
results[name] = {"status": "ready"}
continue
Expand Down Expand Up @@ -1634,6 +1711,7 @@ def rows(
"missing_python": [], "tags": [], "size_bytes": 0, "routing_path": [],
"used_by": list(sessions.get(name, [])), "operation": None,
"managed_by_host": host, "actions": [],
"runtime_issues": [], "install_issues": [],
})
for name in sorted(set(present) | set(packaged) | set(specs)):
if name in VERTICALS:
Expand All @@ -1645,6 +1723,12 @@ def rows(
op = operation(name, root) if (entry is not None or spec is not None) else None
update_available = bool(entry is not None and spec is not None and not _is_current(entry, spec))
enabled = kind == "package" or (entry is not None and name not in disabled)
current_issues = runtime_issues(present, name) if entry is not None and kind != "package" else []
install_issues = runtime_issues(specs, name) if spec is not None else []
actions = _actions(
kind, entry=entry, spec=spec, enabled=enabled, update_available=update_available, host=host,
running=bool(op and op.get("status") == "running"), can_toggle=can_toggle,
)
requirements = list(spec["python_requirements"]) if spec else []
if name in plugins:
routing_path = plugins[name].routing_path
Expand All @@ -1671,10 +1755,13 @@ def rows(
"used_by": list(sessions.get(name, [])),
"operation": op,
"managed_by_host": host,
"actions": _actions(
kind, entry=entry, spec=spec, enabled=enabled, update_available=update_available, host=host,
running=bool(op and op.get("status") == "running"), can_toggle=can_toggle,
),
"runtime_issues": current_issues,
"install_issues": install_issues,
"actions": [
action for action in actions
if not (action in {"install", "update"} and install_issues)
and not (action == "enable" and current_issues)
],
})
return result

Expand Down
49 changes: 48 additions & 1 deletion docs/vertical-store.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,49 @@ The store never installs Python dependencies: a vertical's `python_requirements`
are *shown* (with the ones whose module is missing flagged), so the decision stays
with the operator.

## Framework requirements

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the PR summary with an explicit documentation bullet covering feature declarations, installed-versus-catalog reporting, legacy behavior and the pinned CI boundary. The existing lexical check now reports all three changed categories (tests, docs and config); no gate rule or threshold was changed.


Catalog entries may declare `argus_features`, a distinct list of required
framework capabilities. Supported names currently are:

- `composable-workflow-profiles`: `VerticalContract.compose_workflow`.
- `vertical-routing-paths`: the framework's routing-path validator.
- `host-round-evidence`: the request/result types, provider registration and
collection API used to deliver host evidence to a read-only Reviewer.

The Store checks these known framework APIs and the vertical API version across
the entire selected dependency closure before starting an install/update job.
Unknown features and missing APIs are explicit refusals; no archive is downloaded
or replaced. The catalog cannot name arbitrary modules to import. Plugin code,
project evaluators and EDA tools are not executed by these probes.

Requirements are saved with the installed version, so offline discovery,
enablement and host preinstallation also detect an incompatible runtime.
`runtime_issues` describes the installed dependency closure; `install_issues`
describes the catalog selection. A newer incompatible catalog must not make a
working installed version appear broken or disable it. Disable/removal remain
available; incompatible installation/update/enable actions are not offered.
`enabled` remains the user's setting, not a claim that a plugin loaded.

`min_argus` is only an informational family label. Legacy declarations without
`argus_features` are not retroactively inferred, and Stores predating this
support ignore the field: deploy the framework support separately before relying
on early refusal. This does not automatically upgrade a frozen runtime or migrate
a historical project. Satisfying feature requirements is not proof of arbitrary
plugin importability, Python dependency availability, toolchain readiness or
scientific acceptance.

The existing Linux `tests.yml` job checks out a fixed community-provider
revision and sets `ARGUS_VERTICALS_REPO`, enabling the real Store integration
cases in the normal suite. Providers are built into temporary release archives,
not pip-installed into the framework environment. Icarus runs only the bounded
digital reference. An explicitly configured missing checkout fails rather than
silently skipping; an unconfigured developer checkout remains optional.
The producer's CI independently pins its framework implementation and checks
that release requirements survive the real Store parser and installation.
Update these immutable CI references deliberately alongside cross-repository
changes; neither reference selects a production runtime or authorizes an ACE run.

## Surfaces

| surface | where |
Expand Down Expand Up @@ -207,7 +250,7 @@ Errors: a store refusal is 409 `{"detail": message}`; an unknown name or action
404; writes are same-origin only (403 otherwise); every route needs the usual bearer
token. A row has `name, purpose, purpose_zh, kind, version, installed_version, enabled,
update_available, requires, shared, python_requirements, missing_python, tags,
size_bytes, used_by, operation, managed_by_host, actions`; `kind` is one of
runtime_issues, install_issues, size_bytes, used_by, operation, managed_by_host, actions`; `kind` is one of
`builtin`, `package` (pip-installed `argus-verticals`), `installed` (store) or
`available` (catalog only), and `actions` lists exactly the manage actions the row
accepts in its current state.
Expand All @@ -233,3 +276,7 @@ accepts in its current state.
for this user; the overlay `state.json` cannot be recorded.
- *`missing_python`* lists a requirement — install it into the Python that runs Argus
(`pip install <requirement>`), or accept the documented gap for optional ones.
- *`runtime_issues` / `install_issues`* — the message names the owning dependency
and unsupported feature/API. Select a compatible framework/provider combination;
do not upgrade a frozen project implicitly. The current installed provider can
remain usable even when only its catalog update is incompatible.
6 changes: 6 additions & 0 deletions frontend/web/src/components/VerticalStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ export function VerticalCard({ row, locale, hosted, busy, failure, known, onAct,
<TriangleAlert size={14} className="mt-0.5 shrink-0" />
<span>{t('verticals.missingPython', { packages: row.missing_python.join(', ') })}</span>
</p>}
{!!row.runtime_issues?.length && <p role="status" className="mt-3 rounded-lg bg-warn/10 p-2.5 text-xs text-warn" data-testid="vertical-runtime-issues">
{t('verticals.runtimeIssues', { issues: row.runtime_issues.join('; ') })}
</p>}
{!!row.install_issues?.length && <p role="status" className="mt-3 rounded-lg bg-warn/10 p-2.5 text-xs text-warn" data-testid="vertical-install-issues">
{t('verticals.installIssues', { issues: row.install_issues.join('; ') })}
</p>}
{row.used_by.length > 0 && <div className="mt-3 text-xs text-ink-faint">
<button type="button" aria-expanded={showProjects} onClick={() => setShowProjects((value) => !value)} className="inline-flex items-center gap-1 transition-colors hover:text-ink" data-testid="vertical-used-by">
{row.used_by.length === 1 ? t('verticals.usedByOne') : t('verticals.usedBy', { count: row.used_by.length })}
Expand Down
4 changes: 4 additions & 0 deletions frontend/web/src/i18n.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@ const en: Record<string, string> = {
'verticals.size': 'Size',
'verticals.jumpTo': 'Go to {name}',
'verticals.missingPython': 'Needs: {packages} — install them into the Python environment Argus runs from.',
'verticals.runtimeIssues': 'Installed version is incompatible with this Argus runtime: {issues}',
'verticals.installIssues': 'Catalog installation/update is blocked by runtime requirements: {issues}',
'verticals.usedByOne': 'Used by 1 project',
'verticals.usedBy': 'Used by {count} projects',
'verticals.action.install': 'Install',
Expand Down Expand Up @@ -1493,6 +1495,8 @@ const zhCN: Record<string, string> = {
'verticals.size': '大小',
'verticals.jumpTo': '查看 {name}',
'verticals.missingPython': '缺少 Python 包:{packages}。请把它们安装到运行 Argus 的那个 Python 环境里。',
'verticals.runtimeIssues': '已安装版本与当前 Argus 运行时不兼容:{issues}',
'verticals.installIssues': '目录版本的安装/更新被运行时要求阻止:{issues}',
'verticals.usedByOne': '1 个项目在用',
'verticals.usedBy': '{count} 个项目在用',
'verticals.action.install': '安装',
Expand Down
16 changes: 16 additions & 0 deletions frontend/web/src/test/verticalStore.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,22 @@ describe('vertical cards', () => {
expect(card(materials)).not.toContain('vertical-missing-python');
});

it('distinguishes an incompatible update from the installed runtime and keeps allowed actions', () => {
const html = card(row({
...kernel, runtime_issues: [], install_issues: ['base: unsupported Argus feature future-runtime'],
actions: ['disable', 'uninstall'],
}));
expect(html).toContain('verticals.installIssues base: unsupported Argus feature future-runtime');
expect(html).not.toContain('data-testid="vertical-runtime-issues"');
expect(actionsOf(html)).toEqual(['disable', 'uninstall']);
const incompatible = card(row({
...kernel, runtime_issues: ['base: missing host-round-evidence'], install_issues: [], actions: ['uninstall'],
}));
expect(incompatible).toContain('verticals.runtimeIssues base: missing host-round-evidence');
expect(incompatible).not.toContain('data-testid="vertical-install-issues"');
expect(actionsOf(incompatible)).toEqual(['uninstall']);
});

it('counts the projects using a vertical and hides the list until asked', () => {
const html = card(kernel);
expect(html).toContain('verticals.usedBy 2');
Expand Down
Loading
Loading