Skip to content

Export the error-details models from adcp.types (14 of 15 are unreachable outside generated_poc) #1080

Description

@KonstantinMirin

Summary

adcp/types/generated_poc/error_details/ contains a generated pydantic model for every
error-details/*.json schema in the bundle — 15 modules, e.g. ActionNotAllowedDetails,
AgentPermissionDeniedDetails, StaleResponseDetails, VersionUnsupportedDetails. Only
one of them, AuthorizationRequiredDetails, is re-exported from adcp.types:

from adcp.types import AuthorizationRequiredDetails   # works
from adcp.types import ActionNotAllowedDetails        # ImportError

Verified against adcp==6.6.0 / spec 3.1.1. dir(adcp.types) yields exactly one name
ending in Details, and the generated_poc path is documented as not-for-consumers.

Please export the rest.

Why a consumer needs them

error.details is typed dict on the Error model, so nothing at a raise site
constrains what goes in it. Five of these schemas declare required fields —
action-not-allowed (attempted_action, reason), agent-permission-denied
(scope, reason), billing-not-permitted-for-agent (rejected_billing),
stale-response (served_from_cache, cache_age_seconds), version-unsupported
(supported_versions) — and a seller that wants a missing required key to be a
typecheck error rather than a runtime surprise needs the model at the call site.

The models already exist and already encode exactly that. They are simply unreachable,
so every consumer that wants this has to re-declare them locally and then maintain a
guard asserting the local copy still matches the bundle schema — a transcription of
something you already ship, kept in sync by hand.

This is a small, additive change: the models are generated, the schemas are in the
bundle, and AuthorizationRequiredDetails already establishes the precedent for
exporting one.

Suggested shape

Re-export all 15 from adcp/types/__init__.py alongside AuthorizationRequiredDetails.
If a stable public name is wanted for the family, an adcp.types.error_details
subpackage re-exporting them would work equally well for consumers — the requirement is
just that they are importable from a supported path.

Note on extra

The generated models carry extra="allow", which is right for these: several of the
schemas omit additionalProperties, so draft-07 permits extension keys, and a seller
adding diagnostic fields should not be rejected. Two of the schemas do declare
additionalProperties: false; if the generator can reflect that as extra="forbid" on
just those two, the models would carry the distinction the schemas make. Not a blocker
for exporting them.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions