Skip to content

feat(api): Add residency flag and deprecate geography - #136

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

feat(api): Add residency flag and deprecate geography#136
apcha-oai merged 1 commit into
mainfrom
castiron/promotions/pr-40

Conversation

@apcha-oai

Copy link
Copy Markdown
Contributor

Summary

Introduce a new optional --residency flag to configure project data residency and mark the existing --geography flag as deprecated in admin project commands. This is backward-compatible: geography remains accepted for compatibility, but help text now directs users to prefer residency.

Changes

  • Add an optional --residency flag to the admin organization project create command; the flag value is submitted as the request body field residency.
  • Update help text for the --geography flag to indicate deprecation and direct users to use --residency instead when configuring data residency; the update command help clarifies geography is retained for backward compatibility.
  • Guidance warns not to provide both --geography and --residency, but this is documented in help text only (no programmatic enforcement of mutual exclusivity).
  • No breaking changes: existing --geography usage continues to work, no inputs were made required, and return types and server-side contracts are unchanged.

Copilot AI lite review requested due to automatic review settings August 24, 2026 16:54
@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown

Castiron custom code

✅ No new custom-code files detected.

5 mixed files remain; 0 existing customizations changed.

Compared a1337079da63dfcd54bd6695. Generated baselines verified.

5 existing customizations unchanged
  • pkg/cmd/adminorganizationcertificate.go
  • pkg/cmd/cmd.go
  • scripts/castiron/README.md
  • scripts/castiron/custom_code_report.py
  • scripts/castiron/test_custom_code_report.py

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 32799702027 --repo openai/openai-cli \
  --name castiron-custom-code-32799702027-1 --dir /tmp/castiron-custom-code-32799702027-1
git apply --stat /tmp/castiron-custom-code-32799702027-1/custom-code.patch
cat /tmp/castiron-custom-code-32799702027-1/custom-code.patch

Or reproduce it from an SDK checkout containing the vendored reporter:

git fetch --no-tags origin a1337079da63bfec8e4c55a009af2690a8ff8473 dfcd54bd6695ff40fb8adc233bf10050a9101bec
python3 scripts/castiron/custom_code_report.py report \
  --base a1337079da63bfec8e4c55a009af2690a8ff8473 \
  --head dfcd54bd6695ff40fb8adc233bf10050a9101bec --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-dfcd54bd6695
cat /tmp/castiron-custom-code-dfcd54bd6695/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

Copilot AI 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.

Pull request overview

Adds a new --residency flag for admin organization project creation while deprecating the legacy --geography flag (kept for backward compatibility), aligning CLI flags with updated OpenAPI schema.

Changes:

  • Added --residency flag to admin:organization:projects create, mapped to request body field residency.
  • Marked geography as deprecated in CLI help text (create/update) and in the transformed OpenAPI spec; introduced PublicProjectResidency enum in the spec.
  • Regenerated Castiron outputs/metadata (notably .castiron.stats.yml and api_reference/openapi.transformed.yml), which also includes an unrelated quantity_unit spec change.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
pkg/cmd/adminorganizationproject.go Adds --residency flag and updates --geography help text to indicate deprecation.
pkg/cmd/adminorganizationproject_test.go Updates create tests to include residency (currently uses geography+residency together).
api_reference/openapi.transformed.yml Deprecates geography, adds residency + PublicProjectResidency; also includes unrelated quantity_unit addition.
.castiron.stats.yml Updates generation metadata/hashes for regenerated outputs.
Suppressed comments (1)

pkg/cmd/adminorganizationproject_test.go:31

  • The piped-YAML create test includes both geography and residency in the same input, which contradicts the updated help text guidance. Consider splitting this into two piping tests so each input mode is covered without exercising the discouraged combination.
		pipeData := []byte("" +
			"name: name\n" +
			"external_key_id: external_key_id\n" +
			"geography: geography\n" +
			"residency: GLOBAL\n")

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 33 to +42
&requestflag.Flag[*string]{
Name: "geography",
Usage: "Create the project with the specified data residency region. Your organization must have access to Data residency functionality in order to use. See [data residency controls](https://platform.openai.com/docs/guides/your-data#data-residency-controls) to review the functionality and limitations of setting this field.",
Usage: "Create the project with the specified data residency region. Your organization must have access to Data residency functionality in order to use. See [data residency controls](https://platform.openai.com/docs/guides/your-data#data-residency-controls) to review the functionality and limitations of setting this field.\nDeprecated: use `residency` instead. Do not provide both `geography` and `residency`.",
BodyPath: "geography",
},
&requestflag.Flag[*string]{
Name: "residency",
Usage: "Create the project with the specified residency configuration. Your organization must have access to the requested residency configuration in order to use it. See [data residency controls](https://platform.openai.com/docs/guides/your-data#data-residency-controls) to review the functionality and limitations of setting this field.",
BodyPath: "residency",
},
Comment on lines 18 to 22
"--name", "name",
"--external-key-id", "external_key_id",
"--geography", "geography",
"--residency", "GLOBAL",
)
Comment on lines 9552 to +9556
"line_item": null,
"project_id": null,
"api_key_id": null,
"quantity": null
"quantity": null,
"quantity_unit": null
@apcha-oai
apcha-oai marked this pull request as ready for review August 24, 2026 17:01
@apcha-oai
apcha-oai requested a review from a team as a code owner August 24, 2026 17:01
@apcha-oai
apcha-oai enabled auto-merge August 24, 2026 17:01
@apcha-oai
apcha-oai disabled auto-merge August 24, 2026 17:29
@apcha-oai
apcha-oai marked this pull request as draft August 24, 2026 17:29
Castiron-Internal-PR: openai/openai-cli-internal#40
Castiron-Source-SHA: 8643e556a4bc9906d1287140181c00cd3c48fd50
Castiron-Public-Base-SHA: a133707
Copilot AI review requested due to automatic review settings August 25, 2026 01:53
@apcha-oai
apcha-oai force-pushed the castiron/promotions/pr-40 branch from 1402c1c to dfcd54b Compare August 25, 2026 01:53

Copilot AI 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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (1)

api_reference/openapi.transformed.yml:9556

  • This PR is described as adding a residency flag / deprecating geography, but this OpenAPI snapshot also introduces the new quantity_unit field (and updates the costs example). If these changes are intentional, the PR description should mention them; otherwise, consider regenerating from the intended spec revision or splitting the unrelated spec change into a separate PR to keep review scope clear.

@apcha-oai
apcha-oai marked this pull request as ready for review August 25, 2026 01:59
@apcha-oai
apcha-oai enabled auto-merge August 25, 2026 02:02

@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 mutual-exclusion finding #136 (comment) and invalid-fixture finding #136 (comment): the CLI accepts both --geography and --residency despite its explicit prohibition, and tests assert the invalid combination succeeds. Reject combined flags/body keys, split valid legacy and residency test cases, and encode the invariant in upstream schema/code generation.

@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 e460582 Aug 25, 2026
17 checks passed
@apcha-oai
apcha-oai deleted the castiron/promotions/pr-40 branch August 25, 2026 16:12
@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.

3 participants