fix: detect all changed packages for changeset in model sync pipeline#445
fix: detect all changed packages for changeset in model sync pipeline#445AlemTuzlak wants to merge 2 commits intomainfrom
Conversation
The `pnpm generate:models` pipeline runs three scripts sequentially: fetch, convert (regenerates @tanstack/ai-openrouter), and sync (adds new models to provider-specific packages). The changeset was only created when sync found new provider-specific models (totalAdded > 0), missing changes from the convert step entirely. Replace the totalAdded guard with git-based detection that finds all packages with uncommitted changes across the entire pipeline, ensuring changesets are created whenever any package is modified.
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 Changeset Version PreviewNo changeset entries found. Merging this PR will not cause a version bump for any packages. |
|
View your CI Pipeline Execution ↗ for commit c6bc732
☁️ Nx Cloud last updated this comment at |
@tanstack/ai
@tanstack/ai-anthropic
@tanstack/ai-client
@tanstack/ai-code-mode
@tanstack/ai-code-mode-skills
@tanstack/ai-devtools-core
@tanstack/ai-elevenlabs
@tanstack/ai-event-client
@tanstack/ai-fal
@tanstack/ai-gemini
@tanstack/ai-grok
@tanstack/ai-groq
@tanstack/ai-isolate-cloudflare
@tanstack/ai-isolate-node
@tanstack/ai-isolate-quickjs
@tanstack/ai-ollama
@tanstack/ai-openai
@tanstack/ai-openrouter
@tanstack/ai-preact
@tanstack/ai-react
@tanstack/ai-react-ui
@tanstack/ai-solid
@tanstack/ai-solid-ui
@tanstack/ai-svelte
@tanstack/ai-vue
@tanstack/ai-vue-ui
@tanstack/preact-ai-devtools
@tanstack/react-ai-devtools
@tanstack/solid-ai-devtools
commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/sync-provider-models.ts`:
- Around line 526-528: The catch block that swallows all execFileSync errors in
scripts/sync-provider-models.ts should distinguish expected "not a repo" cases
from real failures: inside the catch after the execFileSync(...) call, log the
caught error (e.g., console.warn or processLogger.warn) and only return the
empty set when the error message indicates a non-repo (match on "not a git
repository" / exit code), otherwise rethrow or exit non‑zero so CI fails; update
the handler around the execFileSync invocation (the try/catch that currently
returns an empty set) to implement this conditional logging-and-fail behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f871ac4f-879e-4253-898c-5b7162e53efd
📒 Files selected for processing (1)
scripts/sync-provider-models.ts
| } catch { | ||
| // git not available (e.g. running outside a repo) — fall back to empty set | ||
| } |
There was a problem hiding this comment.
Surface unexpected git diff failures here.
Returning an empty set for every execFileSync error makes the workflow quietly skip the changeset again when Git detection breaks for any reason other than an intentional local “not a repo” run. I’d at least warn on the fallback and fail loudly in CI.
🔧 Suggested tightening
- } catch {
- // git not available (e.g. running outside a repo) — fall back to empty set
+ } catch (error) {
+ if (process.env.GITHUB_ACTIONS === 'true') {
+ throw error
+ }
+ console.warn('Failed to detect changed packages via git diff:', error)
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@scripts/sync-provider-models.ts` around lines 526 - 528, The catch block that
swallows all execFileSync errors in scripts/sync-provider-models.ts should
distinguish expected "not a repo" cases from real failures: inside the catch
after the execFileSync(...) call, log the caught error (e.g., console.warn or
processLogger.warn) and only return the empty set when the error message
indicates a non-repo (match on "not a git repository" / exit code), otherwise
rethrow or exit non‑zero so CI fails; update the handler around the execFileSync
invocation (the try/catch that currently returns an empty set) to implement this
conditional logging-and-fail behavior.
Summary
pnpm generate:modelspipeline runs 3 scripts: fetch, convert (@tanstack/ai-openrouterregeneration), and sync (provider-specific model additions). The changeset was only created when the sync step found new provider-specific models (totalAdded > 0), silently skipping changesets when only the convert step modified packages (e.g. PR chore: sync model metadata from OpenRouter #441).totalAdded > 0guard withdetectChangedPackages()which usesgit diff HEAD --name-only -- packages/to find all packages with uncommitted changes from any pipeline step, then creates a changeset covering all of them.changedPackages.add('@tanstack/ai-openrouter')fromcreateChangeset()since git diff detection handles it generically.Fixes the missing changeset in #441.
Test plan
Sync Model Metadataworkflow and verify a.changeset/sync-models.mdfile is created when@tanstack/ai-openrouterchangesSummary by CodeRabbit