feat(api): Add residency flag and deprecate geography - #136
Conversation
Castiron custom code✅ No new custom-code files detected. 5 mixed files remain; 0 existing customizations changed. Compared 5 existing customizations unchanged
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 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.patchOr 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.patchThis is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR. |
There was a problem hiding this comment.
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
--residencyflag toadmin:organization:projects create, mapped to request body fieldresidency. - Marked
geographyas deprecated in CLI help text (create/update) and in the transformed OpenAPI spec; introducedPublicProjectResidencyenum in the spec. - Regenerated Castiron outputs/metadata (notably
.castiron.stats.ymlandapi_reference/openapi.transformed.yml), which also includes an unrelatedquantity_unitspec 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
geographyandresidencyin 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.
| &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", | ||
| }, |
| "--name", "name", | ||
| "--external-key-id", "external_key_id", | ||
| "--geography", "geography", | ||
| "--residency", "GLOBAL", | ||
| ) |
| "line_item": null, | ||
| "project_id": null, | ||
| "api_key_id": null, | ||
| "quantity": null | ||
| "quantity": null, | ||
| "quantity_unit": null |
Castiron-Internal-PR: openai/openai-cli-internal#40 Castiron-Source-SHA: 8643e556a4bc9906d1287140181c00cd3c48fd50 Castiron-Public-Base-SHA: a133707
1402c1c to
dfcd54b
Compare
There was a problem hiding this comment.
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
residencyflag / deprecatinggeography, but this OpenAPI snapshot also introduces the newquantity_unitfield (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.
jbeckwith-oai
left a comment
There was a problem hiding this comment.
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.
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