Skip to content

test: support hermetic local API reference - #819

Merged
apcha-oai merged 1 commit into
mainfrom
apcha/hermetic-api-reference
Jul 27, 2026
Merged

test: support hermetic local API reference#819
apcha-oai merged 1 commit into
mainfrom
apcha/hermetic-api-reference

Conversation

@apcha-oai

Copy link
Copy Markdown
Contributor

Allow the SDK mock server to use a locally available API reference when present, while preserving the existing network-based fallback.

Copilot AI review requested due to automatic review settings July 26, 2026 18:06

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

Updates the scripts/mock helper to support hermetic/local usage by preferring a locally checked-in/generated OpenAPI spec when available, while preserving the existing .stats.yml URL-based fallback.

Changes:

  • If no explicit spec path/URL arg is provided, prefer api_reference/openapi.transformed.yml when present.
  • Verify the local spec matches generation metadata by comparing its MD5 hash to openapi_transformed_spec_hash from .castiron.stats.yml.
  • Retain existing behavior of reading openapi_spec_url from .stats.yml when local inputs aren’t available.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@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.

Thermo-nuclear code-quality review: no high-confidence maintainability findings. The 9-line change stays within the existing URL-resolution boundary; scripts/mock remains 61 lines and no file approaches the 1,000-line threshold. Approved.

@HAYDEN-OAI HAYDEN-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.

Reviewed exact head dbde9b5 against the producer-side hermetic API-reference contract. The mock preserves explicit override precedence and the legacy .stats.yml network fallback, selects only the paired local transformed spec plus Castiron metadata, and fails closed on missing or mismatched transformed hashes. I also checked producer path/hash guarantees, Java packaging and test implications, and exercised the resolution branches with a stubbed Steady invocation. No actionable findings.

@apcha-oai
apcha-oai marked this pull request as ready for review July 27, 2026 16:59
@apcha-oai
apcha-oai requested a review from a team as a code owner July 27, 2026 16:59
@openai-sdks

openai-sdks Bot commented Jul 27, 2026

Copy link
Copy Markdown

OkTest Summary

237/237 SDK tests passed in 16.762s for Java SDK PR #819.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 219ms
tests/chat-completions-create.test.ts ✅ Passed 475ms
tests/chat-completions-stream.test.ts ✅ Passed 375ms
tests/files-content-binary.test.ts ✅ Passed 233ms
tests/files-create-multipart.test.ts ✅ Passed 367ms
tests/files-list-pagination.test.ts ✅ Passed 254ms
tests/initialize-config.test.ts ✅ Passed 214ms
tests/instance-isolation.test.ts ✅ Passed 228ms
tests/models-list.test.ts ✅ Passed 186ms
tests/responses-background-lifecycle.test.ts ✅ Passed 287ms
tests/responses-body-method-errors.test.ts ✅ Passed 528ms
tests/responses-cancel-timeout.test.ts ✅ Passed 199ms
tests/responses-cancel.test.ts ✅ Passed 408ms
tests/responses-compact-retries.test.ts ✅ Passed 395ms
tests/responses-compact.test.ts ✅ Passed 443ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 285ms
tests/responses-create-advanced.test.ts ✅ Passed 1.463s
tests/responses-create-disconnect.test.ts ✅ Passed 1.091s
tests/responses-create-errors.test.ts ✅ Passed 339ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 329ms
tests/responses-create-retries.test.ts ✅ Passed 297ms
tests/responses-create-stream-failures.test.ts ✅ Passed 290ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 308ms
tests/responses-create-stream-wire.test.ts ✅ Passed 6.51s
tests/responses-create-stream.test.ts ✅ Passed 111ms
tests/responses-create-terminal-states.test.ts ✅ Passed 390ms
tests/responses-create-timeout.test.ts ✅ Passed 264ms
tests/responses-create.test.ts ✅ Passed 259ms
tests/responses-delete.test.ts ✅ Passed 231ms
tests/responses-input-items-errors.test.ts ✅ Passed 297ms
tests/responses-input-items-list.test.ts ✅ Passed 321ms
tests/responses-input-items-options.test.ts ✅ Passed 245ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 303ms
tests/responses-input-tokens-count.test.ts ✅ Passed 377ms
tests/responses-malformed-inputs.test.ts ✅ Passed 5.154s
tests/responses-not-found-errors.test.ts ✅ Passed 298ms
tests/responses-parse.test.ts ✅ Passed 693ms
tests/responses-retrieve-retries.test.ts ✅ Passed 1.062s
tests/responses-retrieve.test.ts ✅ Passed 358ms
tests/responses-stored-method-errors.test.ts ✅ Passed 991ms
tests/retry-behavior.test.ts ✅ Passed 3.623s
tests/sdk-error-shape.test.ts ✅ Passed 394ms

View OkTest run #30287194107

SDK merge (d993b8a09041) · head (dbde9b568ff3) · base (8b7957326f39) · OkTest (91635c6a2723)

@apcha-oai
apcha-oai merged commit 43c2d9e into main Jul 27, 2026
11 checks passed
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.

4 participants