fix: don't prefill or type widgets from i2's NotSet signature default - #13
Merged
Merged
Conversation
The legacy spec builders (`infer_type`, `get_func_args_specs`, `page_funcs.*get_func_args_specs`, `get_func_elements_commands`) read defaults through the new `util.signature_defaults(sig)`, which drops params whose default is i2's `NotSet` sentinel. So a signature with NotSet defaults (as a re-landed i2mint/i2#88 FuncFactory would show) gives the same widgets as the plain one. No-op for current signatures. The `mk_app` path goes through front, fixed separately (i2mint/front#34). Uses `i2.is_not_set` when available, else falls back on `i2.deco.NotSet`. Refs i2mint/i2#48 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Member
Author
|
Independent refute-review (sub-agent): no blocking bug. Both tests fail without the fix. Normal defaults ( Its findings, and what I did about them:
|
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.
What
Step 2/3 of the re-land plan in i2mint/i2#48, for
streamlitfront: don't treat i2'sNotSetsentinel as a real default.streamlitfront.util.signature_defaults(sig):sig.defaultswithout the params whose default isNotSet.sig.defaultsdirectly:base.infer_type,base.get_func_args_specs,page_funcs.get_func_args_specs,page_funcs.special_get_func_args_specs,page_funcs.get_func_elements_commands.The current
mk_apppath builds widgets throughfront's elements and pydantic helpers. It is fixed in i2mint/front#34, and streamlitfront's own elements never readobj.default. The independent review of that PR found this legacy path (dispatch_funcs→SimplePageFunc) as the one remaining place where the sentinel would become a widget'svalue=or its inferred type.No-op against the current i2: no current signature carries
NotSet.i2 compatibility (decision)
Uses
i2.is_not_set(i2 >= 0.1.74, i2mint/i2#91) when available, otherwise falls back oni2.deco.NotSet(present since 2023). The i2 requirement is unchanged.Tests
streamlitfront/tests/test_not_set_defaults.py: for aNotSet-defaultedfoo,infer_typeand all three spec builders give the same result as for the plainfoo, and there is novalue=prefill. Both tests fail without the fix. There is also a doctest onsignature_defaults.Gate
pytest --doctest-modules streamlitfront(py3.12, scrap/examples and the two selenium-only modules ignored because selenium is not installed here): 18 passed with i2 master and with i2 0.1.73 (fallback path). Master: 16 passed.ruff check/ruff format --checkon changed files: clean.extrude,know.knowcannot be installed on this box (pyaudioneeds system portaudio).extrudeis tested below.🤖 Generated with Claude Code