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
17 changes: 8 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ on:
pull_request:
branches: [main]

# Default @adcp/sdk runner alias for non-matrix storyboard jobs.
# The reference seller storyboard job below runs both sticky 3.0 and 3.1 tags.
# Default @adcp/sdk runner alias for storyboard jobs. Tracks the current
# stable @adcp/sdk release via the ``latest`` npm dist-tag.
env:
ADCP_SDK_VERSION: "adcp-3.1"
ADCP_SDK_VERSION: "latest"

concurrency:
group: ci-${{ github.ref }}
Expand Down Expand Up @@ -361,15 +361,14 @@ jobs:
name: AdCP storyboard runner — examples/seller_agent.py (@adcp/sdk ${{ matrix.adcp-sdk-tag }})
runs-on: ubuntu-latest
# Blocking gate: examples/seller_agent.py is the Python-owned
# reference target for bidirectional storyboard interop. The npm
# dist-tags are sticky compatibility gates: ``adcp-3.0`` stays on
# the 3.0 runner line, while ``adcp-3.1`` tracks the current 3.1
# runner. Downstream SDKs and adopters can assert backwards
# compatibility without depending on moving latest/beta semantics.
# reference target for bidirectional storyboard interop. The matrix
# runs two legs: the sticky ``adcp-3.0`` tag is a fixed, reproducible
# backwards-compat floor (the AdCP 3.0 runner line), while ``latest``
# tracks the current stable @adcp/sdk release (the AdCP 3.1 line).
strategy:
fail-fast: false
matrix:
adcp-sdk-tag: ["adcp-3.0", "adcp-3.1"]
adcp-sdk-tag: ["adcp-3.0", "latest"]

steps:
- uses: actions/checkout@v6
Expand Down
52 changes: 52 additions & 0 deletions scripts/generate_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@ def _load_resolve_bundle_key():
TEMP_DIR = REPO_ROOT / ".schema_temp"
DELTAS_FILE = REPO_ROOT / "SCHEMA_DELTAS.md"

# Bundled schemas are self-contained: each message schema inlines its entire
# ``$ref`` graph, so every bundled module re-emits its own copy of the shared
# provenance/verification/asset sub-schemas. The generator can't merge those
# copies across files, so the bundled tree accounts for the overwhelming
# majority of generated classes. ``consolidate_exports.py`` already excludes
# bundled modules from the public namespace; the only one any source module
# imports is ``get_adcp_capabilities_response`` (via
# ``adcp.types.capabilities``), whose typed sub-models exist *only* in the
# inlined bundled form. Keep that module (and the package ``__init__`` files on
# its import path) and drop the rest after generation.
BUNDLED_DIR_NAME = "bundled"
BUNDLED_KEEP = {
Path("__init__.py"),
Path("protocol/__init__.py"),
Path("protocol/get_adcp_capabilities_response.py"),
}


def rewrite_refs(obj, current_schema_rel_path: Path):
"""
Expand Down Expand Up @@ -495,6 +512,38 @@ def restore_unchanged_files():
print(" No timestamp-only changes found")


def prune_unused_bundled_modules():
"""Drop generated bundled modules no source module imports.

See ``BUNDLED_KEEP`` for why the bundled tree is almost entirely dead
weight. Removing it here keeps the committed tree small without changing
the content of any retained module — generation runs unchanged and this
only deletes the unreferenced output afterwards.
"""
bundled_dir = OUTPUT_DIR / BUNDLED_DIR_NAME
if not bundled_dir.exists():
return

print("Pruning unused bundled modules...")
removed = 0
for py_file in bundled_dir.rglob("*.py"):
if py_file.relative_to(bundled_dir) in BUNDLED_KEEP:
continue
py_file.unlink()
removed += 1

# Drop now-empty package directories (deepest first).
for directory in sorted(
(d for d in bundled_dir.rglob("*") if d.is_dir()),
key=lambda d: len(d.parts),
reverse=True,
):
if not any(directory.iterdir()):
directory.rmdir()

print(f" ✓ Removed {removed} unused bundled module(s)\n")


def apply_post_generation_fixes():
"""Apply post-generation fixes using the dedicated script."""
print("Running post-generation fixes...")
Expand Down Expand Up @@ -561,6 +610,9 @@ def main():
if not apply_post_generation_fixes():
return 1

# Drop unreferenced bundled modules before consolidation
prune_unused_bundled_modules()

# Consolidate exports into generated.py
consolidate_script = REPO_ROOT / "scripts" / "consolidate_exports.py"
result = subprocess.run(
Expand Down

This file was deleted.

Loading
Loading