Skip to content

ci: opt out of manual publish approval - W-24872687 - #819

Merged
peternhale merged 4 commits into
mainfrom
ph/W-24872687-api-semver-release
Nov 13, 2026
Merged

peternhale merged 4 commits into
mainfrom
ph/W-24872687-api-semver-release

Conversation

@peternhale

Copy link
Copy Markdown
Contributor

Summary

  • Set the Apex Language Support API release baseline to 0.11.75.
  • Opt this repository's manual extension publishing out of the shared manual approval gate.
  • Retain approval-gated publishing as the shared-workflow default for all other consumers.

Dependency

Requires salesforcecli/github-workflows#209 to merge first, because it adds the shared require-approval input.

Test Plan

  • Commit hook: repository lint passed.
  • Commit hook: repository test suite passed (5,372 passed, 0 failed; 480 pending).
  • YAML parses with Ruby YAML.load_file.
  • git diff --check.

@W-24872687@

@peternhale
peternhale requested a review from a team as a code owner November 11, 2026 16:45
@peternhale
peternhale requested a review from diyer November 11, 2026 16:45
@github-actions

Copy link
Copy Markdown
Contributor

This PR lacks any commits of the 'fix' or 'feat' type, and therefore will not trigger a release. To silence all further warnings, react to this warning comment (or any other) with the 👀 emoji.

NOTE: If your repo uses squash commits, make sure to add the appropriate conventional commit prefix (e.g., 'fix:', 'feat:', 'chore:', etc) in the squash commit message.

@github-actions

Copy link
Copy Markdown
Contributor

E2E Test Results Summary

Run: 2171

Test Results

  • Passed: 97
  • Failed: 0
  • Errors: 1
  • Total: 98

Passing Rate by File

  • apex-extension-core.spec.ts/junit.xml: 100.0% (8/8 passed)
  • apex-extract-constant.spec.ts/junit.xml: 100.0% (1/1 passed)
  • apex-hover.spec.ts/junit.xml: 100.0% (21/21 passed)
  • apex-extract-variable.spec.ts/junit.xml: 100.0% (3/3 passed)
  • apex-goto-definition.spec.ts/junit.xml: 100.0% (17/17 passed)
  • apex-hover-stdlib.spec.ts/junit.xml: 100.0% (3/3 passed)
  • apex-outline.spec.ts/junit.xml: 100.0% (11/11 passed)
  • apex-goto-definition-advanced.spec.ts/junit.xml: 87.5% (7/8 passed)
  • apex-lsp-integration.spec.ts/junit.xml: 100.0% (16/16 passed)
  • apex-rename-symbol.spec.ts/junit.xml: 100.0% (7/7 passed)
  • apex-capability-gating.spec.ts/junit.xml: 100.0% (3/3 passed)

Artifacts

View detailed test reports in the Artifacts section.

Some tests failed

@github-actions

Copy link
Copy Markdown
Contributor

E2E Test Results Summary

Run: 2178

Test Results

  • Passed: 63
  • Failed: 0
  • Errors: 1
  • Total: 64

Passing Rate by File

  • apex-extension-core.spec.ts/junit.xml: 100.0% (8/8 passed)
  • apex-extract-constant.spec.ts/junit.xml: 100.0% (1/1 passed)
  • apex-hover.spec.ts/junit.xml: 100.0% (1/1 passed)
  • apex-extract-variable.spec.ts/junit.xml: 100.0% (3/3 passed)
  • apex-goto-definition.spec.ts/junit.xml: 100.0% (20/20 passed)
  • apex-hover-stdlib.spec.ts/junit.xml: 100.0% (1/1 passed)
  • apex-outline.spec.ts/junit.xml: 50.0% (1/2 passed)
  • apex-goto-definition-advanced.spec.ts/junit.xml: 100.0% (6/6 passed)
  • apex-lsp-integration.spec.ts/junit.xml: 100.0% (16/16 passed)
  • apex-rename-symbol.spec.ts/junit.xml: 100.0% (3/3 passed)
  • apex-capability-gating.spec.ts/junit.xml: 100.0% (3/3 passed)

Artifacts

View detailed test reports in the Artifacts section.

Some tests failed

@peternhale
peternhale requested review from madhur310 and removed request for diyer November 12, 2026 15:56

@madhur310 madhur310 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review pass focused on correctness and maintainability. One confirmed correctness bug, plus several duplication/staleness findings below. The previously-flagged blocker (require-approval: 'false' relying on an input that didn't exist on vscode-manual-publish.yml@main) is now resolved since salesforcecli/github-workflows#209 merged — no comment needed for that one.

One more not inlined because the file isn't touched by this diff: .github/workflows/release-npm.yml's header comment (line 5) still says the extension API "must be released only with its matching VSIX through publish-extension-api.yml", but that workflow is neutered to a stub pointing at paired-hotfix-release.yml by this PR. Worth a follow-up to update that comment.

[
'log',
'--format=%B%x00',
`${baselineTag}..${resolvedSourceSha}`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git log baselineTag..resolvedSourceSha only checks reachability, not ancestry — it doesn't verify resolvedSourceSha actually descends from baselineTag. If source_sha is on a branch that forked from a point before the last apex-language-server-extension-api-v* tag (e.g. a long-lived hotfix branch), git describe can still resolve some reachable tag as the "baseline", and this range will enumerate that divergent branch's own commits as if they were ahead of the real last release. That lets a hotfix compute/publish an API version relative to the wrong baseline without erroring. Worth adding an explicit ancestry check (e.g. git merge-base --is-ancestor baselineTag resolvedSourceSha) before trusting the commit range.

Comment on lines +61 to +85
- name: Checkout paired release source
uses: actions/checkout@v6
with:
ref: ${{ inputs.source_sha }}
fetch-depth: 0
persist-credentials: false

- name: Assert checkout identity
id: source
run: |
SHA=$(git rev-parse HEAD)
[ "$SHA" = "${SOURCE_SHA,,}" ] || { echo 'Checkout SHA mismatch.'; exit 1; }
echo "sha=$SHA" >> "$GITHUB_OUTPUT"

- name: Enable Corepack
run: corepack enable

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22.x'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This checkout/Corepack/setup-node/install block is repeated verbatim across verify-source, marketplace-guard (lines ~269-285), and verify-host-publication (lines ~373-389) in this same file (and again in resume-paired-hotfix-api.yml's verify-prior-pair). Worth factoring into a composite action to keep the copies from drifting.

Comment on lines +305 to +318
metadata.hostPublication = { status: 'version-available', checkedAt: new Date().toISOString(),
version: metadata.sourceHostPackageVersion, immutableIdentityVerified: false };
fs.writeFileSync(path, JSON.stringify(metadata, null, 2) + '\n');
NODE

- name: Upload Marketplace guard metadata
if: always()
uses: actions/upload-artifact@v7
with:
name: paired-marketplace-guard-${{ github.run_id }}
overwrite: true
path: api-release/extension-api-release.json
if-no-files-found: error
retention-days: 90

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hostPublication: { status: 'version-available', ... } is written here but nothing downstream reads it — verify-host-publication later overwrites metadata.hostPublication with its own status: 'verified' object without checking this one first. Likewise the paired-marketplace-guard-* artifact uploaded below doesn't appear to be consumed by any later job. If neither is used for anything beyond debugging, consider dropping them.

Comment on lines +462 to +468
STATUS=$(curl --silent --show-error --output api-release/registry-response.json --write-out '%{http_code}' \
"https://registry.npmjs.org/@salesforce%2Fapex-language-server-extension-api/$API_VERSION")
case "$STATUS" in
404) ;;
200) echo 'API version already exists and is immutable.'; exit 1 ;;
*) echo "Registry lookup failed: HTTP $STATUS"; exit 1 ;;
esac

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This 404-or-fail-closed registry check duplicates the identical case "$STATUS" block in api-version-guard above (lines 330-336). Could be a shared step/composite action instead of two copies.

Comment on lines +489 to +491
const view = spec => JSON.parse(execFileSync('npm', ['view', spec, '--json', '--registry=https://registry.npmjs.org', '--prefer-online'], { encoding: 'utf8' }));
const version = view(`${process.env.PACKAGE_NAME}@${process.env.API_VERSION}`);
const tags = view(process.env.PACKAGE_NAME)['dist-tags'];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

view(pkg@version) and view(pkg) here are two separate npm view network calls per retry attempt, but npm view <pkg>@<version> --json alone already includes the package-wide dist-tags map in its output (confirmed against the public registry) — so the second call is redundant and could be dropped to halve the registry calls in this retry loop. Same pattern repeats in resume-paired-hotfix-api.yml's publish-api job.

Comment on lines +117 to +135
- name: Verify Marketplace host checksum
run: |
node <<'NODE'
const assert = require('node:assert/strict');
const fs = require('node:fs');
const { execFileSync } = require('node:child_process');
const path = 'api-release/extension-api-release.json';
const metadata = JSON.parse(fs.readFileSync(path, 'utf8'));
const marketplace = JSON.parse(execFileSync('pnpm', ['exec', 'vsce', 'show', 'salesforce.apex-language-server-extension', '--json'],
{ cwd: 'packages/apex-lsp-vscode-extension', encoding: 'utf8' }));
assert(Array.isArray(marketplace.versions), 'Marketplace response must include versions');
const versions = marketplace.versions.filter(entry => entry.targetPlatform !== 'web' && entry.version === metadata.sourceHostPackageVersion);
assert.equal(versions.length, 1, 'Expected exactly one matching non-web Marketplace host version');
const checksums = (versions[0].properties || []).filter(property => property.key === 'Microsoft.VisualStudio.Services.VsixSha256');
assert.equal(checksums.length, 1, 'Expected Marketplace VSIX SHA256 property');
const sha256 = checksums[0].value;
assert.match(sha256, /^[0-9a-f]{64}$/i, 'Expected valid Marketplace VSIX SHA256');
assert.equal(sha256.toLowerCase(), metadata.hostVsixSha256, 'Marketplace host checksum must match paired VSIX');
NODE

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicates the Marketplace-checksum verification logic in paired-hotfix-release.yml's verify-host-publication job (lines ~397-415) almost verbatim. Same candidate for extraction as the other duplicated blocks between this file and the main paired-hotfix-release.yml.

Comment on lines +166 to +210
- name: Publish or verify the paired API tarball
id: npm
run: |
node <<'NODE'
const assert = require('node:assert/strict');
const crypto = require('node:crypto');
const { execFileSync } = require('node:child_process');
const fs = require('node:fs');
const metadataPath = 'api-release/extension-api-release.json';
const metadata = JSON.parse(fs.readFileSync(metadataPath, 'utf8'));
const tarball = fs.readFileSync('api-release/extension-api.tgz');
assert.equal(crypto.createHash('sha256').update(tarball).digest('hex'), metadata.tarballSha256, 'API tarball checksum must match original metadata');
const integrity = 'sha512-' + crypto.createHash('sha512').update(tarball).digest('base64');
const view = spec => JSON.parse(execFileSync('npm', ['view', spec, '--json', '--registry=https://registry.npmjs.org', '--prefer-online'], { encoding: 'utf8' }));
let version;
try {
version = view(`${process.env.PACKAGE_NAME}@${process.env.API_VERSION}`);
assert(version && typeof version === 'object', 'Expected npm version metadata');
} catch (error) {
let code;
try { code = JSON.parse(String(error.stdout)).error?.code; } catch {}
if (code !== 'E404') throw error;
}
if (!version) {
execFileSync('npm', ['publish', './api-release/extension-api.tgz', '--access', 'public', '--tag', process.env.DIST_TAG, '--ignore-scripts', '--registry=https://registry.npmjs.org'], { stdio: 'inherit' });
}
let verified = false;
for (let attempt = 0; attempt < 6; attempt++) {
try {
const actualVersion = view(`${process.env.PACKAGE_NAME}@${process.env.API_VERSION}`);
const tags = view(process.env.PACKAGE_NAME)['dist-tags'];
metadata.npmVerification = { checkedAt: new Date().toISOString(), version: actualVersion.version,
distTag: process.env.DIST_TAG, distTagVersion: tags[process.env.DIST_TAG], integrity: actualVersion.dist.integrity };
verified = actualVersion.version === process.env.API_VERSION && tags[process.env.DIST_TAG] === process.env.API_VERSION && actualVersion.dist.integrity === integrity;
metadata.npmVerification.verified = verified;
} catch (error) {
metadata.npmVerification = { checkedAt: new Date().toISOString(), verified: false, error: error.message };
}
fs.writeFileSync(metadataPath, JSON.stringify(metadata, null, 2) + '\n');
if (verified) break;
if (attempt < 5) Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 10000);
}
if (!verified) throw new Error('Post-publish npm verification failed; inspect release metadata');
if (version) console.log('npm version already matches the verified paired tarball');
NODE

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This publish-and-verify retry loop duplicates paired-hotfix-release.yml's publish-api job (lines ~458-500) almost line-for-line, including the Atomics.wait sleep idiom. Given how easy it'd be for these two copies to silently diverge on a retry-count or backoff tweak, this seems worth sharing via a script/composite action rather than copy-pasting.

Comment on lines +186 to +195
- name: Stage flat extension VSIX artifacts
if: ${{ inputs.flatten-vsix-artifacts }}
run: |
mkdir -p vsix-staging
shopt -s nullglob
VSIX_FILES=(packages/apex-lsp-vscode-extension/*.vsix)
[ "${#VSIX_FILES[@]}" -gt 0 ] || { echo 'No extension VSIXs found.'; exit 1; }
for vsix in "${VSIX_FILES[@]}"; do
cp "$vsix" vsix-staging/
done

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things here: (1) this flatten path only copies *.vsix and drops the checksum files (*.vsix.md5, checksums.md5, checksums.json) that the non-flattened upload path includes — if any downstream consumer of the flattened artifact expects checksums, they'll be silently missing. (2) flatten-vsix-artifacts is a boolean added to this shared package.yml purely to serve paired-hotfix-release.yml's one caller; worth confirming this is intended to become general-purpose rather than a special case bolted onto shared infra for a single pipeline.

Comment on lines +447 to +449
if (process.env.SHARED_WORKFLOWS_DIR) {
const shared = readFileSync(join(process.env.SHARED_WORKFLOWS_DIR, '.github/workflows/vscode-manual-publish.yml'), 'utf8');
const action = readFileSync(join(process.env.SHARED_WORKFLOWS_DIR, '.github/actions/publish-vsix/action.yml'), 'utf8');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cross-repo contract test (comparing against salesforcecli/github-workflows's vscode-manual-publish.yml / publish-vsix/action.yml) only runs when SHARED_WORKFLOWS_DIR is set, but no workflow or script in this repo sets that env var — so as far as I can tell this never actually runs in CI and would only catch drift if someone runs it manually with that checkout present locally.

assert.match(workflow, /extension\/package\.json/, 'inspects packaged host identity');
assert.match(workflow, /createHash\('sha256'\)/, 'computes host checksum from VSIX bytes');
assert.match(workflow, /marketplace-guard:[\s\S]*?needs: \[verify-source, verify-pair\]/, 'checks publication safety after recording artifact identity');
assert.doesNotMatch(workflow, /No safe Marketplace identity verification path/, 'removes unconditional publication blocker');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: this assertion checks that the workflow text doesn't contain the literal string "No safe Marketplace identity verification path" — git log -S shows that exact string never existed anywhere in this repo's history before this PR's own commit, so the assertion isn't guarding against a real prior regression. Not a bug, just flagging in case it was meant to reference wording that got renamed/reworded differently than intended.

@peternhale

Copy link
Copy Markdown
Contributor Author

@madhur310 I have addressed the baseline ancestry validation and removed the inactive cross-repository contract-test block. I also corrected the stale header to point to . Are there any additional details or concerns you want addressed beyond the current review threads?

@peternhale

Copy link
Copy Markdown
Contributor Author

Correction to my prior comment: I have addressed the baseline ancestry validation and removed the inactive cross-repository contract-test block. I also corrected the stale .github/workflows/release-npm.yml header to point to .github/workflows/paired-hotfix-release.yml. Are there any additional details or concerns you want addressed beyond the current review threads?

@github-actions

Copy link
Copy Markdown
Contributor

E2E Test Results Summary

Run: 2205

Test Results

  • Passed: 99
  • Failed: 0
  • Errors: 1
  • Total: 100

Passing Rate by File

  • apex-extension-core.spec.ts/junit.xml: 100.0% (8/8 passed)
  • apex-extract-constant.spec.ts/junit.xml: 100.0% (1/1 passed)
  • apex-hover.spec.ts/junit.xml: 100.0% (21/21 passed)
  • apex-extract-variable.spec.ts/junit.xml: 100.0% (1/1 passed)
  • apex-goto-definition.spec.ts/junit.xml: 100.0% (20/20 passed)
  • apex-hover-stdlib.spec.ts/junit.xml: 100.0% (3/3 passed)
  • apex-outline.spec.ts/junit.xml: 100.0% (11/11 passed)
  • apex-goto-definition-advanced.spec.ts/junit.xml: 88.9% (8/9 passed)
  • apex-lsp-integration.spec.ts/junit.xml: 100.0% (16/16 passed)
  • apex-rename-symbol.spec.ts/junit.xml: 100.0% (7/7 passed)
  • apex-capability-gating.spec.ts/junit.xml: 100.0% (3/3 passed)

Artifacts

View detailed test reports in the Artifacts section.

Some tests failed

@github-actions

Copy link
Copy Markdown
Contributor

E2E Test Results Summary

Run: 2205

Test Results

  • Passed: 91
  • Failed: 0
  • Errors: 0
  • Total: 91

Passing Rate by File

  • apex-extension-core.spec.ts/junit.xml: 100.0% (8/8 passed)
  • apex-extract-constant.spec.ts/junit.xml: 100.0% (1/1 passed)
  • apex-hover.spec.ts/junit.xml: 100.0% (21/21 passed)
  • apex-extract-variable.spec.ts/junit.xml: 100.0% (1/1 passed)
  • apex-goto-definition.spec.ts/junit.xml: 100.0% (20/20 passed)
  • apex-hover-stdlib.spec.ts/junit.xml: 100.0% (3/3 passed)
  • apex-outline.spec.ts/junit.xml: 100.0% (11/11 passed)
  • apex-lsp-integration.spec.ts/junit.xml: 100.0% (16/16 passed)
  • apex-rename-symbol.spec.ts/junit.xml: 100.0% (7/7 passed)
  • apex-capability-gating.spec.ts/junit.xml: 100.0% (3/3 passed)

Specs With No Results

The following specs did not produce test results. This usually means the job crashed before tests ran (e.g. build failure, infra error, dependency download timeout).

  • apex-goto-definition-advanced.spec.ts: Did not run — check the job logs

Artifacts

View detailed test reports in the Artifacts section.

Some tests failed or did not run

@peternhale
peternhale merged commit 04f1d09 into main Nov 13, 2026
39 of 41 checks passed
@peternhale
peternhale deleted the ph/W-24872687-api-semver-release branch November 13, 2026 20:44
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.

2 participants