You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow conflict-safe private storage from plugin panels - #36273
Sidebar plugins currently cannot persist notes through the supported host API. Allow private storage reads from frames and add storage.compareAndSet (host API 1.1) on all surfaces so panels can save without silently overwriting concurrent edits.
The compare and write run synchronously together after capability checks and mutation audit admission. Storage remains scoped to the authenticated plugin and uses the existing quotas and durable store. No filesystem or worker access is exposed.
Validation: 34 targeted tests pass across panel storage, worker API, frame facade, and renderer handshake. A separate integration check uses the actual host handler and disk store to verify saving, reopening a new store instance, and rejecting a stale write. Generated the API reference and formatted changed TypeScript. Full CI is running; the previous production commit passed lint and typecheck, and the follow-up updates the renderer handshake test for API 1.1 and the newly available methods.
Files skipped from review as they are similar to previous changes: 1
src/shared/plugins/workers/plugin-host-api.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
Walkthrough
The plugin Host API is now version 1.1. The storage.get method is available to workers, panels, and editors. The new storage.compareAndSet method conditionally writes a private JSON value and returns whether the value was swapped. The handler includes the key in audit summaries. Tests cover capability denial, concurrent compare-and-set calls, retrieval of the stored value, and the updated API version. Plugin storage reads now ignore inherited properties.
Priority: Normal
Severity of issue fixed: Low
Merge Risk: Minimal · up to 94de3
No actionable merge-blocking risk remains; the null comparison behavior matches the intended Host API 1.1 contract.
Pre-merge checks: 3 · 2
Failed checks: 2 warnings
Check name
Status
Explanation
Resolution
Description check
The description explains the main change, rationale, implementation, and testing, but it omits most required template sections, including ELI5, Linked Issue, Visual Proof, structured Testing, Review, …
Rewrite the description using the repository template. Add an actual linked issue under “Linked Issue,” provide visual proof or state N/A with a reason, complete the Testing section with platforms and test status, and complete the Review,…
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title clearly summarizes the main change: conflict-safe private storage for plugin panels.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description explains the main change, rationale, implementation, and testing, but it omits most required template sections, including ELI5, Linked Issue, Visual Proof, structured Testing, Review, Notes, and Checklist.
Resolution
Rewrite the description using the repository template. Add an actual linked issue under “Linked Issue,” provide visual proof or state N/A with a reason, complete the Testing section with platforms and test status, and complete the Review, Notes, Agent skill upstream boundary, AI Disclosure when applicable, and Checklist sections.
Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 9 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches: 💡 1
📝 Generate docstrings: 💡
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Major · Data Integrity & Integration · Heavy lift
Supported by static analysis
Script executed:
sed -n '1,200p' src/main/plugins/plugin-storage-store.ts
sed -n '140,160p' src/main/plugins/workers/plugin-host-method-bindings.ts
sed -n '55,70p' docs/reference/plugin-host-api.md
Repository: stablyai/orca
Length of output: 5236
Script executed:
rg -n -F -A 12 -e 'new PluginKvStore(' -- src/main ||test"$?" -eq 1
rg -n -F -A 3 -e 'export type PluginJsonValue' -- src/shared ||test"$?" -eq 1
Repository: stablyai/orca
Length of output: 4983
Stored null matches an absent key in storage.compareAndSet.
PluginKvStore.set keeps a JSON null as a present key. The services.storage wrapper passes get straight through, and get returns null for both a stored null and an absent key. The binding's ?? null therefore makes the two compare equal. The documented contract says null expects an absent key, so a caller that expects absence can overwrite a value that another caller stored as null.
For example, caller A runs compareAndSet(key, expected: null, value: null) on an absent key and gets swapped: true. Caller B then runs compareAndSet(key, expected: null, value: "b"). The stored null matches expected: null, so B also gets swapped: true, and A's write is lost.
Fixing this requires a contract decision, so no patch is proposed. Either:
expected: null must mean the key is absent. The binding would then check services.storage.get(...) === undefined. A plugin could no longer compare-and-swap a stored null, so the API needs a way to express a present null expectation, or the limitation must be documented.
set with null must remove the key, as delete does. Then null is never stored as present. This changes keys() and getAll() output, so the storage tests and the API reference need updates.
Choose one direction and update the API reference to match.
Minor · Functional Correctness · Quick win
Supported by static analysis
Script executed:
sed -n '1,200p' src/main/plugins/plugin-storage-store.ts
rg -n 'storageKeySchema' src/shared/plugins/workers/plugin-host-api.ts
Keys such as toString pass storageKeySchema, but an absent toString reads the inherited Object.prototype.toString function. storage.compareAndSet then compares that function with expected: null, returns { swapped: false }, and the panel cannot create the key. storage.get returns the same non-JSON function value for that key.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sidebar plugins currently cannot persist notes through the supported host API. Allow private storage reads from frames and add
storage.compareAndSet(host API 1.1) on all surfaces so panels can save without silently overwriting concurrent edits.The compare and write run synchronously together after capability checks and mutation audit admission. Storage remains scoped to the authenticated plugin and uses the existing quotas and durable store. No filesystem or worker access is exposed.
Validation: 34 targeted tests pass across panel storage, worker API, frame facade, and renderer handshake. A separate integration check uses the actual host handler and disk store to verify saving, reopening a new store instance, and rejecting a stale write. Generated the API reference and formatted changed TypeScript. Full CI is running; the previous production commit passed lint and typecheck, and the follow-up updates the renderer handshake test for API 1.1 and the newly available methods.