Repository navigation
Keep provider pages running across provider deploys - #1193
Conversation
A catalog version change no longer tears down a mounted provider page. The element keeps running the bundle this document loaded, and its context transport stays current. The new version is picked up the next time the provider is opened: a direct-registration provider that cannot be replaced in place finishes the navigation as an ordinary page load, guarded per provider in sessionStorage so a flapping catalog cannot loop. Dashboard tiles and the agent overlay opt into acceptLoadedVersion and keep the loaded bundle for the same provider copy; a different copy still rejects. The overlay remounts for a new bundle only when no assistant is running. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The mount watch's source was a getter returning a new array, which Vue compares by identity. Any replacement of the catalog entry or the binding projection therefore re-ran it, so a provider deploy still remounted the open page (and, for a direct-registration provider, immediately triggered the guarded reload) even with the version out of the key. Use per-key watch sources so only a real identity change remounts. Found by a live smoke test against a Tilt stack: after a simulated deploy the mounted Code and Kuery pages now keep their element and document, and reopening the provider performs one guarded page load. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A catalog or bindings re-read briefly made provider access non-authoritative, which tore the mounted element down and remounted it. After a deploy that remount then hit the guarded page reload, so the page reloaded itself while the user worked in it. While a re-read is in flight for exactly the mounted identity (provider copy, org, workspace, cluster), keep the element, its outlet and its transport, and suppress the refresh banners. A re-read that settles to denied or fails still tears it down; any identity change never holds. Opening a stale provider no longer reloads automatically while the agent overlay reports an open conversation; the reload error offers it instead. A successful mount clears the reload guard, so a second deploy inside the window still gets its page load. Smoke-tested against a live Tilt stack (Code provider): bindings and catalog re-reads keep the element; reopening after a deploy reloads once and clears the guard; with a conversation open it shows the reload error instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@mjudeikis-bot review |
mjudeikis
left a comment
There was a problem hiding this comment.
No Critical findings. Two Notes below, one anchored and one in the test file; neither blocks the merge.
Not anchored
- Note:
retryProviderBundle(ProviderFrame.vue:632) andonProviderBootstrapRetry(:645) still gate onaccessAllowed, while the rest of the file now usesaccessActive. While a catalog or bindings re-read holds a mounted element, a bootstrap-retry event from the provider is ignored, because thepreventDefaultacknowledgement is skipped. The window is only the length of the re-read. Switching both toaccessActivewould make them consistent.
Checked
- Read beyond the diff:
loadProviderScript,invalidateProviderScriptand the failure-cleanup block inproviderScriptLoader.ts; all ofProviderFrame.vue(catalogSettled,catalogRefreshing,bindingProjectionCurrent,accessAllowed,clearMountedElement,mountElement,loadAndMount,pushContext,retryProviderBundle,onProviderBootstrapRetry);AgentOverlay.vue(clear,mountAgent,authorityKeyand its watches);stores/agentOverlay.ts; thebindingsStaleandbindingsLoadStatetransitions instores/providers.ts. - Correctness: the per-key watch sources fix the identity-compare problem.
catalogSettledis dropped from the watch but still part ofaccessAllowed, soaccessActivestill requires it.mountedIdentityis only set aftermountElementand cleared inclearMountedElement, so a hold never applies to a mount that has not happened. The reload guard fails closed: no storage, unreadable marker or a hit inside 60s results in the error UI. One gap is the first Note. - Concurrency: JS single-threaded. Generation checks (
isCurrentMount,current()) still cover the new async paths. ThebundleRevisionwatch only remounts when!element && !loading, so it cannot race a live conversation. Not applicable: the Go and hub side. - Tenancy:
mountIdentityincludes provider name, export path, scope, org, workspace and cluster. A hold is bounded by a re-read in flight, and kcp still authorizes each request.acceptLoadedVersionrequires an identical provider identity. No findings. - Provider contract, API/codegen, hub and provider Go modules: not applicable. The diff is
portal/only, with no manifest, CRD, chart or verb change. - Security: no new fetch, header or token handling. The reload guard stores only a provider name and a timestamp in sessionStorage. No findings.
- Portal: no vendored portalkit or agentkit file is touched. No visible markup is added beyond the
!accessHeldguards on two existing banners. The PR body describes headless-Chromium evidence for the behaviour, but no screenshots in dark and light were attached. I did not render the UI. - Tests: the new ProviderFrame tests assert on source text with regexes and a re-evaluated
accessHeldexpression. They would catch someone editing the watch source list, but they do not drive the hold, remount or reload paths through Vue (see the Note on the tests).providerUpdateReloadandproviderScriptLoaderhave behavioural tests. - Ran in
portal/:node --teston the 9 changed*.test.mjsfiles passed (143 pass, 0 fail).npx vue-tsc -bexited 0. - Not run:
make verify-ui-conformance,make verify-portalkit,make verify-design-docs, and the Go build, vet, lint and e2e targets. The PR touches no Go,apis/, provider or portalkit-source files, and no e2e suite covers this portal-only change.
| if (!name || !ready || !settled || !allowed || !mount) return | ||
| await loadAndMount(name, version, mount) | ||
| if (!name || !ready || !allowed || !mount) return | ||
| await loadAndMount(name, entry.value?.version, mount) |
There was a problem hiding this comment.
Note: a failed load is no longer retried when the catalog moves to a new version
The watch no longer lists entry.version. If the first load of v1 fails (bundle 5xx, SRI mismatch, 5s whenDefined timeout), loadState stays 'error'. A deploy of v2 that fixes the bundle no longer re-runs loadAndMount, so the user sees the error until they press Retry or navigate away and back. Before this PR the version change re-ran the loader. AgentOverlay.vue handles the same case with its bundleRevision watch, which remounts when !element, and this frame has no equivalent. A small fix is to re-run when there is nothing mounted:
watch(() => entry.value?.version, () => {
const mount = mountRef.value
const name = entry.value?.name
if (loadState.value === 'error' && accessActive.value && entry.value?.ready && name && mount) {
void loadAndMount(name, entry.value.version, mount)
}
})| assert.match(functionBody('loadAndMount'), /loadState\.value = 'ready'\s*clearProviderUpdateReload\(name\)/) | ||
| }) | ||
|
|
||
| test('a catalog or bindings re-read holds the mounted element for the same identity only', () => { |
There was a problem hiding this comment.
Note: the hold and reload tests check source text, not behaviour
The accessHeld truth table is real, because it re-evaluates the expression. But the wiring that matters is only matched by regexes: that bindingsRefreshing has a given shape, that the mount <div> uses v-if="accessActive", and that loadAndMount has the instanceof ProviderPageReloadRequiredError branch. A change that kept the text but broke the behaviour would still pass. Examples are mountedIdentity not being set in mountElement, or the guard return skipping state cleanup. A mounted-component test would cover it: mount ProviderFrame with a stub provider, flip providers.loading or bindingsLoadState, and assert the element node is the same. A second case would assert that a stale direct-registration provider calls the injected reload once.
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cwilhit The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Summary
ProviderFrame.vue. Its source was a getter that returned a new array on every evaluation, which Vue compares by identity, so any replacement of the catalog entry or binding projection remounted the element even when no key changed. The watch now uses one source per key.maintoo. A re-read that settles to denied or fails still tears the element down, and any identity change never holds. kcp still authorizes every request.acceptLoadedVersionand keep the loaded bundle of the same provider copy. A different copy still rejects.Validation
vue-tsc -b,make verify-ui-conformance,make verify-portalkitandmake verify-design-docspassed after rebasing onmain.main's portal as the baseline. The deploy was simulated in-page by changing the provider's catalog and binding version in the providers store, which is all the portal sees of a deploy. Changing the CatalogEntry itself was not exercised.mainKuery gave the same results for the deploy and reopen steps.
Known limits
DashboardTilestill uses a getter-array watch and remounts on any entry change. A tile remount is cheap, so it is unchanged here.🤖 Generated with Claude Code