You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: remove stale generated files and improve type generation infrastructure
This commit addresses the downstream report that pricing options were missing
the is_fixed discriminator field. Investigation revealed the discriminator
already exists in the individual pricing option schema files generated by
datamodel-code-generator.
The root causes were:
1. Stale files (pricing_option.py, brand_manifest_ref.py, index.py, start_timing.py)
persisting from previous generations
2. No mechanism to clean output directory before regeneration
3. Timestamp-only changes creating noisy commits
Changes:
- Remove stale generated files that no longer correspond to current schemas
- Add clean slate generation: delete entire output directory before regenerating
types to prevent stale artifacts from old schema versions
- Add timestamp change detection: restore files where only the generation
timestamp changed to avoid noisy commits
- Update CLAUDE.md with patterns for preventing stale files and noisy commits
All pricing options now correctly have the is_fixed discriminator:
- Fixed-rate: CpmFixedRatePricingOption, VcpmFixedRatePricingOption, etc.
(is_fixed: Annotated[Literal[True], ...])
- Auction: CpmAuctionPricingOption, VcpmAuctionPricingOption
(is_fixed: Annotated[Literal[False], ...])
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,14 @@ Files in `src/adcp/types/generated_poc/` and `src/adcp/types/generated.py` are a
27
27
28
28
We use `scripts/post_generate_fixes.py` which runs automatically after type generation to apply necessary modifications that can't be generated.
29
29
30
+
**Preventing Stale Files:**
31
+
32
+
The generation script (`scripts/generate_types.py`) **deletes the entire output directory** before regenerating types. This prevents stale files from persisting when schemas are renamed or removed. Without this, old generated files could remain checked in indefinitely, causing import errors and confusion about which types are actually current.
33
+
34
+
**Avoiding Noisy Commits:**
35
+
36
+
After generation, the script automatically restores files where only the timestamp changed (e.g., `# timestamp: 2025-11-18T03:32:03+00:00`). This prevents commits with 100+ file changes where the only difference is the generation timestamp, making actual changes easier to review.
37
+
30
38
**Type Name Collisions:**
31
39
32
40
The upstream AdCP schemas define multiple types with the same name (e.g., `Contact`, `Asset`, `Status`) in different schema files. These are **genuinely different types** with different fields, not duplicates.
@@ -59,6 +67,14 @@ from adcp.types.generated_poc.format import Asset as FormatAsset
59
67
-`create_media_buy_request.py`
60
68
-`get_products_request.py`
61
69
70
+
**Note on Pricing Options:**
71
+
72
+
The code generator creates individual files for each pricing option (e.g., `cpm_fixed_option.py`, `cpm_auction_option.py`) with the `is_fixed` discriminator field already included:
0 commit comments