Skip to content

fix(types): preserve arbitrary tm.ok result payloads - #61

Merged
marlon-costa-dc merged 1 commit into
0.12.0-devfrom
fix/tm-ok-preserve-result-payload-flext-vaw
Aug 24, 2026
Merged

fix(types): preserve arbitrary tm.ok result payloads#61
marlon-costa-dc merged 1 commit into
0.12.0-devfrom
fix/tm-ok-preserve-result-payload-flext-vaw

Conversation

@marlon-costa-dc

@marlon-costa-dc marlon-costa-dc commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Goal

Keep the no-matcher tm.ok overload generic for any Result payload while retaining the TestResultValue bound for structural matchers.

Root cause

The closed TestResultValue bound caused Mypy to degrade valid downstream Result payloads to object, producing 159 var-annotated errors in flext-infra.

Changes

  • Open only the no-kwargs overload to arbitrary TResult.
  • Retain the bounded kwargs overload.
  • Add a Pydantic payload type-inference regression.

Evidence

  • make fmt WHAT=check: 169 files formatted.
  • make check: 7/7 gates, 0 errors.
  • focused test: 1 passed.
  • Python review: no findings.

Tracker: flext-vaw


Summary by cubic

Preserves arbitrary tm.ok result payload types to restore correct type inference and prevent downstream MyPy degradations. Old: tm.ok constrained payloads to TestResultValue, often collapsing them to object. New: tm.ok(result) is generic over TResult; tm.ok(result, **kwargs) remains bounded to support structural matchers. No runtime behavior change.

  • Adjusts overloads and adds a safe cast in the kwargs path; matcher parameter validation is unchanged.
  • Adds a regression test to ensure pydantic.BaseModel payloads retain their type through tm.ok.
  • Satisfies Linear flext-vaw by eliminating spurious var-annotated errors in flext-infra; no migration required.

Written for commit 203c081. Summary will update on new commits.

Review in cubic

@sonarqubecloud

Copy link
Copy Markdown

@marlon-costa-dc
marlon-costa-dc merged commit a384620 into 0.12.0-dev Aug 24, 2026
5 checks passed
@marlon-costa-dc
marlon-costa-dc deleted the fix/tm-ok-preserve-result-payload-flext-vaw branch August 24, 2026 09:33
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