fix(api): unify conversation and message timestamp defaults#38581
Open
Zhengcy05 wants to merge 1 commit into
Open
fix(api): unify conversation and message timestamp defaults#38581Zhengcy05 wants to merge 1 commit into
Zhengcy05 wants to merge 1 commit into
Conversation
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-07-09 08:33:39.698251192 +0000
+++ /tmp/pyrefly_pr.txt 2026-07-09 08:33:24.060098870 +0000
@@ -630,6 +630,8 @@
--> tests/test_containers_integration_tests/controllers/mcp/test_mcp.py:458:37
ERROR Class member `SessionMatcher.__eq__` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
--> tests/test_containers_integration_tests/controllers/service_api/dataset/test_dataset.py:28:9
+ERROR `in` is not supported between `Literal['webapp-logo']` and `None` [not-iterable]
+ --> tests/test_containers_integration_tests/controllers/web/test_site.py:136:16
ERROR Argument `SimpleNamespace` is not assignable to parameter `webapp_settings` with type `WebAppSettings | None` in function `controllers.web.wraps._validate_user_accessibility` [bad-argument-type]
--> tests/test_containers_integration_tests/controllers/web/test_wraps.py:77:33
ERROR Argument `SimpleNamespace` is not assignable to parameter `webapp_settings` with type `WebAppSettings | None` in function `controllers.web.wraps._validate_user_accessibility` [bad-argument-type]
@@ -2282,12 +2284,32 @@
--> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:628:33
ERROR Argument `() -> TestHitlServiceApi.test_snapshot_events_include_pause_payload_contract._SessionContext` is not assignable to parameter `session_maker` with type `sessionmaker[Session] | None` in function `services.workflow_event_snapshot_service._build_snapshot_events` [bad-argument-type]
--> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:703:27
-ERROR No matching overload found for function `typing.MutableMapping.update` called with arguments: (dict[str, object]) [no-matching-overload]
- --> tests/unit_tests/controllers/service_api/dataset/test_document.py:155:17
-ERROR Object of class `Document` has no attribute `summary_index_status` [missing-attribute]
- --> tests/unit_tests/controllers/service_api/dataset/test_document.py:185:33
-ERROR Missing argument `session` in function `services.dataset_service.DocumentService.get_document` [missing-argument]
- --> tests/unit_tests/controllers/service_api/dataset/test_document.py:377:46
+ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `limit` [bad-argument-type]
+ --> tests/unit_tests/controllers/service_api/app/test_message.py:90:63
+ERROR Argument value `Literal[101]` violates Pydantic `le` constraint `Literal[100]` for field `limit` [bad-argument-type]
+ --> tests/unit_tests/controllers/service_api/app/test_message.py:96:63
+ERROR Argument `str | None` is not assignable to parameter `obj` with type `Sized` in function `len` [bad-argument-type]
+ --> tests/unit_tests/controllers/service_api/app/test_message.py:134:20
+ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `page` [bad-argument-type]
+ --> tests/unit_tests/controllers/service_api/app/test_message.py:166:31
+ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `limit` [bad-argument-type]
+ --> tests/unit_tests/controllers/service_api/app/test_message.py:179:31
+ERROR Argument value `Literal[102]` violates Pydantic `le` constraint `Literal[101]` for field `limit` [bad-argument-type]
+ --> tests/unit_tests/controllers/service_api/app/test_message.py:184:31
+ERROR Argument `list[dict[str, Any]] | None` is not assignable to parameter `obj` with type `Sized` in function `len` [bad-argument-type]
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:111:20
+ERROR Object of class `dict` has no attribute `page` [missing-attribute]
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:219:16
+ERROR Object of class `dict` has no attribute `limit` [missing-attribute]
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:220:16
+ERROR Object of class `NoneType` has no attribute `status` [missing-attribute]
+ --> tests/unit_tests/controllers/service_api/app/test_workflow.py:351:16
+ERROR Argument `SimpleNamespace` is not assignable to parameter `obj` with type `WorkflowRun` in function `controllers.service_api.app.workflow.WorkflowRunStatusField.output` [bad-argument-type]
+ --> tests/unit_tests/controllers/service_api/app/test_workflow_fields.py:11:35
+ERROR Argument `SimpleNamespace` is not assignable to parameter `obj` with type `WorkflowRun` in function `controllers.service_api.app.workflow.WorkflowRunOutputsField.output` [bad-argument-type]
+ --> tests/unit_tests/controllers/service_api/app/test_workflow_fields.py:18:36
+ERROR Argument `SimpleNamespace` is not assignable to parameter `obj` with type `WorkflowRun` in function `controllers.service_api.app.workflow.WorkflowRunOutputsField.output` [bad-argument-type]
+ --> tests/unit_tests/controllers/service_api/app/test_workflow_fields.py:25:36
ERROR Missing argument `app_model` in function `protected_view` [missing-argument]
--> tests/unit_tests/controllers/service_api/test_wraps.py:160:36
ERROR Cannot index into `object` [bad-index]
@@ -2328,6 +2350,14 @@
--> tests/unit_tests/controllers/trigger/test_webhook.py:84:16
ERROR Cannot index into `Response` [bad-index]
--> tests/unit_tests/controllers/trigger/test_webhook.py:101:16
+ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.web.site.serialize_app_site_payload` [bad-argument-type]
+ --> tests/unit_tests/controllers/web/test_human_input_form.py:217:54
+ERROR Argument `SimpleNamespace` is not assignable to parameter `site` with type `Site` in function `controllers.web.site.serialize_app_site_payload` [bad-argument-type]
+ --> tests/unit_tests/controllers/web/test_human_input_form.py:217:65
+ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.web.site.serialize_app_site_payload` [bad-argument-type]
+ --> tests/unit_tests/controllers/web/test_human_input_form.py:251:54
+ERROR Argument `SimpleNamespace` is not assignable to parameter `site` with type `Site` in function `controllers.web.site.serialize_app_site_payload` [bad-argument-type]
+ --> tests/unit_tests/controllers/web/test_human_input_form.py:251:65
ERROR Object of class `ModuleType` has no attribute `web_ns` [missing-attribute]
--> tests/unit_tests/controllers/web/test_message_list.py:41:9
ERROR Object of class `ModuleType` has no attribute `WebApiResource` [missing-attribute]
|
Contributor
Pyrefly Type Coverage
|
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.
PR body:
Important
Fixes #<issue number>.Summary
Fixes #38553.
This PR fixes a timezone inconsistency in
ConversationandMessagetimestamps on MySQL.Previously,
created_atcould be written by DB-sideCURRENT_TIMESTAMP(), while several update paths explicitly assignedupdated_at = naive_utc_now(). Because MySQLDATETIMEdoes not store timezone information, that mixed DB-local creation timestamps with application-side UTC update timestamps and could produce an 8-hour discrepancy on non-UTC MySQL servers.This change unifies the timestamp contract for
ConversationandMessageby usingnaive_utc_nowfor bothcreated_atandupdated_atdefaults, and forupdated_aton update, while keeping the existing DBserver_defaultas a fallback. It also adds a regression test to lock in that behavior.From Codex
Screenshots
Checklist
make lint && make type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint gods