Skip to content

feat(api): add project residency and usage quantity unit support - #933

Merged
apcha-oai merged 1 commit into
mainfrom
castiron/promotions/pr-45
Aug 25, 2026
Merged

feat(api): add project residency and usage quantity unit support#933
apcha-oai merged 1 commit into
mainfrom
castiron/promotions/pr-45

Conversation

@apcha-oai

@apcha-oai apcha-oai commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Castiron custom code

✅ No new custom-code files detected.

53 mixed files remain; 0 existing customizations changed.

Compared d7ecd271fa2b28aa6c084f22. Generated baselines verified.

53 existing customizations unchanged
  • openai-java-core/src/main/kotlin/com/openai/models/audio/AudioResponseFormat.kt
  • openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionCreateParams.kt
  • openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageFunctionToolCall.kt
  • openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionToolMessageParam.kt
  • openai-java-core/src/main/kotlin/com/openai/models/embeddings/Embedding.kt
  • openai-java-core/src/main/kotlin/com/openai/models/embeddings/EmbeddingCreateParams.kt
  • openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCreateParams.kt
  • openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionToolCall.kt
  • openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionWebSearch.kt
  • openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputItem.kt
  • openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseTextConfig.kt
  • openai-java-core/src/main/kotlin/com/openai/models/videos/Video.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/BetaServiceAsync.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/BetaServiceAsyncImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsync.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsyncImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/WebhookServiceAsync.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/WebhookServiceAsyncImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/audio/TranscriptionServiceAsyncImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/chat/ChatCompletionServiceAsync.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/checkpoints/PermissionServiceAsyncImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/BetaService.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/BetaServiceImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseService.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseServiceImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/WebhookService.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/WebhookServiceImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/audio/TranscriptionServiceImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/chat/ChatCompletionService.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/finetuning/checkpoints/PermissionServiceImpl.kt
  • openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponsesServerEventTest.kt
  • openai-java-core/src/test/kotlin/com/openai/models/responses/ResponsesServerEventTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/CompletionServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/ImageServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/ResponseServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/WebhookServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/audio/TranscriptionServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/beta/ResponseServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/beta/ThreadServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/beta/threads/RunServiceAsyncTest.kt

13 more in the full report.

A changed generated baseline means this report cannot reliably identify which handwritten lines changed.

Inspect the custom-code diff

Download 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.patch

Or 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.patch

This is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR.

Full report and patch

Castiron-Internal-PR: openai/openai-java-internal#45
Castiron-Source-SHA: 08133a4084005b04afcf7be8996d908d6e690df0
Castiron-Public-Base-SHA: d7ecd27
@apcha-oai
apcha-oai force-pushed the castiron/promotions/pr-45 branch from 9770176 to 28aa6c0 Compare August 25, 2026 01:50
@apcha-oai
apcha-oai marked this pull request as ready for review August 25, 2026 02:02
@apcha-oai
apcha-oai requested a review from a team as a code owner August 25, 2026 02:02
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-25T02:04:53.403531Z 28aa6c0 Draft marked ready
🔒 Security Review Completed 2026-08-25T02:04:51.273287Z 28aa6c0 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openai-sdks

openai-sdks Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

OkTest Summary

237/237 SDK tests passed in 17.499s for Java SDK PR #933.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 718ms
tests/chat-completions-create.test.ts ✅ Passed 1.049s
tests/chat-completions-stream.test.ts ✅ Passed 399ms
tests/files-content-binary.test.ts ✅ Passed 283ms
tests/files-create-multipart.test.ts ✅ Passed 432ms
tests/files-list-pagination.test.ts ✅ Passed 394ms
tests/initialize-config.test.ts ✅ Passed 189ms
tests/instance-isolation.test.ts ✅ Passed 232ms
tests/models-list.test.ts ✅ Passed 275ms
tests/responses-background-lifecycle.test.ts ✅ Passed 412ms
tests/responses-body-method-errors.test.ts ✅ Passed 486ms
tests/responses-cancel-timeout.test.ts ✅ Passed 200ms
tests/responses-cancel.test.ts ✅ Passed 317ms
tests/responses-compact-retries.test.ts ✅ Passed 427ms
tests/responses-compact.test.ts ✅ Passed 400ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 416ms
tests/responses-create-advanced.test.ts ✅ Passed 1.491s
tests/responses-create-disconnect.test.ts ✅ Passed 1.031s
tests/responses-create-errors.test.ts ✅ Passed 482ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 302ms
tests/responses-create-retries.test.ts ✅ Passed 232ms
tests/responses-create-stream-failures.test.ts ✅ Passed 211ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 219ms
tests/responses-create-stream-wire.test.ts ✅ Passed 6.617s
tests/responses-create-stream.test.ts ✅ Passed 481ms
tests/responses-create-terminal-states.test.ts ✅ Passed 375ms
tests/responses-create-timeout.test.ts ✅ Passed 224ms
tests/responses-create.test.ts ✅ Passed 228ms
tests/responses-delete.test.ts ✅ Passed 300ms
tests/responses-input-items-errors.test.ts ✅ Passed 276ms
tests/responses-input-items-list.test.ts ✅ Passed 309ms
tests/responses-input-items-options.test.ts ✅ Passed 193ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 229ms
tests/responses-input-tokens-count.test.ts ✅ Passed 393ms
tests/responses-malformed-inputs.test.ts ✅ Passed 5.457s
tests/responses-not-found-errors.test.ts ✅ Passed 356ms
tests/responses-parse.test.ts ✅ Passed 585ms
tests/responses-retrieve-retries.test.ts ✅ Passed 864ms
tests/responses-retrieve.test.ts ✅ Passed 295ms
tests/responses-stored-method-errors.test.ts ✅ Passed 999ms
tests/retry-behavior.test.ts ✅ Passed 3.647s
tests/sdk-error-shape.test.ts ✅ Passed 450ms

View OkTest run #32799869143

SDK merge (4a937ad1d585) · head (28aa6c084f22) · base (d7ecd271fa2b) · OkTest (2b1bdfd25e98)

@apcha-oai
apcha-oai enabled auto-merge August 25, 2026 02:04

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +14 to +15
class CostQuantityUnit @JsonCreator private constructor(private val value: JsonField<String>) :
Enum {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

@apcha-oai
apcha-oai disabled auto-merge August 25, 2026 02:11

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@apcha-oai apcha-oai changed the title Add project residency and usage quantity unit support feat(api): add project residency and usage quantity unit support Aug 25, 2026

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@apcha-oai
apcha-oai added this pull request to the merge queue Aug 25, 2026
Merged via the queue into main with commit 3c63360 Aug 25, 2026
19 checks passed
@openai-sdks openai-sdks Bot mentioned this pull request Aug 25, 2026
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.

2 participants