Skip to content

Handle added and removed dynamic widget properties - #134

Open
Bortlesboat wants to merge 1 commit into
openai:mainfrom
Bortlesboat:fix/validated-server-behavior
Open

Bortlesboat wants to merge 1 commit into
openai:mainfrom
Bortlesboat:fix/validated-server-behavior

Conversation

@Bortlesboat

Copy link
Copy Markdown

Adding or removing a property in a dynamic widget template can raise AttributeError during diff_widget(). For example, changing a card from {"type": "Card", "children": []} to the same card with "size": "sm" accesses size on the earlier model, where it does not exist.

Compare missing fields as None, consistent with optional widget properties, so these changes emit the documented root replacement. Regression tests cover adding and removing both a root Card.size property and a nested Text.color property, and check the replacement payload.

Validation with locked dependencies:

  • Four regression cases failed with the expected AttributeError before the fix.
  • Widget tests: 20 passed; full suite: 134 passed.
  • Full Ruff lint and Pyright passed; git diff --check passed.

Tests ran locally on Windows without API calls. Browser rendering was not tested.

This branch has not been deployed

No deployments
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