Skip to content

refactor(workflow): S16 legacy retry field demotion#1589

Open
gsxdsm wants to merge 2 commits into
feature/workflow-owned-merge-s15-self-healing-policy-deletionfrom
feature/workflow-owned-merge-s16-legacy-retry-field-demotion
Open

refactor(workflow): S16 legacy retry field demotion#1589
gsxdsm wants to merge 2 commits into
feature/workflow-owned-merge-s15-self-healing-policy-deletionfrom
feature/workflow-owned-merge-s16-legacy-retry-field-demotion

Conversation

@gsxdsm

@gsxdsm gsxdsm commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Stack Slice

  • Slice: S16
  • Milestone: Deletion
  • Base branch: feature/workflow-owned-merge-s15-self-healing-policy-deletion
  • Full plan: docs/plans/2026-06-09-003-refactor-workflow-owned-merge-full-migration-slices-plan.md

Goal

Demote task-level retry/merge counters to projections and remove policy reads that still treat them as authority.

Dependency

S9 retry state, S12 projections, and S15 self-healing policy deletion.

Expected Scope

core types, retry summary, manual retry reset, core store, project engine, self-healing, retry tests.

Expected Tests

Retry summaries derive from workflow state, manual retry emits workflow wake, task field changes alone cannot cause scheduler/recovery/merge action.

Exit Gate

Task retry fields are display-only compatibility data.

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 hasAuthoritativeWorkflowWork and extended projection tests so workflow work beats legacy retry counters.\n- Legacy retry fields are now explicitly display-only fallback data in projection.

@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: 4d21b8b7-5421-4f33-80ab-478cd9dfb17a

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-s16-legacy-retry-field-demotion

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-s15-self-healing-policy-deletion branch from dec019d to 40336f7 Compare June 9, 2026 20:31
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s16-legacy-retry-field-demotion branch from 0040cf8 to af43c55 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 adds hasAuthoritativeWorkflowWork — a new gate function that signals whether workflow work items should be considered authoritative over legacy task retry counters — and exports it from @fusion/core. The gate checks state !== "cancelled", which exactly mirrors when projectWorkflowWorkStatus returns source: "workflow", closing the alignment gap flagged in earlier review rounds.

  • hasAuthoritativeWorkflowWork is added to workflow-work-projection.ts with a state-based predicate (any non-cancelled item is authoritative), replacing the previous kind-based filter that excluded "task" items and incorrectly included cancelled items.
  • Two new tests verify alignment: cancelled-only items yield false/"legacy" on both the gate and projection, while kind: "task" runnable items yield true/"workflow" on both.

Confidence Score: 5/5

Safe to merge. The new gate function is a pure addition with no changes to existing behavior.

The state-based predicate state !== 'cancelled' is exactly the condition under which projectWorkflowWorkStatus returns source: 'workflow', so the two functions are provably aligned for every possible WorkflowWorkItemState. Tests cover the previously flagged edge cases (cancelled-only items, task-kind items) and a representative active-work scenario. No callers of the new export exist yet — it is staged for future slices — so there is no downstream blast radius from this change.

No files require special attention.

Important Files Changed

Filename Overview
packages/core/src/workflow-work-projection.ts Adds hasAuthoritativeWorkflowWork using state !== "cancelled" — correctly aligned with projectWorkflowWorkStatus's source: "legacy" condition (all items cancelled or empty). No logic bugs found.
packages/core/src/tests/workflow-work-projection.test.ts Adds alignment tests for cancelled items and task-kind items. Alignment for the succeeded state is correct in implementation but not exercised by a new test case.
packages/core/src/index.ts Exports hasAuthoritativeWorkflowWork alongside the existing projection exports — clean, single-line change.
docs/plans/workflow-owned-merge-stack/s16-legacy-retry-field-demotion.md Draft stack-handoff doc for S16. Reserves the review slot; still carries placeholder language in Expected File Scope and Exit Gate per prior acknowledged threads.

Reviews (8): Last reviewed commit: "fix(FN-000): align authoritative workflo..." | Re-trigger Greptile

@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-s16-legacy-retry-field-demotion branch from af43c55 to 42f1c6c Compare June 9, 2026 20:38
@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-s16-legacy-retry-field-demotion branch from 42f1c6c to ab6a3ea Compare June 9, 2026 20:48
@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
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s16-legacy-retry-field-demotion branch 2 times, most recently from 95d7e79 to c1b51bd 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/core/src/workflow-work-projection.ts
@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-s16-legacy-retry-field-demotion branch from c1b51bd to cde8801 Compare June 10, 2026 03:48
Comment thread packages/core/src/workflow-work-projection.ts
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s16-legacy-retry-field-demotion branch from cde8801 to a71b495 Compare June 10, 2026 03:53
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s15-self-healing-policy-deletion branch 2 times, most recently from 4aa973e to 93e9933 Compare June 11, 2026 15:25
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s16-legacy-retry-field-demotion branch 2 times, most recently from a9ba949 to 8382a87 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-s16-legacy-retry-field-demotion branch from 8382a87 to a29b5d9 Compare June 11, 2026 15:39
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s15-self-healing-policy-deletion branch 2 times, most recently from 2b9f4fe to 33ca566 Compare June 11, 2026 15:44
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s16-legacy-retry-field-demotion branch from a29b5d9 to 2d5f995 Compare June 11, 2026 15:44
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s15-self-healing-policy-deletion branch from 33ca566 to 1f85d9b Compare June 11, 2026 15:49
gsxdsm added a commit that referenced this pull request Jun 11, 2026
Address PR #1589 feedback by making hasAuthoritativeWorkflowWork match projection source selection for cancelled and task-kind work items.
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s15-self-healing-policy-deletion branch from 33ca566 to 1f85d9b Compare June 11, 2026 15:49
@gsxdsm gsxdsm force-pushed the feature/workflow-owned-merge-s16-legacy-retry-field-demotion branch from 2d5f995 to 5c07d45 Compare June 11, 2026 15:49
gsxdsm added 2 commits June 11, 2026 08:51
Address PR #1589 feedback by making hasAuthoritativeWorkflowWork match projection source selection for cancelled and task-kind work items.
@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 force-pushed the feature/workflow-owned-merge-s16-legacy-retry-field-demotion branch from 5c07d45 to edd43ce Compare June 11, 2026 15:51
@gsxdsm

gsxdsm commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

The gate function filters by kind alone while the projection additionally filters by state.

Addressed: hasAuthoritativeWorkflowWork is now aligned with projection authority by returning true only for non-cancelled authoritative work, with direct tests for empty, task-kind, retrying, and cancelled cases.

@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 S16 legacy retry field demotion plan
2 Introduce authoritative workflow work detection
3 Test workflow work projection authority
Open in Stage

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

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