Skip to content

Fix all type errors#152

Merged
benjibc merged 3 commits intomainfrom
cursor/fix-all-type-errors-96f4
Sep 2, 2025
Merged

Fix all type errors#152
benjibc merged 3 commits intomainfrom
cursor/fix-all-type-errors-96f4

Conversation

@benjibc
Copy link
Copy Markdown
Contributor

@benjibc benjibc commented Sep 1, 2025


name: Pull Request
about: Propose changes to the codebase
title: "Fix: Resolve type errors across reward functions and evaluation logic"
labels: ''
assignees: ''


Description

This PR addresses and resolves several type errors identified by static analysis (Pyright) across the codebase, primarily focusing on the reward_function decorator, the tau2_airline_eval function, and the lean_prover.py module.

The changes include:

  • reward_function decorator: Added precise overload signatures to eval_protocol/typed_interface.py to correctly handle both bare @reward_function and parameterized @reward_function(...) usage, satisfying static type checkers.
  • tau2_airline_eval:
    • Ensured ToolMessage receives a non-optional id by defaulting tool_call_id to an empty string if None.
    • Explicitly set env_assertions=None when constructing EvaluationCriteria.
    • Added a guard for optional task.evaluation_criteria when accessing reward_basis.
  • lean_prover.py: Implemented guards to safely handle potentially None dataset_item when constructing the info_payload dictionary, preventing optional member access errors.

These changes improve type safety and eliminate reported type errors without altering runtime behavior.

Fixes # (issue)
Implements # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Refactoring/Code cleanup
  • Build/CI/CD related changes
  • Other (please describe):

How Has This Been Tested?

The changes were verified by running static type checks using pyright. The assistant also attempted to run make pre-commit and uv run pyright during the conversation to confirm fixes.

  • Pyright type checks pass
  • Test B

Test Configuration:

  • Firmware version: N/A
  • Hardware: N/A
  • Toolchain: Python, Pyright
  • SDK: N/A

Checklist:

  • My code follows the style guidelines of this project (ran black ., isort ., flake8 .)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings (specifically type warnings)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Screenshots (if applicable)

N/A

Additional context

The primary goal was to resolve pyright errors. The user is expected to run make pre-commit locally to confirm all checks pass.


Open in Cursor Open in Web

@cursor
Copy link
Copy Markdown

cursor bot commented Sep 1, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@benjibc benjibc marked this pull request as ready for review September 2, 2025 13:43
@benjibc benjibc force-pushed the cursor/fix-all-type-errors-96f4 branch from 43ef3be to fae0deb Compare September 2, 2025 14:13
@benjibc benjibc merged commit e5cb83d into main Sep 2, 2025
8 checks passed
@benjibc benjibc deleted the cursor/fix-all-type-errors-96f4 branch September 2, 2025 14:54
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.

2 participants