Skip to content

Fix typing transparency for alternative decorators#14

Merged
Code0x58 merged 8 commits into
masterfrom
codex/fix-pyrefly-typing-for-alternative-features
May 9, 2026
Merged

Fix typing transparency for alternative decorators#14
Code0x58 merged 8 commits into
masterfrom
codex/fix-pyrefly-typing-for-alternative-features

Conversation

@Code0x58
Copy link
Copy Markdown
Owner

@Code0x58 Code0x58 commented May 9, 2026

Summary

  • fixed typing-related issues in alternative.py so decorator-based APIs remain type-checker transparent while preserving runtime behavior
  • replaced direct method rebinding assignments with setattr in Alternatives.callable and Implementation.__call__ to satisfy type checkers without changing dispatch semantics
  • removed duplicate attribute initialization and renamed nested decorator helper functions to avoid redefinition errors
  • added a targeted cast in measure sorting to make comparator typing explicit

Validation

  • uv run --dev ruff format .
  • uv run --dev ruff format --check .
  • uv run --dev mypy .
  • uv run --dev pytest

Notes

  • pyrefly binary is not available in this environment (uv run --dev pyrefly check . fails with No such file or directory).

Codex Task

@codecov
Copy link
Copy Markdown

codecov Bot commented May 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (c9e48d7) to head (7577ece).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #14   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          195       196    +1     
=========================================
+ Hits           195       196    +1     

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

Comment thread alternative.py
@overload
def reference[**P, R](
implementation: ImplementationSig[P, R], *, default: bool = False
def reference[**P, R]( # pyrefly: ignore[inconsistent-overload]
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 this is just a temporary hack to get the pyrefly into the CI pipeline. mypy already passes so that is probably good enough. I'll get this looked into outside of Codex cloud, as that doesn't have pyrefly in the current environment

@Code0x58 Code0x58 merged commit 25629aa into master May 9, 2026
5 checks passed
@Code0x58 Code0x58 deleted the codex/fix-pyrefly-typing-for-alternative-features branch May 9, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant