Skip to content

docs(types): refresh import-architecture references (closes #807)#828

Merged
bokelley merged 1 commit into
mainfrom
bokelley/issue-807-type-baseline
May 23, 2026
Merged

docs(types): refresh import-architecture references (closes #807)#828
bokelley merged 1 commit into
mainfrom
bokelley/issue-807-type-baseline

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

Summary

  • Refresh CLAUDE.md's Import Architecture for Generated Types section against the actual tests/test_import_layering.py allowlist (drops nonexistent stable.py; adds capabilities.py, _forward_compat.py, _generated.py).
  • Drop the Handling Missing Schema Types example — FormatId = str / PackageRequest = dict[str, Any] were both replaced with real generated types in earlier PRs; the section was misleading.
  • Add a Codegen variant numbering is unstable callout so the next person who runs scripts/generate_types.py doesn't mistake the ~600-file ClassNameN → ClassNameM renumber churn for a real schema delta.
  • Carry the stable.py doc fix through three other files that referenced it: src/adcp/types/capabilities.py docstring, src/adcp/decisioning/time_budget.py docstring, .github/ai-review/expert-adcp-reviewer.md layering-breach rule.

Why these are the only changes

#807's stated scope was (a) re-sync schemas, (b) regenerate types and inspect diff, (c) drop obsolete handrolled aliases, (d) update CLAUDE.md.

  • (a) is already done — main is at 3.1.0-beta.3 via chore(schemas): resync 3.1.0-beta.3 cache + fix broken manifest patch (refs #807) #821.
  • (b) was run as part of this work. The diff is 600+ files of pure variant-renumbering churn (Idempotency3 → Idempotency1, Assets162 → Assets161, etc.) — datamodel-code-generator numbers anonymous variant classes by traversal order, and even a latest-keyed re-run on the same pinned schema produces shifts. Committing the regen would break aliases.py's semantic re-exports of the numbered classes for zero spec value, so it's discarded. The new CLAUDE.md callout documents the trap.
  • (c) the FormatId / PackageRequest stubs called out in the original CLAUDE.md no longer exist in code — earlier PRs replaced them. aliases.py does still re-export FormatId = FormatReferenceStructuredObject (a real generated type), which is the load-bearing form and stays.
  • (d) is what this PR actually does.

Net: pure documentation hygiene. No public API or generated-type changes.

Test plan

  • ruff check src/ — all checks passed
  • mypy src/adcp/ — no issues in 892 source files
  • pytest tests/ — 5010 passed, 40 skipped, 1 xfailed
  • tests/test_import_layering.py specifically green (50 tests)

Closes #807.

CLAUDE.md's "Import Architecture for Generated Types" section drifted out
of sync with the actual allowlist enforced by
``tests/test_import_layering.py``. It still pointed at a ``stable.py``
that no longer exists and omitted ``capabilities.py``, ``_forward_compat.py``,
and ``_generated.py`` — the three modules added after the original
two-tier layering.

Also drops the "Handling Missing Schema Types" example, whose only
artifacts (``FormatId = str``, ``PackageRequest = dict[str, Any]``) were
already replaced with real generated types in earlier PRs, and adds a
"Codegen variant numbering is unstable" callout so the next person who
runs ``scripts/generate_types.py`` doesn't mistake the 600-file
``ClassNameN → ClassNameM`` renumber churn for a real schema delta.

Same stale ``stable.py`` reference was carried over into three other
files; updated in-place:

- ``src/adcp/types/capabilities.py`` docstring
- ``src/adcp/decisioning/time_budget.py`` docstring
- ``.github/ai-review/expert-adcp-reviewer.md`` layering-breach rule

No code changes — pure documentation hygiene against #741's clean-
type-baseline precondition. ``ruff check src/``, ``mypy src/adcp/``,
and ``pytest tests/`` all green (5010 passed).
Copy link
Copy Markdown

@aao-ipr-bot aao-ipr-bot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Pure docs hygiene catching CLAUDE.md up with reality — stable.py was already gone, the FormatId = str / PackageRequest = dict[str, Any] stubs were already replaced, and the actual allowlist is enforced by tests/test_import_layering.py:33-48. The doc was lying; this fixes it.

Things I checked

  • Allowlist in tests/test_import_layering.py:33-48 matches the new CLAUDE.md list exactly: aliases.py, _ergonomic.py, _generated.py, __init__.py, capabilities.py, _forward_compat.py. No stable.py. Claim is sound.
  • src/adcp/types/stable.py does not exist on disk — the old doc was pointing at a phantom.
  • grep for FormatId = str and PackageRequest = dict[str, Any] in src/ returns nothing — confirmed the stubs the old section described are gone.
  • aliases.py still re-exports FormatId = FormatReferenceStructuredObject (a real generated type), which is the load-bearing form the PR body calls out. Not regressed.
  • src/adcp/types/capabilities.py:13-15 docstring whitelist now agrees with CLAUDE.md and the test.
  • src/adcp/decisioning/time_budget.py:144 docstring now points at the test as the source of truth instead of naming an outdated subset. Right move — the doc no longer has to be updated when the allowlist grows.
  • .github/ai-review/expert-adcp-reviewer.md:82 MUST FIX rule 6 now cites the test-enforced allowlist. The reviewer prompt was the third site carrying the stable.py ghost; good catch.
  • Codegen-variant-numbering callout in CLAUDE.md is the right warning to bake in. datamodel-code-generator's traversal-order numbering producing 600+ files of ClassNameN → ClassNameM churn on a clean re-run is exactly the kind of trap that costs a day if you don't know about it.
  • Public API surface: untouched. __init__.py not in the diff.
  • Generated layer: untouched. generated_poc/** and _generated.py not in the diff.
  • Test plan: all four checkboxes checked. pytest tests/ reports 5010 passed, including the 50 tests in test_import_layering.py.

Minor nits (non-blocking)

  1. Commit message says "No code changes" but time_budget.py reformats two logger.warning strings from explicit multi-line continuation to single-line implicit-concatenation (time_budget.py:120, 130). The runtime string is identical — Python concatenates adjacent literals at compile time — so no behavior change, but the new form reads worse on a 120-col terminal and isn't part of the stated docs-hygiene scope. Probably an autoformat side effect that snuck in. Notable, not blocking.

LGTM.

@bokelley bokelley merged commit 169bc80 into main May 23, 2026
23 checks passed
@bokelley bokelley deleted the bokelley/issue-807-type-baseline branch May 23, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(types): schema sync against 3.1.0-beta.3 + drop obsolete handrolled aliases

1 participant