Session 47: Change tags #222

Open
opened 2026-11-08 18:22:10 +00:00 by chris-kreidl · 0 comments
chris-kreidl commented 2026-11-08 18:22:10 +00:00 (Migrated from github.com)

47 · Change tags on the Plan calendar

Phase: UI polish · Branch: session/47-change-tags · Depends on: 46 (the roadbook redesign)

The roadbook redesign (46) put a re-plan line under Plan's stage strip: what the latest re-plan did and why, with Undo. The approved sketch also tags each session the re-plan moved, in place on its day: "CHANGED · WAS 2 × 15 TEMPO". This session builds those tags, so the rider sees which days moved without opening Plan history.

Read first

  • src/domain/replan/diff.ts (planDiff, SessionChange, summarise) and its tests: the diff already behind Plan history's "What changed"
  • src/server/plan-views.ts (PlanSessionView, how getPlan builds weeks) and src/server/replan/status.ts (ReplanRunView, RECENT_RUN_MS)
  • src/components/plan/plan-calendar.tsx (SessionCard, day cells) and src/components/plan/replan-card.tsx (ReplanLine)
  • .impeccable/mocks/decision/rb-red.html: the approved sketch (the tag sits under the session's time · TSS)
  • DESIGN.md, src/styles/tokens.stylex.ts

Goal

  1. Which sessions changed. When the active version came from a re-plan that is still recent (the same window as the re-plan line, RECENT_RUN_MS), diff it against its parent with planDiff and attach the change to each affected session in the plan view: changed with the session it replaced (title, and duration or TSS if that is what moved), or added. A session that was removed has no cell; count it on the re-plan line instead ("2 sessions changed, 1 removed").
  2. The tag. Under a changed session's time · TSS: "CHANGED · WAS 2 × 15 TEMPO" in red condensed caps (fonts.display with display.stretch, letterSpacings.label, colors.accent). An added session: "ADDED". The session's accessible name includes it ("Changed, was 2 × 15 tempo").
  3. Its life. Tags show only while that re-plan is the active version and recent. Undo or a newer version clears them; a newer re-plan tags its own changes. Nothing is stored that a diff can derive.
  4. Hand edits. A session the athlete edited is not tagged as a coach change. Decide whether the coach's review after an edit (athlete_edit trigger) tags what the review moved, and record why in docs/decisions.md.

Rules

  • Plans are append-only: derive, don't write to a PlanVersion.
  • Domain logic stays in src/domain/ with tests; the server function only joins versions the user owns.
  • Red marks change and now only. A tag never uses another colour, and never stands without its word.

Tests

  • Unit: the per-session change list from two versions (changed title, changed duration only, added, removed, a same-day swap of kind), and nothing for a version with no parent.
  • E2E: on the seed-replan fixture, Plan shows "CHANGED · WAS STRENGTH A" (or the fixture's real before) on today's session; after Undo, the tag is gone. Axe still passes.

Out of scope

Change tags on Today's week list (note under Follow-ups if worth doing).

Done when

After a re-plan, every moved session on Plan says what it was, and Undo clears the tags. Unit, typecheck, lint, format, audit and e2e pass. End-of-session ritual in CLAUDE.md.

Moved from prompts/47-change-tags.md on 2026-11-08.

# 47 · Change tags on the Plan calendar **Phase:** UI polish · **Branch:** `session/47-change-tags` · **Depends on:** 46 (the roadbook redesign) The roadbook redesign (46) put a re-plan line under Plan's stage strip: what the latest re-plan did and why, with Undo. The approved sketch also tags each session the re-plan moved, in place on its day: "CHANGED · WAS 2 × 15 TEMPO". This session builds those tags, so the rider sees which days moved without opening Plan history. ## Read first - `src/domain/replan/diff.ts` (`planDiff`, `SessionChange`, `summarise`) and its tests: the diff already behind Plan history's "What changed" - `src/server/plan-views.ts` (`PlanSessionView`, how `getPlan` builds weeks) and `src/server/replan/status.ts` (`ReplanRunView`, `RECENT_RUN_MS`) - `src/components/plan/plan-calendar.tsx` (`SessionCard`, day cells) and `src/components/plan/replan-card.tsx` (`ReplanLine`) - `.impeccable/mocks/decision/rb-red.html`: the approved sketch (the tag sits under the session's time · TSS) - `DESIGN.md`, `src/styles/tokens.stylex.ts` ## Goal 1. **Which sessions changed.** When the active version came from a re-plan that is still recent (the same window as the re-plan line, `RECENT_RUN_MS`), diff it against its parent with `planDiff` and attach the change to each affected session in the plan view: `changed` with the session it replaced (title, and duration or TSS if that is what moved), or `added`. A session that was removed has no cell; count it on the re-plan line instead ("2 sessions changed, 1 removed"). 2. **The tag.** Under a changed session's time · TSS: "CHANGED · WAS 2 × 15 TEMPO" in red condensed caps (`fonts.display` with `display.stretch`, `letterSpacings.label`, `colors.accent`). An added session: "ADDED". The session's accessible name includes it ("Changed, was 2 × 15 tempo"). 3. **Its life.** Tags show only while that re-plan is the active version and recent. Undo or a newer version clears them; a newer re-plan tags its own changes. Nothing is stored that a diff can derive. 4. **Hand edits.** A session the athlete edited is not tagged as a coach change. Decide whether the coach's review after an edit (`athlete_edit` trigger) tags what the review moved, and record why in `docs/decisions.md`. ## Rules - Plans are append-only: derive, don't write to a PlanVersion. - Domain logic stays in `src/domain/` with tests; the server function only joins versions the user owns. - Red marks change and now only. A tag never uses another colour, and never stands without its word. ## Tests - Unit: the per-session change list from two versions (changed title, changed duration only, added, removed, a same-day swap of kind), and nothing for a version with no parent. - E2E: on the `seed-replan` fixture, Plan shows "CHANGED · WAS STRENGTH A" (or the fixture's real before) on today's session; after Undo, the tag is gone. Axe still passes. ## Out of scope Change tags on Today's week list (note under Follow-ups if worth doing). ## Done when After a re-plan, every moved session on Plan says what it was, and Undo clears the tags. Unit, typecheck, lint, format, audit and e2e pass. End-of-session ritual in `CLAUDE.md`. _Moved from `prompts/47-change-tags.md` on 2026-11-08._
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
ckreidl/trainer#222
No description provided.