|
| 1 | +name: __tmp verify native-dep guard (DROP BEFORE MERGE) |
| 2 | + |
| 3 | +# TEMPORARY instrumentation to capture real CI fail/pass evidence for the |
| 4 | +# agent-SDK native-optional-dep guard. Dropped before the PR is opened; the |
| 5 | +# captured run URLs remain valid in the Actions history. Mirrors the approach |
| 6 | +# used in #324064. |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + branches: |
| 11 | + - guard-agent-sdk-native-deps |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: tmp-native-dep-guard-${{ github.ref }} |
| 19 | + cancel-in-progress: true |
| 20 | + |
| 21 | +env: |
| 22 | + # Flip to "1" to force the missing-native-dep condition (FAIL run); "0" for a |
| 23 | + # healthy build (PASS run). |
| 24 | + INSTRUMENT_FAIL: "1" |
| 25 | + |
| 26 | +jobs: |
| 27 | + cli-check: |
| 28 | + name: CLI check (${{ matrix.os }}) |
| 29 | + runs-on: ${{ matrix.os }} |
| 30 | + timeout-minutes: 15 |
| 31 | + strategy: |
| 32 | + fail-fast: false |
| 33 | + matrix: |
| 34 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 35 | + steps: |
| 36 | + - name: Checkout |
| 37 | + uses: actions/checkout@v6 |
| 38 | + |
| 39 | + - name: Setup Node.js |
| 40 | + uses: actions/setup-node@v6 |
| 41 | + with: |
| 42 | + node-version-file: .nvmrc |
| 43 | + |
| 44 | + - name: Run refactored checkNativeOptionalDeps.ts against a synthetic node_modules |
| 45 | + shell: bash |
| 46 | + run: | |
| 47 | + set -e |
| 48 | + suffix=$(node -p "process.platform + '-' + process.arch") |
| 49 | + echo "Host native package suffix: $suffix (INSTRUMENT_FAIL=$INSTRUMENT_FAIL)" |
| 50 | + # Base packages present … |
| 51 | + mkdir -p "node_modules/@openai/codex" "node_modules/@anthropic-ai/claude-agent-sdk" |
| 52 | + # … per-platform native packages present only in the PASS case. |
| 53 | + if [ "$INSTRUMENT_FAIL" != "1" ]; then |
| 54 | + mkdir -p "node_modules/@openai/codex-$suffix" "node_modules/@anthropic-ai/claude-agent-sdk-$suffix" |
| 55 | + fi |
| 56 | + node build/azure-pipelines/common/checkNativeOptionalDeps.ts |
| 57 | +
|
| 58 | + release-guard: |
| 59 | + name: Release guard via produce.ts (${{ matrix.vscodePlatform }}-${{ matrix.arch }}) |
| 60 | + runs-on: ${{ matrix.os }} |
| 61 | + timeout-minutes: 20 |
| 62 | + strategy: |
| 63 | + fail-fast: false |
| 64 | + matrix: |
| 65 | + include: |
| 66 | + - os: ubuntu-latest |
| 67 | + vscodePlatform: linux |
| 68 | + arch: x64 |
| 69 | + - os: macos-latest |
| 70 | + vscodePlatform: darwin |
| 71 | + arch: arm64 |
| 72 | + - os: windows-latest |
| 73 | + vscodePlatform: win32 |
| 74 | + arch: x64 |
| 75 | + steps: |
| 76 | + - name: Checkout |
| 77 | + uses: actions/checkout@v6 |
| 78 | + |
| 79 | + - name: Setup Node.js |
| 80 | + uses: actions/setup-node@v6 |
| 81 | + with: |
| 82 | + node-version-file: .nvmrc |
| 83 | + |
| 84 | + - name: Provide produce.ts runtime deps (tar, @azure/*) without a full root install |
| 85 | + shell: bash |
| 86 | + run: | |
| 87 | + set -e |
| 88 | + # produce.ts statically imports package.ts (-> `tar`) and upload.ts |
| 89 | + # (-> `@azure/identity`, `@azure/storage-blob`). In the real pipeline |
| 90 | + # these resolve from the root node_modules created by a full `npm ci`. |
| 91 | + # For this cheap check we install only those three into an isolated |
| 92 | + # project and stage them into a root node_modules so ESM resolution |
| 93 | + # succeeds and execution reaches the guard in buildOne. buildOne's own |
| 94 | + # scratch `npm ci` is unaffected (separate dir). |
| 95 | + tmp="$(mktemp -d)" |
| 96 | + ( cd "$tmp" && npm init -y >/dev/null 2>&1 && npm install --no-audit --no-fund --loglevel=error tar@^7.5.16 @azure/identity @azure/storage-blob ) |
| 97 | + mkdir -p node_modules |
| 98 | + cp -R "$tmp/node_modules/." node_modules/ |
| 99 | + test -d node_modules/tar && test -d node_modules/@azure/identity && test -d node_modules/@azure/storage-blob && echo "produce.ts runtime deps staged into root node_modules" |
| 100 | +
|
| 101 | + - name: Run produce.ts (buildOne) for ${{ matrix.vscodePlatform }}-${{ matrix.arch }} |
| 102 | + shell: bash |
| 103 | + run: | |
| 104 | + set -e |
| 105 | + if [ "$INSTRUMENT_FAIL" = "1" ]; then |
| 106 | + # Reproduce the real bug: npm silently skips the optional native |
| 107 | + # package. The guard in buildOne must throw and produce.ts must exit |
| 108 | + # non-zero instead of building a binary-less tarball. |
| 109 | + echo "Instrumenting failure: npm_config_omit=optional" |
| 110 | + export npm_config_omit=optional |
| 111 | + fi |
| 112 | + node build/agent-sdk/produce.ts --vscode-platform=${{ matrix.vscodePlatform }} --arch=${{ matrix.arch }} |
0 commit comments