Skip to content

packages/django-postgres-cache: fix naive datetime warning - #23033

Merged
BeryJu merged 3 commits into
goauthentik:mainfrom
joaocfernandes:jfernandes/naive-time-db-warning-main
Jun 21, 2026
Merged

BeryJu merged 3 commits into
goauthentik:mainfrom
joaocfernandes:jfernandes/naive-time-db-warning-main

Conversation

@joaocfernandes

Copy link
Copy Markdown
Contributor

The _base_set_expiry method in DatabaseCache returned datetime.max (a timezone-naive value) when timeout=None, while the project runs with USE_TZ=True.

This caused Django to emit a RuntimeWarning on every cache write that
passes timeout=None:

DateTimeField CacheEntry.expires received a naive datetime (...)
while time zone support is active.

@joaocfernandes
joaocfernandes requested a review from a team as a code owner June 12, 2026 10:10
@netlify

netlify Bot commented Jun 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit 0b465aa
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6a383dda77a2fa00089638d4
😎 Deploy Preview https://deploy-preview-23033--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 Jun 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 9d43057
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/6a30100bd00d3e0008c0d502
😎 Deploy Preview https://deploy-preview-23033--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 Jun 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

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

…ut=None with USE_TZ=True

The _base_set_expiry method in DatabaseCache returned datetime.max (a
timezone-naive value) when timeout=None, while the project runs with
USE_TZ=True.

This caused Django to emit a RuntimeWarning on every cache write that
 passes timeout=None:

    DateTimeField CacheEntry.expires received a naive datetime (...)
    while time zone support is active.
@joaocfernandes
joaocfernandes force-pushed the jfernandes/naive-time-db-warning-main branch from b465f79 to 50b8eac Compare June 12, 2026 10:22
@codecov

codecov Bot commented Jun 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.23%. Comparing base (5cdee0b) to head (0b465aa).
⚠️ Report is 104 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #23033      +/-   ##
==========================================
- Coverage   93.26%   93.23%   -0.04%     
==========================================
  Files        1032     1035       +3     
  Lines       60186    60364     +178     
  Branches      400      400              
==========================================
+ Hits        56135    56281     +146     
- Misses       4051     4083      +32     
Flag Coverage Δ
conformance 36.45% <ø> (-0.08%) ⬇️
e2e 41.69% <ø> (-0.10%) ⬇️
integration 32.41% <ø> (-0.56%) ⬇️
rust 0.00% <ø> (ø)
unit 92.21% <ø> (+<0.01%) ⬆️
unit-migrate 92.25% <ø> (+0.01%) ⬆️

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 requested a review from BeryJu June 15, 2026 14:45
@BeryJu BeryJu added area:backend backport/version-2026.2 Add this label to PRs to backport changes to version-2026.2 backport/version-2026.5 Add this label to PRs to backport changes to version-2026.5 labels Jun 21, 2026
Signed-off-by: Jens Langhammer <[email protected]>
@BeryJu
BeryJu enabled auto-merge (squash) June 21, 2026 19:41
@BeryJu
BeryJu merged commit 86e9798 into goauthentik:main Jun 21, 2026
105 checks passed
@authentik-automation

Copy link
Copy Markdown
Contributor

⚠️ Cherry-pick to version-2026.2 has conflicts: #23234

@authentik-automation

Copy link
Copy Markdown
Contributor

🍒 Cherry-pick to version-2026.5 created: #23235

BeryJu pushed a commit that referenced this pull request Jun 21, 2026
This cherry-pick has conflicts that need manual resolution.

Original PR: #23033
Original commit: 86e9798

Signed-off-by: Jens Langhammer <[email protected]>
BeryJu added a commit that referenced this pull request Jun 21, 2026
#23033 to version-2026.5) (#23235)

packages/django-postgres-cache: fix naive datetime warning (#23033)

* packages/django-postgres-cache: fix naive datetime warning when timeout=None with USE_TZ=True

The _base_set_expiry method in DatabaseCache returned datetime.max (a
timezone-naive value) when timeout=None, while the project runs with
USE_TZ=True.

This caused Django to emit a RuntimeWarning on every cache write that
 passes timeout=None:

    DateTimeField CacheEntry.expires received a naive datetime (...)
    while time zone support is active.

* fix linting



---------

Signed-off-by: Jens Langhammer <[email protected]>
Co-authored-by: João C. Fernandes <[email protected]>
Co-authored-by: Marc 'risson' Schmitt <[email protected]>
Co-authored-by: Jens Langhammer <[email protected]>
BeryJu added a commit that referenced this pull request Jun 22, 2026
#23033 to version-2026.2) (#23234)

* Cherry-pick #23033 to version-2026.2 (with conflicts)

This cherry-pick has conflicts that need manual resolution.

Original PR: #23033
Original commit: 86e9798

Signed-off-by: Jens Langhammer <[email protected]>

* fix

Signed-off-by: Jens Langhammer <[email protected]>

---------

Signed-off-by: Jens Langhammer <[email protected]>
Co-authored-by: João C. Fernandes <[email protected]>
Co-authored-by: Jens Langhammer <[email protected]>
kensternberg-authentik added a commit that referenced this pull request Jun 22, 2026
* main: (30 commits)
  core, flows: drop maximum-scale=1 from viewport meta (#23261)
  web: bump vite from 8.0.12 to 8.0.16 in /web (#23129)
  web: bump the storybook group across 1 directory with 4 updates (#23246)
  ci: bump actions/checkout from 6.0.3 to 7.0.0 (#23250)
  core: bump structlog from 25.5.0 to 26.1.0 (#23241)
  packages/django-dramatiq-postgres/broker: fix race condition in broker causing completed tasks to be repeated (#23218)
  core, web: update translations (#23237)
  core: bump pytest from 9.0.3 to 9.1.0 (#23238)
  core: bump aws-cdk-lib from 2.258.1 to 2.259.0 (#23240)
  core: bump goauthentik/fips-python from `9b938f7` to `cbec346` in /lifecycle/container (#23242)
  core: bump ruff from 0.15.17 to 0.15.18 (#23243)
  ci: bump int128/docker-manifest-create-action from 2.22.0 to 2.23.0 (#23244)
  core: bump pytest-github-actions-annotate-failures from 0.4.0 to 0.4.1 (#23245)
  ci: bump softprops/action-gh-release from 3.0.0 to 3.0.1 (#23247)
  core: bump astral-sh/uv from 0.11.22 to 0.11.23 in /lifecycle/container (#23248)
  ci: bump taiki-e/install-action from 2.81.11 to 2.82.0 in /.github/actions/setup (#23252)
  web: bump date-fns from 4.1.0 to 4.4.0 in /web (#23253)
  core: bump which from 8.0.3 to 8.0.4 (#23254)
  translate: Updates for project authentik and language ar_AA (#23255)
  packages/django-postgres-cache: fix naive datetime warning (#23033)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants