[PR #387] [MERGED] Harden workflow fallback behavior and surface degraded mode #693

Closed
opened 2026-03-13 21:04:16 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/AJaySi/ALwrity/pull/387
Author: @AJaySi
Created: 3/6/2026
Status: Merged
Merged: 3/7/2026
Merged by: @AJaySi

Base: mainHead: codex/remove-duplicate-task-ids-and-enforce-uniqueness


📝 Commits (1)

  • ed625ea Harden workflow fallback handling and degraded mode UI

📊 Changes

3 files changed (+169 additions, -155 deletions)

View changed files

📝 frontend/src/components/MainDashboard/components/WorkflowProgressBar.tsx (+29 -2)
📝 frontend/src/services/TaskWorkflowOrchestrator.ts (+72 -132)
📝 frontend/src/stores/workflowStore.ts (+68 -21)

📄 Description

Motivation

  • Provide a small, deterministic local workflow fallback that maps to canonical pillars/routes so the UI behaves predictably when server data is unavailable.
  • Eliminate duplicate task IDs in the fallback data and ensure generated task IDs and dependencies remain consistent after ordering.
  • Prevent silent fallbacks for malformed server responses by only falling back for explicit connection/server availability errors and surface a clear UI indicator when running in degraded (local-fallback) mode.

Description

  • Replace the previous placeholder default tasks in TaskWorkflowOrchestrator with a minimal deterministic workflow aligned to pillars plan → generate → publish → analyze → engage → remarket and shorter, safer defaults; this is implemented in frontend/src/services/TaskWorkflowOrchestrator.ts (generateTasksForDate).
  • Add ensureUniqueTaskIds(tasks: TodayTask[]) to TaskWorkflowOrchestrator to deduplicate/uniquify task IDs and rewrite dependencies to the new IDs, and use it before validation/ordering and before returning ordered tasks.
  • Change useWorkflowStore (frontend/src/stores/workflowStore.ts) to import ConnectionError/NetworkError and only attempt the local fallback when the error is a connection/server-unavailable type, while throwing/setting a typed WorkflowError when the server payload schema is invalid.
  • Add degraded-mode state to the store (isDegradedMode, degradedModeReason) and surface a visible degraded-mode banner in the UI by updating WorkflowProgressBar (frontend/src/components/MainDashboard/components/WorkflowProgressBar.tsx) to show a CloudOff banner when the store sets degraded mode.

Testing

  • Ran npm run build in this environment to validate the frontend build, but it failed because react-scripts is not installed here (automated build attempt: failed).
  • Attempted an automated UI snapshot via a Playwright script pointed at http://127.0.0.1:3000, but the local dev server was not running so the navigation failed (ERR_EMPTY_RESPONSE) and no screenshot was produced (automated check: failed).
  • Verified code changes saved and committed locally (commit created and diff inspected) after making the described changes (automated git operations: succeeded).

Codex Task


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/AJaySi/ALwrity/pull/387 **Author:** [@AJaySi](https://github.com/AJaySi) **Created:** 3/6/2026 **Status:** ✅ Merged **Merged:** 3/7/2026 **Merged by:** [@AJaySi](https://github.com/AJaySi) **Base:** `main` ← **Head:** `codex/remove-duplicate-task-ids-and-enforce-uniqueness` --- ### 📝 Commits (1) - [`ed625ea`](https://github.com/AJaySi/ALwrity/commit/ed625eae6175a13696ec2542c1b85abbb4eba123) Harden workflow fallback handling and degraded mode UI ### 📊 Changes **3 files changed** (+169 additions, -155 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/components/MainDashboard/components/WorkflowProgressBar.tsx` (+29 -2) 📝 `frontend/src/services/TaskWorkflowOrchestrator.ts` (+72 -132) 📝 `frontend/src/stores/workflowStore.ts` (+68 -21) </details> ### 📄 Description ### Motivation - Provide a small, deterministic local workflow fallback that maps to canonical pillars/routes so the UI behaves predictably when server data is unavailable. - Eliminate duplicate task IDs in the fallback data and ensure generated task IDs and dependencies remain consistent after ordering. - Prevent silent fallbacks for malformed server responses by only falling back for explicit connection/server availability errors and surface a clear UI indicator when running in degraded (local-fallback) mode. ### Description - Replace the previous placeholder default tasks in `TaskWorkflowOrchestrator` with a minimal deterministic workflow aligned to pillars `plan → generate → publish → analyze → engage → remarket` and shorter, safer defaults; this is implemented in `frontend/src/services/TaskWorkflowOrchestrator.ts` (`generateTasksForDate`). - Add `ensureUniqueTaskIds(tasks: TodayTask[])` to `TaskWorkflowOrchestrator` to deduplicate/uniquify task IDs and rewrite dependencies to the new IDs, and use it before validation/ordering and before returning ordered tasks. - Change `useWorkflowStore` (`frontend/src/stores/workflowStore.ts`) to import `ConnectionError`/`NetworkError` and only attempt the local fallback when the error is a connection/server-unavailable type, while throwing/setting a typed `WorkflowError` when the server payload schema is invalid. - Add degraded-mode state to the store (`isDegradedMode`, `degradedModeReason`) and surface a visible degraded-mode banner in the UI by updating `WorkflowProgressBar` (`frontend/src/components/MainDashboard/components/WorkflowProgressBar.tsx`) to show a `CloudOff` banner when the store sets degraded mode. ### Testing - Ran `npm run build` in this environment to validate the frontend build, but it failed because `react-scripts` is not installed here (automated build attempt: failed). - Attempted an automated UI snapshot via a Playwright script pointed at `http://127.0.0.1:3000`, but the local dev server was not running so the navigation failed (`ERR_EMPTY_RESPONSE`) and no screenshot was produced (automated check: failed). - Verified code changes saved and committed locally (commit created and diff inspected) after making the described changes (automated git operations: succeeded). ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_69aaf77cf32c8328ad3a49b478e7b043) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-13 21:04:16 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ALwrity#693
No description provided.