feat(actions): add addedWithVersion to CommonSettings for version-dependent defaults (#315)#317
Conversation
…endent defaults (#315) Add addedWithVersion field to CommonSettings (defaults to "0.0.0" for existing instances). BaseAction.onWillAppear persists the current plugin version on first appearance, enabling version-dependent setting defaults.
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 21 minutes and 40 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe changes add version tracking to actions by introducing an Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
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 `@packages/deck-core/src/base-action.ts`:
- Around line 304-308: The call to ev.action.setSettings(...) inside the
addedWithVersion block can reject and short-circuit onWillAppear; wrap the await
ev.action.setSettings({...}) in a try/catch (around the code in the
addedWithVersion conditional that uses getPluginVersion and this.logger.debug)
and handle failures by logging the error via this.logger.error (include context
like ev.action.id and the version) but do not rethrow so execution continues and
later setup (e.g., flagsOverlay handling) still runs.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0fbf6b16-5662-4eda-b807-661ffb68ae4e
📒 Files selected for processing (3)
packages/deck-core/src/base-action.tspackages/deck-core/src/common-settings.tspackages/stream-deck-plugin/src/shared/base-action.test.ts
Related Issue
Fixes #315
What changed?
addedWithVersionfield toCommonSettings(Zod default"0.0.0"for pre-existing instances)BaseAction.onWillAppear()persists the current plugin version (fromconfig.jsonviagetPluginVersion()) on first appearance when the field is missing"0.0.0", new instances get the current plugin version (e.g.,"1.13.0")semver.lt(settings.addedWithVersion, "1.13.0") ? oldDefault : newDefaultHow to test
pnpm test— all tests pass including 3 new tests for version persistenceaddedWithVersionin settings → persisted on firstonWillAppearaddedWithVersion→ not overwrittenChecklist
Summary by CodeRabbit
New Features
Tests