Coverage for scripts/_rhiza_common.py: 100%
5 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-07-31 06:18 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-07-31 06:18 +0000
1#!/usr/bin/env python3
2"""The two things every part of the sync pipeline needs: its error type and its logger.
4Both would naturally live in `sync.py`, but the modules it orchestrates raise the error
5and write the log lines — so keeping them there would force each extracted module to
6import its own orchestrator, which is a cycle. One small shared module is the cheaper
7answer than five copies or a circular import.
8"""
10from __future__ import annotations
12import sys
15class SyncError(Exception):
16 """A fatal, non-conflict sync failure (bad config, dirty tree, git error)."""
19def log(message: str) -> None:
20 """Emit a progress/diagnostic line to stderr.
22 stderr, not stdout: `/update` reads the sync's exit code and shows this text to the
23 user, while stdout stays free for machine-readable output.
24 """
25 print(message, file=sys.stderr)