Skip to content

chore: track uv.lock for reproducible installs#70

Merged
javier-alvarez merged 2 commits into
mainfrom
chore/track-uv-lock
Apr 27, 2026
Merged

chore: track uv.lock for reproducible installs#70
javier-alvarez merged 2 commits into
mainfrom
chore/track-uv-lock

Conversation

@javier-alvarez
Copy link
Copy Markdown
Contributor

@javier-alvarez javier-alvarez commented Apr 27, 2026

Summary

  • Remove uv.lock from .gitignore and commit the lockfile so dependency resolution is reproducible across dev machines and CI.
  • Adjust three queue producers (kafka.py, rabbitmq.py, redis.py) to satisfy pyright's stricter narrowing in 1.1.409.

Why the queue files changed

The committed uv.lock pins pyright==1.1.409, which is stricter about narrowing Any-typed instance attributes. Each producer uses a lazy-start pattern:

self._producer: Any = None
...
async def publish(...):
    if self._producer is None:
        await self.start()      # mutates self._producer
    await self._producer.send_and_wait(...)  # pyright: still narrowed to None here

Pyright 1.1.409 narrows self._producer to None inside the is None branch and does not re-broaden across the intervening await self.start() call (it can't see that start() reassigns the attribute), so it reports reportOptionalMemberAccess on the subsequent member access. The runtime behavior is correct; the limitation is in pyright's flow analysis.

Fix: after the lazy-start block, alias the attribute into a local Any variable and use that. No behavior change.

Test plan

  • uv sync --extra dev --extra studio resolves cleanly from the committed lockfile
  • uv run pyright → 0 errors
  • uv run ruff check . && uv run ruff format --check . pass
  • uv run pytest tests/test_exposure/test_queues.py → 6 passed
  • CI passes

Remove uv.lock from .gitignore and commit the lockfile so installs
are reproducible across environments.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@javier-alvarez javier-alvarez self-assigned this Apr 27, 2026
@javier-alvarez javier-alvarez mentioned this pull request Apr 27, 2026
Pyright 1.1.409 (newly pinned via uv.lock) narrows Any-typed instance
attributes to None after an `is None` check and does not re-broaden
across the intervening `await self.start()` call. Alias the attribute
into a local Any variable after the lazy-start so type flow is clear.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@javier-alvarez javier-alvarez merged commit bcd89e0 into main Apr 27, 2026
12 checks passed
@ancongui ancongui deleted the chore/track-uv-lock branch May 31, 2026 00:44
ancongui pushed a commit that referenced this pull request May 31, 2026
chore: track uv.lock for reproducible installs
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