Skip to content

feat: add config-sdk-version.json and SDK version guard [LIN-2149] - #3

Closed
ChetanBhosale wants to merge 4 commits into
mainfrom
chetan/lin-2149-sdk-version-guard
Closed

feat: add config-sdk-version.json and SDK version guard [LIN-2149]#3
ChetanBhosale wants to merge 4 commits into
mainfrom
chetan/lin-2149-sdk-version-guard

Conversation

@ChetanBhosale

Copy link
Copy Markdown
Contributor

What

Adds config-sdk-version.json at the repo root — the full published version history as {version, pushed_date, description}, newest first — and a check that stops the SDK version being bumped without a matching entry.

The rule

The version in package.json must equal sdk_versions[0].version.

  • A PR that does not touch the SDK version passes untouched. Ordinary fixes, docs and refactors are unaffected.
  • A PR that bumps the version fails until an entry is added at the top of config-sdk-version.json.

How

  • scripts/check-sdk-version.py — stdlib-only, no dependencies. Also rejects duplicate versions, out-of-order arrays and malformed JSON.
  • .github/workflows/sdk-version-check.yml — runs it on every PR.

The checker is driven by the version_source block inside config-sdk-version.json, so the same script is used across all nine SDK repos.

Data provenance

version and description come from Postgres public."SDKVersion". pushed_date does not — all 206 rows there were bulk-inserted on 2026-07-24 11:47:43, so created_at carries no release-date signal. Dates come from the package registry publish date instead, falling back to CHANGELOG, git tag, then the commit that bumped the manifest. All entries are dated and verified monotonic against version order.

WEB has no rows in `SDKVersion`, so versions and dates come from npm and every `description` is `null` rather than invented. The check warns about this but does not fail. Backfill tracked in LIN-2150.

Note

Adding "SDK version check" as a required status check in branch protection is what actually blocks a merge — CI alone only reports.

Linear: LIN-2149

🤖 Generated with Claude Code

https://claude.ai/code/session_011RipJmrW6btPTyoXRXhfLU

Record the full published version history (version, pushed_date,
description) in config-sdk-version.json at the repo root, newest first,
and enforce that the version declared in the package manifest is always
its top entry.

A PR that does not touch the SDK version is unaffected; one that bumps
the version fails until a matching entry is added.

Enforced by scripts/check-sdk-version.py, run in CI via the SDK version
check workflow and locally via a pre-commit hook.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011RipJmrW6btPTyoXRXhfLU
Comment thread .github/workflows/sdk-version-check.yml Fixed
ChetanBhosale and others added 2 commits July 28, 2026 20:57
…IN-2149]

Replaces the shared Python checker with a Node implementation and exposes
it as an npm script, so the check runs on the toolchain the package
already requires to build and publish.

  npm run check:version

Also wired into prepublishOnly, so an unrecorded version cannot be
published even if CI is bypassed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011RipJmrW6btPTyoXRXhfLU
Two stray NUL bytes inside a string literal made git treat
scripts/check-sdk-version.js as a binary blob, so diffs and review
comments did not work on it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011RipJmrW6btPTyoXRXhfLU
Comment on lines +19 to +31
name: SDK version check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20

# No `npm ci`: the checker uses Node built-ins only, so `npm run` can
# invoke it without installing dependencies.
- name: Verify the SDK version is recorded in config-sdk-version.json
run: npm run check:version
Adds a Build workflow that compiles the SDK with its own toolchain, kept
separate from the SDK version check so a version mistake and a build
break are reported independently.

Every command was run locally before being wired up.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011RipJmrW6btPTyoXRXhfLU
Comment on lines +15 to +28
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build
@ChetanBhosale

Copy link
Copy Markdown
Contributor Author

Closing for now — parking this work. The branch chetan/lin-2149-sdk-version-guard is preserved and both checks were passing, so this can be reopened as-is if we pick it up again. Tracked in LIN-2149.

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