Step 10A.18: apply CR-001 plan amendments
CI / check (push) Successful in 2m49s Details

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
fireshaper 2026-10-03 11:38:38 -04:00
parent f2f719415d
commit 7e122dcee7
3 changed files with 22 additions and 2 deletions

View File

@ -550,7 +550,7 @@ Implementation decisions not spelled out in `memory-bank/implementation-plan.md`
## Step 10A.10 ## Step 10A.10
- **"Own-ship deliveries" = resolved, non-tutorial dispatches that carried a contract** (repositions store a null contract and do not count). - **"Own-ship deliveries" = resolved, non-tutorial dispatches that carried a contract** (repositions store a null contract and do not count).
- **A goal stays claimable whenever its condition holds at claim time:** status is computed fresh from current state, so a goal is not "ready" because of something that has since reversed (for example, discovered locations never reverse, but the counts are re-read each time). - **Goal status is computed fresh from current state on every read and every claim;** nothing is cached, so a claim checks the same condition the player saw.
- **Claims during the tutorial fail with `goal-not-ready`,** since goals do not exist until the tutorial is over. - **Claims during the tutorial fail with `goal-not-ready`,** since goals do not exist until the tutorial is over.
## Step 10A.11 ## Step 10A.11
@ -593,3 +593,8 @@ Implementation decisions not spelled out in `memory-bank/implementation-plan.md`
- **The summary lists every goal currently ready to claim,** not only ones that became ready since the last visit. The server does not track when a goal became ready, and an unclaimed ready goal is worth pointing out on any return. - **The summary lists every goal currently ready to claim,** not only ones that became ready since the last visit. The server does not track when a goal became ready, and an unclaimed ready goal is worth pointing out on any return.
- **"Claim on HQ" acknowledges the deliveries and navigates to `/#goals`.** - **"Claim on HQ" acknowledges the deliveries and navigates to `/#goals`.**
- **Web tests wait up to 3 s for elements** (`asyncUtilTimeout`); the 1 s default occasionally ran out under a fully parallel run. - **Web tests wait up to 3 s for elements** (`asyncUtilTimeout`); the 1 s default occasionally ran out under a fully parallel run.
## Step 10A.18
- **Plan amendments are appended to each affected step** as "Amended by CR-001: …" lines, keeping the original text readable next to the change.
- **Known issue found in the regression (not fixed in this phase):** after the deal the player owns only a Courier (20 t), but bay boards draw contract mass uniformly from 5–400 t, so about three boards in four have nothing a Courier can carry. Before CR-001 the player chose their first ship, which hid this; now every player starts with a Courier and would usually have no flyable contract. Fixing it changes contract generation, so it is left for the user to decide.

View File

@ -154,6 +154,7 @@ These answer the pre-build review. Log each one in `DECISIONS.md` as it is imple
- Set time compression to 60 (1 real minute = 1 game hour). - Set time compression to 60 (1 real minute = 1 game hour).
- Choose starting credits, tutorial payout share, and ship prices so that the cheapest ship plus an Earth bay lease is affordable after roughly 15–25 tutorial runs. - Choose starting credits, tutorial payout share, and ship prices so that the cheapest ship plus an Earth bay lease is affordable after roughly 15–25 tutorial runs.
- **Test:** A test validates the config through the schema. A second test computes (Courier price + Earth bay lease) ÷ average tutorial payout (using a fixed placeholder average defined in the test) and asserts it falls between 15 and 25. This test will be revisited in Phase 12 with real sim numbers. - **Test:** A test validates the config through the schema. A second test computes (Courier price + Earth bay lease) ÷ average tutorial payout (using a fixed placeholder average defined in the test) and asserts it falls between 15 and 25. This test will be revisited in Phase 12 with real sim numbers.
- **Amended by CR-001:** Replace the 15–25 runs test. New test: the total tutorial share earned over the configured tutorial runs, plus starting credits, covers fuel for at least three Courier Earth→Moon runs (no soft-lock after the deal).
### Step 2.6 — Export a single content bundle ### Step 2.6 — Export a single content bundle
- Export one `content` object containing all locations, ships, cargo types, skills, and config, plus lookup helpers by id. - Export one `content` object containing all locations, ships, cargo types, skills, and config, plus lookup helpers by id.
@ -183,6 +184,7 @@ These answer the pre-build review. Log each one in `DECISIONS.md` as it is imple
### Step 3.5 — Travel time ### Step 3.5 — Travel time
- Add a function: travel time = distance ÷ ship cruise speed + ship takeoff/landing overhead. Distance is measured at departure time (no mid-flight recalculation). - Add a function: travel time = distance ÷ ship cruise speed + ship takeoff/landing overhead. Distance is measured at departure time (no mid-flight recalculation).
- **Test:** For fixed inputs, the result matches a hand-calculated value. A faster ship always arrives sooner on the same route. Overhead dominates on Earth→Moon (overhead is more than half of total time for the Courier). - **Test:** For fixed inputs, the result matches a hand-calculated value. A faster ship always arrives sooner on the same route. Overhead dominates on Earth→Moon (overhead is more than half of total time for the Courier).
- **Amended by CR-001:** Travel time also includes cargo handling: + mass × handling time per tonne (Step 10A.2, decision 0.5.31).
### Step 3.6 — Fuel cost ### Step 3.6 — Fuel cost
- Add a function: fuel cost = distance × ship fuel cost per million km × origin location's launch multiplier. - Add a function: fuel cost = distance × ship fuel cost per million km × origin location's launch multiplier.
@ -205,6 +207,7 @@ These answer the pre-build review. Log each one in `DECISIONS.md` as it is imple
### Step 3.10 — Tutorial contract board ### Step 3.10 — Tutorial contract board
- Add a separate generator for the tutorial "company board": Earth↔Moon only, Standard cargo only, payout reduced by the tutorial payout share, always flown with the company loaner Courier. Contracts start at the loaner's current location: Earth→Moon when it is at Earth, Moon→Earth when it is at the Moon. - Add a separate generator for the tutorial "company board": Earth↔Moon only, Standard cargo only, payout reduced by the tutorial payout share, always flown with the company loaner Courier. Contracts start at the loaner's current location: Earth→Moon when it is at Earth, Moon→Earth when it is at the Moon.
- **Test:** With the loaner at Earth, every tutorial contract is Earth→Moon; with it at the Moon, every one is Moon→Earth. All use Standard cargo and pay exactly the tutorial share of the equivalent normal payout. - **Test:** With the loaner at Earth, every tutorial contract is Earth→Moon; with it at the Moon, every one is Moon→Earth. All use Standard cargo and pay exactly the tutorial share of the equivalent normal payout.
- **Amended by CR-001:** Superseded by Step 10A.3 (tutorial board v2: three mass tiers, scripted contracts, runs-completed input).
### Step 3.11 — Pilot eligibility ### Step 3.11 — Pilot eligibility
- Add a function that decides if a pilot can take a contract given their skill levels: the pilot's level in the contract's required skill must meet the required level, and the pilot's Long Haul level must meet the contract's required Long Haul level (decision 0.5.7). - Add a function that decides if a pilot can take a contract given their skill levels: the pilot's level in the contract's required skill must meet the required level, and the pilot's Long Haul level must meet the contract's required Long Haul level (decision 0.5.7).
@ -299,26 +302,32 @@ These answer the pre-build review. Log each one in `DECISIONS.md` as it is imple
### Step 6.3 — Tutorial board endpoint ### Step 6.3 — Tutorial board endpoint
- Return the tutorial board for the current period and the loaner's current location, stored on first request per (period, location) (decision 0.5.21), excluding contracts this player has already accepted. Only available while tutorial mode is on. - Return the tutorial board for the current period and the loaner's current location, stored on first request per (period, location) (decision 0.5.21), excluding contracts this player has already accepted. Only available while tutorial mode is on.
- **Test:** A tutorial player at Earth gets a board of the configured size, all Earth→Moon. A non-tutorial player gets an error. Accepted contracts disappear from the board. - **Test:** A tutorial player at Earth gets a board of the configured size, all Earth→Moon. A non-tutorial player gets an error. Accepted contracts disappear from the board.
- **Amended by CR-001:** Board size 3, v2 generator, stored per run as well as per period and location (Step 10A.7).
### Step 6.4 — Tutorial dispatch ### Step 6.4 — Tutorial dispatch
- Allow a tutorial player to dispatch their avatar pilot with the company loaner Courier on a tutorial contract. The loaner is not owned and cannot be used for anything else. Only one tutorial dispatch may be in flight at a time. - Allow a tutorial player to dispatch their avatar pilot with the company loaner Courier on a tutorial contract. The loaner is not owned and cannot be used for anything else. Only one tutorial dispatch may be in flight at a time.
- **Test:** A tutorial dispatch succeeds, charges no fuel, and creates an in-flight dispatch with the correct arrival time. A second tutorial dispatch while one is in flight is rejected. After arrival, state shows credits increased by exactly the tutorial share, pilot XP increased, and the loaner and avatar at the Moon; the next tutorial board is Moon→Earth. - **Test:** A tutorial dispatch succeeds, charges no fuel, and creates an in-flight dispatch with the correct arrival time. A second tutorial dispatch while one is in flight is rejected. After arrival, state shows credits increased by exactly the tutorial share, pilot XP increased, and the loaner and avatar at the Moon; the next tutorial board is Moon→Earth.
- **Amended by CR-001:** Each resolved tutorial run increments the runs-completed counter (Step 10A.7).
### Step 6.5 — Buy a ship ### Step 6.5 — Buy a ship
- Allow buying any ship model if the player has enough credits. A new ship appears idle at Earth with no pilot assigned. - Allow buying any ship model if the player has enough credits. A new ship appears idle at Earth with no pilot assigned.
- **Test:** Buying with enough credits deducts the price and adds the ship. Buying without enough credits returns the insufficient-funds error and changes nothing. - **Test:** Buying with enough credits deducts the price and adds the ship. Buying without enough credits returns the insufficient-funds error and changes nothing.
- **Amended by CR-001:** Blocked during the tutorial with `tutorial-active` (Step 10A.7, decision 0.5.16 as replaced).
### Step 6.6 — Lease a bay ### Step 6.6 — Lease a bay
- Allow leasing a bay at any discovered location where the player does not already have one, for that location's one-time lease price. - Allow leasing a bay at any discovered location where the player does not already have one, for that location's one-time lease price.
- **Test:** Leasing at Earth succeeds and deducts the price. Leasing at an undiscovered location fails. Leasing a second bay at the same location fails. - **Test:** Leasing at Earth succeeds and deducts the price. Leasing at an undiscovered location fails. Leasing a second bay at the same location fails.
- **Amended by CR-001:** Blocked during the tutorial with `tutorial-active` (Step 10A.7).
### Step 6.7 — End tutorial ### Step 6.7 — End tutorial
- When the player owns at least one ship, has a bay at Earth, and has no tutorial run in flight, tutorial mode turns off automatically. The loaner is removed and the avatar moves to Earth as a normal, unassigned pilot. - When the player owns at least one ship, has a bay at Earth, and has no tutorial run in flight, tutorial mode turns off automatically. The loaner is removed and the avatar moves to Earth as a normal, unassigned pilot.
- **Test:** With the avatar at the Moon, buying a ship and leasing an Earth bay turns tutorial mode off, removes the loaner, and leaves the avatar unassigned at Earth. If a tutorial run is in flight when the conditions are met, the tutorial ends when that run resolves. Afterward, the tutorial board endpoint returns an error. - **Test:** With the avatar at the Moon, buying a ship and leasing an Earth bay turns tutorial mode off, removes the loaner, and leaves the avatar unassigned at Earth. If a tutorial run is in flight when the conditions are met, the tutorial ends when that run resolves. Afterward, the tutorial board endpoint returns an error.
- **Amended by CR-001:** Replaced by Step 10A.8 (accepting the deal ends the tutorial; the automatic rule is removed).
### Step 6.8 — Hire and assign pilots ### Step 6.8 — Hire and assign pilots
- Hiring a pilot costs the configured fee and creates a level-0 pilot with a generated name (from the player seed) at a player bay the player chooses. Pilots can be assigned to an idle, uncrewed ship at the same location. Unassigning is allowed only at a location with a player bay. One pilot per ship (decision 0.5.2). - Hiring a pilot costs the configured fee and creates a level-0 pilot with a generated name (from the player seed) at a player bay the player chooses. Pilots can be assigned to an idle, uncrewed ship at the same location. Unassigning is allowed only at a location with a player bay. One pilot per ship (decision 0.5.2).
- **Test:** Hiring at the Moon bay deducts credits and places the pilot at the Moon; hiring at a location without a bay fails. Assigning to an idle ship at the same location succeeds; assigning to a ship at another location, to a crewed ship, or while in flight fails. Unassigning at a location without a bay fails. - **Test:** Hiring at the Moon bay deducts credits and places the pilot at the Moon; hiring at a location without a bay fails. Assigning to an idle ship at the same location succeeds; assigning to a ship at another location, to a crewed ship, or while in flight fails. Unassigning at a location without a bay fails.
- **Amended by CR-001:** Hiring is blocked during the tutorial with `tutorial-active` (Step 10A.7).
### Step 6.9 — Bay contract board endpoint ### Step 6.9 — Bay contract board endpoint
- Return the contract board for one of the player's bays for the current period. On the first request in a period, generate it with the sim using the player's discovered locations at that moment and store it in contract_boards; later requests in the period return the stored board. Exclude already-accepted contracts. Contracts from earlier periods are never shown. - Return the contract board for one of the player's bays for the current period. On the first request in a period, generate it with the sim using the player's discovered locations at that moment and store it in contract_boards; later requests in the period return the stored board. Exclude already-accepted contracts. Contracts from earlier periods are never shown.
@ -380,6 +389,7 @@ These answer the pre-build review. Log each one in `DECISIONS.md` as it is imple
### Step 8.4 — Guest onboarding ### Step 8.4 — Guest onboarding
- On first launch with no session, show a start screen with a "Start your company" button that creates a guest account. Persist the session. - On first launch with no session, show a start screen with a "Start your company" button that creates a guest account. Persist the session.
- **Test:** Component test: clicking the button calls create-guest and navigates to HQ. Reloading with a stored session skips the start screen. - **Test:** Component test: clicking the button calls create-guest and navigates to HQ. Reloading with a stored session skips the start screen.
- **Amended by CR-001:** After creating the guest, the client lands on Contracts, not HQ (Step 10A.11).
### Step 8.5 — Player state store ### Step 8.5 — Player state store
- Use TanStack Query to load player state, refetching when the app regains focus and when any in-flight dispatch's arrival time passes. - Use TanStack Query to load player state, refetching when the app regains focus and when any in-flight dispatch's arrival time passes.
@ -392,6 +402,7 @@ These answer the pre-build review. Log each one in `DECISIONS.md` as it is imple
### Step 9.1 — HQ screen ### Step 9.1 — HQ screen
- Show credits, game date/time, counts of ships idle/in flight, and the next arrival with a countdown. During tutorial, show a clear goal: "Save up for your first ship and an Earth bay," with progress toward the combined cost. - Show credits, game date/time, counts of ships idle/in flight, and the next arrival with a countdown. During tutorial, show a clear goal: "Save up for your first ship and an Earth bay," with progress toward the combined cost.
- **Test:** Component test with seeded state shows correct counts and countdown. Tutorial goal progress shows the correct percentage. - **Test:** Component test with seeded state shows correct counts and countdown. Tutorial goal progress shows the correct percentage.
- **Amended by CR-001:** The tutorial savings goal is replaced by tutorial run progress, the loan card and goals (Steps 10A.14, 10A.15).
### Step 9.2 — "While you were away" summary ### Step 9.2 — "While you were away" summary
- When state contains unacknowledged summaries, show a modal listing each completed delivery (ship, route, credits, XP, discoveries). Dismissing acknowledges them. - When state contains unacknowledged summaries, show a modal listing each completed delivery (ship, route, credits, XP, discoveries). Dismissing acknowledges them.
@ -400,6 +411,7 @@ These answer the pre-build review. Log each one in `DECISIONS.md` as it is imple
### Step 9.3 — Tutorial contract board ### 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. - 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.
- **Test:** Component test shows the board with trip times matching the sim. "Fly it" calls dispatch; it is disabled while a run is in flight. - **Test:** Component test shows the board with trip times matching the sim. "Fly it" calls dispatch; it is disabled while a run is in flight.
- **Amended by CR-001:** Each tutorial contract shows pay, trip time and XP; scripted contracts are styled (Step 10A.12).
### Step 9.4 — Bay contract boards ### Step 9.4 — Bay contract boards
- After tutorial, the Contracts screen has a selector for the player's bays and shows each bay's board. Each contract shows route, cargo type, mass, distance, payout, required skill, expiry countdown, and a first-contact badge where applicable. - After tutorial, the Contracts screen has a selector for the player's bays and shows each bay's board. Each contract shows route, cargo type, mass, distance, payout, required skill, expiry countdown, and a first-contact badge where applicable.
@ -472,14 +484,17 @@ Steps 10A.1–10A.18 are specified in `memory-bank/change-requests/CR-001-faster
- Add a script in `packages/sim` that simulates a player making reasonable choices (always take the highest-paying eligible contract, buy the cheapest ship when affordable, lease Earth bay, then hire pilots) over a configurable span of real time, using only sim functions. - Add a script in `packages/sim` that simulates a player making reasonable choices (always take the highest-paying eligible contract, buy the cheapest ship when affordable, lease Earth bay, then hire pilots) over a configurable span of real time, using only sim functions.
- Output: real time to finish the tutorial, real time to own 3 ships, credits over time, and pilot levels over time. - Output: real time to finish the tutorial, real time to own 3 ships, credits over time, and pilot levels over time.
- **Test:** Running the script with a fixed seed produces identical output twice. With default content, tutorial completion falls between 45 and 120 real minutes of active play. (Adjust content values, not the test thresholds, if it fails; record changes in `DECISIONS.md`.) - **Test:** Running the script with a fixed seed produces identical output twice. With default content, tutorial completion falls between 45 and 120 real minutes of active play. (Adjust content values, not the test thresholds, if it fails; record changes in `DECISIONS.md`.)
- **Amended by CR-001:** Change the thresholds to: deal accepted under 10 real minutes; first pilot hired between 30 and 45 minutes; first discovery under 90 minutes; and a new check that after the deal the player always either has a ship in flight or can afford fuel for at least one contract. The simulated player accepts the deal as soon as it is available, takes the highest credits-per-minute contract, and pays down the loan only through automatic repayment. Adjust content values, not thresholds.
### Step 12.2 — Revisit the tutorial economy test ### Step 12.2 — Revisit the tutorial economy test
- Replace the placeholder average in the Step 2.5 test with the average tutorial payout measured by the balance script. - Replace the placeholder average in the Step 2.5 test with the average tutorial payout measured by the balance script.
- **Test:** The updated Step 2.5 test passes with real sim numbers. - **Test:** The updated Step 2.5 test passes with real sim numbers.
- **Amended by CR-001:** Replaced: use the balance script's measured numbers in the new Step 2.5 test.
### Step 12.3 — End-to-end: tutorial to first ship ### Step 12.3 — End-to-end: tutorial to first ship
- Playwright test against a real server and test database, with the server clock controllable via a test-only setting: start as guest → fly tutorial runs (advancing the clock) until affordable → buy a Courier → lease Earth bay → tutorial ends. - Playwright test against a real server and test database, with the server clock controllable via a test-only setting: start as guest → fly tutorial runs (advancing the clock) until affordable → buy a Courier → lease Earth bay → tutorial ends.
- **Test:** The E2E test passes and final state shows one owned ship, one Earth bay, and tutorial mode off. - **Test:** The E2E test passes and final state shows one owned ship, one Earth bay, and tutorial mode off.
- **Amended by CR-001:** Rewritten: guest → four tutorial runs → accept deal → state shows one owned Courier at Earth crewed by the avatar, one Earth bay, a loan balance, and tutorial off → one contract dispatched and resolved with a repayment applied.
### Step 12.4 — End-to-end: offline progress ### Step 12.4 — End-to-end: offline progress
- Playwright test: dispatch a contract, close the page, advance the server clock past arrival, reopen. - Playwright test: dispatch a contract, close the page, advance the server clock past arrival, reopen.

View File

@ -123,4 +123,4 @@ Spec: `memory-bank/change-requests/CR-001-faster-start.md`. Decisions recorded a
- [x] **Step 10A.15 — Client: goals on HQ.** `src/components/GoalsCard.tsx` (`#goals`): the next three unclaimed goals with rewards; ready goals have "Claim", which calls `claimGoal`; the refreshed state brings the next goal into view. Hidden during the tutorial. - [x] **Step 10A.15 — Client: goals on HQ.** `src/components/GoalsCard.tsx` (`#goals`): the next three unclaimed goals with rewards; ready goals have "Claim", which calls `claimGoal`; the refreshed state brings the next goal into view. Hidden during the tutorial.
- [x] **Step 10A.16 — Client: whole map from the start.** The Map tab works from the first screen (tutorial included); undiscovered locations are labelled with a lock; tapping one shows "Undiscovered — deliver here to unlock" and "Reachable with: …" from the sim route check over purchasable models from Earth (`src/map/reach.ts`). - [x] **Step 10A.16 — Client: whole map from the start.** The Map tab works from the first screen (tutorial included); undiscovered locations are labelled with a lock; tapping one shows "Undiscovered — deliver here to unlock" and "Reachable with: …" from the sim route check over purchasable models from Earth (`src/map/reach.ts`).
- [x] **Step 10A.17 — Client: something waiting on return.** The "while you were away" dialog lists goals ready to claim, with a "Claim on HQ" link that dismisses it and opens HQ's goals. - [x] **Step 10A.17 — Client: something waiting on return.** The "while you were away" dialog lists goals ready to claim, with a "Claim on HQ" link that dismisses it and opens HQ's goals.
- [ ] Step 10A.18 — Plan amendments and regression - [x] **Step 10A.18 — Plan amendments and regression.** CR-001 §6 amendments added to `implementation-plan.md` (steps 2.5, 3.5, 3.10, 6.3–6.8, 8.4, 9.1, 9.3, 12.1–12.3). Full suite and CI green. End-to-end smoke against the real server: four light tutorial runs take 1.9 real minutes of flying, the deal appears at Earth and produces the expected state. **Open issue:** after the deal the Earth board usually has no contract a Courier (20 t) can carry, because bay contracts draw mass uniformly from 5–400 t; awaiting the user's decision. Manual check pending.