fix(M11): propagate PipelineCriticalError, redact configured secrets, signal blog failures
Correct 4 findings from the independent M11 review: #1 (Critical) — PipelineCriticalError was downgraded to PipelineWarning: - Add except PipelineCriticalError: raise before each except Exception in all 5 non-blocking steps (fetch_blog, compare, caldav_sync, synthesis, send) - Critical errors now propagate to the outer handler and stop the pipeline #2 (Critical) — redact_exception() did not use configured secrets: - Extend redact_exception() with extra_secrets parameter (upward compatible) - Harden redact_secrets(): sort extra_secrets by length descending - Add Settings.redaction_secrets() collecting all 6 SecretStr fields - Add PipelineRunner._redact(exc) using self._redaction_secrets - All except blocks in run() now use self._redact(exc) - CalDAV FAILED-status path uses full redaction_secrets collection #3 (Medium) — BlogRSSClient silently swallowed failures: - Add error field to BlogRSSFetchResult - rss.py sets error on failure paths (except Exception, bozo/invalid feed) - fetch_blog_step raises RuntimeError when result.error is set - PipelineRunner now produces PipelineWarning for blog failures #4 (Medium) — Test coverage at 80%, now 91%: - 11 new integration tests covering blog failure/success, compare failure, CalDAV failure (exception + FAILED status), send False/exception, PipelineCriticalError propagation, secret redaction with sentinel, empty agenda/homework, iCal cache cleanup - Secret redaction test uses mock (no network) and proves configured-secret propagation via non-URL sentinel in RuntimeError Validation: 619 tests pass, ruff/mypy/bandit/pre-commit green, coverage 91%. Co-authored-by: opencode/coder <coder@agents.invalid> Co-authored-by: opencode/test-engineer <test-engineer@agents.invalid>
This commit is contained in:
@@ -29,6 +29,8 @@ class BlogRSSFetchResult(BaseModel):
|
||||
réponse RSS, si elle est disponible. ``None`` par défaut.
|
||||
:param not_modified: Vaut ``True`` si le serveur a répondu avec le
|
||||
statut ``304 Not Modified``, ``False`` sinon.
|
||||
:param error: Message d'erreur expurgé si la récupération a échoué,
|
||||
``None`` sinon.
|
||||
"""
|
||||
|
||||
model_config = ConfigDict(frozen=True)
|
||||
@@ -52,3 +54,7 @@ class BlogRSSFetchResult(BaseModel):
|
||||
default=False,
|
||||
description="Vaut True si le serveur a répondu 304 Not Modified",
|
||||
)
|
||||
error: str | None = Field(
|
||||
default=None,
|
||||
description=("Message d'erreur expurgé si la récupération a échoué, None sinon"),
|
||||
)
|
||||
|
||||
@@ -131,12 +131,14 @@ class BlogRSSClient:
|
||||
if getattr(feed, "bozo", None):
|
||||
bozo_exception = getattr(feed, "bozo_exception", None)
|
||||
if bozo_exception is not None:
|
||||
error_msg = f"Flux RSS invalide : {redact_exception(bozo_exception)}"
|
||||
logger.warning(
|
||||
"Flux RSS du blog invalide (%s), ignoré : %s",
|
||||
redact_exception(bozo_exception),
|
||||
redact_url(self.rss_url),
|
||||
)
|
||||
else:
|
||||
error_msg = "Flux RSS invalide"
|
||||
logger.warning(
|
||||
"Flux RSS du blog invalide, ignoré : %s",
|
||||
redact_url(self.rss_url),
|
||||
@@ -146,6 +148,7 @@ class BlogRSSClient:
|
||||
etag=etag,
|
||||
last_modified=last_modified,
|
||||
not_modified=False,
|
||||
error=error_msg,
|
||||
)
|
||||
|
||||
articles: list[BlogArticle] = []
|
||||
@@ -234,16 +237,18 @@ class BlogRSSClient:
|
||||
not_modified=False,
|
||||
)
|
||||
except Exception as exc:
|
||||
error_msg = redact_exception(exc)
|
||||
logger.error(
|
||||
"Échec de la récupération du flux RSS du blog %s : %s",
|
||||
redact_url(self.rss_url),
|
||||
redact_exception(exc),
|
||||
error_msg,
|
||||
)
|
||||
return BlogRSSFetchResult(
|
||||
articles=(),
|
||||
etag=etag,
|
||||
last_modified=last_modified,
|
||||
not_modified=False,
|
||||
error=error_msg,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user