Repository navigation
fix(app): decode chat sessions through a generated wire type - #19945
Merged
Merged
Conversation
#19838 added ChatSessionSummary with a hand-written fromJson, which the app-client schema inventory counts as a remaining manual DTO; main has failed test_app_client_schema_inventory since (latent: that PR touched no backend path, so the backend shard never ran). - /v2/chat-sessions joins the app-client OpenAPI export; the spec and the Swift/TS generated clients are regenerated. - New chat_sessions generator group -> chat_sessions_wire.g.dart (GeneratedChatSessionResponse). - ChatSessionSummary.fromJson now decodes through the generated type, keeping the old tolerance: updated_at falls back to created_at, a mistyped/missing title or preview reads empty, a missing count 0, a missing star unstarred; an id and one parseable timestamp stay required; times are shown in local time. The new tests pass against both the old decoder and the new one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This branch was successfully deployed
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
Fixes the backend unit test
test_app_client_schema_inventory::test_inventory_separates_generated_backed_adapters_from_raw_manual_dtos, which has been failing onmainsince #19838 (assert 1 == 0,remaining_manual_dart_json_schema_file_count). #19838 addedapp/lib/backend/schema/chat_session.dartwith a hand-writtenChatSessionSummary.fromJson. It touched no backend path, so the backend unit shard never ran on it. The failure first showed up on #19887, the next PR that touchedbackend/./v2/chat-sessionsis added toAPP_CLIENT_PREFIXES(backend/scripts/export_openapi.py).docs/api-reference/app-client-openapi.jsonis regenerated, and so are the Swift and TypeScript generated clients (operation functions only, no new named types).chat_sessionsgenerator group →app/lib/backend/schema/gen/chat_sessions_wire.g.dart(GeneratedChatSessionResponse).ChatSessionSummary.fromJsonnow decodes through the generated type, viafromGenerated.ChatSessionsApikeeps calling it, and the inventory now classifies both files as generated-backed. The old tolerance is kept by filling the contract's required fields the way the old decoder read them:updated_atfalls back tocreated_at. This covers the create route's answer, which carries onlycreated_at.updated_atis still rejected, with no fallback, exactly as before.Verification
test.shfile list:test_app_client_schema_inventory.py(12 passed),test_app_client_swift_generator.py,test_app_client_ts_generator.py.export_openapi.py --app-client --checkthroughscripts/openapi_runner.shpasses, and so doesgenerate_dart_models.py --all --check.test/backend/chat_session_schema_test.dart(9 tests) plus the existingchat_sessions_api_test,chat_history_state_testandpast_chats_page_test: 29 passed. Parity check: the 9 new tests also pass against the old hand-written decoder fromorigin/main, so decoding behaviour is unchanged.Layer: unit and widget tests. Not verified against a live backend.
Follow-up (not in this PR):
backend-unit-tests.ymlpath filters do not includeapp/lib/backend/**, although this inventory test reads those files. An app-only PR can therefore break it without the check ever running. That is the class declared below.Product invariants affected
none
Failure class (fixes)
Failure-Class: FC-path-filter-masks-default-branch-health
🤖 Generated with Claude Code