feat(api): add project residency and usage quantity unit support - #933
Conversation
Castiron custom code✅ No new custom-code files detected. 53 mixed files remain; 0 existing customizations changed. Compared 53 existing customizations unchanged
13 more in the full report. A changed generated baseline means this report cannot reliably identify which handwritten lines changed. Inspect the custom-code diffDownload the exact patch produced by this run (requires repository access): gh run download 32861409156 --repo openai/openai-java \
--name castiron-custom-code-32861409156-1 --dir /tmp/castiron-custom-code-32861409156-1
git apply --stat /tmp/castiron-custom-code-32861409156-1/custom-code.patch
cat /tmp/castiron-custom-code-32861409156-1/custom-code.patchOr reproduce it from an SDK checkout containing the vendored reporter: git fetch --no-tags origin d7ecd271fa2bf0f85ed56e66d009f89b7aecd2a0 28aa6c084f22ee51781180c7f5ee17aeed38a319
python3 scripts/castiron/custom_code_report.py report \
--base d7ecd271fa2bf0f85ed56e66d009f89b7aecd2a0 \
--head 28aa6c084f22ee51781180c7f5ee17aeed38a319 --fetch --require-head-hash --public \
--out /tmp/castiron-custom-code-28aa6c084f22
cat /tmp/castiron-custom-code-28aa6c084f22/custom-code.patchThis is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR. |
Castiron-Internal-PR: openai/openai-java-internal#45 Castiron-Source-SHA: 08133a4084005b04afcf7be8996d908d6e690df0 Castiron-Public-Base-SHA: d7ecd27
9770176 to
28aa6c0
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 28aa6c084f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| class CostQuantityUnit @JsonCreator private constructor(private val value: JsonField<String>) : | ||
| Enum { |
There was a problem hiding this comment.
Add JSON coverage for quantity-unit mapping
When a costs response contains a known, unknown, or null quantity_unit, this new @JsonCreator/@JsonValue mapping and its nested response fields currently have no regression coverage: a repository-wide search of openai-java-core/src/test finds no reference to CostQuantityUnit or quantity_unit. Add focused deserialization and round-trip assertions so runtime Jackson mapping failures are caught, as required for serialization/deserialization changes.
AGENTS.md reference: AGENTS.md:L41-L45
Useful? React with 👍 / 👎.
| .name("name") | ||
| .externalKeyId("external_key_id") | ||
| .geography("geography") | ||
| .residency(ProjectResidency.GLOBAL) |
There was a problem hiding this comment.
Exercise residency without deprecated geography
In both the blocking and async create tests, this new setter follows .geography("geography"), although the added API contract explicitly says not to provide geography and residency together. Because the Prism schema does not structurally encode that prose-only constraint, the mock can accept a request that production rejects, so these tests do not cover a valid residency-only create request; remove geography here or split the legacy and residency cases.
AGENTS.md reference: AGENTS.md:L41-L45
Useful? React with 👍 / 👎.
jbeckwith-oai
left a comment
There was a problem hiding this comment.
Requesting changes for the existing P2 contract/fixture mismatch in #933 (comment): generated blocking and async creation tests send geography and residency together despite the documented API prohibition. Encode mutual exclusion in the authoritative schema and regenerate separate valid cases. Also address existing serialization-coverage discussion #933 (comment) by testing known, unknown, and null quantity-unit JSON behavior.
Summary
Adds typed residency support to project models and project creation params, including known residency configurations and raw-value accessors. Deprecates geography fields while retaining them for backward compatibility. Adds quantity_unit fields and typed quantity unit enums to organization usage cost results, with support for known units and unknown raw values.
Project responses and project-creation inputs now reuse a shared residency model. Usage cost responses reuse a shared quantity-unit model, with unknown unit values and optional/null fields preserved.