fix(harness): preserve session migration JSON errors
This commit is contained in:
@@ -149,3 +149,29 @@ session while the adapter executes as `thoth_sessions_runtime`.
|
||||
- Task 7 must safely provision the dedicated runtime login/membership and inject its TLS
|
||||
credentials/CA; this task intentionally does not create a deployment-specific LOGIN role or
|
||||
password.
|
||||
|
||||
## Review follow-up — unavailable migration database JSON contract
|
||||
|
||||
### RED
|
||||
|
||||
Command:
|
||||
|
||||
```sh
|
||||
cd harness && .venv/bin/pytest \
|
||||
tests/test_session_migrate_cmd.py::test_session_migrate_status_database_failure_is_pristine_json -q
|
||||
```
|
||||
|
||||
Result: `1 failed in 0.46s`. The unreachable direct PostgreSQL URL exited with code 1 but left
|
||||
stdout empty, so `json.loads(result.stdout)` raised `JSONDecodeError`.
|
||||
|
||||
### GREEN
|
||||
|
||||
The session migration CLI now catches `SQLAlchemyError` at the same command boundary as its
|
||||
migration/domain errors and emits only `{"error": ...}` on stdout for `--json`.
|
||||
|
||||
```sh
|
||||
cd harness && .venv/bin/pytest tests/test_session_migrate_cmd.py -q
|
||||
cd harness && .venv/bin/ruff check tht/cli/session_cmd.py tests/test_session_migrate_cmd.py
|
||||
```
|
||||
|
||||
Result: `2 passed in 3.60s`; Ruff: `All checks passed!`.
|
||||
|
||||
Reference in New Issue
Block a user