ci(repo): extend snapi coverage to all SDK packages#8691
Conversation
🦋 Changeset detectedLatest commit: 8330b8b The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
@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/upgrade
@clerk/vue
commit: |
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis 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
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
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 winUpdate 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 winAdd 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:declarationsexists 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 valueConsider standardizing compiler options across declaration configs.
This config uses
declarationDirand relies on the base tsconfig.json for options likedeclaration,emitDeclarationOnly, andnoEmit. Other packages in this PR (e.g.,packages/nuxt/tsconfig.declarations.json) explicitly set these options and useoutDirinstead. 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
📒 Files selected for processing (24)
.changeset/snapi-coverage-all-packages.md.github/workflows/api-changes.ymlpackages/astro/package.jsonpackages/astro/tsconfig.declarations.jsonpackages/express/package.jsonpackages/express/tsconfig.declarations.jsonpackages/fastify/package.jsonpackages/fastify/tsconfig.declarations.jsonpackages/hono/package.jsonpackages/hono/tsconfig.declarations.jsonpackages/localizations/package.jsonpackages/localizations/tsconfig.declarations.jsonpackages/nuxt/package.jsonpackages/nuxt/src/runtime/components/uiComponents.tspackages/nuxt/tsconfig.declarations.jsonpackages/react-router/package.jsonpackages/react-router/tsconfig.declarations.jsonpackages/tanstack-react-start/tsconfig.declarations.jsonpackages/testing/package.jsonpackages/testing/tsconfig.declarations.jsonpackages/testing/tsup.config.tspackages/vue/package.jsonpackages/vue/tsconfig.declarations.jsonsnapi.config.json
|
Actionable comments posted: 0 |
There was a problem hiding this comment.
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 winUpdate 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), butSNAPI_FILTERSnow 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
📒 Files selected for processing (1)
.github/workflows/api-changes.yml
…al declaration builds
API Changes Report
Summary
@clerk/sharedCurrent version: 4.14.0 Subpath
|
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.jsonand a"build:declarations": "tsc -p tsconfig.declarations.json"script, mirroring the pattern already inbackend,clerk-js,nextjs,react,shared, andui.@clerk/vueusesvue-tscinstead oftscso SFCs resolve correctly. The choice to standardize on a TypeScript-compiler-emitted per-file.d.tstree (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.tsadds explicittypeof BaseUserProfile/typeof BaseOrganizationProfileannotations. Without them tsc emits TS2742 ("inferred type cannot be named without a reference to '../../../node_modules/@clerk/vue/dist/types'") becauseObject.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.jsonadds anexcludefor__tests__/*.test.{ts,tsx}. The pre-existing config didn't exclude tests, so itsbuild:declarationswas 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.jsonand.github/workflows/api-changes.ymlare then expanded to include the new packages in both the path filter andSNAPI_FILTERS. Verified locally:pnpm turbo build:declarationsacross all 19 packages runs clean (38 tasks, ~57s).