Skip to content

The generated_poc.brand alias resolves to the wrong half of a split, so Brand, BrandDiscovery3 and LocalizedName raise ImportError through it #1402

Closed

Description

@KonstantinMirin

Measured on adcp==9.0.0 built from main + #1392.

What I found

The generated_poc compatibility alias for the brand module resolves to a module that does not contain the names it is supposed to alias.

>>> import importlib
>>> importlib.import_module("adcp.types.generated_poc.brand").__name__
'adcp.types.domains.brand'                       # the module imports fine
>>> from adcp.types.generated_poc.brand import Brand
ImportError: cannot import name 'Brand' from 'adcp.types.domains.brand'
>>> import adcp.types.domains.brand_discovery as bd
>>> hasattr(bd, "Brand")
True

Brand, BrandDiscovery3 and LocalizedName moved to domains.brand_discovery when brand was split, but the alias maps generated_poc.brand → domains.brand. The module resolves; every one of those three names raises.

Why it matters

A compatibility alias that resolves the module and not its contents is worse than no alias: the ImportError names adcp.types.domains.brand, a module the adopter never wrote and cannot find in their own source. With no alias the error would at least have named generated_poc.brand and pointed at the thing to change.

Proposed fix

Map the alias per name, not per module, wherever a generated_poc module was split — or point generated_poc.brand at domains.brand_discovery if that is where the whole of the old module's contents went. A test that imports every name the old generated_poc tree exported, through the alias, would have caught this and would catch the next split.

Context

Descendant of #911 (silent name collisions in adcp.types / _generated.py) and of the alias mechanism added in #1392. Found while moving an adopter off generated_poc entirely: 125 references across 38 files, now 0 — this was the one that did not survive the alias.

Activity

  1. added
    claude-triagingTriage routine is actively working on this issue (1-3 min)
    on Oct 6, 2026
  2. bokelley commented on Oct 6, 2026

    @bokelley
    Contributor

    Triage

    Classification: Bug
    Bucket(s): client (types / alias layer)
    Status: deferred — fold-candidate into #1392
    Milestone: —

    What the experts said:

    • code-reviewer: Bug confirmed — domains/brand/__init__.py exports only API-endpoint types (no Brand, BrandDiscovery3, LocalizedName); those three names live in domains/brand_discovery/__init__.py, which is exactly where generated_poc/brand_discovery.py migrated to. The tombstone entry for generated_poc.brand names the wrong destination.
    • dx-expert: A tombstone that silently resolves the module and then raises ImportError: cannot import name 'Brand' from 'adcp.types.domains.brand' is worse than the bare ModuleNotFoundError it replaced — the adopter is given a path they can't find in their own codebase, and no hint that the three missing names are one word away in domains.brand_discovery.

    My take: The bug is squarely inside PR #1392: the tombstone's per-module redirect table maps generated_poc.brand → domains.brand, but Brand, BrandDiscovery3, and LocalizedName never lived in the brand/ package — they lived in the flat brand_discovery.py file beside it, which maps to domains.brand_discovery. The fix is per-name overrides in the tombstone for this split case (or pointing the brand tombstone at brand_discovery if the whole public surface landed there). A test that imports every name the old generated_poc tree surfaced through the tombstone would prevent this class of regression from any future split.

    Blocked-on: #1392 — resurfaces on merge


    Triaged by Claude Code. Session: https://claude.ai/code/session_018p8ZYcpxokvNiFFJ2si8Rg


    Generated by Claude Code

  3. added and removed
    claude-triagingTriage routine is actively working on this issue (1-3 min)
    on Oct 6, 2026
  4. added 2 commits that reference this issue on Oct 6, 2026
    607adf4
    152f15b
  5. added a commit that references this issue on Oct 7, 2026
    3092340
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions