Repository navigation
fix(store): scope the offboarding sweep and settings read to the active provider - #848
Open
rahul05ranjan wants to merge 1 commit into
Open
rahul05ranjan wants to merge 1 commit into
rahul05ranjan wants to merge 1 commit into
Conversation
…ve provider retireConnectionsFor and brokeredConnectionsFor read brokered connections keyed (holder, userId) only, so a row filed under another provider would be revoked through the wrong broker while the audit row claimed the vendor was asked, or dropped silently from the settings page. Both reads now filter on the active brokerProvider, the predicate the other eleven selects in the file already carry. Unreachable while assertActivatable refuses mixed deployments; this keeps the two reads correct the moment the provider sunset flow relaxes that refusal. Fixes CopilotKit#783 Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com>
rahul05ranjan
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso,
mxmzb and
tylerslaton
as code owners
October 27, 2026 12:07
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #783.
What this changes
The two
brokered_connectionsreads that carried no provider predicate now filter on the activebrokerProvider, like the other eleven selects inconnections.ts:retireConnectionsFor— the offboarding sweep. Before: on a deployment holding both providers' rows, the sweep would have called the active broker'srevoke()for a connection filed under the other provider — a vendor that would not recognise it — while the audit row recordedvendorRevocationRequestedabout access that was never removed.brokeredConnectionsFor— the settings-page read. Before: a foreign-provider row would be silently dropped from the page when its app failed to resolve at the active provider's canonical scheme.Both sites' comments said a future flow must add this predicate; this adds it, together with the regression test the issue's acceptance asks for. No behavior changes today:
assertActivatablestill refuses to boot a deployment whose rows disagree with the configured provider, so neither read can meet a foreign row — the predicate is free now and already right when the provider sunset flow relaxes that refusal.Where it runs
SELECTs gain a predicate; nothing is written, held, or memoised.inArray(brokeredConnections.app, withdrawn...)list derived from this read, so a foreign row is never deleted either — that needed no change.Boundary and audit
Changelog
CHANGELOG.mdunderUnreleased, or a sentence on why a deployment behaves no differently afterwards: no deployment behaves differently — a mixed-provider deployment cannot boot today (assertActivatable), and on a single-provider deployment the predicate matches every row.Proof
What I ran and read (no Postgres on this arm64 CI box, so the test itself runs in CI, not here):
mainat their exact locations (brokeredConnectionsFor's select,retireConnectionsFor'sbrokeredselect), each carrying the comment naming this as the sunset-flow work item.brokeredConnectiondeployment-row select:eq(brokeredConnections.provider, brokerProvider).inArray(..., withdrawn.map(...))):withdrawnis built from this read, so a filtered read means a foreign row is neither revoked, nor deleted, nor audited — nothing else in the method needs the predicate.offboarding does not revoke or audit another provider's rowsbeside the two neighboring offboarding tests: it seeds onecomposiorow and onearcaderow for the same user, runs the sweep through the samebrokerSpy/freshStoreharness as its neighbors, and assertsretired: 1, exactly onerevoke:call, the arcade row still standing, and exactly onemcp.account_disconnectedaudit row (gmail,vendorRevocationRequested: true). Onmainthe sweep reads the arcade row too, so the spy revokes it,retiredis 2, the row is deleted, and two audit rows exist — every assertion in the test fails there.bun testlocally: the suite needs a live Postgres, which this host does not have. The test follows the file's existing harness line for line; CI is the authoritative run.