Skip to content

Revert #88: FuncFactory NotSet signature defaults break signature consumers - #89

Merged
thorwhalen merged 1 commit into
masterfrom
revert-88-funcfactory-notset
Sep 22, 2026
Merged

thorwhalen merged 1 commit into
masterfrom
revert-88-funcfactory-notset

Conversation

@thorwhalen

Copy link
Copy Markdown
Member

Why

Post-merge adversarial review of #88 (which closed #48). #88 gave every non-defaulted FuncFactory param a NotSet sentinel default in the factory's __signature__. The call behaviour is unchanged, but the signature is public API, and several i2 dependents build things from it. They read the sentinel as a real default value:

Consumer Before #88 After #88
front IntInputBase/FloatInputBase for an int/float param of a FuncFactory view value 0 TypeError: int() argument must be ... not 'Sentinel' at element init
front TextInputBase for a str param view value '' prefilled with the literal text 'NotSet', which gets submitted as a real string (not the sentinel, so FuncFactory does not filter it)
py2http.service.mk_routes_and_openapi_specs([factory]) spec is JSON-serializable TypeError: Object of type Sentinel is not JSON serializable, and the params stop being listed as required

streamlitfront's examples/data_prep.py (and know's equivalents) feed Sig(FuncFactory(...)) straight into KwargsInput, so they hit the front path.

The test suites of front, streamlitfront, meshed, ju and slang give the same result before and after #88. None of them covers a FuncFactory signature going through a UI or schema. That is why #88's dependents check did not catch this.

What

The plan for re-landing #48 without breaking consumers is written in #48.

Gate

  • pytest --doctest-modules i2: 762 passed, 2 xfailed
  • black --check -S on the changed files: clean
  • Hosted CI: see checks on this PR

Review: independent post-merge review of #88. This revert itself is self-reviewed only (the reviewing session was told not to spawn sub-agents).

🤖 Generated with Claude Code

…ired params (#88)"

This reverts commit 70125c0.

Post-merge adversarial review found that putting a NotSet sentinel default
on every FuncFactory param breaks signature-driven consumers in the fleet:

- front input elements: an int/float-annotated param crashes at element
  init (int(NotSet) -> TypeError); str params prefill the literal text
  "NotSet", which is then passed as a real value.
- py2http: the OpenAPI spec built for a FuncFactory is no longer
  JSON-serializable (Object of type Sentinel), and its params stop being
  listed as required.

Adds a regression test pinning the FuncFactory signature contract (the
wrapped function's defaults, no sentinel ones) until consumers are made
sentinel-aware. Re-landing plan is in #48.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@thorwhalen
thorwhalen merged commit fa1a1b3 into master Sep 22, 2026
8 checks passed
@thorwhalen
thorwhalen deleted the revert-88-funcfactory-notset branch September 22, 2026 14:04
@thorwhalen thorwhalen mentioned this pull request Sep 22, 2026
2 tasks done
thorwhalen added a commit that referenced this pull request Sep 22, 2026
Module map centered on signatures.py/deco.py/wrapper.py, verified test
command (legacy isee CI, no lint gate), the i2#88/#89 breaking-change
postmortem as a standing invariant, and the 50-package dependent list.
Docs-only.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
@thorwhalen

Copy link
Copy Markdown
Member Author

round-3 review: one defect, now fixed. This PR's body says "#88 (which closed #48)", and GitHub read "closed #48" as a closing keyword, so merging it re-closed #48 with nothing landed. #48 is reopened. Also checked: the code is byte-identical to pre-#88 (the only other diffs are setup.cfg and the new test), and test_deco.py fails on #88's code (required_names == []) and passes on master (762 passed).

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.

Using a NotSet sentinel to solve make FuncFactory instances' signature more truthful about argument requirements.

1 participant