chore: switch to ty type checker
ty is astral's new extremely fast python type checker written in rust.
this replaces mypy in pre-commit with ty while keeping mypy for the
pytest-mypy-plugins typesafety tests.
starting with permissive rules - all existing errors are ignored for now
and can be gradually enabled as we fix them.
see https://astral.sh/blog/ty
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
fix: cancel orphaned flow runs when deployment is deleted during concurrency wait
When a flow run is waiting in AwaitingConcurrencySlot state and its deployment
is deleted, the worker would previously keep polling the run indefinitely. The
server's SecureFlowConcurrencySlots rule returns an ABORT when the deployment
doesn't exist, but the worker only logged this and returned False, leaving the
run stuck.
This fix cancels the run when we receive a "Deployment not found" abort,
preventing the infinite polling loop and giving users visibility that the run
was terminated due to deployment deletion.
Also adds regression tests for:
- Server correctly updating next_scheduled_start_time on concurrency rejection
- Worker cancelling runs on deployment-not-found abort
- Worker NOT cancelling runs for other abort reasons (like concurrency limit=0)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fix deployment concurrency slot starvation bug
When a flow run is rejected to AwaitingConcurrencySlot state, its
scheduled_time was set to now + 30 seconds (concurrency_slot_wait_seconds
default). However, workers poll for runs with scheduled_before = now + 10
seconds (prefetch_seconds default).
This mismatch caused runs to be invisible to workers for 20+ seconds,
and if the slot was still unavailable when finally polled, they'd be
rescheduled another 30 seconds out - creating indefinite starvation.
Fix: Reduce concurrency_slot_wait_seconds default from 30s to 5s, ensuring
runs become visible within the worker's prefetch window.
Adds regression tests:
- test_enqueued_runs_acquire_slots_after_release
- test_enqueued_runs_visible_in_worker_polling_query
- test_awaiting_concurrency_slot_visible_within_worker_prefetch_window
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>