From 23e647a7b2a07394ddd702d1ce205ee5b8059425 Mon Sep 17 00:00:00 2001 From: fireshaper Date: Sun, 18 Oct 2026 17:32:22 -0400 Subject: [PATCH] Step 28.5: regression Co-Authored-By: Claude Opus 5.5 --- DECISIONS.md | 4 ++++ memory-bank/change-requests/CR-024-fleet-sleep.md | 1 + memory-bank/change-requests/CR-025-short-away-summary.md | 1 + memory-bank/change-requests/CR-026-random-events-hull.md | 1 + memory-bank/implementation-plan.md | 1 + memory-bank/progress.md | 2 +- 6 files changed, 9 insertions(+), 1 deletion(-) diff --git a/DECISIONS.md b/DECISIONS.md index bf3e222..e3c4013 100644 --- a/DECISIONS.md +++ b/DECISIONS.md @@ -2074,3 +2074,7 @@ Implementation decisions not spelled out in `memory-bank/implementation-plan.md` - **Only entries worth a toast open the pop-up**: a return to only refuelling, rest or automatic bookings shows nothing (and marks them seen). - **Delivery summaries are still acknowledged**, now by whichever showed the news (the feed, the toasts after a short absence, or the pop-up), because the deal, the skill-point prompt and radio calls wait for them; a new `useAwayOpen` flag also holds those back while the pop-up decides or shows. - **The Logbook's "This absence"** is the absence the player last came back from in this session; before any, the save's own. + +## Step 28.5 + +- **Amendments go on each amended document** as "Amended by CR-028" lines: plan Step 9.2, CR-024, CR-025 and CR-026. diff --git a/memory-bank/change-requests/CR-024-fleet-sleep.md b/memory-bank/change-requests/CR-024-fleet-sleep.md index acb6dda..cb187b5 100644 --- a/memory-bank/change-requests/CR-024-fleet-sleep.md +++ b/memory-bank/change-requests/CR-024-fleet-sleep.md @@ -75,6 +75,7 @@ Record these in `DECISIONS.md` and `implementation-plan.md` §0.5, using the nex ### Step 22.5 — Client: return banner, status, and setting - **Amended by CR-025:** The sleep banner stays at the top of the highlights pop-up, under its title. - **Amended by CR-027:** Service trips go on while the fleet is asleep (flying empty, so the fleet earns nothing), and `bookService`, `cancelBooking` and `setAutoRepair` are manual decisions. +- **Amended by CR-028:** The fleet going quiet while the game is open shows a toast and the Bridge's "Fleet asleep" panel, not the pop-up. - The "while you were away" screen shows the sleep banner and "Back to work" button when the fleet went quiet. HQ shows "Fleet asleep — waiting for your orders" with the same button while asleep. - Pilot status lines show "Waiting for orders" for sleeping Independent pilots. diff --git a/memory-bank/change-requests/CR-025-short-away-summary.md b/memory-bank/change-requests/CR-025-short-away-summary.md index 833167e..2563dd1 100644 --- a/memory-bank/change-requests/CR-025-short-away-summary.md +++ b/memory-bank/change-requests/CR-025-short-away-summary.md @@ -83,6 +83,7 @@ Record these in `DECISIONS.md` and `implementation-plan.md` §0.5, using the nex ### Step 23.2 — Sim: summary builder - **Amended by CR-026:** Events are logbook entries; good ones and any that hurt a hull are highlights just below level-ups, and a short absence lists its trips' events (not counted towards the 3). - **Amended by CR-027:** Service is logged (automatic bookings, starts, finishes, waiting for funds), and booked service waiting for funds or out of reach is a highlight. +- **Amended by CR-028:** The pop-up shows only after being away, built from that absence's unseen entries (seen is saved per entry); under 60 seconds away, and whenever the player is here, news shows as toasts. - A pure function that turns the entries for an absence into: duration, totals, up to 3 highlights in priority order with an overflow count, up to 5 pilot lines sorted by net profit with an overflow line, the idle-pilots line, and the "short absence" direct list when there are 3 events or fewer. - **Test:** With 50 pilots' worth of entries, the result has exactly 5 pilot lines and an overflow line whose totals equal the rest. Highlights follow the priority order and cap at 3 with the right overflow count. Totals equal the sum of entries. With 2 events, the result is the direct list. Net matches the delivery-summary calculation. diff --git a/memory-bank/change-requests/CR-026-random-events-hull.md b/memory-bank/change-requests/CR-026-random-events-hull.md index 89efdcc..2fef04f 100644 --- a/memory-bank/change-requests/CR-026-random-events-hull.md +++ b/memory-bank/change-requests/CR-026-random-events-hull.md @@ -208,6 +208,7 @@ Removes "random events" from the deferred list (`implementation-plan.md` §0.3). ## Amendments - **Amended by CR-027:** Hull damage and wear that take an Independent crew's hull below the auto-repair threshold (40% by default) book a repair at the nearest reachable HQ; Manual crews see "Repair recommended". +- **Amended by CR-028:** Event outcomes are toasts while the player is here; radio calls keep their card. ## 10. Out of scope diff --git a/memory-bank/implementation-plan.md b/memory-bank/implementation-plan.md index 58960e7..f4078f8 100644 --- a/memory-bank/implementation-plan.md +++ b/memory-bank/implementation-plan.md @@ -610,6 +610,7 @@ The game has had no server since CR-014. When a later or unfinished change reque - When state contains unacknowledged summaries, show a modal listing each completed delivery (ship, route, credits, XP, discoveries). Dismissing acknowledges them. - **Test:** Component test shows the modal with two seeded summaries; dismissing calls acknowledge and hides it. - **Amended by CR-025:** The summary is the highlights pop-up: its duration, the sleep banner, company totals, at most 3 highlights and at most 5 pilot lines, on one phone screen, or a direct list for 3 events or fewer; the detail is on the Logbook screen (Steps 25.3, 25.4). It still opens on unseen deliveries and finished upgrades. +- **Amended by CR-028:** The pop-up opens only on coming back after being away (the tab hidden, the app in the background, or closed), for that absence's unseen logbook entries only; under 60 seconds away they show as toasts; while the player is here, news is toasts. ### Step 9.3 — Tutorial contract board - During tutorial, the Contracts screen shows the tutorial board: route, cargo, payout, estimated trip time (computed with sim), and a "Fly it" button. The button is disabled while a tutorial run is in flight. diff --git a/memory-bank/progress.md b/memory-bank/progress.md index 8522eba..e023216 100644 --- a/memory-bank/progress.md +++ b/memory-bank/progress.md @@ -585,4 +585,4 @@ Spec: `memory-bank/change-requests/CR-028-live-toasts.md` (received as "CR-026 - [x] **Step 28.2 — Client: presence tracking.** `apps/web/src/platform/presence.ts`: `usePresence` (here, away since, the last absence that ended, a count of comebacks) fed by `startPresence` from the Page Visibility API (`browserPresence`) or Capacitor's `appStateChange` on iOS and Android (`nativePresence`), with times from the game clock so they compare with logbook times; pure `presenceAtStart` and `presenceChange`. `GameRoot` reads the save's `lastTimeSeen` before the resolution loop moves it on, so a cold start counts as coming back from then. New `apps/web/src/client-config.ts` holds the toast timings and the 60-second short absence (CR-028 §3). Tests (`apps/web/test/presence.test.ts`): going away and coming back give the right times, repeats ignored; a cold start (and one in a background tab); the store following a host with the game clock; the browser's `visibilitychange`. - [x] **Step 28.3 — Client: toasts.** `apps/web/src/state/toasts.ts` (the store: newest first; an Independent delivery joins a batch toast shown in the last 10 s, "3 deliveries · +4,200 cr"), `components/Toasts.tsx` (top-right at 768 px and wider, top-center below the safe area on phones, both under the top bar; 5 s each, paused by hover or touch; ✕ and a 60 px swipe close early; at most 3, the rest as "+N more" opening the Logbook; tapping opens the toast's screen; `aria-live="polite"`; no slide with reduced motion) and `components/ToastFeed.tsx` (after each refresh while the player is here: the logbook's unseen entries from `hereSince` on become toasts (`entryToasts`: deliveries, discoveries, level-ups, goals ready, event outcomes, service started, finished and waiting for funds, plain upgrades and repairs; none for deadheads, refuelling, rest or automatic bookings) and are marked seen; a booked service newly out of reach and the fleet going quiet get toasts too). Timings in `client-config.ts`. The away pop-up still opens as before until Step 28.4. Tests (`apps/web/test/toasts.test.tsx`): placement at 1280 and 375 px; 5 s, not while hovered; ✕ and swipe; a fourth toast giving "+1 more" and opening the Logbook; tapping a discovery opening Places; reduced motion; three Independent deliveries within 10 s in one toast with a discovery on its own, and a new toast past the window; player deliveries alone, deadheads none; the feed toasting only entries from while here and marking them seen. Screenshots: `docs/screenshots/28-3-toasts-*`. - [x] **Step 28.4 — Client: pop-up only after being away.** `AwaySummary` no longer opens on unacknowledged deliveries: on each return (presence `returns`, a cold start included) it reads the logbook and takes the unseen entries from before coming back (anything from while the player was here is already seen). None worth a toast: nothing shows (they're marked seen). Away under 60 s: they show as toasts. Otherwise the pop-up, built from exactly those entries, marks them seen and closes the delivery summaries when it closes. `useAwayOpen` holds the deal, the skill-point prompt and radio calls back while it decides or shows. `ToastFeed` closes the summaries of deliveries and upgrades toasted while here, which the pop-up used to do. Presence remembers on the device when the player went away (`devicePresenceMemory`), because a hidden tab keeps running and saving: a cold start comes back from then, else from the save's last time seen. The Logbook's "This absence" is the absence the player last came back from. End-to-end helpers: `goAway` (the tab hidden), `expectNews` (a toast or the pop-up), and `dismissLogbook` copes with either. End-to-end suite green locally (11 tests). Screenshots: `docs/screenshots/28-4-away-*`. Tests (`apps/web/test/away-return.test.tsx`): a delivery while here is a toast with no pop-up; 5 minutes hidden with two deliveries shows the pop-up with exactly those two, and a reload afterwards shows nothing; 30 seconds hidden gives toasts; coming back to nothing shows nothing; `presence.test.ts` (closing a hidden tab). Tests that open the pop-up now come back first (`comeBack` in `test/render.tsx`). -- [ ] Step 28.5 — Regression +- [x] **Step 28.5 — Regression.** Full suite green (199 files, 1,642 tests), lint and type check clean, and the end-to-end suite green locally (11 tests, with the away flows now hiding the tab or reloading). Amendments (CR-028 §6) added to plan Step 9.2, CR-024, CR-025 and CR-026. CI checked after the push. Manual check left for the user: watch deliveries arrive as toasts with the game open, then switch away for a few minutes and confirm the pop-up covers only that time.