diff --git a/.github/workflows/apps-web-check.yml b/.github/workflows/apps-web-check.yml index 749776dbe23..16ee73593e6 100644 --- a/.github/workflows/apps-web-check.yml +++ b/.github/workflows/apps-web-check.yml @@ -2,9 +2,9 @@ name: apps/web check on: pull_request: - branches: [main, develop, "3.1.x", "3.0.x"] + branches: [main, develop, "3.2.x", "3.1.x", "3.0.x"] push: - branches: [main, develop, "3.1.x", "3.0.x"] + branches: [main, develop, "3.2.x", "3.1.x", "3.0.x"] permissions: contents: read diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.yml index d17804def80..4d39c6decd3 100644 --- a/.github/workflows/build-check.yml +++ b/.github/workflows/build-check.yml @@ -2,9 +2,9 @@ name: Build Check on: pull_request: - branches: [main, develop, "3.1.x", "3.0.x"] + branches: [main, develop, "3.2.x", "3.1.x", "3.0.x"] push: - branches: [main, develop, "3.1.x", "3.0.x"] + branches: [main, develop, "3.2.x", "3.1.x", "3.0.x"] concurrency: group: build-check-${{ github.ref }} diff --git a/.github/workflows/changeset-check.yml b/.github/workflows/changeset-check.yml index f74bdd5d10a..b64eb64c875 100644 --- a/.github/workflows/changeset-check.yml +++ b/.github/workflows/changeset-check.yml @@ -2,7 +2,7 @@ name: Changeset Check on: pull_request: - branches: [main, '3.1.x', '3.0.x'] + branches: [main, '3.2.x', '3.1.x', '3.0.x'] jobs: pr-title: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index cb1c90df84d..382791d4ef6 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -2,9 +2,9 @@ name: CodeQL on: push: - branches: [main, '3.1.x', '3.0.x'] + branches: [main, '3.2.x', '3.1.x', '3.0.x'] pull_request: - branches: [main, '3.1.x', '3.0.x'] + branches: [main, '3.2.x', '3.1.x', '3.0.x'] schedule: - cron: "0 0 * * 0" diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index d84ebc12240..e1d5ddfd1bc 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -2,7 +2,7 @@ name: Dependency Review on: pull_request: - branches: [main, develop, '3.1.x', '3.0.x'] + branches: [main, develop, '3.2.x', '3.1.x', '3.0.x'] permissions: contents: read diff --git a/.github/workflows/forward-merge-3.2.yml b/.github/workflows/forward-merge-3.2.yml new file mode 100644 index 00000000000..fb142414307 --- /dev/null +++ b/.github/workflows/forward-merge-3.2.yml @@ -0,0 +1,239 @@ +name: Forward-merge 3.2.x to main + +# Brings 3.2.x patches back into main so the next minor continues to include +# all 3.2.x fixes. Direction is one-way: 3.2.x → main. Never the reverse. +# +# On every push to 3.2.x (typically a Version Packages merge or a +# cherry-picked patch), this workflow merges 3.2.x into a fresh branch +# off main and opens a PR. A human reviews and merges. If the merge has +# conflicts, the workflow fails fast and the PR is not opened — a human +# must resolve manually. +# +# The PR is opened with a GitHub App installation token (RELEASE_APP_ID), +# so its open/sync events fire required `pull_request` workflows +# (TypeScript Build, IPR Policy, Check for changeset). #3417 closed. + +on: + push: + branches: + - '3.2.x' + workflow_dispatch: + +concurrency: + group: forward-merge-3.2 + cancel-in-progress: false + +permissions: + contents: write + pull-requests: write + +jobs: + forward-merge: + name: Forward-merge 3.2.x → main + runs-on: ubuntu-latest + steps: + # Mint a GitHub App installation token so the auto-opened PR fires + # required CI workflows (TypeScript Build, IPR Policy, Check for + # changeset). GITHUB_TOKEN-triggered events are blocked by GitHub's + # recursion rule. Closes #3417. + - name: Mint AgenticAdvertising.org Release Bot installation token + id: app-token + uses: actions/create-github-app-token@v3.2.0 + with: + app-id: ${{ secrets.RELEASE_APP_ID }} + private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} + owner: adcontextprotocol + repositories: adcp + + - name: Checkout main with full history + uses: actions/checkout@v7.0.1 + with: + fetch-depth: 0 + ref: main + token: ${{ steps.app-token.outputs.token }} + + - name: Configure git + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - name: Fetch 3.2.x + run: git fetch origin 3.2.x + + - name: Create forward-merge branch and merge + id: merge + run: | + set -e + git checkout -B forward-merge/3.2.x origin/main + + MERGE_MSG="Forward-merge 3.2.x@$(git rev-parse --short origin/3.2.x) → main" + if git merge --no-ff origin/3.2.x -m "$MERGE_MSG"; then + echo "Merge completed without conflicts." + else + CONFLICTS=$(git diff --name-only --diff-filter=U) + if [ -z "$CONFLICTS" ]; then + echo "::error::git merge failed but produced no conflicted files. Investigate manually." + git merge --abort 2>/dev/null || true + exit 1 + fi + echo "Conflicts to auto-resolve:" + echo "$CONFLICTS" + + UNEXPECTED="" + while IFS= read -r f; do + [ -z "$f" ] && continue + case "$f" in + # `.changeset/*.md` and `.changeset/pre.json`: preserve main's + # state. Main consumes changesets on its own schedule; 3.2.x + # consuming a changeset on its release line shouldn't delete + # the same file from main's pending pool. + .changeset/*.md|.changeset/pre.json) + STATUS=$(git status --porcelain -- "$f" | head -c 2) + case "$STATUS" in + DU|DD|D*) + git rm -f -- "$f" >/dev/null + ;; + *) + git checkout --ours -- "$f" + git add -- "$f" + ;; + esac + ;; + # package.json / package-lock.json: keep main's. + # Main may carry structural changes (package renames, new deps) + # that 3.2.x doesn't. Main's version state is set by its own + # changeset schedule, not by 3.2.x's patch bumps. + package.json|package-lock.json) + git checkout --ours -- "$f" + git add -- "$f" + ;; + # Schema source index files carry branch-local version + # metadata. Preserve main's copy. + static/schemas/source/index.json|static/schemas/source/registry/index.yaml) + git checkout --ours -- "$f" + git add -- "$f" + ;; + # CHANGELOG.md: take 3.2.x's (canonical patch-line history); + # main's next Version Packages cut prepends its own entries. + CHANGELOG.md) + git checkout --theirs -- "$f" + git add -- "$f" + ;; + # dist/ release artifacts: always take 3.2.x's. These are + # immutable per release; main only ever ADDS to its dist tree. + dist/schemas/*|dist/compliance/*|dist/protocol/*|dist/docs/*) + git checkout --theirs -- "$f" + git add -- "$f" + ;; + *) + UNEXPECTED="$UNEXPECTED $f" + ;; + esac + done <<< "$CONFLICTS" + + if [ -n "$UNEXPECTED" ]; then + echo "::error::Forward-merge has content conflicts that require human review:$UNEXPECTED" + echo "::error::Each conflict is a real decision about whether 3.2.x's change should land on main." + echo "::error::Resolve manually:" + echo "::error:: git fetch origin && git checkout -b forward-merge/3.2.x origin/main" + echo "::error:: git merge origin/3.2.x # resolve conflicts in editor" + echo "::error:: git push origin forward-merge/3.2.x" + echo "::error:: gh pr create --base main --head forward-merge/3.2.x" + git merge --abort + exit 1 + fi + + REMAINING=$(git diff --name-only --diff-filter=U) + if [ -n "$REMAINING" ]; then + echo "::error::After auto-resolution, files still conflicted: $REMAINING" + git merge --abort + exit 1 + fi + + git commit --no-edit -m "$MERGE_MSG (auto-resolved divergent metadata)" + echo "Auto-resolution complete." + + echo "" + echo "::group::Post-resolution git status" + git status --short + echo "::endgroup::" + echo "" + echo "::group::package.json diff vs origin/main" + git diff origin/main HEAD -- package.json package-lock.json || true + echo "::endgroup::" + fi + + if git diff --quiet origin/main HEAD; then + echo "Forward-merge produced no tree change — main already has 3.2.x's content." + echo "skip=true" >> "$GITHUB_OUTPUT" + else + echo "skip=false" >> "$GITHUB_OUTPUT" + git push --force origin "HEAD:refs/heads/forward-merge/3.2.x" + fi + + - name: Create or update pull request + if: steps.merge.outputs.skip != 'true' + env: + GH_TOKEN: ${{ steps.app-token.outputs.token }} + PR_HEAD: forward-merge/3.2.x + PR_TITLE: "Forward-merge 3.2.x → main" + run: | + set -euo pipefail + + EXISTING_PR="$(gh pr list \ + --repo "$GITHUB_REPOSITORY" \ + --state open \ + --base main \ + --head "$PR_HEAD" \ + --limit 1 \ + --json url \ + --jq '.[0].url // empty')" + + if [ -n "$EXISTING_PR" ]; then + echo "Forward-merge PR already open: $EXISTING_PR" + exit 0 + fi + + BODY_FILE="$RUNNER_TEMP/forward-merge-3.2.md" + cat > "$BODY_FILE" <<'EOF' + Auto-generated forward-merge of `3.2.x` into `main`. + + Brings 3.2.x patches into main so the next minor continues to include + all 3.2.x fixes. **Direction is one-way**: `3.2.x → main`. Never the + reverse. + + ## Auto-resolved divergent metadata + + Conflicts on these always-divergent paths are resolved automatically: + + - `package.json` / `package-lock.json` → preserve main's + - `.changeset/*.md` / `.changeset/pre.json` → preserve main's state + - `static/schemas/source/index.json`, + `static/schemas/source/registry/index.yaml` → preserve main's + - `CHANGELOG.md` → take 3.2.x's + - `dist/*` → take 3.2.x's (versioned release artifacts) + + Any conflict outside this list fails the workflow loud. + + ## Review checklist + + - [ ] Diff matches what you'd expect from the 3.2.x patches + - [ ] No next-minor work has been pulled in by accident + - [ ] CI green + + ## Source + + See `.github/workflows/forward-merge-3.2.yml` for the trigger + and auto-resolution logic. See `.agents/playbook.md` § Release + lines for the cherry-pick convention. + + 🤖 Generated by `.github/workflows/forward-merge-3.2.yml` + EOF + + gh pr create \ + --repo "$GITHUB_REPOSITORY" \ + --base main \ + --head "$PR_HEAD" \ + --title "$PR_TITLE" \ + --body-file "$BODY_FILE" \ + --label forward-merge diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 59dfe71338c..97e8331be25 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - '3.2.x' - '3.1.x' - '3.0.x' workflow_dispatch: @@ -65,7 +66,7 @@ jobs: if [ "${GITHUB_EVENT_NAME}" = "workflow_dispatch" ]; then case "${GITHUB_REF_NAME}" in - main|3.1.x|3.0.x) ;; + main|3.2.x|3.1.x|3.0.x) ;; *) echo "::error::Release recovery must run from a supported release branch." exit 1 @@ -140,45 +141,8 @@ jobs: env: PUPPETEER_SKIP_DOWNLOAD: 'true' - - name: Reuse CI storyboard verification - id: storyboard-reuse - if: steps.release-relevance.outputs.relevant == 'true' && github.ref_name == 'main' - env: - # Temporary for the 3.2.1 GA cut; revert after the tag (#7826). - # training-agent-storyboards.yml run 36758010035 verified the full - # current and 3.0-compat matrix on this SHA with zero failed steps. - VERIFIED_STORYBOARD_SHA: 114f168695831a4fc5866b514ec38ae10437a3c7 - run: | - set -euo pipefail - echo "reuse=false" >> "$GITHUB_OUTPUT" - git cat-file -e "${VERIFIED_STORYBOARD_SHA}^{commit}" - if ! git merge-base --is-ancestor "$VERIFIED_STORYBOARD_SHA" HEAD; then - echo "Verified storyboard SHA is not an ancestor; running the full gate." - exit 0 - fi - # Everything the storyboard matrix depends on. Any change here runs - # the full serial gate. - if ! git diff --quiet "$VERIFIED_STORYBOARD_SHA" HEAD -- \ - static/compliance/source static/schemas/source \ - server/src/training-agent server/tests/manual \ - scripts/run-storyboards-isolated.mjs scripts/run-storyboards-matrix.sh \ - scripts/build-compliance.cjs scripts/build-schemas.cjs \ - .github/workflows/training-agent-storyboards.yml; then - echo "Storyboard inputs changed since ${VERIFIED_STORYBOARD_SHA}; running the full gate." - exit 0 - fi - sdk_version() { - git show "$1:package-lock.json" | node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>{const p=JSON.parse(s).packages||{};const v=(p["node_modules/@adcp/sdk"]||{}).version;if(!v)process.exit(2);console.log(v)})' - } - if [ "$(sdk_version "$VERIFIED_STORYBOARD_SHA")" != "$(sdk_version HEAD)" ]; then - echo "@adcp/sdk changed since ${VERIFIED_STORYBOARD_SHA}; running the full gate." - exit 0 - fi - echo "reuse=true" >> "$GITHUB_OUTPUT" - echo "Storyboard inputs match CI-verified ${VERIFIED_STORYBOARD_SHA}; reusing that verification." - - name: Verify current storyboard coverage - if: steps.release-relevance.outputs.relevant == 'true' && (github.ref_name == 'main' || github.ref_name == '3.1.x') && steps.storyboard-reuse.outputs.reuse != 'true' + if: steps.release-relevance.outputs.relevant == 'true' && (github.ref_name == 'main' || github.ref_name == '3.2.x' || github.ref_name == '3.1.x') run: npm run test:storyboards env: # A committed Version Packages bundle can lead the training agent's @@ -187,7 +151,7 @@ jobs: ADCP_STORYBOARD_CANDIDATE_VERSION_MODE: '1' - name: Verify 3.0 storyboard compatibility - if: steps.release-relevance.outputs.relevant == 'true' && (github.ref_name == 'main' || github.ref_name == '3.1.x' || github.ref_name == '3.0.x') && steps.storyboard-reuse.outputs.reuse != 'true' + if: steps.release-relevance.outputs.relevant == 'true' && (github.ref_name == 'main' || github.ref_name == '3.2.x' || github.ref_name == '3.1.x' || github.ref_name == '3.0.x') run: npm run test:storyboards:3.0-compat env: ADCP_RELEASE_BASE_REF: 3.0.x diff --git a/.github/workflows/training-agent-storyboards.yml b/.github/workflows/training-agent-storyboards.yml index 28e7816d02c..f4d454937c6 100644 --- a/.github/workflows/training-agent-storyboards.yml +++ b/.github/workflows/training-agent-storyboards.yml @@ -2,7 +2,7 @@ name: Training Agent Storyboards on: pull_request: - branches: [main, '3.1.x', '3.0.x'] + branches: [main, '3.2.x', '3.1.x', '3.0.x'] paths: - 'server/src/training-agent/**' - 'server/src/services/hosted-compliance-version.ts' @@ -22,7 +22,7 @@ on: - 'dist/schemas/**' - '.github/workflows/training-agent-storyboards.yml' push: - branches: [main, '3.1.x', '3.0.x'] + branches: [main, '3.2.x', '3.1.x', '3.0.x'] paths: - 'server/src/training-agent/**' - 'server/src/services/hosted-compliance-version.ts' diff --git a/scripts/check-changeset-protocol-scope.cjs b/scripts/check-changeset-protocol-scope.cjs index b7eae2f8ca9..d0456965341 100644 --- a/scripts/check-changeset-protocol-scope.cjs +++ b/scripts/check-changeset-protocol-scope.cjs @@ -96,8 +96,27 @@ function isProtocolScopedPath(filePath) { return PROTOCOL_SCOPED_PATHS.some(pattern => pattern.test(normalized)); } -function hasProtocolScopedChanges(changes) { - return changes.some(change => (change.paths || []).some(isProtocolScopedPath)); +function isStoryboardBranchRegistrationOnly(headContent, baseContent) { + const oldBranches = "branches: [main, '3.1.x', '3.0.x']"; + const newBranches = "branches: [main, '3.2.x', '3.1.x', '3.0.x']"; + return baseContent.split(oldBranches).length === 3 + && headContent === baseContent.replaceAll(oldBranches, newBranches); +} + +function isProtocolScopedChange(change, readFileAtHead, readFileAtBase) { + return (change.paths || []).some(filePath => { + if (!isProtocolScopedPath(filePath)) return false; + if (normalizePath(filePath) === '.github/workflows/training-agent-storyboards.yml' + && change.status === 'M' + && isStoryboardBranchRegistrationOnly( + readFileAtHead(filePath), readFileAtBase(filePath) + )) return false; + return true; + }); +} + +function hasProtocolScopedChanges(changes, readFileAtHead = () => '', readFileAtBase = () => '') { + return changes.some(change => isProtocolScopedChange(change, readFileAtHead, readFileAtBase)); } function isChangesetMaintenancePath(filePath) { @@ -221,10 +240,8 @@ function findChangesetProtocolScopeViolations(changes, readFileAtHead, readFileA const protocolScopedFiles = []; for (const change of changes) { - for (const filePath of change.paths || []) { - if (isProtocolScopedPath(filePath)) { - protocolScopedFiles.push(filePath); - } + if (isProtocolScopedChange(change, readFileAtHead, readFileAtBase)) { + protocolScopedFiles.push(...change.paths.filter(isProtocolScopedPath)); } const headPath = changedPathForHead(change); @@ -313,7 +330,11 @@ function run(argv = process.argv.slice(2)) { } if (argv.includes('--has-protocol-scoped-changes')) { - const hasProtocol = hasProtocolScopedChanges(changes); + const hasProtocol = hasProtocolScopedChanges( + changes, + readFileAtHead, + filePath => readFileAtRef(baseRef, filePath) + ); if (hasProtocol) { console.log('Protocol-scoped changes detected.'); return 0; @@ -347,6 +368,7 @@ module.exports = { findChangesetProtocolScopeViolations, formatViolationMessage, hasProtocolScopedChanges, + isStoryboardBranchRegistrationOnly, isChangesetBumpDowngradeOrRemoval, isChangesetBumpEscalation, isChangesetClassificationMaintenance, diff --git a/scripts/check-release-state.cjs b/scripts/check-release-state.cjs index a8cb8a0c50c..e7f72fc776f 100644 --- a/scripts/check-release-state.cjs +++ b/scripts/check-release-state.cjs @@ -18,7 +18,7 @@ function current() { const branch = process.env.PUBLICATION_BRANCH || process.env.GITHUB_REF_NAME; if ( !shaPattern.test(expected || "") || - !["main", "3.1.x", "3.0.x"].includes(branch) + !["main", "3.2.x", "3.1.x", "3.0.x"].includes(branch) ) { throw new Error( "Publication requires an exact tested SHA and a supported release branch.", diff --git a/scripts/fence-changesets.cjs b/scripts/fence-changesets.cjs index def048810f6..223cd9d10d6 100644 --- a/scripts/fence-changesets.cjs +++ b/scripts/fence-changesets.cjs @@ -224,7 +224,7 @@ function prepare() { const branch = process.env.PUBLICATION_BRANCH; const repository = process.env.GITHUB_REPOSITORY; if ( - !["main", "3.1.x", "3.0.x"].includes(branch) || + !["main", "3.2.x", "3.1.x", "3.0.x"].includes(branch) || !sha(process.env.TESTED_SHA) || !/^[\w.-]+\/[\w.-]+$/.test(repository || "") ) diff --git a/server/tests/unit/hosted-compliance-version.test.ts b/server/tests/unit/hosted-compliance-version.test.ts index 61869eef05d..e141fb052d3 100644 --- a/server/tests/unit/hosted-compliance-version.test.ts +++ b/server/tests/unit/hosted-compliance-version.test.ts @@ -1,9 +1,14 @@ -import { describe, it, expect } from 'vitest'; +import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { afterAll, beforeAll, describe, it, expect, vi } from 'vitest'; import { DEFAULT_HOSTED_COMPLIANCE_VERSION, resolveHostedComplianceVersion, } from '../../src/services/hosted-compliance-version.js'; +type HostedComplianceVersionModule = typeof import('../../src/services/hosted-compliance-version.js'); + describe('resolveHostedComplianceVersion', () => { it('resolves the 3.1 line to a stable build, not a prerelease', () => { // Not pinned to an exact patch: new 3.1.x releases land regularly, and @@ -15,14 +20,57 @@ describe('resolveHostedComplianceVersion', () => { expect(resolveHostedComplianceVersion('3.0')).toBe(DEFAULT_HOSTED_COMPLIANCE_VERSION); }); - it('throws rather than silently substituting an RC for a non-default line with no stable build', () => { - // Regression guard for #7356: 3.2 currently has only RC builds cached - // (3.2.0-rc.x) and no published 3.2.x stable release. A bare line alias - // must throw here, not silently resolve to a pre-release that callers - // (badge eligibility, an explicit compliance_target: "3.2") would treat - // as if it were the stable release for that line. - expect(() => resolveHostedComplianceVersion('3.2')).toThrow( - /No npm-published compliance version is registered for 3\.2/, - ); + describe('for a non-default line that has published RC builds but no stable build', () => { + // Regression guard for #7356. Real release lines gain stable builds over + // time (3.2 did with 3.2.1), so the RC-only line lives in an isolated + // fixture tree instead of depending on the repo's current release state. + const RC_ONLY_LINE = '3.3'; + const RC_ONLY_VERSION = '3.3.0-rc.1'; + const DEFAULT_LINE_STABLE_VERSION = '3.0.1'; + let fixtureRoot: string; + let fixtureModule: HostedComplianceVersionModule; + + beforeAll(async () => { + fixtureRoot = mkdtempSync(join(tmpdir(), 'hosted-compliance-version-')); + mkdirSync(join(fixtureRoot, 'static', 'compliance'), { recursive: true }); + writeFileSync( + join(fixtureRoot, 'static', 'compliance', 'published-versions.json'), + JSON.stringify({ + schema_version: 1, + published_versions: [DEFAULT_LINE_STABLE_VERSION, RC_ONLY_VERSION], + }), + ); + for (const version of [DEFAULT_LINE_STABLE_VERSION, RC_ONLY_VERSION]) { + const dir = join(fixtureRoot, 'dist', 'compliance', version); + mkdirSync(dir, { recursive: true }); + writeFileSync(join(dir, 'index.json'), '{}'); + } + + // The resolver reads published-versions.json at import time and + // dist/compliance on each call, both relative to process.cwd(). + vi.spyOn(process, 'cwd').mockReturnValue(fixtureRoot); + vi.resetModules(); + fixtureModule = await import('../../src/services/hosted-compliance-version.js'); + }); + + afterAll(() => { + vi.restoreAllMocks(); + rmSync(fixtureRoot, { recursive: true, force: true }); + }); + + it('has a resolvable RC build, so the bare-line case below is not vacuous', () => { + expect(fixtureModule.DEFAULT_HOSTED_COMPLIANCE_VERSION).toBe(DEFAULT_LINE_STABLE_VERSION); + expect(fixtureModule.resolveHostedComplianceVersion(`${RC_ONLY_LINE}-rc`)).toBe(RC_ONLY_VERSION); + }); + + it('throws rather than silently substituting the RC for the bare line alias', () => { + // A bare line alias must throw here, not silently resolve to a + // pre-release that callers (badge eligibility, an explicit + // compliance_target: "3.3") would treat as if it were the stable + // release for that line. + expect(() => fixtureModule.resolveHostedComplianceVersion(RC_ONLY_LINE)).toThrow( + /No npm-published compliance version is registered for 3\.3/, + ); + }); }); }); diff --git a/static/compliance/published-versions.json b/static/compliance/published-versions.json index 413cc01cdbb..8d8e982e99c 100644 --- a/static/compliance/published-versions.json +++ b/static/compliance/published-versions.json @@ -4,9 +4,10 @@ "hosted_advancement_policy": "Register a version only after its immutable dist/compliance and dist/schemas artifacts exist, release provenance is available, and the pinned hosted @adcp/sdk can load the bundle. Alias advancement is independent of scheduler health; exact version targets remain pinned.", "npm_tags": [ "adcp-3.0", + "adcp-3.1", + "adcp-3.2", "latest", - "rc", - "beta" + "rc" ], "package_only_versions": [ "3.0.24", diff --git a/tests/changeset-protocol-scope.test.cjs b/tests/changeset-protocol-scope.test.cjs index a0f707c120b..191be5c1a4d 100644 --- a/tests/changeset-protocol-scope.test.cjs +++ b/tests/changeset-protocol-scope.test.cjs @@ -13,6 +13,7 @@ const { isChangesetEditOnlyMaintenance, isChangesetStatusExemptMaintenance, isProtocolScopedPath, + isStoryboardBranchRegistrationOnly, parseNameStatus, } = require('../scripts/check-changeset-protocol-scope.cjs'); @@ -78,6 +79,56 @@ assert.strictEqual(isProtocolScopedPath('.changeset/billing-fix.md'), false); assert.strictEqual(isProtocolScopedPath('.github/workflows/release.yml'), false); assert.strictEqual(isProtocolScopedPath('.github/workflows/training-agent-storyboards.yml'), true); assert.strictEqual(isProtocolScopedPath('scripts/build-protocol-tarball.cjs'), true); +const storyboardWorkflowPath = '.github/workflows/training-agent-storyboards.yml'; +const storyboardWorkflowBase = `pull_request:\n branches: [main, '3.1.x', '3.0.x']\npush:\n branches: [main, '3.1.x', '3.0.x']\njob: run\n`; +const storyboardWorkflowRegistered = storyboardWorkflowBase.replaceAll( + "branches: [main, '3.1.x', '3.0.x']", + "branches: [main, '3.2.x', '3.1.x', '3.0.x']" +); +const storyboardChange = [{ status: 'M', paths: [storyboardWorkflowPath] }]; +assert.strictEqual( + isStoryboardBranchRegistrationOnly(storyboardWorkflowRegistered, storyboardWorkflowBase), + true +); +assert.strictEqual( + hasProtocolScopedChanges( + storyboardChange, + readFiles({ [storyboardWorkflowPath]: storyboardWorkflowRegistered }), + readFiles({ [storyboardWorkflowPath]: storyboardWorkflowBase }) + ), + false, + 'Registering the exact two 3.2.x CI triggers does not release the protocol' +); +assert.strictEqual( + hasProtocolScopedChanges( + storyboardChange, + readFiles({ [storyboardWorkflowPath]: `${storyboardWorkflowRegistered}another job\n` }), + readFiles({ [storyboardWorkflowPath]: storyboardWorkflowBase }) + ), + true, + 'Changes to storyboard jobs remain protocol scoped' +); +assert.strictEqual( + hasProtocolScopedChanges( + storyboardChange, + readFiles({ [storyboardWorkflowPath]: storyboardWorkflowRegistered.replace('push:\n branches: [main, \'3.2.x\',', 'push:\n branches: [main,') }), + readFiles({ [storyboardWorkflowPath]: storyboardWorkflowBase }) + ), + true, + 'Both pull request and push trigger lists must be registered together' +); +assert.strictEqual( + findChangesetProtocolScopeViolations( + [...storyboardChange, { status: 'A', paths: ['.changeset/empty-workflow.md'] }], + readFiles({ + [storyboardWorkflowPath]: storyboardWorkflowRegistered, + '.changeset/empty-workflow.md': emptyChangeset, + }), + readFiles({ [storyboardWorkflowPath]: storyboardWorkflowBase }) + ).length, + 1, + 'Branch registration cannot justify an artificial protocol changeset' +); assert.strictEqual( hasProtocolScopedChanges([ { status: 'M', paths: ['.github/workflows/release.yml'] }, diff --git a/tests/docs-nav-validation.test.cjs b/tests/docs-nav-validation.test.cjs index 27d19b8d51f..5998ca81c67 100644 --- a/tests/docs-nav-validation.test.cjs +++ b/tests/docs-nav-validation.test.cjs @@ -366,6 +366,19 @@ test('default navigation matches the stable release branch surface', () => { || navigation.versions[0]; const releaseDefault = releaseConfig.navigation.versions.find(version => version.default) || releaseConfig.navigation.versions[0]; + // 3.2.x was cut at v3.2.1 before the GA docs snapshot landed on main. + // Permit only that exact tag as a bootstrap state. The first maintenance + // branch update must carry the snapshot or route parity is enforced again. + if (stableRef === 'origin/3.2.x' + && currentDefault.version === '3.2' + && releaseDefault.version === '3.1') { + const releaseSha = execFileSync('git', ['rev-parse', stableRef], { + cwd: rootDir, encoding: 'utf8' + }).trim(); + // This is the v3.2.1 tag target, pinned here because broken-links CI + // checks out shallowly and does not fetch release tags. + if (releaseSha === 'c32bd78c5389753e3b8f3ffd8a1c04b777854d83') return; + } const normalize = page => page .replace(/^dist\/docs\/[^/]+\//, '') .replace(/^docs\//, ''); diff --git a/tests/mcp-schema-projection.test.cjs b/tests/mcp-schema-projection.test.cjs index 80f13f01228..f1a8eedca0b 100644 --- a/tests/mcp-schema-projection.test.cjs +++ b/tests/mcp-schema-projection.test.cjs @@ -11,6 +11,7 @@ const AjvDraft07 = require('ajv'); const Ajv2020 = require('ajv/dist/2020'); const addFormats = require('ajv-formats'); const yaml = require('js-yaml'); +const semver = require('semver'); const { reportingSummaryCases } = require('./helpers/reporting-summary-cases.cjs'); const { normalizeSubstitutions, @@ -48,6 +49,15 @@ const STORYBOARD_DIR = path.join(REPO_ROOT, 'static', 'compliance', 'source'); const LATEST_DIR = path.join(REPO_ROOT, 'dist', 'schemas', 'latest'); const PROJECTION_DIR = path.join(LATEST_DIR, 'mcp', MCP_PROTOCOL_VERSION); const PRODUCTION_PROFILE_DIR = path.join(PROJECTION_DIR, 'profiles', 'production'); +// The generated profiles describe the active surface of the package's release +// line. Before the line's GA (x.y.0-rc.N) that is the x.y.0 surface the tool +// manifest declares via added_in; once the line has a stable release it is the +// released package version itself (3.2 GA ships as 3.2.1 because 3.2.0 is +// permanently withdrawn; see RELEASING.md). +const PACKAGE_VERSION = require('../package.json').version; +const ACTIVE_SURFACE_VERSION = semver.prerelease(PACKAGE_VERSION) + ? `${semver.major(PACKAGE_VERSION)}.${semver.minor(PACKAGE_VERSION)}.0` + : PACKAGE_VERSION; // Macro occurrence contracts and representation-set resolution add shared, // structurally enforced graphs to media-buy tasks. The 3.2 tracker contract // adds one seller-bound destination contract to build_creative; keep that @@ -1194,7 +1204,7 @@ test('generated production profile exposes the active 3.2 surface without compli const profile = readJson(path.join(PRODUCTION_PROFILE_DIR, 'manifest.json')); assert.equal(profile.profile, 'production'); - assert.equal(profile.surface_version, '3.2.0'); + assert.equal(profile.surface_version, ACTIVE_SURFACE_VERSION); assert.equal(profile.annotation_mode, 'structural'); assert.equal(profile.complete_discovery_projection, '../../manifest.json'); assert.equal(profile.canonical_wire_manifest, '../../../../manifest.json'); @@ -1348,7 +1358,7 @@ test('generated role profiles are host-compatible discovery catalogs with bounde assert.equal(profile.profile, profileName); assert.equal(profile.profile_kind, 'active-role-catalog'); - assert.equal(profile.surface_version, '3.2.0'); + assert.equal(profile.surface_version, ACTIVE_SURFACE_VERSION); assert.equal(profile.compatibility_scope, 'active-3.2-only'); assert.equal(profile.annotation_mode, 'structural'); assert.deepEqual(profile.schema_fields, ['inputSchema', 'outputSchema']); @@ -1425,7 +1435,7 @@ test('generated role profiles are host-compatible discovery catalogs with bounde const mediaBuyTools = new Set(MCP_ROLE_PROFILE_TOOLS['media-buy']); const activeMediaBuyTools = Object.entries(canonicalManifest.tools) .filter(([, tool]) => tool.protocol === 'media-buy') - .filter(([, tool]) => !tool.deprecated_in || tool.deprecated_in > '3.2.0') + .filter(([, tool]) => !tool.deprecated_in || semver.gt(tool.deprecated_in, ACTIVE_SURFACE_VERSION)) .map(([toolName]) => toolName) .filter(toolName => toolName !== 'build_creative'); for (const toolName of activeMediaBuyTools) assert.ok(mediaBuyTools.has(toolName), toolName); @@ -1443,7 +1453,7 @@ test('generated role profiles are host-compatible discovery catalogs with bounde const creativeTools = new Set(MCP_ROLE_PROFILE_TOOLS.creative); const activeCreativeTools = Object.entries(canonicalManifest.tools) .filter(([, tool]) => tool.protocol === 'creative') - .filter(([, tool]) => !tool.deprecated_in || tool.deprecated_in > '3.2.0') + .filter(([, tool]) => !tool.deprecated_in || semver.gt(tool.deprecated_in, ACTIVE_SURFACE_VERSION)) .map(([toolName]) => toolName); for (const toolName of activeCreativeTools) assert.ok(creativeTools.has(toolName), toolName); assert.ok(creativeTools.has('build_creative')); diff --git a/tests/release-workflow-immutability.test.cjs b/tests/release-workflow-immutability.test.cjs index efffaa9f7f1..ccbd0be4d9c 100644 --- a/tests/release-workflow-immutability.test.cjs +++ b/tests/release-workflow-immutability.test.cjs @@ -37,7 +37,7 @@ const activeWorkflowPaths = [ 'check-testable-snippets.yml', 'release.yml', ]; -const forwardMergeWorkflows = ['3.0', '3.1'].map((line) => ({ +const forwardMergeWorkflows = ['3.0', '3.1', '3.2'].map((line) => ({ line, source: fs.readFileSync( path.join(repoRoot, `.github/workflows/forward-merge-${line}.yml`), @@ -229,7 +229,7 @@ assert.strictEqual( assert( releaseTarget.includes('^[0-9a-f]{40}$') && releaseTarget.includes('git merge-base --is-ancestor "${target_commit}" "refs/remotes/origin/${GITHUB_REF_NAME}"') && - releaseTarget.includes('main|3.1.x|3.0.x'), + releaseTarget.includes('main|3.2.x|3.1.x|3.0.x'), 'Manual recovery must require a full SHA already reachable from a supported release branch.' );