Skip to content

UX: freshly-started workflows show all-red at t=0 — add scheduled/not-started state + richer bundle cards #106

Description

@alexeygrigorev

Freshly-started workflows show all-red at t=0: add scheduled/not-started state + richer bundle cards

Status: pending
Tags: enhancement, frontend, backend, P2
Depends on: #105
Blocks: None

Groomed from the same live UX audit. #5: freshly-started workflows are instantly
all-red, destroying the signal value of the risk indicators. A workflow anchored
today (started from a template) immediately shows Overdue 9 / Missing evidence
15 / At risk on every task, because template task offsets are pre-publication
(relative to a future anchor/event) — so tasks with negative offsets land in the
past the moment the bundle is created. At t=0 the operator cannot tell a
genuinely late workflow from a brand-new one. Evidence:
.tmp/screenshots/ux-audit/13-bundle-header.png, 15-dashboard-populated.png.

Scope

Two related changes:

  1. Scheduled / not-started semantics. Template instantiation
    (instantiateTemplate in backend/src/db/templates.ts, ~lines 129-160)
    computes each task date as anchorDate + offsetDays; with negative offsets and
    an anchor of today, tasks are born in the past. The risk/queue helpers on the
    frontend (bundleRiskSummary ~line 707, dashboardQueueLabels /
    taskPrimaryQueueGroup ~lines 677-705) then flag them Overdue / Missing
    evidence / At risk. A freshly-created workflow must not be flagged
    overdue/at-risk before its tasks are genuinely due. Introduce a
    "scheduled / not-started" treatment so not-yet-worked template tasks are shown
    as scheduled rather than overdue at t=0. The engineer should choose the
    simplest correct mechanism and document it; candidate approaches:

    • a bundle-level "not started / scheduled" state that suppresses
      overdue/missing-evidence/at-risk flags until the operator activates the
      workflow (e.g. on first task action or an explicit "Start"), or
    • treating a task as not-overdue when its due date is before the bundle's
      creation date (i.e. do not retroactively mark pre-anchor tasks late for a
      bundle created today).
      The chosen rule must be applied consistently in bundleRiskSummary, the
      dashboard queue grouping, and the bundle risk header so the same task is not
      "overdue" in one place and "scheduled" in another.
  2. Richer bundle-list cards. The Bundles list card (loadBundles,
    ~lines 3820-3843) shows only "N / M done". Enrich it to also show stage,
    next-due date, overdue count, and waiting count — the same summary the
    dashboard bundle card and the detail header already compute via
    bundleRiskSummary (renderBundleCard ~line 1682). Reuse that helper; do not
    duplicate risk logic.

Serves JTBD 2 ("The first next action is immediately visible after creation"),
JTBD 3 ("Workflow detail shows stage, progress, next due task, overdue count, and
waiting count"), and the reminder model (overdue reminders "catch tasks that were
not closed on time" — a t=0 task was never late).

Acceptance Criteria

  • A workflow started from a template with an anchor of today does NOT show all
    tasks as Overdue / Missing evidence / At risk at creation time; tasks that
    are not yet genuinely due are shown as scheduled/not-started instead.
  • A genuinely late task (past its due date after the workflow has been active)
    is still flagged Overdue — the scheduled treatment applies only to
    not-yet-worked / freshly-created tasks, not as a blanket suppression.
  • The scheduled/overdue/at-risk rule is consistent across the dashboard queue
    grouping, the dashboard bundle card, and the bundle detail risk header (the
    same task is never "overdue" in one view and "scheduled" in another).
  • The Bundles list card shows, in addition to progress: stage, next-due date,
    overdue count, and waiting count (reusing bundleRiskSummary).
  • A brand-new bundle's list card and header read as a healthy new workflow
    (e.g. "0 overdue", a next-due date), not "Overdue 9 / Missing evidence 15".
  • If a stored bundle state/field is added, it is declared in the data model
    (backend/src/types.ts) and the SAM/CloudFormation-managed table is used —
    no unmanaged tables or one-off migrations; export/restore
    (npm run export:data, npm run validate:export) still round-trips.

Test Scenarios

Scenario: New workflow is not all-red at t=0

Given: Grace starts a Newsletter workflow anchored today from its template
When: she opens the bundle and the dashboard
Then: the tasks that fall before the anchor are shown as scheduled/not-started,
the bundle is not "Overdue 9 / Missing evidence 15 / At risk", and a clear
next-due is visible.

Scenario: Genuine overdue still flags

Given: an active workflow with a task whose due date has passed while the
workflow was in progress
When: the dashboard and bundle render
Then: that task is still shown Overdue.

Scenario: Bundle-list card carries risk

Given: the Bundles list with several bundles
When: it renders
Then: each card shows stage, next-due, overdue count, and waiting count in
addition to progress.

Out of Scope

Dependencies

Verification

  • From backend/: npm test (backend unit tests, node --test) covering the
    scheduled/overdue classification and instantiateTemplate date behavior.
  • From backend/: npm run typecheck.
  • From backend/: npm run test:e2e — at minimum home-dashboard.spec.js,
    bundle-detail.spec.js, and api-instantiation.spec.js; add a spec asserting a
    today-anchored template workflow is not all-red at creation and that the bundle
    list card shows stage/next-due/overdue/waiting.
  • If export shape changes: npm run export:data + npm run validate:export (or
    npm run restore:drill) to confirm round-trip; outputs under .tmp/exports/.
  • Playwright screenshots of a freshly-started bundle detail + header and the
    Bundles list under .tmp/screenshots/ux-audit/, read to confirm it no longer
    reads all-red.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Nice to havebackendBackend/APIenhancementNew or improved functionalityfrontendFrontend UI

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions