Address code review: fix 12 issues in server status command
1. Gate 'Connecting to...' message behind non-JSON output check
2. Fix control flow: each branch handles its own exit explicitly
3. Replace raise typer.Exit(0) with return on success path
4. Move get_client to top-level import (consistent with all CLI modules)
5. Remove redundant quotes from 'str | None' annotation
6. Replace orjson with stdlib json for simple serialization
7. Remove fragile _extract_json test helper (no longer needed after #1)
8. Update test mock target to prefect.cli.server.get_client
9. Use deterministic time mocking via _monotonic reference
10. Add test for api_url is None case
11. Normalize output check with is_json flag
12. Centralize output formatting to reduce duplication
Co-Authored-By: alex.s@prefect.io <ajstreed1@gmail.com>
Fix Runner to honor documented heartbeat_seconds default
Runner.__init__ docstring promises that if heartbeat_seconds is not
provided, it will default to PREFECT_FLOWS_HEARTBEAT_FREQUENCY, but
the implementation was just storing None.
This caused all workers (Process, Docker, Kubernetes, ECS, etc.) to
fail to emit heartbeats, triggering false positives in zombie flow
detection.
Fixes the root cause in one place rather than patching all callsites.
Regression from PR #19641 which moved heartbeats from runner to flow
engine but didn't update Runner.__init__ to apply the default.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix flaky test: increase SQLite busy_timeout for test mode
The test_get_runs_in_queue_concurrency_limit_and_limit test was
intermittently failing with httpx.ReadError because the hosted API
server subprocess encountered SQLite lock contention during parallel
test execution (pytest-xdist). The 5-second busy_timeout in test mode
was insufficient, causing the server to fail and close the connection.
Remove the test-specific 5s busy_timeout and use the same 60s timeout
for all modes. This gives SQLite enough time to handle lock contention
during parallel test execution without significantly impacting test
performance.
Co-Authored-By: unknown <>