Skip to content

packages/django-postgres-cache: rework to use ORM - #17771

Merged
rissson merged 12 commits into
mainfrom
django-cache-improvements
Mar 31, 2026
Merged

rissson merged 12 commits into
mainfrom
django-cache-improvements

Conversation

@rissson

@rissson rissson commented Oct 28, 2025

Copy link
Copy Markdown
Member

Details

REPLACE ME


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)

Signed-off-by: Marc 'risson' Schmitt <[email protected]>
Signed-off-by: Marc 'risson' Schmitt <[email protected]>
Signed-off-by: Marc 'risson' Schmitt <[email protected]>
@rissson rissson added this to the Release 2025.12 milestone Oct 28, 2025
@rissson rissson self-assigned this Oct 28, 2025
@rissson
rissson requested a review from a team as a code owner October 28, 2025 16:23
@netlify

netlify Bot commented Oct 28, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit cd0a6ff
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/69cbbfbee835a4000870fd0b
😎 Deploy Preview https://deploy-preview-17771--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

netlify Bot commented Oct 28, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit a699208
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/69cbdaf98054a900086fe95f
😎 Deploy Preview https://deploy-preview-17771--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

netlify Bot commented Oct 28, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit a699208
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/69cbdaf9b5a048000879de6c
😎 Deploy Preview https://deploy-preview-17771--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

codecov Bot commented Oct 28, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.79%. Comparing base (55e555c) to head (2e7c4c9).
⚠️ Report is 8 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #17771   +/-   ##
=======================================
  Coverage   92.79%   92.79%           
=======================================
  Files        1005     1005           
  Lines       57024    57024           
  Branches      437      437           
=======================================
+ Hits        52916    52917    +1     
+ Misses       4108     4107    -1     
Flag Coverage Δ
conformance 37.19% <ø> (+<0.01%) ⬆️
e2e 42.67% <ø> (+<0.01%) ⬆️
integration 22.12% <ø> (+<0.01%) ⬆️
rust 0.22% <ø> (ø)
unit 91.83% <ø> (+<0.01%) ⬆️
unit-migrate 91.90% <ø> (+<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.

Signed-off-by: Marc 'risson' Schmitt <[email protected]>
@rissson
rissson marked this pull request as draft October 28, 2025 17:26
@rissson rissson removed this from the Release 2026.2.0: Nice to have milestone Mar 24, 2026
rissson added 3 commits March 31, 2026 14:35
Signed-off-by: Marc 'risson' Schmitt <[email protected]>
Signed-off-by: Marc 'risson' Schmitt <[email protected]>
@rissson rissson changed the title packages/django-postgres-cache: rework packages/django-postgres-cache: rework to use ORM Mar 31, 2026
rissson added 3 commits March 31, 2026 16:42
Signed-off-by: Marc 'risson' Schmitt <[email protected]>
Signed-off-by: Marc 'risson' Schmitt <[email protected]>
Signed-off-by: Marc 'risson' Schmitt <[email protected]>
@rissson
rissson marked this pull request as ready for review March 31, 2026 16:42
@github-project-automation github-project-automation Bot moved this from Todo to In Progress in authentik Core Mar 31, 2026
@rissson
rissson enabled auto-merge (squash) March 31, 2026 17:01
@rissson
rissson merged commit fd31967 into main Mar 31, 2026
152 of 154 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in authentik Core Mar 31, 2026
@rissson
rissson deleted the django-cache-improvements branch March 31, 2026 17:05
@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-2e7c4c9de679b5626a81f2558aee03eddbad19bc
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-2e7c4c9de679b5626a81f2558aee03eddbad19bc

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

@@ -66,59 +41,34 @@ def _base_set_expiry(self, timeout: float | None) -> datetime:
exp.replace(microsecond=0)

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.

afaik replace creates a new datetime, this should be
exp = exp.replace(microsecond=0)

class DatabaseCache(BaseCache):
pickle_protocol = pickle.HIGHEST_PROTOCOL

def _cull(self, *args: Any, **kwargs: Any) -> None:

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.

nit: This backend doesn't handle expired entry cleanup but since this is a standalone package, we should document that consumers must implement their own periodic cleanup imho

@@ -66,59 +41,34 @@ def _base_set_expiry(self, timeout: float | None) -> datetime:
exp.replace(microsecond=0)

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.

afaik this returns a new datetime. this should be something like
exp = exp.replace(microsecond=0)


def delete(self, key: Any, version: int | None = None) -> bool:
key = self.make_and_validate_key(key, version=version)
return bool(CacheEntry.objects.filter(cache_key=key).delete())

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.

QuerySet.delete() returns a tuple (count, {label: count}), so bool(...) is always True here.
Needs something like count, _ = ...delete() then return count !=0

kensternberg-authentik added a commit that referenced this pull request Apr 8, 2026
* main:
  translate: Updates for project authentik and language fr_FR (#21285)
  packages/django-postgres-cache: rework to use ORM (#17771)
  providers/saml: Fix redirect for saml slo (#21258)
  core: fix provider not nullable (#21275)
  website/docs: ad source: add note about ldap signing (#21274)
  website/api: update API clients doc (#21202)
  ci: bump taiki-e/install-action from 2.70.2 to 2.70.3 in /.github/actions/setup (#21267)
  lifecycle/aws: bump aws-cdk from 2.1114.1 to 2.1115.0 in /lifecycle/aws (#21265)
  core, web: update translations (#21264)
  packages/ak-lib: init (#21257)
  website/docs: document group_uuid as a property for group object (#20865)
  web/flow: extract lifecycle events peripheral to stage management into their own controllers (#20898)
  core: bump pygments from 2.19.2 to 2.20.0 (#21260)
  website/docs: add grafana dashboard (#21254)
davepgreene pushed a commit to davepgreene/authentik that referenced this pull request Apr 13, 2026
davepgreene pushed a commit to davepgreene/authentik that referenced this pull request Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants