Skip to content

openapi-codegen: classify operations for safe retry hooks - #68

Open
chrischeng-c4 wants to merge 1 commit into
mainfrom
issue/36
Open

chrischeng-c4 wants to merge 1 commit into
mainfrom
issue/36

Conversation

@chrischeng-c4

Copy link
Copy Markdown
Contributor

Closes #36

Summary of Changes

  • Intermediate Representation (crates/openapi-codegen/src/domain/ir/operations.rs):
    • Defined pub enum RetryClassIR { SafeRead, IdempotencyKey, NonRetryable, Unclassified } with Default pointing to Unclassified.
    • Added pub retry_class: RetryClassIR field to OperationIR.
    • In build_one, extracted x-retry-class vendor extension from op.extensions and mapped:
      • "safe-read" -> RetryClassIR::SafeRead
      • "idempotency-key" -> RetryClassIR::IdempotencyKey
      • "non-retryable" -> RetryClassIR::NonRetryable
      • Missing, unknown strings, or non-string values -> RetryClassIR::Unclassified.
    • Never inferred retry classification from HTTP method, is_query, or idempotency headers.
  • Public API Re-export (crates/openapi-codegen/src/api/ir.rs):
    • Re-exported RetryClassIR alongside OperationIR in api::ir::operations.
  • Unit Tests (crates/openapi-codegen/src/domain/ir/operations.rs):
    • Added 4 test cases covering:
      • retry_class_maps_known_extension_values: maps "safe-read", "idempotency-key", "non-retryable".
      • retry_class_defaults_to_unclassified_when_missing: missing extension defaults to Unclassified across get, post, delete, and query.
      • retry_class_defaults_to_unclassified_for_unknown_or_non_string_values: unknown strings ("yes") and non-string values (true, 42) default to Unclassified.
      • retry_class_reads_extension_on_additional_operations: vendor extension honored on additionalOperations.
  • Negative Control:
    • Verified negative control: mutating build_one to set SafeRead for get when missing extension failed retry_class_defaults_to_unclassified_when_missing at the get assertion, and only rows expecting Unclassified failed.

Validation Evidence

  • Affected Isolated Unit Tests (PASSED):
    cargo test --locked -p openapi-codegen --lib domain::ir::operations::tests:
    7 passed; 0 failed; 0 ignored; 102 filtered out
  • Static Formatting (PASSED):
    cargo fmt -p openapi-codegen --check: clean exit 0.
  • Static Compilation (PASSED):
    cargo check --locked -p openapi-codegen: clean exit 0.
  • Unfiltered Package Test Record (CANCELED / PARTIAL FAILURE):
    An unfiltered package test run (cargo test --locked -p openapi-codegen) executed network/h2c/TLS suites, exhibiting partial failure on h2c connection tests and hanging on tls_alpn, and was terminated via task management (status: CANCELED). Per policy, local testing is strictly limited to isolated affected unit tests; package/integration tests belong in cloud CI.
  • Local Tests NOT RUN:
    Local integration/h2c/server/network tests and full package suites are NOT RUN locally per confirmed test policy.
  • Cloud MR Validation Needed:
    • Cloud MR affected unit, functional/e2e, and integration tests: PENDING (awaiting cloud CI execution upon PR submission).
    • Full release qualification matrix: NOT RUN (managed by release pipeline).

…yClassIR

Add RetryClassIR enum with SafeRead, IdempotencyKey, NonRetryable, and Unclassified variants.
Parse operation's x-retry-class vendor extension into OperationIR.retry_class without inferring from HTTP method.
Re-export RetryClassIR in api::ir::operations and add isolated unit tests in operations.rs.
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.

openapi-codegen: classify operations for safe retry hooks

1 participant