Skip to content

canonical_formats: structural VAST/DAAST entries never match a LegacyFormat model, because version extraction reads dicts only #1750

Open

Description

@KonstantinMirin

Summary

project_v1_format_to_declaration never matches the registry's VAST or DAAST structural entries when it is handed a LegacyFormat model. _v1_version_constraints (adcp/canonical_formats/v1_to_v2.py) reads versions only from a dict:

src = v1_format if isinstance(v1_format, dict) else None
if src is None:
    return out

_v1_asset_types right above it handles both dicts and models, so the asset types reach structural_match but the versions do not. Three of the seven structural entries in the bundled registry require a version, so all three fail for a model input:

canonical structural pattern
video_vast {"asset_types": ["vast"], "vast_versions": [">=4.0"]}
video_vast {"asset_types": ["vast"], "vast_versions": ["3.x", "2.x"]}
audio_daast {"asset_types": ["daast"], "daast_versions": ["1.0", "1.1"]}

Spec

static/schemas/source/registries/v1-canonical-mapping.json (3.2.7), match modes: "structural — match against the format's slot shape, asset types, and version constraints. The PRIMARY fallback for v1 wire traffic".

Reproduction (adcp 9.3.0)

from adcp.canonical_formats import project_v1_format_to_declaration
from adcp.types.legacy import LegacyFormat

raw = {
    "format_id": {"agent_url": "https://peer.example.com", "id": "acme_preroll"},
    "name": "Acme preroll",
    "assets": [{"item_type": "individual", "asset_id": "v", "asset_type": "vast",
                "required": True, "requirements": {"vast_version": "4.2"}}],
}
print(project_v1_format_to_declaration(raw).declaration.format_kind)                        # video_vast
print(project_v1_format_to_declaration(LegacyFormat.model_validate(raw)).declaration)  # None

The same declaration projects to video_vast as a dict and to nothing as a model. Any caller that holds a typed LegacyFormat (for example one read back from list_creative_formats) gets a fail-closed result for a VAST or DAAST format with no canonical that no glob names.

Expected

Read vast_version / vast_versions / daast_version / daast_versions from a model the same way as from a dict: from each individual asset's requirements (VastAssetRequirements, DaastAssetRequirements; daast_versions is a DaastVersions root model). The pinned LegacyFormat has no top-level version member, so the top-level lookup applies only to dict input.

Activity

  1. changed the title [-]canonical_formats: structural VAST/DAAST entries never match a Format model, because version extraction reads dicts only[/-] [+]canonical_formats: structural VAST/DAAST entries never match a LegacyFormat model, because version extraction reads dicts only[/+] on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions