← Back to Pull requests

feat(log): add stopChainOnFailure handler option #10578

Open
unknown opened this pull request with 319 lines diff across 3 files
View on GitHub
unknown unknown commented on Sep 21, 2026 18:13 UTC
Author

Note: This PR originally changed HandlerInterface::handle() to return int with RESULT_CONTINUE /

RESULT_STOP constants. That approach was dropped after review in favour of a config option. Review comments the force-push refer to the original implementation.
Follow-up to #10560.
Logger::log() stops running handlers when one returns false from handle(). FileHandler and ErrorlogHandler
return false when a write fails, so one failing handler (e.g. FileHandler with bad permissions on the log directory) silently prevents every handler after it from logging. A configured ErrorlogHandler fallback never runs and the log
entry is lost.

This PR adds a per-handler option, stopChainOnFailure, for FileHandler and ErrorlogHandler, set in the handler
settings of Config\Logger:

  • true (default, also when the key is missing): a failed write returns false and stops the chain. Same as today. - false: a failed write returns true, so the handlers after it still run.
  • The option is read in BaseHandler, so custom handlers extending it can use it as well. Custom handlers can still return false to stop the chain on purpose.

    There is no breaking change:

  • HandlerInterface::handle() still returns bool, and Logger::log() is not modified.

  • The default keeps the current behavior, so existing app/Config/Logger.php files work unchanged.

  • BaseHandler gains a new protected property, bool $stopChainOnFailure.
  • Project files:

  • app/Config/Logger.php: stopChainOnFailure added to the FileHandler block and to the commented ErrorlogHandler block. The @var type of $handlers now includes bool (same in MockLogger).
  • Tests:

  • LoggerTest: a FileHandler pointed at a missing directory followed by TestHandler. With the default, the second handler does not log. With 'stopChainOnFailure' => false, it does.

  • FileHandlerTest and ErrorlogHandlerTest: default, explicit true, and false on a failed write. FileHandlerTest also covers a successful write with false.
  • User guide:

  • general/logging.rst: new section "Stopping the Handler Chain on Failure" with an example.

  • v4.8.0.rst: entry under Enhancements.

  • upgrade_480.rst: app/Config/Logger.php listed under the config content changes.
  • Checklist:

  • Securely signed commits

  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)

  • Unit testing, with >80% coverage

  • User guide updated

  • Conforms to style guide
  • Diff: 319 lines (+239 / -80) across 3 files Reviewer: neznaika0 Review duration: 17814m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.40) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 319 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.345
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #10578"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.4% (MEDIUM) · Higher = larger blast radius
    40.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 21.6% · Safe to merge
    21.6%