From 55c67023a091621b7a2b348207e819cb06e3c4e6 Mon Sep 17 00:00:00 2001 From: ajay-k Date: Thu, 30 Jul 2026 21:15:52 -0700 Subject: [PATCH 1/2] scripts: default the android namespace to WorkOS, fix empty EXTRA_ARGS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `android` was missing from the cased-namespace branch, so `sdk-generate.sh --lang android` defaulted to `workos` and generated `WorkosClient` accessors that do not match the hand-maintained `WorkOSClient` — the SDK does not compile. Separately, `"${EXTRA_ARGS[@]}"` is an unbound-variable error under `set -u` in bash 3.2, which macOS still ships as /bin/bash. Only the node branch appends to that array, so the script failed locally for every other language while Linux CI's bash 5 was unaffected. --- scripts/sdk-generate.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/sdk-generate.sh b/scripts/sdk-generate.sh index b60b58f..6e3294b 100755 --- a/scripts/sdk-generate.sh +++ b/scripts/sdk-generate.sh @@ -47,9 +47,9 @@ if [[ -z "$OUTPUT" ]]; then fi # Default namespace: WorkOS for languages whose namespace is a cased type/module -# name (php namespace, Swift module), workos for everything else +# name (php namespace, Swift module, Kotlin type prefix), workos for everything else if [[ -z "$NAMESPACE" ]]; then - if [[ "$LANG" == "php" || "$LANG" == "ios" ]]; then + if [[ "$LANG" == "php" || "$LANG" == "ios" || "$LANG" == "android" ]]; then NAMESPACE="WorkOS" else NAMESPACE="workos" @@ -121,4 +121,9 @@ PY EXTRA_ARGS+=(--api-surface "$TMP_SURFACE") fi -exec npx oagen generate --lang "$LANG" --spec "$SPEC" --namespace "$NAMESPACE" --output "$OUTPUT" "${EXTRA_ARGS[@]}" +# `${EXTRA_ARGS[@]+…}` rather than a bare `"${EXTRA_ARGS[@]}"`: under `set -u`, +# bash 3.2 (still what macOS ships as /bin/bash) treats expanding an empty array +# as an unbound variable. Only the node branch appends to EXTRA_ARGS, so every +# other language hit that error locally while Linux CI's bash 5 was unaffected. +exec npx oagen generate --lang "$LANG" --spec "$SPEC" --namespace "$NAMESPACE" \ + --output "$OUTPUT" ${EXTRA_ARGS[@]+"${EXTRA_ARGS[@]}"} From 9529e23dfa14e9dbab1c1214f517cd5c46495dbe Mon Sep 17 00:00:00 2001 From: ajay-k Date: Thu, 30 Jul 2026 23:12:40 -0700 Subject: [PATCH 2/2] ci: prepare the SDK matrix jobs for android Two additions so that adding android to sdk-matrix.json later is a one-line change rather than a broken build. Both are inert until that entry exists, because no current matrix entry has language == 'android'. setup-sdk-runtime gains an android case. It cannot reuse the kotlin branch: that greps JavaVersion.VERSION_, which workos-android's build.gradle.kts never mentions -- it sets the JVM target with jvmToolchain(17) -- so the kotlin pattern yields an empty java-version. The Java and Gradle steps are widened to android, which needs no Android SDK because the library targets the JVM (kotlin("jvm")) and so builds on ubuntu with the same JDK + Gradle pair kotlin uses. validate-sdks skips the three compatibility steps for android. No extractor is registered for it, so sdk:compat-extract exits 1 and would fail the whole matrix; and android is unreleased, so there is no published surface for a baseline to protect. Downstream aggregation already tolerates the absence: the PR-comment script has an explicit "compat-report.json missing" branch, build-sdk-diff-report needs only sdk-code.diff, and both jq passes skip absent files. Compat summary is already guarded on the diff step's outcome being 'skipped'. Remove the conditions once an android extractor exists. --- .github/actions/setup-sdk-runtime/action.yml | 13 ++++++++++--- .github/workflows/validate-sdks.yml | 13 +++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-sdk-runtime/action.yml b/.github/actions/setup-sdk-runtime/action.yml index b61148a..e05be36 100644 --- a/.github/actions/setup-sdk-runtime/action.yml +++ b/.github/actions/setup-sdk-runtime/action.yml @@ -3,7 +3,7 @@ description: Install the language runtime and formatter tools needed by an SDK e inputs: language: - description: Target language (ruby, python, go, dotnet, php, kotlin) + description: Target language (ruby, python, go, dotnet, php, kotlin, android) required: true sdk-path: description: Path to the checked-out SDK repo @@ -24,6 +24,10 @@ runs: dotnet) echo "version=$(grep -Po '(?<=net)\d+\.\d+' $(find . -name '*.csproj' -path '*/src/*' | head -1))" >> "$GITHUB_OUTPUT" ;; php) echo "version=$(grep -Po '\"php\":\s*\"\^?\K[\d.]+' composer.json)" >> "$GITHUB_OUTPUT" ;; kotlin) echo "version=$(grep -Po '(?<=JavaVersion\.VERSION_)\d+' build.gradle.kts | head -1)" >> "$GITHUB_OUTPUT" ;; + # android needs its own pattern: it sets the JVM target with + # `jvmToolchain(17)` and never mentions `JavaVersion.VERSION_`, so the + # kotlin branch above would yield an empty version. + android) echo "version=$(grep -Po 'jvmToolchain\(\K\d+' build.gradle.kts | head -1)" >> "$GITHUB_OUTPUT" ;; esac - name: Setup Ruby @@ -65,15 +69,18 @@ runs: with: php-version: ${{ steps.sdk-version.outputs.version }} + # Both Kotlin SDKs build with Gradle on a JDK. `android` targets the JVM + # (`kotlin("jvm")`), so it needs no Android SDK — the same JDK + Gradle pair + # the kotlin SDK uses is sufficient, on ubuntu. - name: Setup Java - if: inputs.language == 'kotlin' + if: inputs.language == 'kotlin' || inputs.language == 'android' uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 with: distribution: temurin java-version: ${{ steps.sdk-version.outputs.version }} - name: Setup Gradle - if: inputs.language == 'kotlin' + if: inputs.language == 'kotlin' || inputs.language == 'android' uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v6.1.0 - name: Install SDK formatter tools diff --git a/.github/workflows/validate-sdks.yml b/.github/workflows/validate-sdks.yml index 25b4ba6..9c8d61f 100644 --- a/.github/workflows/validate-sdks.yml +++ b/.github/workflows/validate-sdks.yml @@ -79,7 +79,16 @@ jobs: language: ${{ matrix.language }} sdk-path: ${{ env.SDK_CHECKOUT_PATH }} + # Compatibility checking is skipped for android: no extractor is registered + # for it, so `sdk:compat-extract` exits 1 and would fail the whole matrix. + # There is nothing to protect yet either — android is unreleased, so it has + # no published surface a baseline could guard. Remove this condition (here + # and on the two steps below) once src/compat/extractors/android.ts exists. + # Downstream steps already tolerate the absence: the PR-comment script has + # an explicit "compat-report.json missing" branch, the diff report needs + # only sdk-code.diff, and both jq aggregations skip absent files. - name: Extract baseline snapshot + if: matrix.language != 'android' working-directory: openapi-spec run: | npm run sdk:compat-extract -- \ @@ -114,6 +123,7 @@ jobs: > "$GITHUB_WORKSPACE/openapi-spec/.oagen/${{ matrix.language }}/sdk-code.diff" || true - name: Extract candidate snapshot + if: matrix.language != 'android' working-directory: openapi-spec run: | npm run sdk:compat-extract -- \ @@ -129,8 +139,11 @@ jobs: cp "$GITHUB_WORKSPACE/${{ env.SDK_CHECKOUT_PATH }}/.oagen-manifest.json" \ .oagen/${{ matrix.language }}/sdk/ 2>/dev/null || true + # Skipping this sets steps.compat-diff.outcome to 'skipped', which the + # "Compat summary" step below already guards against. - name: Compat diff id: compat-diff + if: matrix.language != 'android' continue-on-error: true working-directory: openapi-spec run: npm run sdk:compat-diff -- --lang ${{ matrix.language }}