Skip to content

test: move webhook service coverage to unit tests - #38945

Open
asukaminato0721 wants to merge 9 commits into
langgenius:mainfrom
asukaminato0721:agent/migrate-webhook-service-unit
Open

test: move webhook service coverage to unit tests#38945
asukaminato0721 wants to merge 9 commits into
langgenius:mainfrom
asukaminato0721:agent/migrate-webhook-service-unit

Conversation

@asukaminato0721

Copy link
Copy Markdown
Contributor

What changed

Moves unit-level coverage out of the Testcontainers integration suite. Database-dependent unit paths use real in-memory SQLite sessions, while genuine container-backed coverage remains in the integration suite.

Why

These cases mocked their service or session boundaries and therefore did not exercise container infrastructure. Keeping them in the unit suite makes their ownership and runtime requirements explicit.

Impact

Production behavior is unchanged. Test classification is more accurate and the integration suite avoids unit-only work.

Validation

  • Ruff passed for all changed Python files.
  • Changed unit suite: 662 passed.
  • Remaining changed integration suite: 71 tests collected successfully.

Reclassify unit-level coverage from tests/test_containers_integration_tests/services/test_webhook_service.py into the unit test suite, or remove it when equivalent unit coverage already exists. Preserve real container-backed coverage and use SQLite sessions for database-dependent unit paths.
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-08-04 11:10:47.159159260 +0000
+++ /tmp/pyrefly_pr.txt	2026-08-04 11:10:33.658157230 +0000
@@ -1206,28 +1206,6 @@
    --> tests/test_containers_integration_tests/services/test_webapp_auth_service.py:345:20
 ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
    --> tests/test_containers_integration_tests/services/test_webapp_auth_service.py:715:20
-ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:293:88
-ERROR Argument `dict[str, dict[str, str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:312:83
-ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:333:83
-ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:355:88
-ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:380:83
-ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:402:83
-ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:425:88
-ERROR Argument `dict[str, dict[Unknown, Unknown]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.generate_webhook_response` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:483:79
-ERROR Argument `dict[str, dict[str, int | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.generate_webhook_response` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:493:79
-ERROR Argument `dict[str, dict[str, int | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.generate_webhook_response` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:503:79
-ERROR Argument `dict[str, dict[str, int | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.generate_webhook_response` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:512:79
 ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/services/test_webhook_service_relationships.py:40:72
 ERROR Class `WebhookServiceRelationshipFactory` has no class attribute `_read_cache` [missing-attribute]
@@ -6555,13 +6533,13 @@
 ERROR Object of class `NoneType` has no attribute `assert_called_once_with` [missing-attribute]
    --> tests/unit_tests/core/workflow/nodes/test_document_extractor_node.py:211:9
 ERROR Object of class `FunctionType` has no attribute `return_value` [missing-attribute]
-   --> tests/unit_tests/core/workflow/nodes/test_if_else.py:240:5
+   --> tests/unit_tests/core/workflow/nodes/test_if_else.py:247:5
 ERROR Argument `dict[str, list[dict[str, Any]] | str]` is not assignable to parameter `node_data` with type `IfElseNodeData | dict[str, object]` in function `_build_if_else_node` [bad-argument-type]
-   --> tests/unit_tests/core/workflow/nodes/test_if_else.py:326:19
+   --> tests/unit_tests/core/workflow/nodes/test_if_else.py:333:19
 ERROR Argument `dict[str, list[dict[str, list[str] | str]] | str]` is not assignable to parameter `node_data` with type `IfElseNodeData | dict[str, object]` in function `_build_if_else_node` [bad-argument-type]
-   --> tests/unit_tests/core/workflow/nodes/test_if_else.py:388:19
+   --> tests/unit_tests/core/workflow/nodes/test_if_else.py:398:19
 ERROR Argument `dict[str, list[dict[str, list[dict[str, list[str] | str]] | str]] | str]` is not assignable to parameter `node_data` with type `IfElseNodeData | dict[str, object]` in function `_build_if_else_node` [bad-argument-type]
-   --> tests/unit_tests/core/workflow/nodes/test_if_else.py:453:19
+   --> tests/unit_tests/core/workflow/nodes/test_if_else.py:466:19
 ERROR `Literal['{invalid-json-schema']` is not assignable to attribute `json_schema` with type `dict[str, Any] | None` [bad-assignment]
    --> tests/unit_tests/core/workflow/nodes/test_start_node_json_object.py:208:28
 ERROR Object of class `ModuleType` has no attribute `TraceQueueManager` [missing-attribute]
@@ -8143,23 +8121,33 @@
 ERROR Argument `list[File]` is not assignable to parameter `value` with type `list[object]` in function `services.variable_truncator.VariableTruncator._truncate_array` [bad-argument-type]
    --> tests/unit_tests/services/test_variable_truncator.py:751:44
 ERROR Argument `dict[str, dict[Unknown, Unknown]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.generate_webhook_response` [bad-argument-type]
-   --> tests/unit_tests/services/test_webhook_service.py:250:79
+   --> tests/unit_tests/services/test_webhook_service.py:310:79
 ERROR Argument `dict[str, dict[str, int | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.generate_webhook_response` [bad-argument-type]
-   --> tests/unit_tests/services/test_webhook_service.py:260:79
+   --> tests/unit_tests/services/test_webhook_service.py:320:79
 ERROR Argument `dict[str, dict[str, int | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.generate_webhook_response` [bad-argument-type]
-   --> tests/unit_tests/services/test_webhook_service.py:270:79
+   --> tests/unit_tests/services/test_webhook_service.py:330:79
 ERROR Argument `dict[str, dict[str, int | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.generate_webhook_response` [bad-argument-type]
-   --> tests/unit_tests/services/test_webhook_service.py:279:79
+   --> tests/unit_tests/services/test_webhook_service.py:339:79
 ERROR Argument `dict[str, dict[str, int | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.generate_webhook_response` [bad-argument-type]
-   --> tests/unit_tests/services/test_webhook_service.py:288:79
+   --> tests/unit_tests/services/test_webhook_service.py:348:79
 ERROR Argument `dict[str, dict[str, int | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.generate_webhook_response` [bad-argument-type]
-   --> tests/unit_tests/services/test_webhook_service.py:298:79
+   --> tests/unit_tests/services/test_webhook_service.py:358:79
 ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
-   --> tests/unit_tests/services/test_webhook_service.py:544:88
+   --> tests/unit_tests/services/test_webhook_service.py:604:88
 ERROR Argument `dict[str, dict[str, str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
-   --> tests/unit_tests/services/test_webhook_service.py:571:83
+   --> tests/unit_tests/services/test_webhook_service.py:631:83
 ERROR Argument `dict[str, dict[str, str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
-   --> tests/unit_tests/services/test_webhook_service.py:591:83
+   --> tests/unit_tests/services/test_webhook_service.py:651:83
+ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
+   --> tests/unit_tests/services/test_webhook_service.py:669:79
+ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
+   --> tests/unit_tests/services/test_webhook_service.py:688:84
+ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
+   --> tests/unit_tests/services/test_webhook_service.py:710:79
+ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
+   --> tests/unit_tests/services/test_webhook_service.py:729:79
+ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
+   --> tests/unit_tests/services/test_webhook_service.py:747:84
 ERROR Argument `dict[str, str | dict[str, str]]` is not assignable to parameter `webhook_data` with type `RawWebhookDataDict` in function `services.trigger.webhook_service.WebhookService._validate_http_metadata` [bad-argument-type]
    --> tests/unit_tests/services/test_webhook_service_additional.py:238:57
 ERROR Argument `dict[str, dict[str, int] | dict[str, str]]` is not assignable to parameter `webhook_data` with type `RawWebhookDataDict` in function `services.trigger.webhook_service.WebhookService.build_workflow_inputs` [bad-argument-type]

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 57.26% 57.29% +0.04%
Strict coverage 56.83% 56.87% +0.04%
Typed symbols 36,938 36,949 +11
Untyped symbols 27,782 27,748 -34
Modules 3095 3095 0

@asukaminato0721
asukaminato0721 marked this pull request as ready for review July 14, 2026 09:34
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 14, 2026
Allow callers to provide an externally owned Session and pass a real SQLite Session in unit coverage.
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jul 14, 2026
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jul 14, 2026
@WH-2099 WH-2099 closed this Jul 16, 2026
@WH-2099 WH-2099 reopened this Jul 17, 2026
@asukaminato0721
asukaminato0721 force-pushed the agent/migrate-webhook-service-unit branch from 12b73ec to 4562db4 Compare July 22, 2026 09:03
Comment thread api/tests/test_containers_integration_tests/services/test_webhook_service.py Outdated
@asukaminato0721
asukaminato0721 force-pushed the agent/migrate-webhook-service-unit branch from d0a9059 to f77169c Compare July 28, 2026 14:56
@asukaminato0721
asukaminato0721 requested a review from 41tair July 28, 2026 14:56

@41tair 41tair left a comment

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.

Integration failed

@asukaminato0721
asukaminato0721 force-pushed the agent/migrate-webhook-service-unit branch from f77169c to 9d193f8 Compare August 4, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants