Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: used_by: handle NotImplementedError in used_by endpoint #13588

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dominic-r
Copy link
Contributor

The used_by endpoint was failing when inspecting model members because it tried
to access properties that might raise NotImplementedError (like the component
property in Source models).

This fix changes the member inspection to first get
all members and then filter them, rather than using a predicate function that
tries to access each property.

The endpoint will still show all objects that reference the queried object, but
it will do so without trying to access properties that might raise exceptions.

Closes #13587<!--
👋 Hi there! Welcome.

Please check the Contributing guidelines: https://docs.goauthentik.io/docs/developer-docs/#how-can-i-contribute
-->

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 website)

The used_by endpoint was failing when inspecting model members because it tried
to access properties that might raise NotImplementedError (like the component
property in Source models).

This fix changes the member inspection to first get
all members and then filter them, rather than using a predicate function that
tries to access each property.

The endpoint will still show all objects that reference the queried object, but
it will do so without trying to access properties that might raise exceptions.

Closes goauthentik#13587
@dominic-r dominic-r requested a review from a team as a code owner March 20, 2025 03:05
Copy link

netlify bot commented Mar 20, 2025

Deploy Preview for authentik-docs failed. Why did it fail? →

Name Link
🔨 Latest commit 9ac78aa
🔍 Latest deploy log https://app.netlify.com/sites/authentik-docs/deploys/67db85e334d17300082d61e5

Copy link

netlify bot commented Mar 20, 2025

Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 9ac78aa
🔍 Latest deploy log https://app.netlify.com/sites/authentik-storybook/deploys/67db85e35d0a030008dbe850
😎 Deploy Preview https://deploy-preview-13588--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 site configuration.

Copy link

codecov bot commented Mar 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.74%. Comparing base (868261c) to head (9ac78aa).
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13588      +/-   ##
==========================================
+ Coverage   92.68%   92.74%   +0.06%     
==========================================
  Files         794      794              
  Lines       40479    40496      +17     
==========================================
+ Hits        37518    37560      +42     
+ Misses       2961     2936      -25     
Flag Coverage Δ
e2e 47.95% <0.00%> (+0.07%) ⬆️
integration 24.28% <0.00%> (-0.01%) ⬇️
unit 90.52% <100.00%> (+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.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dominic-r
Copy link
Contributor Author

what? I didn't change docs at all. Will ignore

@rissson
Copy link
Member

rissson commented Mar 20, 2025

The error you're seeing is probably a symptom of a missing UsedByMixin on a serializer. Do you know which model this is failing on?

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.

GET /api/v3/sources/all/authentik-built-in/used_by/
2 participants