Skip to content

fix(models): accept unknown view state value keys - #2042

Merged
mwbrooks merged 2 commits into
mainfrom
fix/view-state-value-unknown-keys
Nov 16, 2026
Merged

mwbrooks merged 2 commits into
mainfrom
fix/view-state-value-unknown-keys

Conversation

@WilliamBergamin

Copy link
Copy Markdown
Contributor

Summary

This pull request lets ViewStateValue accept state value keys it does not model, so View(**view_payload) stops crashing on modern modals.

  • ViewStateValue.__init__ had no **kwargs, so selected_date_time, timezone, rich_text_value, and files raised TypeError. Any view payload with a datetimepicker, a timepicker with a timezone, a rich_text_input, or a file_input could not be loaded.
  • Unknown keys now land in additional_attributes, as View already does. attributes is unchanged, so to_dict() drops them (the Java SDK's Gson model drops them the same way).
  • Modeling those four keys so they round-trip is a separate follow-up.

Testing

The new tests fail on main with TypeError and pass on this branch:

  • ViewStateValue(type="datetimepicker", selected_date_time=1700000000) constructs and keeps the key in additional_attributes.
  • View(type="modal", ..., state={...datetimepicker value...}) constructs.

Category

  • slack_sdk.web.WebClient (sync/async) (Web API client)
  • slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • slack_sdk.socket_mode (Socket Mode client)
  • slack_sdk.signature (Request Signature Verifier)
  • slack_sdk.oauth (OAuth Flow Utilities)
  • slack_sdk.models (UI component builders)
  • slack_sdk.scim (SCIM API client)
  • slack_sdk.audit_logs (Audit Logs API client)
  • slack_sdk.rtm_v2 (RTM client)
  • /docs (Documents)
  • /tutorial (PythOnBoardingBot tutorial)
  • tests/integration_tests (Automated tests for this library)

Requirements

🤖 Generated with Claude Code

ViewStateValue had no **kwargs, so any state value key it does not
model (selected_date_time, timezone, rich_text_value, files) raised
TypeError, and View(**view_payload) crashed on modals with a
datetimepicker, rich_text_input, or file_input. Unknown keys now land
in additional_attributes, as View already does.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.43%. Comparing base (a078670) to head (e84ffa3).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2042      +/-   ##
==========================================
+ Coverage   84.40%   84.43%   +0.02%     
==========================================
  Files         118      118              
  Lines       14034    14035       +1     
==========================================
+ Hits        11845    11850       +5     
+ Misses       2189     2185       -4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@WilliamBergamin WilliamBergamin self-assigned this Nov 16, 2026
@WilliamBergamin WilliamBergamin added bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented semver:patch models labels Nov 16, 2026
@WilliamBergamin WilliamBergamin added this to the 3.47.1 milestone Nov 16, 2026
@WilliamBergamin
WilliamBergamin marked this pull request as ready for review November 16, 2026 16:54
@WilliamBergamin
WilliamBergamin requested a review from a team as a code owner November 16, 2026 16:54

@zimeg zimeg 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.

✅ 🐍 @WilliamBergamin LGTM! Thanks for keeping view payloads loadable.

@mwbrooks mwbrooks 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.

✅ Thanks @WilliamBergamin! Datetimepicker and file_input modals load again instead of hitting a TypeError, nice fix.

@mwbrooks
mwbrooks merged commit f4b0575 into main Nov 16, 2026
19 checks passed
@mwbrooks
mwbrooks deleted the fix/view-state-value-unknown-keys branch November 16, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented models semver:patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants