Skip to content

lib/sync: add Sync base model for storing past sync history - #23184

Merged
rissson merged 1 commit into
mainfrom
sync-status
Jun 29, 2026
Merged

rissson merged 1 commit into
mainfrom
sync-status

Conversation

@rissson

@rissson rissson commented Jun 18, 2026

Copy link
Copy Markdown
Member

Details

What does this PR change?

Extracted from #23126

Add a Sync model (looking for feedback on the name) that can store past sync statuses and related tasks. See the above PR for use case.

Currently 20 syncs are kept, but I am also looking for feedback regarding that, especially since we might create Sync objects for partial syncs (in SCIM providers for instance).

Why is this change needed?

Relying on past tasks is flaky and hard to correctly track. A persistent model to store that state is better suited for that task.

How was this tested?

Linked issues


Checklist

  • The project has been linted, built, and tested (make all)
  • The documentation has been updated and formatted (make docs)

@rissson rissson self-assigned this Jun 18, 2026
@rissson
rissson requested a review from a team as a code owner June 18, 2026 14:11
@netlify

netlify Bot commented Jun 18, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit eea8b44
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6a33fca00af51000083f815f
😎 Deploy Preview https://deploy-preview-23184--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.

Comment thread authentik/core/tasks.py
Comment on lines +48 to +50
for cls in Sync.__subclasses__():
amount = cls.cleanup()
LOGGER.debug("Expired models", model=cls, amount=amount)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if we're doing this in here why not inherit from expiringmodel

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

How do you handle the count-based expiration with ExpiringModel?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

good point

@codecov

codecov Bot commented Jun 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 55.55556% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.19%. Comparing base (7019180) to head (eea8b44).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
authentik/lib/sync/models.py 50.94% 26 Missing ⚠️
authentik/core/tasks.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #23184      +/-   ##
==========================================
- Coverage   93.26%   93.19%   -0.08%     
==========================================
  Files        1035     1036       +1     
  Lines       60338    60400      +62     
  Branches      400      400              
==========================================
+ Hits        56277    56287      +10     
- Misses       4061     4113      +52     
Flag Coverage Δ
conformance 36.48% <53.96%> (+0.01%) ⬆️
e2e 41.72% <53.96%> (+0.01%) ⬆️
integration 32.89% <53.96%> (-0.02%) ⬇️
rust 0.00% <ø> (ø)
unit 92.17% <55.55%> (-0.04%) ⬇️
unit-migrate 92.20% <55.55%> (-0.04%) ⬇️

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

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

@rissson rissson moved this from Todo to Needs review in authentik Core Jun 18, 2026
@github-actions

Copy link
Copy Markdown
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-eea8b441d0c0575e0e9c72359b0aca1775136f3f
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-eea8b441d0c0575e0e9c72359b0aca1775136f3f

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

@github-project-automation github-project-automation Bot moved this from Needs review to In Progress in authentik Core Jun 26, 2026
@rissson
rissson merged commit 0d8dc08 into main Jun 29, 2026
163 of 166 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in authentik Core Jun 29, 2026
@rissson
rissson deleted the sync-status branch June 29, 2026 15:32
kensternberg-authentik added a commit that referenced this pull request Jun 30, 2026
* main: (591 commits)
  core: bump dramatiq from 2.1.0 to 2.2.0 (#23381)
  website: bump semver from 7.8.4 to 7.8.5 in /website (#23299)
  web/flows: fix untranslated user field labels in identification stage (#23518)
  tasks/schedules: fix paused schedules getting unpaused on startup (#23521)
  sources/ldap: avoid re-creating connections to LDAP server (#23520)
  web: bump the bundler group across 1 directory with 3 updates (#23207)
  core: bump webauthn from 2.7.1 to 2.8.0 (#23249)
  lib/sync: add Sync base model for storing past sync history (#23184)
  web: bump launch-editor from 2.13.2 to 2.14.1 (#23309)
  web: bump the eslint group across 1 directory with 2 updates (#23239)
  web: bump uuid from 14.0.0 to 14.0.1 in /web (#23310)
  lifecycle/aws: bump aws-cdk from 2.1126.0 to 2.1128.0 in /lifecycle/aws (#23377)
  website: bump the build group across 1 directory with 6 updates (#23406)
  core: bump coverage[toml] from 7.14.2 to 7.14.3 (#23410)
  core: bump github.com/jellydator/ttlcache/v3 from 3.4.0 to 3.4.1 (#23405)
  core: bump gorm.io/gorm from 1.31.1 to 1.31.2 (#23404)
  ci: bump actions/setup-go from 6.4.0 to 6.5.0 (#23412)
  core: bump library/node from `f9b8bd6` to `a1d9d67` in /lifecycle/container (#23407)
  core: bump goauthentik/fips-python from `fe20a68` to `15f00f3` in /lifecycle/container (#23408)
  core: bump library/node from 26.3.1-trixie to 26.4.0-trixie in /website (#23409)
  ...
kensternberg-authentik added a commit that referenced this pull request Jul 2, 2026
* main:
  core: bump dramatiq from 2.1.0 to 2.2.0 (#23381)
  website: bump semver from 7.8.4 to 7.8.5 in /website (#23299)
  web/flows: fix untranslated user field labels in identification stage (#23518)
  tasks/schedules: fix paused schedules getting unpaused on startup (#23521)
  sources/ldap: avoid re-creating connections to LDAP server (#23520)
  web: bump the bundler group across 1 directory with 3 updates (#23207)
  core: bump webauthn from 2.7.1 to 2.8.0 (#23249)
  lib/sync: add Sync base model for storing past sync history (#23184)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants