Skip to content

Protect user updates and clean up orphaned private views - #2631

Open
niemyjski wants to merge 15 commits into
issue/external-account-statefrom
issue/user-record-concurrency
Open

niemyjski wants to merge 15 commits into
issue/external-account-statefrom
issue/user-record-concurrency

Conversation

@niemyjski

@niemyjski niemyjski commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Clean up orphaned private saved views in the existing job and coordinate membership grants with cleanup so restored access preserves old private views. Membership handlers honor patch outcomes and use cached follow-up reads. Predefined-view initialization updates only its metadata, preserving concurrent invitations. Fixes #2672.

Validation: zero-warning build, 515 combined local tests, and nine final metadata/credential/API checks passed. Full CI passed on 4e9c9d5c1, based on #2630 at d99fc68df.

Stack dependency: merge #2630 first. GitHub currently reports this stacked PR as blocked despite passing checks and no conflicts; recheck readiness after its base is retargeted. Native user versioning and its API contract now live in that prerequisite. An ambiguous transfer failure can leave an account unlinked; retry coverage verifies recovery.

Verification and implementation details
  • The existing job scans private views in 500-record pages. A real integration regression crosses the boundary with 503 orphaned views and five retained views. Deleted users, missing organizations, and former members lose private views; shared views, administrators, disabled members with membership, and views in accessible organizations remain intact. Deletion filters on scanned IDs, owner, organization, and current private visibility.
  • Membership grants and cleanup share a per-user Foundatio lock. The job skips busy users and holds the lock across its final access check and deletion. Existing-user adds, invitation acceptance, organization creation, and global-admin grants participate. A real HTTP invitation-acceptance regression pauses grant persistence, runs cleanup, completes the grant, and verifies the old private view survives. It failed before coordination and passed after the fix. No persisted coordination field or custom repository is added.
  • Additional native repository tests change visibility after scanning and restore membership during initial/final organization reads. The final-read case failed before the read-order fix. Cleanup reads the organization before its final owner-access check so grants committed during that lookup are observed.
  • Membership changes use named patch results, handle missing users, and follow successful invalidation with normal cached reads. Real HTTP tests cover retries, invite cancellation, global administrators, and restored membership. Repository tests warm ID/email caches and verify patched membership. Custom integration repositories and lock mocks are removed; failure injection stays in handler unit tests.
  • Predefined-view initialization records the existing definitions hash with native PartialPatch, preserving unrelated organization data. A real regression commits an invitation and another data entry during view creation, then verifies both survive and invite-token lookup works. It failed before the fix. See Foundatio partial updates.
  • Organization deletion removes members while the requester is available, then persists the existing soft-delete marker before resource cleanup. A member-write conflict returns 409 before that marker; the real HTTP regression retries and checks requester survival. Unit tests cover marker/token cleanup failures. No DeletedByUserId field, migration, or resave is required. Organization creation rolls back definite repository rejection and preserves state after ambiguous failure.
  • User saves inherit plain IVersioned from Validate external account state and identity #2630. Elasticsearch supplies versions for legacy records, old caches expire normally, and no read overrides or serializer special cases are needed. Repository deletes do not use version preconditions, so speculative deletion-conflict changes are omitted. Production repositories and the standard localhost Aspire fixture cover the full stack; CI gates and retry settings remain unchanged.

@niemyjski
niemyjski force-pushed the issue/user-record-concurrency branch from 5bc84d1 to 179c281 Compare October 2, 2026 04:10
@niemyjski
niemyjski added this pull request to stack #2642 October 5, 2026 02:11
@niemyjski
niemyjski force-pushed the issue/user-record-concurrency branch from 179c281 to 032664f Compare October 13, 2026 02:39
@niemyjski
niemyjski force-pushed the issue/user-record-concurrency branch from 032664f to 57f409f Compare October 13, 2026 02:41
@niemyjski
niemyjski force-pushed the issue/user-record-concurrency branch from 57f409f to 975b25e Compare October 13, 2026 02:58
@niemyjski
niemyjski removed this pull request from stack #2642 October 13, 2026 03:05
@niemyjski
niemyjski force-pushed the issue/user-record-concurrency branch from 975b25e to 793b7c9 Compare October 13, 2026 03:05
@niemyjski
niemyjski added this pull request to stack #2659 October 13, 2026 03:05
@niemyjski
niemyjski removed this pull request from stack #2659 October 13, 2026 12:26
@niemyjski
niemyjski force-pushed the issue/user-record-concurrency branch from 793b7c9 to 2c36ec1 Compare October 13, 2026 12:26
@niemyjski
niemyjski added this pull request to stack #2660 October 13, 2026 12:27
@niemyjski
niemyjski force-pushed the issue/user-record-concurrency branch from 2c36ec1 to a0d6b0e Compare October 13, 2026 12:40
@niemyjski
niemyjski force-pushed the issue/user-record-concurrency branch from a0d6b0e to aa27175 Compare October 13, 2026 13:33
@niemyjski
niemyjski force-pushed the issue/user-record-concurrency branch from aa27175 to c2ffd53 Compare October 13, 2026 13:55
@niemyjski
niemyjski force-pushed the issue/user-record-concurrency branch from c2ffd53 to d307b6a Compare October 14, 2026 03:03
@niemyjski
niemyjski force-pushed the issue/user-record-concurrency branch from d307b6a to 8e94661 Compare October 14, 2026 03:16

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a66489346a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Exceptionless.Core/Services/OrganizationService.cs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af59bd303b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Exceptionless.Core/Models/User.cs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ccc8e1786

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Exceptionless.Core/Models/User.cs
@niemyjski
niemyjski force-pushed the issue/user-record-concurrency branch from 1a51885 to 730c034 Compare October 20, 2026 00:10

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5995389b47

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Exceptionless.Core/Jobs/CleanupDataJob.cs
@niemyjski
niemyjski force-pushed the issue/user-record-concurrency branch 3 times, most recently from 054b8f6 to 9803243 Compare October 20, 2026 01:39
@niemyjski
niemyjski force-pushed the issue/user-record-concurrency branch 2 times, most recently from 0859373 to 122b9ac Compare October 22, 2026 03:25

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 122b9acb27

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Exceptionless.Core/Models/User.cs
@github-actions

Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Complexity Health
Exceptionless.AppHost 70% 65% 128 ➖
Exceptionless.Core 78% 70% 11045 ✔
Exceptionless.Insulation 51% 43% 370 ➖
Exceptionless.Web 86% 71% 9347 ✔
Summary 81% (28926 / 35678) 70% (14375 / 20496) 20890 ✔

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Correct user membership patch outcomes and external-account transfer recovery

1 participant