Skip to content

Fix undefined forward-ref type annotations and remove dead duplicate tests#258

Open
serrebidev wants to merge 1 commit into
XGDevGroup:mainfrom
serrebidev:fix/forward-ref-and-dead-tests
Open

Fix undefined forward-ref type annotations and remove dead duplicate tests#258
serrebidev wants to merge 1 commit into
XGDevGroup:mainfrom
serrebidev:fix/forward-ref-and-dead-tests

Conversation

@serrebidev

Copy link
Copy Markdown

Summary

Pre-existing lint cleanup in the server tree (none of these were introduced by an open PR; the repo's gated ruff set E9/F63/F7 stays clean, but a broader scan surfaced these).

Resolves all 14 ruff F821 undefined-name errors:

  • Three were genuine wrong class names in string annotations and would NameError under typing.get_type_hints():
    • AuthUserRecordUserRecord (core/server.py)
    • GuidedTableRuleStateGuidedTableState (core/virtual_bots.py, ×3)
    • ChaosPlayerChaosBearPlayer (games/chaosbear/game.py)
  • The rest were correct names missing their type-only imports: Table, TribeState, GnubgProcess, SorryPawnState.

Removes three dead duplicate definitions that Python silently shadowed, so they never executed:

  • test_process_leaving_game_logout_branch and test_process_leaving_game_offline_path (redefined later in test_virtual_bots.py)
  • a doubled save_state method in a test fake (test_server_admin_virtual_bots.py)

The surviving copies assert equivalent outcomes, so no coverage is lost.

Testing

  • uvx ruff check server --select F821All checks passed (was 14 errors)
  • uv run --extra dev pytest tests/test_virtual_bots.py tests/test_server_admin_virtual_bots.py91 passed
  • uv run --extra dev pytest tests/test_ageofheroes.py tests/test_backgammon.py tests/test_chaosbear.py tests/test_sorry.py145 passed
  • Import smoke of all touched modules → no import errors / cycles

🤖 Generated with Claude Code

…tests

Resolve all 14 ruff F821 undefined-name errors in the server tree. Three
were genuine wrong class names in string annotations (AuthUserRecord ->
UserRecord, GuidedTableRuleState -> GuidedTableState, ChaosPlayer ->
ChaosBearPlayer); the rest were correct names missing their type-only
imports (Table, TribeState, GnubgProcess, SorryPawnState).

Also remove three dead duplicate definitions that were silently shadowed
and never executed: two redefined test functions in test_virtual_bots.py
and a doubled save_state method in a test fake.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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