fix(cli): format Granian worker import errors as JSON

Closed
HA
2mo ago
+82-13

Fixes #7196.

When running  reflex run --json , backend worker import failures from Granian were printed as plain-text multiprocessing tracebacks, breaking consumers that parse stderr as JSON lines.

This change:

• Adds a Reflex-managed Granian target loader for backend workers.
• Logs worker application import failures as structured JSON records.
• Includes the full traceback in the  exception  field.
• Applies to development and Granian production backend paths.
• Preserves the existing plain traceback behavior when  --json  is not enabled.
• Adds regression tests and a changelog fragment.

Validation

•  74 passed, 1 skipped 
• Ruff check passed
• Ruff format check passed
• Pyright passed
• Ty passed
• Codespell passed
• Biome format passed
• Manual backend verification passed with  --backend-only --json 
• Confirmed no  Process granian-worker:  or raw traceback lines are emitted in JSON mode