typing: widget: Add typed widget outputs and JSON shapes.#1612
Open
aryan98795 wants to merge 1 commit intozulip:mainfrom
Open
typing: widget: Add typed widget outputs and JSON shapes.#1612aryan98795 wants to merge 1 commit intozulip:mainfrom
aryan98795 wants to merge 1 commit intozulip:mainfrom
Conversation
Member
|
Hello @zulip/server-refactoring members, this pull request was labeled with the "area: refactoring" label, so you may want to check it out! |
There was a problem hiding this comment.
Pull request overview
Adds stronger typing around widget (submessage) payloads and processing results, and updates widget rendering/tests to use the new structured return shapes.
Changes:
- Define
TypedDicttypes for submessages and poll/todo widget payloads/results. - Update
process_todo_widget/process_poll_widgetto return typed dict “result objects” instead of tuples. - Update message rendering and widget unit tests to consume the new result shape.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| zulipterminal/widget.py | Switch widget processors to typed result dicts and import shared widget/submessage types. |
| zulipterminal/ui_tools/messages.py | Update widget rendering to use the new {title,tasks} / {question,options} result shapes. |
| zulipterminal/model.py | Normalize stored submessage schema (use id, drop type/submessage_id). |
| zulipterminal/api_types.py | Add TypedDict definitions for submessages and poll/todo widget structures; tighten Message.submessages typing. |
| tests/widget/test_widget.py | Update widget tests to assert on new result dict shapes and use shared api_types types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d9ca6e8 to
2b035e8
Compare
Define TypedDicts for todo/poll widget outputs and JSON payloads. Update widget processing to use typed structures and casts. Update widget rendering to use the new return shape. Add a widget test fixture and normalize submessages in tests. Fixes: zulip#1576
7c18b34 to
8706f5f
Compare
4 tasks
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.
Define TypedDicts for todo/poll widget outputs and JSON payloads. Update widget processing to use typed structures and casts. Update widget rendering to use the new return shape. Add a widget test fixture and normalize submessages in tests.
Fixes: #1576
External discussion & connections
topicHow did you test this?
Self-review checklist for each commit