Skip to content

lib/sync/outgoing: handle deletions even if object does not exist in database#18968

Merged
rissson merged 1 commit intomainfrom
lib-sync-outgoing-deletion-handling
Jan 20, 2026
Merged

lib/sync/outgoing: handle deletions even if object does not exist in database#18968
rissson merged 1 commit intomainfrom
lib-sync-outgoing-deletion-handling

Conversation

@rissson
Copy link
Member

@rissson rissson commented Dec 19, 2025

Details

See #18961


Checklist

  • Local tests pass (ak test authentik/)
  • The code has been formatted (make lint-fix)

If an API change has been made

  • The API schema has been updated (make gen-build)

If changes to the frontend have been made

  • The code has been formatted (make web)

If applicable

  • The documentation has been updated
  • The documentation has been formatted (make docs)

…database

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
@rissson rissson self-assigned this Dec 19, 2025
@rissson rissson requested a review from a team as a code owner December 19, 2025 15:19
@netlify
Copy link

netlify bot commented Dec 19, 2025

Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit 6ba2db3
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/69456ce86473370008041dfd
😎 Deploy Preview https://deploy-preview-18968--authentik-integrations.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Dec 19, 2025

Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 6ba2db3
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/69456ce850acd50008f0d8a5
😎 Deploy Preview https://deploy-preview-18968--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Dec 19, 2025

Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 6ba2db3
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/69456ce8463d1800084a5dd3
😎 Deploy Preview https://deploy-preview-18968--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

❌ Patch coverage is 87.75510% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.18%. Comparing base (4d9f463) to head (6ba2db3).
⚠️ Report is 347 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
authentik/lib/sync/outgoing/tasks.py 65.38% 9 Missing ⚠️
...ik/enterprise/providers/google_workspace/models.py 85.71% 1 Missing ⚠️
...tik/enterprise/providers/microsoft_entra/models.py 85.71% 1 Missing ⚠️
authentik/providers/scim/models.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18968      +/-   ##
==========================================
- Coverage   93.22%   93.18%   -0.05%     
==========================================
  Files         948      948              
  Lines       52026    52053      +27     
==========================================
+ Hits        48503    48505       +2     
- Misses       3523     3548      +25     
Flag Coverage Δ
e2e 44.81% <38.77%> (+0.04%) ⬆️
integration 23.29% <24.48%> (-0.03%) ⬇️
unit 91.50% <87.75%> (+<0.01%) ⬆️
unit-migrate 91.54% <87.75%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link
Contributor

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-6ba2db3ec364794590ff116e69dd4687e8ef887d
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
    image:
        repository: ghcr.io/goauthentik/dev-server
        tag: gh-6ba2db3ec364794590ff116e69dd4687e8ef887d

Afterwards, run the upgrade commands from the latest release notes.

Comment on lines -56 to -58
if not microsoft_group:
self.logger.debug("Group does not exist in Microsoft, skipping")
return None
Copy link
Member

Choose a reason for hiding this comment

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

I am trying to remember if there was a reason this check exists

)
microsoft_user.delete()
return response
MicrosoftEntraProviderUser.objects.filter(
Copy link
Member

Choose a reason for hiding this comment

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

Do we even needs these deletes here? Cause when a user/group is deleted this should cascade..although I guess we need this to delete from the connection object?

Copy link
Member Author

Choose a reason for hiding this comment

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

It might not be required, but it doesn't hurt for now I guess

Copy link
Member

@BeryJu BeryJu left a comment

Choose a reason for hiding this comment

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

Added some comments otherwise lgtm

@github-project-automation github-project-automation bot moved this from Todo to In Progress in authentik Core Jan 13, 2026
@BeryJu BeryJu added this to the Release 2026.2.0: Nice to have milestone Jan 20, 2026
@rissson rissson added the backport/version-2025.12 Add this label to PRs to backport changes to version-2025.12 label Jan 20, 2026
@rissson rissson merged commit 6d9766e into main Jan 20, 2026
102 of 105 checks passed
@rissson rissson deleted the lib-sync-outgoing-deletion-handling branch January 20, 2026 17:17
@github-project-automation github-project-automation bot moved this from In Progress to Done in authentik Core Jan 20, 2026
@authentik-automation
Copy link
Contributor

🍒 Cherry-pick to version-2025.12 created: #19617

rissson added a commit that referenced this pull request Jan 20, 2026
…database (cherry-pick #18968 to version-2025.12) (#19617)

Co-authored-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
kensternberg-authentik added a commit that referenced this pull request Jan 20, 2026
* main:
  website/docs: sources: add keycloak (#19591)
  website/docs: endpoints devices: typo fix (#19621)
  lib/sync/outgoing: handle deletions even if object does not exist in database (#18968)
kensternberg-authentik added a commit that referenced this pull request Jan 20, 2026
* main:
  website/docs: sources: add keycloak (#19591)
  website/docs: endpoints devices: typo fix (#19621)
  lib/sync/outgoing: handle deletions even if object does not exist in database (#18968)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend backport/version-2025.12 Add this label to PRs to backport changes to version-2025.12

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants