Skip to content

feat(content): follow an opportunity through its Action Center work - #952

Merged
gkhngyk merged 1 commit into
mainfrom
feature/opportunity-lifecycle
Oct 6, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feature/opportunity-lifecycle

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Summary

First PR of Phase 4 in #857. The spec defines the opportunity lifecycle as New → Reviewed → Sent to Workflow → In Progress → Completed → Measured (§27). Until now, an opportunity sent to the Action Center (#943) stayed at Sent: nothing moved it once the work was underway, and the action's measurement never showed on the opportunity.

Reviewed

  • New reviewed status. A new opportunity's detail page has Mark as reviewed.
  • The status filter and the MCP status lists accept reviewed.

Status follows the work (migration 00106)

A trigger on actions sets the opportunity's status from every action sent from it. It runs on insert and on status updates:

Its actions Opportunity
all still new sent
any started or completed in_progress
every one not dismissed is completed done
all dismissed (the work was called off) reviewed
  • It is a trigger, so it holds however an action changes: the Action Center UI, MCP or anything later.
  • It only moves opportunities on that path. One a person dismissed, or one that was archived, stays where it is.
  • The send path no longer sets sent itself.
  • The migration also syncs the actions already sent.

Results

The opportunity detail page has a Results card once work has been sent. It lists each action with:

  • its AC number, linking to the action;
  • its status;
  • once completed, the measured outcome (Improved, No meaningful change or Declined) with each metric before → after;
  • while the after-window is still open, the date measurement starts.

The measurement is the Action Center's existing one, which still reads the whole brand. The next PR scopes it to the opportunity's basket, as §28 asks.

Tried on production data

The migration is applied. In a transaction that was rolled back, a test action moved new → in_progress → completed → dismissed. Its opportunity followed: sent → in_progress → done → reviewed. Nothing was left changed.

Related issue

Part of #857 (Phase 4)

Type of change

  • feat — New feature

How to test

  1. Mark a new opportunity as reviewed. Its status reads Reviewed.
  2. Send an opportunity to the Action Center, then move the action to In Progress. The opportunity reads In Progress.
  3. Complete the action. The opportunity reads Done, and its Results card shows when measurement starts.

Checklist

  • Branch follows the naming convention
  • Commits follow Conventional Commits
  • yarn lint, yarn typecheck, yarn format:check, yarn test (418) and yarn build pass (run from web/)
  • yarn lint, yarn format:check and yarn test (990) pass (run from server/)
  • supabase/schema.sql rebuilt with build-schema.sh

🤖 Generated with Claude Code

@github-actions github-actions Bot added the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 6, 2026
The spec's lifecycle is New → Reviewed → Sent → In Progress → Completed →
Measured (#857, Phase 4). Opportunities stopped at Sent: nothing moved them
once the work was in the Action Center, and the measurement never showed
on them.

- A Reviewed status, set by "Mark as reviewed" on a new opportunity, and
  offered in the status filter and MCP.
- Migration 00106 adds a trigger on actions that sets the opportunity's
  status from every action sent from it: all new → sent, any started →
  in_progress, every live one completed → done, all dismissed → reviewed.
  It runs however the action changes, and leaves dismissed and archived
  opportunities alone. The send path no longer sets the status itself.
- A Results card on the opportunity lists its actions with status, and for
  completed ones the measured outcome with each metric before and after,
  or the date measurement starts.
@gkhngyk
gkhngyk force-pushed the feature/opportunity-lifecycle branch from b98299b to 0a0e8ba Compare October 6, 2026 17:01
@gkhngyk
gkhngyk merged commit 136e858 into main Oct 6, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-migration Adds or edits a migration — apply it to the hosted database

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant