Skip to content

crypto: don't dispatch discovery if one is queued - #25483

Merged
BeryJu merged 3 commits into
mainfrom
crypto/dedupe-discovery-tasks
Aug 26, 2026
Merged

BeryJu merged 3 commits into
mainfrom
crypto/dedupe-discovery-tasks

Conversation

@BeryJu

@BeryJu BeryJu commented Aug 25, 2026

Copy link
Copy Markdown
Member

@BeryJu
BeryJu requested a review from a team as a code owner August 25, 2026 18:16
@netlify

netlify Bot commented Aug 25, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 0eeab72
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6a8ddc1d13c6880008713a04
😎 Deploy Preview https://deploy-preview-25483--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 Aug 25, 2026 •

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
4243 1 4242 1
View the top 1 failed test(s) by shortest run time
tests.openid_conformance.test_oidc_basic.TestOpenIDConformanceBasic::test_oidcc_basic_certification_test
Stack Traces | 169s run time
self = <unittest.case._Outcome object at 0x7f880290de80>
test_case = <tests.openid_conformance.test_oidc_basic.TestOpenIDConformanceBasic testMethod=test_oidcc_basic_certification_test>
subTest = False

    @contextlib.contextmanager
    def testPartExecutor(self, test_case, subTest=False):
        old_success = self.success
        self.success = True
        try:
>           yield

.../hostedtoolcache/Python/3.14.7........./x64/lib/python3.14/unittest/case.py:58: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.openid_conformance.test_oidc_basic.TestOpenIDConformanceBasic testMethod=test_oidcc_basic_certification_test>
result = <TestCaseFunction test_oidcc_basic_certification_test>

    def run(self, result=None):
        if result is None:
            result = self.defaultTestResult()
            startTestRun = getattr(result, 'startTestRun', None)
            stopTestRun = getattr(result, 'stopTestRun', None)
            if startTestRun is not None:
                startTestRun()
        else:
            stopTestRun = None
    
        result.startTest(self)
        try:
            testMethod = getattr(self, self._testMethodName)
            if (getattr(self.__class__, "__unittest_skip__", False) or
                getattr(testMethod, "__unittest_skip__", False)):
                # If the class or method was skipped.
                skip_why = (getattr(self.__class__, '__unittest_skip_why__', '')
                            or getattr(testMethod, '__unittest_skip_why__', ''))
                _addSkip(result, self, skip_why)
                return result
    
            expecting_failure = (
                getattr(self, "__unittest_expecting_failure__", False) or
                getattr(testMethod, "__unittest_expecting_failure__", False)
            )
            outcome = _Outcome(result)
            start_time = time.perf_counter()
            try:
                self._outcome = outcome
    
                with outcome.testPartExecutor(self):
                    self._callSetUp()
                if outcome.success:
                    outcome.expecting_failure = expecting_failure
                    with outcome.testPartExecutor(self):
>                       self._callTestMethod(testMethod)

.../hostedtoolcache/Python/3.14.7........./x64/lib/python3.14/unittest/case.py:669: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.openid_conformance.test_oidc_basic.TestOpenIDConformanceBasic testMethod=test_oidcc_basic_certification_test>
method = <bound method TestOpenIDConformanceBasic.test_oidcc_basic_certification_test of <tests.openid_conformance.test_oidc_basic.TestOpenIDConformanceBasic testMethod=test_oidcc_basic_certification_test>>

    def _callTestMethod(self, method):
>       result = method()
                 ^^^^^^^^

.../hostedtoolcache/Python/3.14.7........./x64/lib/python3.14/unittest/case.py:615: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.openid_conformance.test_oidc_basic.TestOpenIDConformanceBasic testMethod=test_oidcc_basic_certification_test>
args = (), kwargs = {}

    @wraps(func)
    def wrapper(self: TransactionTestCase, *args, **kwargs):
        """Run test again if we're below max_retries, including tearDown and
        setUp. Otherwise raise the error"""
        nonlocal count
        try:
>           return func(self, *args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/decorators.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.openid_conformance.test_oidc_basic.TestOpenIDConformanceBasic testMethod=test_oidcc_basic_certification_test>

    @retry()
    def test_oidcc_basic_certification_test(self):
>       self.run_test(
            "oidcc-basic-certification-test-plan",
            self.test_plan_config,
            {
                "server_metadata": "discovery",
                "client_registration": "static_client",
            },
        )

tests/openid_conformance/test_oidc_basic.py:9: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.openid_conformance.test_oidc_basic.TestOpenIDConformanceBasic testMethod=test_oidcc_basic_certification_test>
test_name = 'oidcc-basic-certification-test-plan'
test_plan_config = {'alias': 'authentik', 'description': 'authentik', 'server': {'discoveryUrl': 'https://10.1.0.57:.../application/o/o...86b5389d15b173109a0555dc47e0cc0949104f1925bcc6565351cb1dffd7e6818cf074f5bd50c210b565121a7328ee8bd40107fc4bbd867'}, ...}
test_variant = {'server_metadata': 'discovery', 'client_registration': 'static_client'}

    def run_test(
        self,
        test_name: str,
        test_plan_config: dict[str, Any],
        test_variant: dict[str, Any] | None = None,
    ):
        self.conformance = Conformance(f"https://{self.host}:8443", None, verify_ssl=False)
    
        test_plan = self.conformance.create_test_plan(
            test_name,
            test_plan_config,
            test_variant,
        )
        plan_id = test_plan["id"]
        for test in test_plan["modules"]:
            # Fetch name and variant of the next test to run
            module_name = test["testModule"]
            variant = test["variant"]
            module_instance = self.conformance.create_test_from_plan_with_variant(
                plan_id, module_name, variant
            )
            module_id = module_instance["id"]
>           self.run_single_test(module_id)

tests/openid_conformance/base.py:87: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.openid_conformance.test_oidc_basic.TestOpenIDConformanceBasic testMethod=test_oidcc_basic_certification_test>
module_id = 'ndZZkZ1l66MZRI1'

    def run_single_test(self, module_id: str):
        """Process instructions for a single test, navigate to browser URLs and take screenshots"""
        tested_browser_url = 0
        uploaded_image = 0
        cleared_cookies = False
        while True:
            # Fetch all info
            test_status = self.conformance.get_test_status(module_id)
            test_log = self.conformance.get_test_log(module_id)
            test_info = self.conformance.get_module_info(module_id)
            # Check status early, if we're finished already we don't want to do anything extra
            if test_info["status"] in ["INTERRUPTED", "FINISHED"]:
                return
            # Check if we need to clear cookies - tests only indicates this in their written summary
            # so this check is a bit brittle
            if "cookies" in test_info["summary"] and not cleared_cookies:
                # Navigate to our origin to delete cookies in the right context
                self.driver.get(self.url("authentik_api:user-me") + "?format=json")
                self.driver.delete_all_cookies()
                cleared_cookies = True
            # Check if we need deal with any browser URLs
            browser_urls = test_status.get("browser", {}).get("urls", [])
            if len(browser_urls) > tested_browser_url:
>               self.do_browser(browser_urls[tested_browser_url])

tests/openid_conformance/base.py:122: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.openid_conformance.test_oidc_basic.TestOpenIDConformanceBasic testMethod=test_oidcc_basic_certification_test>
url = 'https://10.1.0.57:.../application/o/authorize/?client_id=4054d882aff59755f2f279968b97ce8806a926e1&nonce=1sMHrsxCJQ&...t=login&redirect_uri=https://localhost:.../a/authentik/callback&response_type=code&scope=openid&state=MZAFnymNI3'

    def do_browser(self, url):
        """For any specific OpenID Conformance test, execute the operations required"""
        self.driver.get(url)
        should_expect_completion = False
        if "if/flow/default-authentication-flow" in self.driver.current_url:
            self.logger.debug("Logging in")
            skipped = []
            if "login_hint" in self.driver.current_url:
                skipped.append("ak-stage-identification")
>           self.login(skip_stages=skipped)

tests/openid_conformance/base.py:153: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.openid_conformance.test_oidc_basic.TestOpenIDConformanceBasic testMethod=test_oidcc_basic_certification_test>
shadow_dom = True, skip_stages = []

    def login(self, shadow_dom=True, skip_stages: list[str] | None = None):
        """Perform the entire authentik login flow."""
        skip_stages = skip_stages or []
    
        if "ak-stage-identification" not in skip_stages:
            if shadow_dom:
>               flow_executor = self.get_shadow_root("ak-flow-executor")
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/selenium.py:293: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.openid_conformance.test_oidc_basic.TestOpenIDConformanceBasic testMethod=test_oidcc_basic_certification_test>
selector = 'ak-flow-executor'
container = <selenium.webdriver.remote.webdriver.WebDriver (session="d47990677dd04b8e78332d26e3867047")>
timeout = 10

    def get_shadow_root(
        self, selector: str, container: WebElement | WebDriver | None = None, timeout: float = 10
    ) -> WebElement:
        """Get the shadow root of a web component specified by `selector`."""
        if not container:
            container = self.driver
        wait = WebDriverWait(container, timeout)
        host: WebElement | None = None
    
        try:
            host = wait.until(lambda c: c.find_element(By.CSS_SELECTOR, selector))
        except TimeoutException:
            self.fail(f"Timed out waiting for shadow host {selector} to appear")
    
        attempts = 0
    
        while attempts < SHADOW_ROOT_RETRIES:
            try:
                host = container.find_element(By.CSS_SELECTOR, selector)
                return host.shadow_root
            except (
                NoSuchElementException,
                NoSuchShadowRootException,
                DetachedShadowRootException,
                StaleElementReferenceException,
            ):
                attempts += 1
                sleep(0.2)
    
        inner_html = "<no host>"
        if host is not None:
            try:
                inner_html = host.get_attribute("innerHTML") or "<no host>"
            except DetachedShadowRootException, StaleElementReferenceException:
                inner_html = "<stale host>"
    
>       raise RuntimeError(
            f"Failed to obtain shadow root for {selector} after {attempts} attempts. "
            f"Host innerHTML: {inner_html}"
        )
E       RuntimeError: Failed to obtain shadow root for ak-flow-executor after 5 attempts. Host innerHTML: 
E               
E       
E       <div class="ak-c-placeholder" id="ak-placeholder" slot="placeholder">
E           <span class="pf-c-spinner" role="progressbar" aria-valuetext="Loading...">
E               <span class="pf-c-spinner__clipper"></span>
E               <span class="pf-c-spinner__lead-ball"></span>
E               <span class="pf-c-spinner__tail-ball"></span>
E           </span>
E       </div>
E       
E               
E               <ak-brand-links name="flow-links" slot="footer"></ak-brand-links>

tests/selenium.py:270: RuntimeError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@BeryJu BeryJu changed the title cryto: don't dispatch discovery if one is queued crypto: don't dispatch discovery if one is queued Aug 25, 2026
@github-actions

github-actions Bot commented Aug 25, 2026 •

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-d2029e04c109d3a12836e12024e7eb014c3525ac
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-d2029e04c109d3a12836e12024e7eb014c3525ac

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

abhisheksharma2411

This comment was marked as low quality.

Comment thread authentik/crypto/tasks.py Resolved
Co-authored-by: Marc 'risson' Schmitt <[email protected]>
Signed-off-by: Jens L. <[email protected]>
@netlify

netlify Bot commented Aug 26, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit fc328dc
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6a8eeadce5d0ef000858b7d2
😎 Deploy Preview https://deploy-preview-25483--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.

Signed-off-by: Marc 'risson' Schmitt <[email protected]>
@rissson rissson added backport/version-2026.5 Add this label to PRs to backport changes to version-2026.5 backport/version-2026.8 Add this label to PRs to backport changes to version-2026.8 labels Aug 26, 2026
@netlify

netlify Bot commented Aug 26, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit d2029e0
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/6a8ef74ac16be40008ecb330
😎 Deploy Preview https://deploy-preview-25483--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.

@BeryJu
BeryJu merged commit f7445f2 into main Aug 26, 2026
140 of 143 checks passed
@BeryJu
BeryJu deleted the crypto/dedupe-discovery-tasks branch August 26, 2026 14:49
@authentik-cherry-pick

Copy link
Copy Markdown
Contributor

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

@authentik-cherry-pick

Copy link
Copy Markdown
Contributor

🍒 Cherry-pick to version-2026.8 created: #25512

BeryJu added a commit that referenced this pull request Aug 26, 2026
…to version-2026.8) (#25512)

crypto: don't dispatch discovery if one is queued (#25483)

* cryto: don't dispatch discovery if one is queued

* Update tasks.py




* lint



---------

Signed-off-by: Jens L. <[email protected]>
Signed-off-by: Marc 'risson' Schmitt <[email protected]>
Co-authored-by: Jens L. <[email protected]>
Co-authored-by: Marc 'risson' Schmitt <[email protected]>
BeryJu added a commit that referenced this pull request Aug 26, 2026
…to version-2026.5) (#25511)

crypto: don't dispatch discovery if one is queued (#25483)

* cryto: don't dispatch discovery if one is queued

* Update tasks.py




* lint



---------

Signed-off-by: Jens L. <[email protected]>
Signed-off-by: Marc 'risson' Schmitt <[email protected]>
Co-authored-by: Jens L. <[email protected]>
Co-authored-by: Marc 'risson' Schmitt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/version-2026.5 Add this label to PRs to backport changes to version-2026.5 backport/version-2026.8 Add this label to PRs to backport changes to version-2026.8

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants