Skip to content

feat(process): add ProcessJsonDecodeError and remove run_sync/pipe_sync#108

Open
bedus-creation wants to merge 3 commits into
mainfrom
feat/process-output-json-remove-run-sync
Open

feat(process): add ProcessJsonDecodeError and remove run_sync/pipe_sync#108
bedus-creation wants to merge 3 commits into
mainfrom
feat/process-output-json-remove-run-sync

Conversation

@bedus-creation

Copy link
Copy Markdown
Contributor

Summary

  • Add ProcessJsonDecodeError — new ValueError subclass in exception.py with stdout and original attributes, providing a rich error message that includes the raw output
  • Update output_json() — now raises ProcessJsonDecodeError (wrapping the original json.JSONDecodeError) instead of letting json.JSONDecodeError propagate naked
  • Remove run_sync() / pipe_sync() from both PendingProcess and the Process facade — the process module is async-first; sync helpers are removed to reduce surface area
  • Test updates — remove TestPendingProcessRunSync and TestProcessRunSync; add TestProcessResultJson (4 tests); update test_result.py to expect the new exception type

Test plan

  • All 105 process tests pass (uv run pytest tests/process/ -v)
  • TestProcessResultJson::test_output_json_returns_dict — valid JSON dict round-trips correctly
  • TestProcessResultJson::test_output_json_returns_list — valid JSON list round-trips correctly
  • TestProcessResultJson::test_output_json_raises_on_invalid_jsonProcessJsonDecodeError raised on bad input
  • TestProcessResultJson::test_output_json_error_contains_raw_output — exception message includes the raw stdout

🤖 Generated with Claude Code

bedus-creation and others added 3 commits June 10, 2026 15:24
- Add ProcessJsonDecodeError(ValueError) to exception.py with stdout and original attributes
- Update output_json() in ProcessResult to raise ProcessJsonDecodeError on invalid JSON instead of bare json.JSONDecodeError
- Remove run_sync() and pipe_sync() from PendingProcess and Process facade (async-only API)
- Remove Sync API mentions from Process class docstring
- Delete TestPendingProcessRunSync and TestProcessRunSync test classes
- Add TestProcessResultJson with 4 tests covering dict/list parsing and error behaviour
- Update test_result.py to expect ProcessJsonDecodeError instead of json.JSONDecodeError

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace the blocking subprocess.run() call in PendingProcess.run() tty
branch with asyncio.create_subprocess_shell() passing stdin/stdout/stderr
as None so the child inherits the parent's real TTY. Timeout is honoured
via asyncio.wait_for(); ProcessTimedOutException is raised on expiry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant