python / python/mypy

subtle cache corruption when using dataclass transform leading to `Cannot determine type of "<my-dataclass-transform>" [has-type]` and a big complicated codebase (Pomodouroboros)

Open
#21,043 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Bug Report

This commit https://github.com/glyph/Pomodouroboros/commit/0d72cbb5079c87e3727a507c7752d1b053665abb prevents a mypy error, while making no semantic changes.

To Reproduce

Unfortunately I cannot construct a minimal reproducer.

  1. Check out that commit, replace the call to observify(SessionManager) with @observable() above the declaration of SessionManager.
  2. mypy src/pomodouroboros/model/sessions.py -> no error
  3. mypy src/ ->
    src/pomodouroboros/model/sessions.py:150: error: Cannot determine type of "observable"  [has-type]
    Found 1 error in 1 file (checked 58 source files)
    
  4. notice the error.

Expected Behavior

I would expect no error here, or at the very least, the same error with or without running mypy on the rest of the codebase.

Actual Behavior

See above.

Your Environment

  • Mypy version used: mypy 1.19.1 (compiled: yes)
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): see project
  • Python version used: 3.13.12

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Pomodouroboros commit and src/pomodouroboros/model/sessions.py, then run mypy src/pomodouroboros/model/sessions.py and mypy src/ as described. Compare the results with and without the @observable() change, using the reported mypy and Python versions. Done means the cache-related error is reproducible and resolved consistently for both invocation scopes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.