# Item 5 — sentiment-tag refactor (CLOSED-2026-05-18)

> **STATUS: CLOSED — scope-closed by user 2026-05-18.**
> **Reason:** Tags use reusable component; `red[350]` already applied via `TaggedMetricGrid` in PR #340. No further refactor needed.
> No follow-up branch will be created. Plan docs (`design-polish-plan-q5-sweep.md`, `design-polish-item5-refactor-plan.md`) retained for historical context only — they are NOT active work items.

## Original deferral reason (historical)

Item 5 (palette-wide red-tag refactor with `sentimentColor` util + `SentimentTag` component) was scoped into the design-polish PR but pivoted from "wholesale token swap" → "DRY refactor-first" mid-PR by user direction. The refactor plan was written (plan-third pass) but never patched — visual review on Metro:8087 cycled through gradient/glow/width fixes instead, and the PR was shipped with only Items 1, 2, 3, 4 (glow + per-card overlay + full-width previews + `red[350]` token added but not yet consumed) and Item 6 (home refresh fix).

No sentiment-tag site was migrated in this PR. The `red[350]` token EXISTS in `src/shared/theme/palette.ts` but is currently unreferenced — it's available for the deferred refactor to adopt.

## Existing plan docs

Both UNTRACKED in `feat/design-polish` worktree (gitignored). Copy them into the new worktree before resuming:

- `docs/dev/design-polish-plan-q5-sweep.md` — 75-site enumeration across `red[300/400/500/700]`. Classification: 35 SWAP / 40 KEEP / 10 FLAG.
- `docs/dev/design-polish-item5-refactor-plan.md` — PATH 2 refactor plan: 2 new shared abstractions (`sentimentColor` util in `src/shared/theme/sentimentColors.ts` + `SentimentTag` component in `src/shared/ui/`), 43 migration sites (35 SWAP + 8 FLAG→SWAP per agent lean), 6 Open Qs flagged for user sanity-check.

## Pending decisions (the 6 Open Qs — verbatim)

1. `scoreColors.down` in `ScoreSectionCard.tsx:13` is consumed by the smart-score gauge — IS that surface a "sentiment tag" or "chart"? If chart, KEEP as `red[500]`. If sentiment, swap to `sentimentColor.negative`.
2. `FairValueCard.tsx:23` is a `<Path stroke={red[500]} />` on an inline TrendDown SVG icon used in the card body. Even though it's SVG `stroke`, the icon serves as a sentiment indicator (red downward trend), not a data series chart. Lean SWAP. Confirm?
3. `PracticeSheetWrongParts.tsx:15` (XCircle) and `:38` (Continue button bg after wrong) — agent leaned DESTRUCTIVE-keep (XCircle = error iconography; Continue button bg = action chrome). User may want them SWAP'd to match the rest of the wrong-state UI. Want them tied to the other learn quiz surfaces?
4. Bg color for `SentimentTag.positive` and `.neutral` — proposing the current `TaggedMetricGrid` tokens (`rgba(166,239,103,0.10)` for positive; `rgba(193,208,255,0.15)` for neutral). If a Figma node specifies different positive/neutral tag bg, point at it.
5. Should `RatingChangeRow ActionBadge`'s bg (`#543C47` for downgrade, `#385149` for upgrade) ALSO move into `SentimentTag` as a `variant="dense"`? Or keep `ActionBadge` as a feature-local component and only migrate its text color? Lean: keep ActionBadge as-is, migrate text only — it's a different visual density used in exactly one place.
6. Should `CommunityPulseSection`'s bearish vote button (`#40343D`) ALSO unify with `SentimentTag`? Same call as #5 — it's a vote button (interactive), not a passive tag. Lean: keep, migrate text/icon color only.

## Recommended next-session bundle

Coor's spot-check call: `scoreColors.down` (Q1) → **SWAP** (sentiment surface, not chart). Agent leans on Q2/Q4/Q5/Q6 stand. Q3 needs user input.

So the resumable bundle if user replies "yes" / "agent-lean":
- 35 SWAP wholesale
- 8 FLAG→SWAP from agent lean (quiz wrong-state)
- 1 FLAG→SWAP from coor (`scoreColors.down`)
- 1 spot-check remaining: PracticeSheetWrongParts XCircle + Continue button (Q3)
- 2 architectural calls confirmed as KEEP-custom-bg-migrate-text-only: ActionBadge, CommunityPulseSection bearish button

## Branch suggestion

`feat/design-polish-sentiment-refactor`, new branch off **main** (NOT a stack on this PR). Rationale:
- Plan docs at `docs/dev/design-polish-{plan-q5-sweep, item5-refactor-plan}.md` are UNTRACKED — they live only in the design-polish worktree. The next worktree should either be created off the same worktree (`git worktree add` from inside) or have the docs `cp`'d in.
- The `red[350]` token addition is already on `main` after this PR merges, so the refactor branch has a clean base.

## Estimated effort

Per the plan doc: ~50 LOC net delta (mostly token substitutions), ~30 min of careful migration after greenlight + gate run + commit. Single PR.
