refactor: migrate verify_subscription_credentials return type to TypedDict#34967
Merged
asukaminato0721 merged 1 commit intolanggenius:mainfrom Apr 11, 2026
Conversation
asukaminato0721
approved these changes
Apr 11, 2026
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-11 16:34:16.764645134 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-11 16:34:07.335740804 +0000
@@ -350,9 +350,9 @@
ERROR `handled_tenant_count` was assigned in the current scope before the nonlocal declaration [unknown-name]
--> services/plugin/plugin_migration.py:91:34
ERROR `dict[str, Any]` is not assignable to attribute `credentials` with type `Never` [bad-assignment]
- --> services/trigger/trigger_provider_service.py:446:40
+ --> services/trigger/trigger_provider_service.py:450:40
ERROR `int` is not assignable to attribute `credential_expires_at` with type `Never` [bad-assignment]
- --> services/trigger/trigger_provider_service.py:447:50
+ --> services/trigger/trigger_provider_service.py:451:50
ERROR Object of class `dict` has no attribute `encode`
ERROR Object of class `dict` has no attribute `encode`
ERROR `Literal['error']` is not assignable to attribute `status` with type `Never` [bad-assignment]
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves type safety in the trigger service layer by replacing the broad dict[str, Any] return annotation on TriggerProviderService.verify_subscription_credentials() with a dedicated TypedDict that matches the method’s stable JSON response shape.
Changes:
- Introduced
VerifyCredentialsResult(TypedDict) with a singleverified: boolfield. - Updated
verify_subscription_credentials()to returnVerifyCredentialsResultinstead ofdict[str, Any].
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
HanqingZ
pushed a commit
to HanqingZ/dify
that referenced
this pull request
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the
-> dict[str, Any]return type hint onTriggerProviderService.verify_subscription_credentials()inapi/services/trigger/trigger_provider_service.pyto a properTypedDictdefinition as part of the broader type safety refactor.Changes
VerifyCredentialsResultTypedDict with a singleverified: boolfield, modeling the stable JSON response shape returned byverify_subscription_credentials()(both return sites yield{"verified": True})dict[str, Any]toVerifyCredentialsResultcontrollers/console/workspace/trigger_providers.pypasses the result straight to Flask-RESTx for JSON serialization, and the dict is never mutated or unpackedRelated Issue
Closes part of #32863
Checklist
tests/unit_tests/services/test_trigger_provider_service.py— 49/49, including all 5verify_subscription_credentialstests)