Repository navigation
565 lines (512 loc) · 21.3 KB
/
Copy pathinterop-python.yml
File metadata and controls
565 lines (512 loc) · 21.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
name: Reference Seller Interop
on:
pull_request:
branches: [main, 16.x]
workflow_dispatch:
inputs:
python_ref:
description: 'adcp-client-python commit SHA, tag, or branch to test against'
required: false
default: '' # Use the pinned matrix fallback unless explicitly overridden.
runner_package_ref:
description: 'Optional @adcp/sdk npm package ref for manual runner probes, e.g. adcp-3.0 or @adcp/sdk@adcp-3.1. Empty packs this checkout.'
required: false
default: ''
workflow_call:
inputs:
python_ref:
description: 'adcp-client-python commit SHA, tag, or branch to test against'
required: false
type: string
default: '' # Use the pinned matrix fallback unless explicitly overridden.
runner_package_ref:
description: 'Optional @adcp/sdk npm package ref for manual runner probes. Empty packs this checkout.'
required: false
type: string
default: ''
permissions:
contents: read
jobs:
pack-sdk-runner:
name: Pack SDK runner
runs-on: ubuntu-latest
timeout-minutes: 15
env:
RUNNER_PACKAGE_REF: ${{ inputs.runner_package_ref || '' }}
steps:
- name: Checkout @adcp/sdk
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 24
cache: npm
- name: Install dependencies
if: env.RUNNER_PACKAGE_REF == ''
run: npm ci
- name: Build SDK runner
if: env.RUNNER_PACKAGE_REF == ''
run: npm run build:lib
- name: Pack SDK runner
shell: bash
run: |
set -euo pipefail
pack_dir="$RUNNER_TEMP/adcp-sdk-pack"
mkdir -p "$pack_dir"
if [[ -n "${RUNNER_PACKAGE_REF:-}" ]]; then
package_ref="$RUNNER_PACKAGE_REF"
if [[ "$package_ref" != @adcp/sdk@* ]]; then
package_ref="@adcp/sdk@$package_ref"
fi
echo "Packing SDK runner from npm package ref $package_ref"
npm pack "$package_ref" --pack-destination "$pack_dir" --silent
else
echo "Packing SDK runner from this checkout"
npm pack --pack-destination "$pack_dir" --silent
fi
mapfile -t tarballs < <(find "$pack_dir" -maxdepth 1 -type f -name '*.tgz' -print)
if [[ "${#tarballs[@]}" -ne 1 ]]; then
echo "::error::Expected one packed SDK tarball in $pack_dir, found ${#tarballs[@]}."
printf '%s\n' "${tarballs[@]}"
exit 1
fi
echo "Packed SDK runner at ${tarballs[0]}"
- name: Upload SDK runner tarball
uses: actions/upload-artifact@v7
with:
name: adcp-sdk-runner-tarball
if-no-files-found: error
path: ${{ runner.temp }}/adcp-sdk-pack/*.tgz
# The reporting evidence gate installs the PostgreSQL ledger store from its own package. A manual
# probe of a published SDK ref (RUNNER_PACKAGE_REF) has no storage package to pack, and that gate
# does not run for it.
- name: Pack reporting storage
if: env.RUNNER_PACKAGE_REF == ''
shell: bash
run: |
set -euo pipefail
pack_dir="$RUNNER_TEMP/adcp-reporting-storage-pack"
mkdir -p "$pack_dir"
npm pack --workspace=@adcp/reporting-storage --pack-destination "$pack_dir" --silent
mapfile -t tarballs < <(find "$pack_dir" -maxdepth 1 -type f -name '*.tgz' -print)
if [[ "${#tarballs[@]}" -ne 1 ]]; then
echo "::error::Expected one packed reporting storage tarball in $pack_dir, found ${#tarballs[@]}."
printf '%s\n' "${tarballs[@]}"
exit 1
fi
echo "Packed reporting storage at ${tarballs[0]}"
- name: Upload reporting storage tarball
if: env.RUNNER_PACKAGE_REF == ''
uses: actions/upload-artifact@v7
with:
name: adcp-reporting-storage-tarball
if-no-files-found: error
path: ${{ runner.temp }}/adcp-reporting-storage-pack/*.tgz
reporting-evidence-and-reverse-runtime:
name: Reporting evidence and reverse runtime (Node ${{ matrix.node }})
# Historical runner probes remain available; this gate qualifies the checkout.
if: inputs.runner_package_ref == ''
needs: pack-sdk-runner
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
node: ['20.19.0', '24']
services:
postgres:
image: mirror.gcr.io/library/postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout interoperability gate
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Checkout pinned Python harness
uses: actions/checkout@v5
with:
repository: adcontextprotocol/adcp-client-python
ref: 68345b5043b1cd8bae973c3d2ba0c0e7e53b6294
path: .context/reporting-python-harness
# Git archive can inspect objects outside its selected paths. A full
# pinned checkout keeps the bounded export local; export.py still
# verifies and exports only scripts/tests, excluding SDK source.
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node }}
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Download packed SDK
uses: actions/download-artifact@v7
with:
name: adcp-sdk-runner-tarball
path: ${{ runner.temp }}/reporting-sdk
- name: Download packed reporting storage
uses: actions/download-artifact@v7
with:
name: adcp-reporting-storage-tarball
path: ${{ runner.temp }}/reporting-storage
- name: Install pinned SDK artifacts and record resolved dependencies
shell: bash
run: |
set -euo pipefail
task_dir="$RUNNER_TEMP/reporting-sdk"
mapfile -t archives < <(find "$task_dir" -maxdepth 1 -name '*.tgz' -type f)
test "${#archives[@]}" -eq 1
mapfile -t storage_archives < <(find "$RUNNER_TEMP/reporting-storage" -maxdepth 1 -name '*.tgz' -type f)
test "${#storage_archives[@]}" -eq 1
npm install --prefix "$task_dir/install" --ignore-scripts --no-audit --no-fund "${archives[0]}" "${storage_archives[0]}" pg
python - "$task_dir" <<'PY'
import hashlib, json, sys, urllib.request
from pathlib import Path
pins = json.loads(Path('scripts/reporting-interop/pins.json').read_bytes())
with urllib.request.urlopen(pins['python_wheel_url'], timeout=60) as response:
body = response.read()
if hashlib.sha256(body).hexdigest() != pins['python_wheel_sha256']:
raise SystemExit('Python wheel digest differs from immutable pin')
wheel = Path(sys.argv[1]) / 'adcp-8.0.0-py3-none-any.whl'
wheel.write_bytes(body)
PY
python -m venv "$task_dir/python"
"$task_dir/python/bin/python" -m pip install "$task_dir/adcp-8.0.0-py3-none-any.whl" 'psycopg[binary,pool]' pytest pytest-asyncio
echo "REPORTING_TS_ARCHIVE=${archives[0]}" >> "$GITHUB_ENV"
echo "REPORTING_STORAGE_ARCHIVE=${storage_archives[0]}" >> "$GITHUB_ENV"
- name: Verify both evidence directions and TypeScript seller with Python buyer
env:
REPORTING_INTEROP_PG_URL: postgresql://postgres@127.0.0.1:5432/postgres
run: |
node scripts/reporting-interop/run.mjs \
"$RUNNER_TEMP/reporting-sdk/python/bin/python" \
"$RUNNER_TEMP/reporting-sdk/install" \
"$REPORTING_TS_ARCHIVE" \
"$REPORTING_STORAGE_ARCHIVE" \
"$RUNNER_TEMP/reporting-sdk/adcp-8.0.0-py3-none-any.whl" \
"$GITHUB_WORKSPACE/.context/reporting-python-harness" \
"$RUNNER_TEMP/reporting-evidence"
- name: Upload reporting evidence
if: always()
uses: actions/upload-artifact@v7
with:
name: reporting-evidence-node-${{ matrix.node }}
if-no-files-found: error
path: ${{ runner.temp }}/reporting-evidence
reference-seller-matrix:
name: ${{ matrix.language }} reference seller
needs: pack-sdk-runner
runs-on: ubuntu-latest
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
include:
- language: python
repository: adcontextprotocol/adcp-client-python
# adcp-client-python#1507 makes discovery servable: output schemas are
# advertised compactly instead of inlining every shared $ref, taking
# tools/list from 22.2 MiB to 1.34 MiB. The previous pin's reply was
# refused by this SDK's 4 MiB default response cap (adcp-client#3253),
# which left the lane with zero executed tracks.
#
# Pinned to the fix itself rather than main's head: the next commit
# (#1504, d5195a95) is a buyer-side response cap this seller lane never
# exercises. Verified on this ref — negotiates AdCP 3.2.4, advertises 14
# tools, and executes 2/2 passing tracks under the 4 MiB default.
ref: ${{ inputs.python_ref || 'd908aaa98caa88e5b0cd992037eb5010dc009da1' }}
harness: scripts/ci/run_storyboard_reference_seller.sh
port: 3001
advisory: true
- language: typescript
repository: adcontextprotocol/adcp-client
ref: df7b5837896154002bb5a4941b4b07c828521001 # @adcp/sdk@8.1.0-beta.17
harness: scripts/ci/run_storyboard_reference_seller.sh
port: 3002
advisory: true
- language: go
repository: adcontextprotocol/adcp-go
ref: adcp-v2.0.1
harness: scripts/ci/run_storyboard_reference_seller.sh
port: 3004
advisory: true
env:
STORYBOARD_RESULT_PATH: ${{ github.workspace }}/storyboard-result-${{ matrix.language }}.json
SELLER_LOG_PATH: ${{ github.workspace }}/storyboard-seller-${{ matrix.language }}.log
steps:
- name: Checkout candidate SDK harness
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 24
- name: Setup Python
if: matrix.language == 'python'
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Setup Go
if: matrix.language == 'go'
uses: actions/setup-go@v6
with:
go-version: '1.26.2'
- name: Download SDK runner tarball
uses: actions/download-artifact@v7
with:
name: adcp-sdk-runner-tarball
path: ${{ runner.temp }}/adcp-sdk-pack
- name: Resolve SDK runner tarball
id: pack
shell: bash
run: |
set -euo pipefail
mapfile -t tarballs < <(find "$RUNNER_TEMP/adcp-sdk-pack" -maxdepth 1 -type f -name '*.tgz' -print)
if [[ "${#tarballs[@]}" -ne 1 ]]; then
echo "::error::Expected one SDK runner tarball, found ${#tarballs[@]}."
printf '%s\n' "${tarballs[@]}"
exit 1
fi
echo "tarball=${tarballs[0]}" >> "$GITHUB_OUTPUT"
echo "Using SDK runner tarball ${tarballs[0]}"
- name: Checkout ${{ matrix.language }} reference seller
uses: actions/checkout@v5
with:
repository: ${{ matrix.repository }}
ref: ${{ matrix.ref }}
path: reference-${{ matrix.language }}
persist-credentials: false
- name: Verify ${{ matrix.language }} storyboard harness
shell: bash
run: |
set -euo pipefail
harness="reference-${{ matrix.language }}/${{ matrix.harness }}"
if [[ ! -f "$harness" ]]; then
echo "::error::Pinned ${{ matrix.repository }} ref '${{ matrix.ref }}' does not contain ${{ matrix.harness }}."
echo "::error::Pin a tag or commit that includes a blocking reference-seller storyboard harness."
exit 1
fi
chmod +x "$harness"
- name: Run ${{ matrix.language }} reference seller storyboard
shell: bash
run: |
set -euo pipefail
cd "reference-${{ matrix.language }}"
set +e
ADCP_SDK_TARBALL="${{ steps.pack.outputs.tarball }}" \
ADCP_PORT="${{ matrix.port }}" \
STORYBOARD_RESULT_PATH="$STORYBOARD_RESULT_PATH" \
SELLER_LOG_PATH="$SELLER_LOG_PATH" \
"$GITHUB_WORKSPACE/.github/scripts/run-reference-seller.sh" "${{ matrix.language }}" "${{ matrix.harness }}"
status=$?
set -e
if [[ "$status" -ne 0 && "${{ matrix.advisory }}" == "true" ]]; then
echo "::warning::${{ matrix.language }} reference seller storyboard failed; this lane is advisory."
exit 0
fi
exit "$status"
- name: Require Python interop to execute tracks
if: matrix.language == 'python'
shell: bash
run: |
python3 - <<'PY'
import json
import os
from pathlib import Path
path = Path(os.environ['STORYBOARD_RESULT_PATH'])
if not path.is_file() or path.stat().st_size == 0:
raise SystemExit('Python reference seller produced no storyboard result')
result = json.loads(path.read_text())
summary = result.get('summary') or {}
executed = sum(summary.get(f'tracks_{status}', 0) for status in ('passed', 'failed', 'partial', 'silent'))
if executed == 0:
raise SystemExit('Python reference seller executed zero tracks; check version negotiation')
print(f'Python reference seller executed {executed} tracks')
PY
- name: Add interop summary
if: always()
shell: bash
run: |
{
echo "### Reference seller interop"
echo ""
echo "- Implementation: \`${{ matrix.language }}\`"
echo "- Repository: \`${{ matrix.repository }}\`"
echo "- Ref: \`${{ matrix.ref }}\`"
echo "- Harness: \`${{ matrix.harness }}\`"
echo "- Advisory: \`${{ matrix.advisory }}\`"
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload storyboard artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.language }}-reference-seller-storyboard
if-no-files-found: ignore
path: |
storyboard-result-${{ matrix.language }}.json
storyboard-seller-${{ matrix.language }}.log
typescript-reference-seller-current:
name: TypeScript reference seller (current checkout)
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
needs: pack-sdk-runner
runs-on: ubuntu-latest
timeout-minutes: 25
env:
STORYBOARD_RESULT_PATH: ${{ github.workspace }}/storyboard-result-typescript.json
SELLER_LOG_PATH: ${{ github.workspace }}/storyboard-seller-typescript.log
steps:
- name: Checkout @adcp/sdk
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 24
cache: npm
- name: Download SDK runner tarball
uses: actions/download-artifact@v7
with:
name: adcp-sdk-runner-tarball
path: ${{ runner.temp }}/adcp-sdk-pack
- name: Resolve SDK runner tarball
id: pack
shell: bash
run: |
set -euo pipefail
mapfile -t tarballs < <(find "$RUNNER_TEMP/adcp-sdk-pack" -maxdepth 1 -type f -name '*.tgz' -print)
if [[ "${#tarballs[@]}" -ne 1 ]]; then
echo "::error::Expected one SDK runner tarball, found ${#tarballs[@]}."
printf '%s\n' "${tarballs[@]}"
exit 1
fi
echo "tarball=${tarballs[0]}" >> "$GITHUB_OUTPUT"
echo "Using SDK runner tarball ${tarballs[0]}"
- name: Run TypeScript example seller storyboard
shell: bash
run: |
set -euo pipefail
chmod +x scripts/ci/run_storyboard_reference_seller.sh
ADCP_SDK_TARBALL="${{ steps.pack.outputs.tarball }}" \
ADCP_PORT=3002 \
STORYBOARD_RESULT_PATH="$STORYBOARD_RESULT_PATH" \
SELLER_LOG_PATH="$SELLER_LOG_PATH" \
./scripts/ci/run_storyboard_reference_seller.sh
- name: Add interop summary
if: always()
shell: bash
run: |
{
echo "### TypeScript reference seller harness"
echo ""
echo "- Repository: \`${{ github.repository }}\`"
echo "- Ref: current checkout \`${{ github.sha }}\`"
echo "- Seller: \`examples/hello_seller_adapter_guaranteed.ts\`"
echo "- Harness: \`scripts/ci/run_storyboard_reference_seller.sh\`"
echo "- Note: tagged TypeScript release compatibility is covered by the matrix row pinned to @adcp/sdk@8.1.0-beta.17."
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload storyboard artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: typescript-reference-seller-storyboard
if-no-files-found: ignore
path: |
storyboard-result-typescript.json
storyboard-seller-typescript.log
typescript-strict-adcp-3-0-reference-seller:
name: TypeScript strict AdCP 3.0 reference seller
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call'
needs: pack-sdk-runner
runs-on: ubuntu-latest
timeout-minutes: 25
env:
STORYBOARD_RESULT_PATH: ${{ github.workspace }}/storyboard-result-typescript-strict-3-0.json
SELLER_LOG_PATH: ${{ github.workspace }}/storyboard-seller-typescript-strict-3-0.log
# v5.22.0 is the final tagged TypeScript SDK release line pinned to
# AdCP 3.0.x before the 3.1 beta envelope shipped. The harness runs it
# behind a strict proxy that rejects the 3.1-only adcp_version marker.
STRICT_ADCP_3_0_REF: 88bacfdcc0fca4066462d5b621ffc2d7f7a5d348
steps:
- name: Checkout candidate @adcp/sdk
uses: actions/checkout@v5
with:
path: candidate-sdk
persist-credentials: false
- name: Checkout pinned strict AdCP 3.0 TypeScript reference seller
uses: actions/checkout@v5
with:
repository: adcontextprotocol/adcp-client
ref: ${{ env.STRICT_ADCP_3_0_REF }}
path: reference-typescript-strict-3-0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 24
- name: Download SDK runner tarball
uses: actions/download-artifact@v7
with:
name: adcp-sdk-runner-tarball
path: ${{ runner.temp }}/adcp-sdk-pack
- name: Resolve SDK runner tarball
id: pack
shell: bash
run: |
set -euo pipefail
mapfile -t tarballs < <(find "$RUNNER_TEMP/adcp-sdk-pack" -maxdepth 1 -type f -name '*.tgz' -print)
if [[ "${#tarballs[@]}" -ne 1 ]]; then
echo "::error::Expected one SDK runner tarball, found ${#tarballs[@]}."
printf '%s\n' "${tarballs[@]}"
exit 1
fi
echo "tarball=${tarballs[0]}" >> "$GITHUB_OUTPUT"
echo "Using SDK runner tarball ${tarballs[0]}"
- name: Run strict AdCP 3.0 reference seller storyboard
shell: bash
run: |
set -euo pipefail
chmod +x candidate-sdk/scripts/ci/run_storyboard_strict_3_0_reference_seller.sh
ADCP_SDK_TARBALL="${{ steps.pack.outputs.tarball }}" \
ADCP_REFERENCE_REPO_ROOT="${{ github.workspace }}/reference-typescript-strict-3-0" \
ADCP_PORT=3003 \
ADCP_INTERNAL_PORT=3004 \
STORYBOARD_RESULT_PATH="$STORYBOARD_RESULT_PATH" \
SELLER_LOG_PATH="$SELLER_LOG_PATH" \
candidate-sdk/scripts/ci/run_storyboard_strict_3_0_reference_seller.sh
- name: Add interop summary
if: always()
shell: bash
run: |
{
echo "### Strict AdCP 3.0 reference seller interop"
echo ""
echo "- Repository: \`adcontextprotocol/adcp-client\`"
echo "- Ref: \`${STRICT_ADCP_3_0_REF}\`"
echo "- Protocol pin: AdCP 3.0.x"
echo "- Harness: \`scripts/ci/run_storyboard_strict_3_0_reference_seller.sh\`"
echo "- Advisory: \`false\`"
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload storyboard artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: typescript-strict-adcp-3-0-reference-seller-storyboard
if-no-files-found: ignore
path: |
storyboard-result-typescript-strict-3-0.json
storyboard-seller-typescript-strict-3-0.log