Skip to content

Exception logs probe#375

Draft
rmcdaniel wants to merge 15 commits intomasterfrom
codex/probing-tentative-replay
Draft

Exception logs probe#375
rmcdaniel wants to merge 15 commits intomasterfrom
codex/probing-tentative-replay

Conversation

@rmcdaniel
Copy link
Copy Markdown
Member

Summary

This change replaces the global "any prior Workflow\\Exception log" suppression with a replay probe.

When an exception job arrives for a missing log index, we now:

  • tentatively insert that exception log inside a transaction
  • replay the workflow in a probing mode that does not dispatch missing work or execute side effects
  • keep the exception only if replay actually matches that tentative exception on the active path

This preserves the child-exception propagation fix from #348 while avoiding the later logging regression reported in #372.

Root cause

1.0.70 changed exception persistence from "one log per index" to "only the first exception log anywhere in the workflow". That deduped stale parallel sibling failures, but it also suppressed legitimate later exceptions after:

  • signal-driven retries
  • consecutive caught failures at new indexes

Heuristics like "previous log is an exception" or "same replay timestamp" were still too coarse, because real workflows can catch one exception and then legitimately hit another failure without any neutral log in between.

What changed

  • add a probing replay mode to WorkflowStub / Workflow
  • prevent probing replays from dispatching missing activities, children, timers, side effects, or versions
  • pass the failing child source class into Workflow\\Exception jobs
  • only persist a tentative exception if the probing replay matches that exact (index, class) on the live path
  • add regression coverage for:
    • signal-driven retries logging multiple sequential exceptions
    • back-to-back caught failures logging multiple sequential exceptions
    • parallel child failures still deduping to one parent exception log

Validation

Live sample-app repro with a real queue:work worker:

  • php artisan app:pr374-review retry --timeout=30
  • php artisan app:pr374-review back-to-back --timeout=30
  • php artisan app:pr374-review child --timeout=30

Workflow repo tests:

  • php vendor/bin/phpunit --testsuite unit --filter ExceptionTest
  • php vendor/bin/phpunit --testsuite feature --filter ExceptionLoggingReplayTest

@rmcdaniel rmcdaniel changed the title [codex] Probe replay before persisting exception logs Exception logs probe Apr 3, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.19%. Comparing base (0f4b774) to head (d8d4219).

Files with missing lines Patch % Lines
src/ChildWorkflowStub.php 77.77% 4 Missing ⚠️
src/Exception.php 94.64% 3 Missing ⚠️
src/Traits/Awaits.php 50.00% 2 Missing ⚠️
src/Traits/SideEffects.php 33.33% 2 Missing ⚠️
src/Traits/Timers.php 60.00% 2 Missing ⚠️
src/Traits/Versions.php 33.33% 2 Missing ⚠️
src/WorkflowStub.php 88.23% 2 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##              master     #375      +/-   ##
=============================================
- Coverage     100.00%   99.19%   -0.81%     
- Complexity       578      626      +48     
=============================================
  Files             62       62              
  Lines           2005     2118     +113     
=============================================
+ Hits            2005     2101      +96     
- Misses             0       17      +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants