fix(core/webview): merge view-local state into getState for per-view overrides - #1550
fix(core/webview): merge view-local state into getState for per-view overrides#1550easonLiangWorldedtech wants to merge 10 commits into
Conversation
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
Review statusThanks for contributing. This comment tracks the review sequence and the next action. Current step: Fix the failing required CI checks; awaiting-maintainer requires CI and automated review completion. Review-state labels are managed by this workflow; do not edit them manually. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…States Each ClineProvider instance now owns a unique viewId (renderContext plus a monotonic counter) and registers a stable viewStateId for durable persistence. - Per-view state buffer (viewLocalState) holds mode / currentApiConfigName / apiConfiguration overrides in memory; saveViewState persists the non-secret subset durably under the active view id, rekeyed to the stable id on registration. - viewStates is stored as a map pruned to the newest 50 entries; writes go through a serialized queue so concurrent provider instances merge without lost updates. - setViewStateId sanitizes ids and rejects "__proto__" so a per-view entry can never be keyed through the Object.prototype setter. - postMessageToWebview no longer awaits the webview ack: a remounted or disposed page never acknowledges, and awaiting would wedge task-critical callers. - History restore falls back to the default mode view-locally instead of writing the shared global mode. - GlobalState gains the "viewStates" key and GLOBAL_STATE_KEYS tracks it. Adds F1a coverage in ClineProvider.spec.ts (viewId uniqueness, saveViewState persistence semantics, loadViewState fallback and failure, pruning, the __proto__ guard) and adapts the two history-restore tests in ClineProvider.sticky-mode.spec.ts to the view-local restore. getState() merging of hydrated per-view values and the remaining view-state suites land in the follow-up (F1b).
…overrides Fold ClineProvider viewLocalState on top of ContextProxy values in getState() (mode, apiConfiguration, and all per-view fields) so each webview reports its own selections while falling back to shared global state for everything else. Ports the getState-merging and local-state-isolation spec coverage from the superseded vps2 source. Also pins the full default surface of the merged read path, including the apiConfiguration provider fill-in when provider settings sanitize the raw value away (mutation-diff gate).
43b52aa to
a37d085
Compare
…el CI load (no code change)
…elated search_files/terminal tests)
…ass timeouts on unrelated search_files/terminal tests)
…ad-flake, run 34097300971)
…ures, 0-line diff)
…ures, 0-line diff)
Part of the vps2 durable per-view state series — tracked in easonLiangWorldedtech#41 (cross-repo: standalone a+d measured against the stack base; the displayed vs-main diff includes F1a #1546 until it merges).
Issue (created at PR-open time): #1549
What
Fix unit F1b (2/3 of the F1 split). F1a landed the per-view identity, the durable viewStates pipeline, and the in-memory viewLocalState buffer, but getState() still read every field straight from the shared ContextProxy — so a webview reporting state ignored its own hydrated per-view selections. This PR merges viewLocalState on top of the context values in getState() and ports the getState merging + local state isolation spec coverage from the superseded vps2 source. It also pins the full default surface of the merged read path (mutation-diff gate). The webview-side identity / launch wiring (F1c) lands in the follow-up.
Design decisions
Measurements
0a8ffc9e1: 717 (622+/95−) — over the 400 soft budget (spec-heavy unit: 518 of the added lines are the new spec describes); under the 1000 hard cap. Measuredgit diff --numstat 0a8ffc9e1..HEAD.Gates
Parked / documented
From the gap-review parked-items register (F1b scope, all bounded):
Porting notes