Repository navigation
fix(scim): push Stop for runs a directory sync ends, after its transaction commits - #9104
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
There was a problem hiding this comment.
3 issues found across 17 files
Confidence score: 3/5
reconcile-user.tscan stop runs for a workspace that receives a new grant in the same reconciliation: the stop is collected beforeplan.applyand canceled only after access is restored. Make the stop decision account for grants applied in that reconciliation.removal-stops-runs.integration.tsonly seeds two users, so it misses whether Stops from a committed batch survive a later batch rollback. Seed more than 25 users and fail a grant in the second batch.removal-stops-runs.integration.tsuses a fixed 200 ms delay to check rollback behavior, so a late asynchronous Stop can arrive after the assertion. Use a deterministic delivery barrier or await delivery.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/sim/lib/mothership/request/application/removal-stops-runs.integration.ts">
<violation number="1" location="apps/sim/lib/mothership/request/application/removal-stops-runs.integration.ts:713">
P3: The rollback checks use a fixed 200 ms delay, so a delayed asynchronous Stop can arrive after the assertion and make the regression test pass. Replace the wall-clock sleep with a deterministic delivery barrier or awaitable worker observation.</violation>
<violation number="2" location="apps/sim/lib/mothership/request/application/removal-stops-runs.integration.ts:738">
P2: This supplies only two users, so reconciliation uses one batch and never tests whether Stops from an earlier committed batch survive a later batch rollback. Seed more than 25 users and fail a grant in the second batch to cover that guarantee.</violation>
</file>
<file name="apps/sim/ee/scim/lib/projection/reconcile-user.ts">
<violation number="1" location="apps/sim/ee/scim/lib/projection/reconcile-user.ts:379">
P2: Role demotion runs before `plan.apply`, so a run in a workspace receiving a new grant is collected here while access is temporarily absent, then canceled after commit despite restored access. Filter Stops against the final grants.</violation>
</file>
Contributor
[Critical impact] This PR appears safe to merge; no new actionable issues were found. SummaryThis PR pushes Stop for Chat runs whose workspace access ends during directory sync.
|
Collaborator
Author
|
@greptileai review |
Collaborator
Author
|
@cubic-dev-ai review |
Contributor
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
…ction commits A directory sync that withdrew a workspace grant or demoted an organization admin recorded Stop for the user's live Chat runs but never pushed it, so the runs ended only on the worker's next run-control read. - Projection deltas carry the runs their withdrawals stopped; withdrawGrant and setOrganizationRole return them instead of dropping them - Group writes and user updates deliver them once their transaction commits; the batched reconcile delivers each batch after it commits, so a rolled-back batch delivers nothing - Member removal, transfer and external-collaborator removal results carry stoppedRuns as a required field, returned from inside the transaction
- A reconciliation pass that demotes an admin or withdraws a grant while granting the same workspace back no longer stops the run there: access is checked once after every withdrawal and grant - Fix the readonly skipped result that failed type-check - Cover a committed batch delivering when a later batch rolls back, and observe rollback deliveries deterministically
waleedlatif1
force-pushed
the
fix/stop-delivery-convention
branch
from
October 16, 2026 03:31
fc60e9d to
8c1efe3
Compare
Collaborator
Author
|
@greptileai review |
Collaborator
Author
|
@cubic-dev-ai review |
Contributor
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
This branch was previously 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.
Summary
withdrawGrant) or demoted an org admin (setOrganizationRole) recorded Stop for the user's live Chat runs but dropped the returned runs, so nothing pushed the Stop; the run ended only on the worker's next run-control readProjectionDeltanow carriesstoppedRuns;withdrawGrantandsetOrganizationRolereturn the runs they stoppeddeliverRunStopsstrictly after commit — group writes (withGroupWrite), SCIM user PUT/PATCH (writeUser), and the batched reconcile per committed batch (reconcile job, mapping changes). A rolled-back write or batch delivers nothingstoppedRunsas a required field (no more?? []at callers), returned from inside the transaction so a retried attempt can never surface runs from a rolled-back oneNot in this PR:
disableUserResources) still relies on run control: delivering from it (statically or lazily) pulls the delivery graph into every page vialib/auth/auth.tsand exceeds the module-count baseline on 11 page entries. Needs a separate decisionchangeMemberRoleTxare unchanged (tracked separately)Type of Change
Testing
Checklist