Skip to content

refactor(workflow): S15 self-healing policy deletion#1588

Merged
gsxdsm merged 2 commits into
feature/workflow-owned-merge-s08-workflow-owned-merge-processingfrom
feature/workflow-owned-merge-s15-self-healing-policy-deletion
Jun 17, 2026
Merged

refactor(workflow): S15 self-healing policy deletion#1588
gsxdsm merged 2 commits into
feature/workflow-owned-merge-s08-workflow-owned-merge-processingfrom
feature/workflow-owned-merge-s15-self-healing-policy-deletion

Conversation

@gsxdsm

@gsxdsm gsxdsm commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Stack Slice

  • Slice: S15
  • Milestone: Deletion
  • Base branch: feature/workflow-owned-merge-s14-project-engine-merge-queue-deletion
  • Full plan: docs/plans/2026-06-09-003-refactor-workflow-owned-merge-full-migration-slices-plan.md

Goal

Delete self-healing direct lifecycle mutations for merge/retry tasks after recovery events cover all cases.

Dependency

S10 recovery events, S11 branch-group subgraphs, and S14 merge queue deletion.

Expected Scope

packages/engine/src/self-healing.ts; self-healing audit docs; recovery event and deletion tests.

Expected Tests

Direct move/pause/requeue/retry-reset patterns absent for merge/retry surfaces, valid held states no-op, recovery facts include audit context.

Exit Gate

Search tests fail on direct self-healing merge/retry lifecycle mutation patterns.

Status

Draft stack placeholder. This PR reserves ordering and review context; implementation should replace or extend the handoff artifact before this slice is marked ready.

Implementation Added

  • Added self-healing policy deletion guard test for workflow-recovery-events.\n- The guard fails if recovery fact publishing directly moves/updates tasks, enqueues merge, or mutates merge request state.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 24c1ce67-f92b-4d7c-935c-8371c3487e18

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/workflow-owned-merge-s15-self-healing-policy-deletion

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s14-project-engine-merge-queue-deletion branch from 264d113 to 25f4de6 Compare June 9, 2026 20:31
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s15-self-healing-policy-deletion branch from dec019d to 40336f7 Compare June 9, 2026 20:31
@gsxdsm gsxdsm marked this pull request as ready for review June 9, 2026 20:35
@greptile-apps

greptile-apps Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR wires publishWorkflowRecoveryEvent into the two transient-merge and completion-handoff-limbo recovery paths in self-healing.ts, adds a publication-failure resilience test, and introduces a static guard test that enforces the event-sourcing contract between self-healing.ts and workflow-recovery-events.ts. Both call-sites are guarded with try/catch so a publication error cannot bypass the existing requeue logic.

  • self-healing.ts gains two publishWorkflowRecoveryEvent calls (one per recovery path), each isolated in try/catch so failures log a warning without blocking the recovery requeue.
  • workflow-recovery-events.ts (new) implements the event publisher and a recoveryRunIdForPublish helper that avoids reusing terminal work-item run IDs.
  • Two new tests cover the publication-failure resilience path and the static structure of both files; however the resilience test never actually reaches upsertWorkflowWorkItem due to a chaining bug in the helper.

Confidence Score: 3/5

The existing recovery requeue logic is unaffected, but the new event publication feature is broken for stores that don't implement the optional listWorkflowWorkItemsForTask method, and the test that was written to guard against publication-error bypass never actually exercises upsertWorkflowWorkItem.

Two defects in the newly introduced code: recoveryRunIdForPublish chains .find() directly after an optional method call, so any store omitting listWorkflowWorkItemsForTask gets a silently swallowed TypeError instead of a published event. The resilience test's mock upsertWorkflowWorkItem is never reached for the same reason, leaving the guard path it was meant to cover untested.

packages/engine/src/workflow-recovery-events.ts (the chaining bug) and packages/engine/src/__tests__/self-healing.test.ts (the unreachable mock).

Important Files Changed

Filename Overview
packages/engine/src/workflow-recovery-events.ts New file implementing recovery event publication; contains a chaining bug where .find() is used instead of ?.find() after an optional method call, silently breaking publication for stores that don't implement listWorkflowWorkItemsForTask.
packages/engine/src/tests/self-healing.test.ts New guard test for publication resilience passes but exercises the wrong failure path — upsertWorkflowWorkItem mock is never reached due to the recoveryRunIdForPublish TypeError; test needs listWorkflowWorkItemsForTask mocked alongside upsertWorkflowWorkItem to cover the intended scenario.
packages/engine/src/self-healing.ts Adds two guarded publishWorkflowRecoveryEvent calls (transient-merge-failure and completion-handoff-limbo), both wrapped in try/catch so publication failures cannot interrupt the existing recovery flow.
packages/engine/src/tests/workflow-self-healing-policy-deletion.test.ts Exit-gate guard test checks positive wiring assertions on self-healing.ts and negative mutation assertions on workflow-recovery-events.ts; correctly addresses the prior reviewer concern about reading the wrong file.
docs/plans/workflow-owned-merge-stack/s15-self-healing-policy-deletion.md Placeholder plan doc for S15 slice; documentation only, no code logic.

Reviews (8): Last reviewed commit: "fix(FN-000): guard self-healing recovery..." | Re-trigger Greptile

@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s14-project-engine-merge-queue-deletion branch from 25f4de6 to 0636a71 Compare June 9, 2026 20:38
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s15-self-healing-policy-deletion branch from 40336f7 to 021ddbb Compare June 9, 2026 20:38
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s14-project-engine-merge-queue-deletion branch from 0636a71 to 44b8d22 Compare June 9, 2026 20:48
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s15-self-healing-policy-deletion branch from 021ddbb to a70ab3e Compare June 9, 2026 20:48
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s14-project-engine-merge-queue-deletion branch from 44b8d22 to 7dbdc6c Compare June 9, 2026 23:35
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s15-self-healing-policy-deletion branch from a70ab3e to 02b791a Compare June 9, 2026 23:35
Comment thread packages/engine/src/__tests__/workflow-self-healing-policy-deletion.test.ts Outdated
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s14-project-engine-merge-queue-deletion branch from 7dbdc6c to f3a3eb5 Compare June 10, 2026 00:23
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s15-self-healing-policy-deletion branch from 02b791a to a613b33 Compare June 10, 2026 00:23
Comment thread packages/engine/src/self-healing.ts Outdated
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s15-self-healing-policy-deletion branch from a613b33 to 90705d2 Compare June 10, 2026 03:48
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s14-project-engine-merge-queue-deletion branch 2 times, most recently from 2e59421 to b5661a3 Compare June 10, 2026 03:53
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s15-self-healing-policy-deletion branch from 90705d2 to 4aa973e Compare June 10, 2026 03:53
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s14-project-engine-merge-queue-deletion branch from b5661a3 to f06dcb1 Compare June 11, 2026 15:25
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s15-self-healing-policy-deletion branch from 4aa973e to 93e9933 Compare June 11, 2026 15:25
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s14-project-engine-merge-queue-deletion branch from f06dcb1 to 68bd7d6 Compare June 11, 2026 15:35
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s15-self-healing-policy-deletion branch from 93e9933 to 192b3a9 Compare June 11, 2026 15:35
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s14-project-engine-merge-queue-deletion branch from 68bd7d6 to 34c9acc Compare June 11, 2026 15:39
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s15-self-healing-policy-deletion branch from 192b3a9 to 2b9f4fe Compare June 11, 2026 15:39
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s14-project-engine-merge-queue-deletion branch from 34c9acc to 6616caf Compare June 11, 2026 15:44
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s15-self-healing-policy-deletion branch from 2b9f4fe to 33ca566 Compare June 11, 2026 15:44
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s14-project-engine-merge-queue-deletion branch from 6616caf to 9a85540 Compare June 11, 2026 15:49
gsxdsm added a commit that referenced this pull request Jun 11, 2026
Address PR #1588 feedback by preventing workflow recovery event publication failures from bypassing transient merge requeue or completion handoff recovery follow-up.
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s15-self-healing-policy-deletion branch 2 times, most recently from 33ca566 to 1f85d9b Compare June 11, 2026 15:49
gsxdsm added 2 commits June 11, 2026 08:51
Address PR #1588 feedback by preventing workflow recovery event publication failures from bypassing transient merge requeue or completion handoff recovery follow-up.
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s15-self-healing-policy-deletion branch from 1f85d9b to 7a141d1 Compare June 11, 2026 15:51
@gsxdsm

gsxdsm commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

The transient-merge-failure path places the unguarded synchronous call between the task state reset and the guarded requeue.

Addressed: self-healing recovery-event publication is guarded so publication failures cannot block the requeue/recovery follow-up path.

@stage-review

stage-review Bot commented Jun 16, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 3 individual chapters for you:

Title
1 Document S15 self-healing policy deletion plan
2 Integrate workflow recovery events into self-healing
3 Verify recovery event publication and mutation guards
Open in Stage

Chapters generated by Stage for commit 7a141d1 on Jun 16, 2026 9:19am UTC.

Base automatically changed from feature/workflow-owned-merge-s14-project-engine-merge-queue-deletion to feature/workflow-owned-merge-s08-workflow-owned-merge-processing June 17, 2026 21:47
@gsxdsm gsxdsm merged commit cc1697a into feature/workflow-owned-merge-s08-workflow-owned-merge-processing Jun 17, 2026
2 checks passed
@gsxdsm gsxdsm deleted the feature/workflow-owned-merge-s15-self-healing-policy-deletion branch June 17, 2026 21:48
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.

1 participant