Skip to content

ci(repo): extend snapi coverage to all SDK packages#8691

Open
jacekradko wants to merge 7 commits into
mainfrom
jacek/snapi-coverage-all-packages
Open

ci(repo): extend snapi coverage to all SDK packages#8691
jacekradko wants to merge 7 commits into
mainfrom
jacek/snapi-coverage-all-packages

Conversation

@jacekradko
Copy link
Copy Markdown
Member

Extends snapi API-change tracking from the original 6 packages to all 19 publishable SDKs (skipping @clerk/upgrade, @clerk/dev-cli, and @clerk/msw, which either have no public JS API or are private).

Most of the work is mechanical: each newly-tracked package gets a 3-line tsconfig.declarations.json and a "build:declarations": "tsc -p tsconfig.declarations.json" script, mirroring the pattern already in backend, clerk-js, nextjs, react, shared, and ui. @clerk/vue uses vue-tsc instead of tsc so SFCs resolve correctly. The choice to standardize on a TypeScript-compiler-emitted per-file .d.ts tree (vs tsup's bundled .d.ts) is deliberate: per-file output is what API Extractor / snapi can analyze without inventing duplicate-index-signature errors.

Two non-mechanical bits worth a look:

  • packages/nuxt/src/runtime/components/uiComponents.ts adds explicit typeof BaseUserProfile / typeof BaseOrganizationProfile annotations. Without them tsc emits TS2742 ("inferred type cannot be named without a reference to '../../../node_modules/@clerk/vue/dist/types'") because Object.assign(component, { Page, Link }) produces a structural type that can only be written by reaching into a transitive dep. Same emitted type, just spelled out.

  • packages/tanstack-react-start/tsconfig.declarations.json adds an exclude for __tests__ / *.test.{ts,tsx}. The pre-existing config didn't exclude tests, so its build:declarations was actually failing on a test file's type assertion. It just hadn't been wired into the snapi workflow yet, so nobody noticed.

snapi.config.json and .github/workflows/api-changes.yml are then expanded to include the new packages in both the path filter and SNAPI_FILTERS. Verified locally: pnpm turbo build:declarations across all 19 packages runs clean (38 tasks, ~57s).

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 28, 2026

🦋 Changeset detected

Latest commit: 8330b8b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment May 29, 2026 5:35pm

Request Review

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 28, 2026

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@8691

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@8691

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@8691

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@8691

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@8691

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@8691

@clerk/express

npm i https://pkg.pr.new/@clerk/express@8691

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@8691

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@8691

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@8691

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@8691

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@8691

@clerk/react

npm i https://pkg.pr.new/@clerk/react@8691

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@8691

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@8691

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@8691

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@8691

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@8691

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@8691

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@8691

commit: 8330b8b

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR expands API-change detection to many more packages by updating snapi.config.json and the api-changes workflow, rewrites the workflow’s report-posting step to use actions/github-script, and changes cache key derivation for snapi baselines. It also adds per-package tsconfig.declarations.json files and build:declarations scripts across multiple packages, updates package build scripts (astro/vue/testing/tsup) to run the declaration flow, and adds explicit typeof annotations to two Nuxt component exports.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • clerk/javascript#8621: Both PRs update the api-changes.yml and snapi.config.json SNAPI package/snapshot filtering and baseline/detection behavior, so the main PR’s SNAPI workflow/config changes are directly related.
  • clerk/javascript#8677: Both PRs modify .github/workflows/api-changes.yml, specifically the SNAPI_PACKAGE version reference used by the snapi CLI.
  • clerk/javascript#8670: Both PRs modify .github/workflows/api-changes.yml by updating the SNAPI_PACKAGE pin and its triggering/coverage behavior.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'ci(repo): extend snapi coverage to all SDK packages' directly and clearly summarizes the main objective: extending snapi API-change tracking to all publishable SDK packages.
Description check ✅ Passed The description provides comprehensive context about extending snapi coverage to 19 packages, explaining the mechanical changes and highlighting two non-mechanical modifications with detailed reasoning.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/api-changes.yml (1)

205-205: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update hardcoded message to reflect expanded package coverage.

The hardcoded message lists only the original 6 packages, but the workflow now monitors 19 packages. This creates confusion about the actual scope of API-change detection.

💬 Proposed fix to list all monitored packages
-              echo '**Snapi**: no API changes detected in `@clerk/backend`, `@clerk/clerk-js`, `@clerk/nextjs`, `@clerk/react`, `@clerk/shared`, `@clerk/ui`.'
+              echo '**Snapi**: no API changes detected in `@clerk/astro`, `@clerk/backend`, `@clerk/chrome-extension`, `@clerk/clerk-js`, `@clerk/expo`, `@clerk/expo-passkeys`, `@clerk/express`, `@clerk/fastify`, `@clerk/hono`, `@clerk/localizations`, `@clerk/nextjs`, `@clerk/nuxt`, `@clerk/react`, `@clerk/react-router`, `@clerk/shared`, `@clerk/tanstack-react-start`, `@clerk/testing`, `@clerk/ui`, `@clerk/vue`.'

Alternatively, consider making this message dynamic based on the snapi.config.json packages list to avoid future mismatches.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/api-changes.yml at line 205, The hardcoded echo message in
the api-changes workflow (the line that runs echo '**Snapi**: no API changes
detected...') lists only six packages but the workflow actually monitors 19;
update that string to enumerate all 19 monitored packages or (better) make the
message dynamic by reading the package list from snapi.config.json so it always
reflects the actual snapi package set; locate the echo command (the exact shell
command containing '**Snapi**: no API changes detected in') and either expand
the list to include every monitored package name or replace it with logic that
builds the package list from snapi.config.json before echoing.
🧹 Nitpick comments (2)
packages/astro/package.json (1)

80-81: ⚡ Quick win

Add a lightweight CI test for declaration build wiring.

Since this PR changes package build/declaration scripts and no tests were added, please add a small CI assertion (or workspace script check) that build:declarations exists and runs for touched packages.

As per coding guidelines: "**/*: If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/astro/package.json` around lines 80 - 81, Add a lightweight CI check
that validates the package script "build:declarations" exists and runs
successfully for packages touched by the PR: implement a new workspace script or
CI job that (1) detects changed packages from the commit/PR, (2) for each
changed package reads its package.json and asserts the "build:declarations"
script key exists (e.g., "build:declarations": "tsc -p
tsconfig.declarations.json"), and (3) runs that script (or runs tsc -p
tsconfig.declarations.json directly) to ensure declaration wiring succeeds;
update CI workflow to call this check for changed packages so future PRs must
include or update declaration scripts when build changes are made.
packages/localizations/tsconfig.declarations.json (1)

1-8: 💤 Low value

Consider standardizing compiler options across declaration configs.

This config uses declarationDir and relies on the base tsconfig.json for options like declaration, emitDeclarationOnly, and noEmit. Other packages in this PR (e.g., packages/nuxt/tsconfig.declarations.json) explicitly set these options and use outDir instead. While both approaches work, explicit configuration improves maintainability and makes the intent clearer.

📋 Suggestion for explicit configuration
 {
   "extends": "./tsconfig.json",
   "compilerOptions": {
-    "declarationDir": "./dist",
-    "skipLibCheck": true
+    "declaration": true,
+    "declarationMap": true,
+    "emitDeclarationOnly": true,
+    "noEmit": false,
+    "outDir": "./dist",
+    "skipLibCheck": true
   },
   "exclude": ["node_modules", "tmp", "dist", "**/__tests__/**/*"]
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/localizations/tsconfig.declarations.json` around lines 1 - 8, This
declaration tsconfig currently only sets "declarationDir" and inherits other
flags from the base, so make the file explicit and consistent with other
packages by adding compilerOptions: set "declaration": true,
"emitDeclarationOnly": true, and explicitly set "outDir": "./dist" (and
adjust/remove "declarationDir" if you prefer outDir semantics), ensure "noEmit"
is not blocking (set to false or omit if base sets true), and keep
"skipLibCheck": true; update the JSON in this tsconfig to explicitly declare
these keys so the intent and behavior match packages/nuxt's
tsconfig.declarations.json.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/api-changes.yml:
- Line 205: The hardcoded echo message in the api-changes workflow (the line
that runs echo '**Snapi**: no API changes detected...') lists only six packages
but the workflow actually monitors 19; update that string to enumerate all 19
monitored packages or (better) make the message dynamic by reading the package
list from snapi.config.json so it always reflects the actual snapi package set;
locate the echo command (the exact shell command containing '**Snapi**: no API
changes detected in') and either expand the list to include every monitored
package name or replace it with logic that builds the package list from
snapi.config.json before echoing.

---

Nitpick comments:
In `@packages/astro/package.json`:
- Around line 80-81: Add a lightweight CI check that validates the package
script "build:declarations" exists and runs successfully for packages touched by
the PR: implement a new workspace script or CI job that (1) detects changed
packages from the commit/PR, (2) for each changed package reads its package.json
and asserts the "build:declarations" script key exists (e.g.,
"build:declarations": "tsc -p tsconfig.declarations.json"), and (3) runs that
script (or runs tsc -p tsconfig.declarations.json directly) to ensure
declaration wiring succeeds; update CI workflow to call this check for changed
packages so future PRs must include or update declaration scripts when build
changes are made.

In `@packages/localizations/tsconfig.declarations.json`:
- Around line 1-8: This declaration tsconfig currently only sets
"declarationDir" and inherits other flags from the base, so make the file
explicit and consistent with other packages by adding compilerOptions: set
"declaration": true, "emitDeclarationOnly": true, and explicitly set "outDir":
"./dist" (and adjust/remove "declarationDir" if you prefer outDir semantics),
ensure "noEmit" is not blocking (set to false or omit if base sets true), and
keep "skipLibCheck": true; update the JSON in this tsconfig to explicitly
declare these keys so the intent and behavior match packages/nuxt's
tsconfig.declarations.json.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: baf3d4f9-d55d-4bce-92e9-55c2225d2019

📥 Commits

Reviewing files that changed from the base of the PR and between c24a965 and be63baa.

📒 Files selected for processing (24)
  • .changeset/snapi-coverage-all-packages.md
  • .github/workflows/api-changes.yml
  • packages/astro/package.json
  • packages/astro/tsconfig.declarations.json
  • packages/express/package.json
  • packages/express/tsconfig.declarations.json
  • packages/fastify/package.json
  • packages/fastify/tsconfig.declarations.json
  • packages/hono/package.json
  • packages/hono/tsconfig.declarations.json
  • packages/localizations/package.json
  • packages/localizations/tsconfig.declarations.json
  • packages/nuxt/package.json
  • packages/nuxt/src/runtime/components/uiComponents.ts
  • packages/nuxt/tsconfig.declarations.json
  • packages/react-router/package.json
  • packages/react-router/tsconfig.declarations.json
  • packages/tanstack-react-start/tsconfig.declarations.json
  • packages/testing/package.json
  • packages/testing/tsconfig.declarations.json
  • packages/testing/tsup.config.ts
  • packages/vue/package.json
  • packages/vue/tsconfig.declarations.json
  • snapi.config.json

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/api-changes.yml (1)

204-205: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update the "no changes" message to reflect all tracked packages.

The message lists only 6 packages (@clerk/backend, @clerk/clerk-js, @clerk/nextjs, @clerk/react, @clerk/shared, @clerk/ui), but SNAPI_FILTERS now includes 19 packages. This inconsistency could mislead PR authors about the scope of API-change detection.

📝 Proposed fix to include all tracked packages
-              echo '**Snapi**: no API changes detected in `@clerk/backend`, `@clerk/clerk-js`, `@clerk/nextjs`, `@clerk/react`, `@clerk/shared`, `@clerk/ui`.'
+              echo '**Snapi**: no API changes detected in `@clerk/astro`, `@clerk/backend`, `@clerk/chrome-extension`, `@clerk/clerk-js`, `@clerk/expo`, `@clerk/expo-passkeys`, `@clerk/express`, `@clerk/fastify`, `@clerk/hono`, `@clerk/localizations`, `@clerk/nextjs`, `@clerk/nuxt`, `@clerk/react`, `@clerk/react-router`, `@clerk/shared`, `@clerk/tanstack-react-start`, `@clerk/testing`, `@clerk/ui`, `@clerk/vue`.'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/api-changes.yml around lines 204 - 205, The "no API
changes" echo is out-of-date: replace the hardcoded six-package list with the
full set of tracked packages (or reference the SNAPI_FILTERS variable) so the
message matches SNAPI_FILTERS; locate the check that greps api-changes-report.md
and update the echoed string to enumerate all 19 package names (or dynamically
expand SNAPI_FILTERS) so PR authors see an accurate list of packages covered by
API-change detection.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/api-changes.yml:
- Around line 204-205: The "no API changes" echo is out-of-date: replace the
hardcoded six-package list with the full set of tracked packages (or reference
the SNAPI_FILTERS variable) so the message matches SNAPI_FILTERS; locate the
check that greps api-changes-report.md and update the echoed string to enumerate
all 19 package names (or dynamically expand SNAPI_FILTERS) so PR authors see an
accurate list of packages covered by API-change detection.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 42d0ad54-4bb5-4675-883c-9f32d2168f9d

📥 Commits

Reviewing files that changed from the base of the PR and between 7cdc34d and 599e224.

📒 Files selected for processing (1)
  • .github/workflows/api-changes.yml

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

API Changes Report

Generated by snapi on 2026-05-29T17:43:20.692Z

Summary

Metric Count
Packages analyzed 19
Packages with changes 1
🔴 Breaking changes 0
🟡 Non-breaking changes 1
🟢 Additions 0

🤖 This report was reviewed by claude-sonnet-4-6.

Note
snapi could not snapshot 3 subpaths; the diff below excludes them.

  • @clerk/astro ./env: Internal Error: Unable to determine module for: /home/runner/_work/javascript/javascript/packages/astro/env.d.ts You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
  • @clerk/shared ./cookie: Internal Error: Unable to follow symbol for "Cookies" You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
  • @clerk/testing ./cypress: Symbol not found for identifier: Cypress

@clerk/shared

Current version: 4.14.0
Recommended bump: MINOR → 4.15.0

Subpath ./apiUrlFromPublishableKey

🟡 Non-breaking Changes (1)

Modified: apiUrlFromPublishableKey
- apiUrlFromPublishableKey: (publishableKey: string) => "https://api.clerk.com" | "https://api.lclclerk.com" | "https://api.clerkstage.dev"
+ apiUrlFromPublishableKey: (publishableKey: string) => "https://api.lclclerk.com" | "https://api.clerkstage.dev" | "https://api.clerk.com"

Static analyzer: Breaking change in function apiUrlFromPublishableKey: Return type changed: "https://api.clerk.com"|"https://api.lclclerk.com"|"https://api.clerkstage.dev""https://api.lclclerk.com"|"https://api.clerkstage.dev"|"https://api.clerk.com"

🤖 AI review (reclassified as non-breaking) (99%): The return type is a union of the exact same three string literal types — only their order has changed. TypeScript union types are order-independent structurally, so any well-typed consumer code that was valid before remains valid after this change.


Report generated by snapi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant