Skip to content

fix(app): decode chat sessions through a generated wire type - #19945

Merged
Git-on-my-level merged 2 commits into
mainfrom
lane/chat-sessions-generated-schema
Sep 30, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
lane/chat-sessions-generated-schema

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

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 on main since #19838 (assert 1 == 0, remaining_manual_dart_json_schema_file_count). #19838 added app/lib/backend/schema/chat_session.dart with a hand-written ChatSessionSummary.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 touched backend/.

  • Spec: /v2/chat-sessions is added to APP_CLIENT_PREFIXES (backend/scripts/export_openapi.py). docs/api-reference/app-client-openapi.json is regenerated, and so are the Swift and TypeScript generated clients (operation functions only, no new named types).
  • Dart wire type: new chat_sessions generator group → app/lib/backend/schema/gen/chat_sessions_wire.g.dart (GeneratedChatSessionResponse).
  • Adapter: ChatSessionSummary.fromJson now decodes through the generated type, via fromGenerated. ChatSessionsApi keeps 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_at falls back to created_at. This covers the create route's answer, which carries only created_at.
    • A missing or mistyped title or preview reads as empty, a missing count as 0 and a missing star as unstarred. A fractional count is converted to an integer.
    • An id and one parseable timestamp are still required. A present but unparseable updated_at is still rejected, with no fallback, exactly as before.
    • Times are still converted to local time.

Verification

  • Backend, via the test.sh file 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 --check through scripts/openapi_runner.sh passes, and so does generate_dart_models.py --all --check.
  • App: new test/backend/chat_session_schema_test.dart (9 tests) plus the existing chat_sessions_api_test, chat_history_state_test and past_chats_page_test: 29 passed. Parity check: the 9 new tests also pass against the old hand-written decoder from origin/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.yml path filters do not include app/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

Review in cubic

Git-on-my-level and others added 2 commits September 30, 2026 13:27
#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]>
@mintlify

mintlify Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
omi 🟢 Ready View Preview Sep 30, 2026, 6:49 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-30T06:53:44.585282Z c80e9b2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

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

1 active deployment
staging - docs — c80e9b27 Deployed Sep 30, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant