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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ jobs:
- name: Build and install wheel
run: |
python -m pip install --upgrade pip build
python scripts/bundle_schemas.py
python -m build --wheel --outdir dist/
pip install dist/*.whl

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ jobs:
python -m pip install --upgrade pip
pip install build twine

- name: Bundle schemas
if: ${{ steps.release.outputs.release_created == 'true' || (github.event_name == 'workflow_dispatch' && inputs.publish == true) }}
run: python scripts/bundle_schemas.py

- name: Build package
if: ${{ steps.release.outputs.release_created == 'true' || (github.event_name == 'workflow_dispatch' && inputs.publish == true) }}
run: python -m build
Expand Down
3 changes: 2 additions & 1 deletion src/adcp/validation/schema_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ def _ensure_state(version: str | None = None) -> _LoaderState | None:
return None
root = _resolve_schema_root(bundle_key)
if root is None:
logger.debug(
log_missing = logger.warning if version is None else logger.debug
log_missing(
"AdCP schemas not found for bundle_key=%s; validation will skip "
"all tools for this version",
bundle_key,
Expand Down
33 changes: 33 additions & 0 deletions tests/test_schema_loader_per_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from __future__ import annotations

import json
import logging
import shutil
from pathlib import Path

Expand Down Expand Up @@ -190,6 +191,38 @@ def test_validate_request_unknown_version_skips_safely(
assert outcome.issues == []


def test_missing_sdk_pinned_bundle_warns(
monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture
) -> None:
monkeypatch.setattr(_loader_mod, "_resolve_schema_root", lambda bundle_key=None: None)

_reset_for_tests()
try:
with caplog.at_level(logging.WARNING, logger="adcp.validation.schema_loader"):
outcome = validate_request("synthetic_tool", {"x": 1})
finally:
_reset_for_tests()

assert outcome.valid
assert any("AdCP schemas not found" in rec.message for rec in caplog.records)


def test_missing_explicit_version_bundle_does_not_warn(
monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture
) -> None:
monkeypatch.setattr(_loader_mod, "_resolve_schema_root", lambda bundle_key=None: None)

_reset_for_tests()
try:
with caplog.at_level(logging.WARNING, logger="adcp.validation.schema_loader"):
outcome = validate_request("synthetic_tool", {"x": 1}, version="9.9.9")
finally:
_reset_for_tests()

assert outcome.valid
assert not any("AdCP schemas not found" in rec.message for rec in caplog.records)


def test_validate_response_threads_version_through(
synthetic_legacy_bundle: tuple[str, Path],
) -> None:
Expand Down
Loading