Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The [handbook](docs/USER-GUIDE.md) documents every current user flow: steps, def
- Private multiplayer rooms with a C#-owned simulation clock, SignalR snapshots, guest driver claims/readiness, host controls, live pit calls, reconnect, spectator support, guest removal and driver/host handover. Rooms are temporary and use one API instance. See [the multiplayer guide](docs/guide/07-multiplayer.md).
- Fictional driver recruitment: generated stat-based prospects, a 12,000-credit budget, six-driver roster, custom 210-point builds, two swappable race seats, browser persistence and lineup application to local/new multiplayer races. See [recruiting flows](docs/guide/08-driver-recruitment.md).
- Live signed-roster availability in the sandbox, per-slot build selection and partial-lineup sync. **Race this circuit** starts a separate fictional race on the current replay's approximate outline with your selected signed drivers; generated pit lanes are validated before use.
- A local three-race championship with a frozen signed lineup and four rivals, saved calendar/results, points/countback, team score and resumable in-race checkpoints. Entry is free; recruiting prizes/training and multiplayer championships remain future increments. See [championship flows](docs/guide/09-championship.md).
- A local three-race championship with a frozen signed lineup and four rivals, saved calendar/results, points/countback, team score and resumable in-race checkpoints. Saved rounds offer claim-once recruiting rewards with atomic balance/receipts and cross-tab locks. Entry is free; training and multiplayer championships remain future increments. See [championship flows](docs/guide/09-championship.md).
- On-demand tool bundles, recovery from tool download failures, indexed replay lookups, a read-only setup doctor, and a one-command local preview.
- Light/dark themes with a header toggle, system preference on first visit, and a browser-saved choice across races.
- Save, revisit, and delete replay moments. Bookmarks are isolated by race and survive API restarts in PostgreSQL.
Expand Down
2 changes: 1 addition & 1 deletion docs/DEMO.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The next session increment also lets you choose **Race distance (laps)**, select

## Engineering evidence

- [Testing guide](TESTING.md): 84 frontend unit checks, nine Node checks, 62 browser scenarios, real API/database integration and dedicated storage/room concurrency checks.
- [Testing guide](TESTING.md): 93 frontend unit checks, nine Node checks, 67 browser scenarios, real API/database integration and dedicated storage/room concurrency checks.
- [v1.3 architecture and limitations](V1.3.md): separate recorded/fictional state, independent enrichment, data quality and model assumptions.
- `node scripts/benchmark-replay.mjs`: reproducible lookup-only comparison against v1.2 with correctness assertions.
- GitHub Actions builds and tests the application and container; release branches publish an image. Hosting, accounts and multiplayer are later scope.
2 changes: 1 addition & 1 deletion docs/FOLLOW-UP-PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Fictional recruiting now adds generated prospects/fees, a browser-local budget a

Roster/venue integration now fills empty team seats on signing, keeps signed choices current in an open sandbox, applies selected profiles to new unsaved grids and supports explicit partial sync/per-slot swaps without silently resetting active runs. **Race this circuit** prepares the open replay's approximate outline as a validated independent race venue, with a generated connected pit route and the selected signed drivers. Historical results remain separate; public hosting and a protected cross-device team economy are still later work.

The next local-career increment implements a three-round championship using saved/custom and cached replay venues, two frozen signed builds plus four rivals, exact classified results, points/countback, team totals and saved race checkpoints. See [championship flows](guide/09-championship.md). Next: integrate carefully bounded prize credits, then capped driver training, then consider multiplayer championships. The current cup does not change recruiting credits.
The local-career increment implements a three-round championship using saved/custom and cached replay venues, two frozen signed builds plus four rivals, exact classified results, points/countback, team totals and saved race checkpoints. Saved completed rounds now offer explicit claim-once recruiting rewards: 200 plus 20 per team point, with receipts/balance in one record, cross-tab coordination, owner binding and legacy linking. See [championship flows](guide/09-championship.md). Next: capped driver training, a fuller transaction history, then consider multiplayer championships and a protected server economy.

## Branch and validation workflow

Expand Down
7 changes: 4 additions & 3 deletions docs/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Run `node scripts/check-docs.mjs` from the repository root. CI runs the same che

When changing a flow, update its chapter and `docs/flows.json`, then run `node scripts/update-guide-index.mjs` and the checker. Follow [CONTRIBUTING](../CONTRIBUTING.md). Checks catch structural drift; reviewing the steps against actual behavior remains necessary. Documentation-only changes need this check, without repeating unrelated application suites locally.

## Playwright: 62 browser scenarios
## Playwright: 67 browser scenarios

| Area | Coverage |
| --- | --- |
Expand Down Expand Up @@ -35,15 +35,16 @@ When changing a flow, update its chapter and `docs/flows.json`, then run `node s
| Multiplayer | Two independent guest sessions, readiness, synchronized clock/results, live calls, reload/reconnect, driver/host handover, invalid invitations, mobile leave, real-hub concurrent claim conflicts, token/ownership/host checks, forged-time rejection and guest removal |
| Fictional recruitment | Generated sign/release/scouting fees and persistence, custom point limits, saved seat swaps and applied performance, new multiplayer room copies, mobile/failed-write behavior, stale-tab protection, raw backup and confirmed corrupted-profile recovery |
| Roster/venue integration | Same-window/cross-tab signed-roster availability without resetting an active run, explicit partial sync and per-slot swaps, saved-grid preservation, replay-outline racing, valid pit geometry, new-room hosting and historical replay isolation |
| Local championship | Complete three-venue season/results/standings, between-round reload, frozen recruiting budget, live checkpoint and pit-call restore, animation pause/close persistence, stale-tab locking/reload, mobile failed-write preservation and backed-up corrupted-save recovery |
| Local championship | Complete three-venue season/results/standings, between-round reload, no automatic budget changes before explicit reward claims, live checkpoint and pit-call restore, animation pause/close persistence, stale-tab locking/reload, mobile failed-write preservation and backed-up corrupted-save recovery |
| Championship rewards | Saved-result payout and recruiting purchase, reload/receipt persistence, denied-write retry, real Web Locks with simultaneous tab claims, legacy linking/team-reset protection and unsupported-coordination handling |
| Sector map | Completed-reference alignment, saved layout preference, no invented coordinates during gaps, hidden markers before coverage or in estimate mode |
| Tool loading | Studio bundle stays deferred until opened; a failed download returns to a usable replay |

These scenarios run against the production frontend build in Chromium. Historical import transitions/outages are mocked so tests do not depend on the external provider. Cached replay data and bookmark CRUD use the C# API. Each Playwright test receives an isolated browser context.

## Other checks

- 84 Vitest checks cover replay timing and indexed boundary/seek behavior, track interpolation, map/layout preferences, recorded sample lookup and sector alignment, trails, share links, named layouts, geometry/rounding/import validation, deterministic strategy math, held-out pace evaluation, sandbox route/service transitions, setup migration, finish timing/frame invariance, result ordering, cancellation/repeat visits and pit-lane finishes. Recruiting checks cover seeded stats/identities, custom constraints, budget/fees/refunds, roster limits, seat swapping, applied settings and storage/revision failures. A committed shared fixture checks browser/server parity for rounded geometry, pit traversal/service/rejoin and finite results.
- 93 Vitest checks cover replay timing and indexed boundary/seek behavior, track interpolation, map/layout preferences, recorded sample lookup and sector alignment, trails, share links, named layouts, geometry/rounding/import validation, deterministic strategy math, held-out pace evaluation, sandbox route/service transitions, setup migration, finish timing/frame invariance, result ordering, cancellation/repeat visits and pit-lane finishes. Recruiting checks cover seeded stats/identities, custom constraints, budget/fees/refunds, roster limits, seat swapping, applied settings and storage/revision failures. A committed shared fixture checks browser/server parity for rounded geometry, pit traversal/service/rejoin and finite results.
- `Pitwall.RoomChecks` checks authoritative room physics, frame invariance, validation, concurrent seat claims, host/driver authorization, reconnect, handover, guest removal and departure. It also consumes `data/testing/room-model.json`; fixture changes need review, rather than automatic regeneration to make a failure pass.
- Nine Node tests cover catalog filtering, identifiers, location alignment/quality, measured-sector/pit normalization, local environment parsing, bounded ports and connection-string escaping.
- `Pitwall.StoreChecks` verifies enrichment preservation, downgrade protection, concurrent writes, safe bundle seeding and bookmarks against both in-memory storage and PostgreSQL. It creates uniquely named test rows and removes only those rows.
Expand Down
9 changes: 7 additions & 2 deletions docs/USER-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**Product version:** 1.4.0

**Last reviewed:** 2026-11-21
**Last reviewed:** 2026-11-22

This is the current handbook for what each flow does, how to use it, what is saved, and how to recover. The [three-minute demo](DEMO.md) is a quick tour; release notes describe historical changes. This guide describes the current app.

Expand Down Expand Up @@ -69,6 +69,7 @@ Saving to PostgreSQL, saving in your browser and downloading a file are differen
| Multiplayer room | Reconnect while that API process retains it | Guest token in tab session storage; rooms are in server memory even with PostgreSQL |
| Recruiting team | Yes, same browser origin | Autosaved market, roster, lineup and credits; applying to a grid is separate |
| Local championship | Yes, same browser origin | One frozen calendar/lineup, results and latest saved race checkpoint; no importer |
| Championship reward receipts | Yes, with recruiting team | Credits/claim ID saved together; explicit claims read committed cup results and require Web Locks |

Closing a studio or scenario without saving can lose its draft. Clearing browser data, changing browser/profile, or using another hostname/port can change which browser saves you see. A normal database-backed API restart does not erase server caches/bookmarks.

Expand All @@ -90,7 +91,7 @@ Closing a studio or scenario without saving can lose its draft. Clearing browser
<!-- flow-index:start -->
<!-- Generated by scripts/update-guide-index.mjs. -->

94 documented flows. Each ID links directly to its instructions.
98 documented flows. Each ID links directly to its instructions.

### Start Pitwall and choose a race

Expand Down Expand Up @@ -217,6 +218,7 @@ Closing a studio or scenario without saving can lose its draft. Clearing browser
| [TEAM-07](guide/08-driver-recruitment.md#team-07) | Recover from storage failures or another tab's changes |
| [TEAM-08](guide/08-driver-recruitment.md#team-08) | Export a record or explicitly start fresh |
| [TEAM-09](guide/08-driver-recruitment.md#team-09) | Sync signed drivers directly into a sandbox |
| [TEAM-10](guide/08-driver-recruitment.md#team-10) | Inspect championship earnings and spend prize credits |

### Local three-race championships

Expand All @@ -230,6 +232,9 @@ Closing a studio or scenario without saving can lose its draft. Clearing browser
| [CUP-06](guide/09-championship.md#cup-06) | Recover from failed saves or another editing tab |
| [CUP-07](guide/09-championship.md#cup-07) | Export a cup or replace it with a new championship |
| [CUP-08](guide/09-championship.md#cup-08) | Recover an unreadable saved championship |
| [CUP-09](guide/09-championship.md#cup-09) | Claim saved round rewards for recruiting |
| [CUP-10](guide/09-championship.md#cup-10) | Retry safely and coordinate reward claims across tabs |
| [CUP-11](guide/09-championship.md#cup-11) | Link an older cup and understand team resets |
<!-- flow-index:end -->

## How this stays current
Expand Down
62 changes: 61 additions & 1 deletion docs/flows.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"productVersion": "1.4.0",
"lastReviewed": "2026-11-21",
"lastReviewed": "2026-11-22",
"chapters": [
{
"path": "docs/guide/01-start-library.md",
Expand Down Expand Up @@ -1158,6 +1158,66 @@
"frontend/e2e/championship.spec.ts",
"frontend/src/App.tsx"
]
},
{
"id": "CUP-09",
"title": "Claim saved round rewards for recruiting",
"guide": "docs/guide/09-championship.md",
"anchor": "cup-09",
"sources": [
"frontend/src/championship-rewards.ts",
"frontend/src/championship-rewards.test.ts",
"frontend/src/recruitment.ts",
"frontend/src/championship.ts",
"frontend/src/LocalChampionship.tsx",
"frontend/src/DriverRecruitment.tsx",
"frontend/e2e/rewards.spec.ts"
]
},
{
"id": "CUP-10",
"title": "Retry safely and coordinate reward claims across tabs",
"guide": "docs/guide/09-championship.md",
"anchor": "cup-10",
"sources": [
"frontend/src/championship-rewards.ts",
"frontend/src/championship-rewards.test.ts",
"frontend/src/recruitment.ts",
"frontend/src/championship.ts",
"frontend/src/LocalChampionship.tsx",
"frontend/src/DriverRecruitment.tsx",
"frontend/e2e/rewards.spec.ts"
]
},
{
"id": "CUP-11",
"title": "Link an older cup and understand team resets",
"guide": "docs/guide/09-championship.md",
"anchor": "cup-11",
"sources": [
"frontend/src/championship-rewards.ts",
"frontend/src/championship-rewards.test.ts",
"frontend/src/recruitment.ts",
"frontend/src/championship.ts",
"frontend/src/LocalChampionship.tsx",
"frontend/src/DriverRecruitment.tsx",
"frontend/e2e/rewards.spec.ts"
]
},
{
"id": "TEAM-10",
"title": "Inspect championship earnings and spend prize credits",
"guide": "docs/guide/08-driver-recruitment.md",
"anchor": "team-10",
"sources": [
"frontend/src/championship-rewards.ts",
"frontend/src/championship-rewards.test.ts",
"frontend/src/recruitment.ts",
"frontend/src/championship.ts",
"frontend/src/LocalChampionship.tsx",
"frontend/src/DriverRecruitment.tsx",
"frontend/e2e/rewards.spec.ts"
]
}
]
}
1 change: 1 addition & 0 deletions docs/guide/06-maintenance.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
| Saved circuits/sandbox setups/strategy scenarios | Browser only | Browser only | Same origin isolation |
| Recruiting roster/market/lineup/credits | Browser only, autosaved on successful transactions | Browser only | Same origin; separate from server rooms and guest ownership |
| Local championship/results/race checkpoint | Browser only | Browser only | One cup per origin; independent of recruiting credits and server rooms |
| Claimed championship rewards | Credits and receipts in recruiting team record | Same browser record | Explicit claim bridges saved cup results into budget; no server-account economy |
| Unsaved drafts, tool selections, simulation clock | Current page/tool session | Current page/tool session | Not automatically restored |
| Multiplayer rooms/shared race clock | API process memory; lost on restart | API process memory; lost on restart | Guest credential in tab session storage, no token in invitation |
| Exported files | Download location you choose | Download location you choose | Not automatically re-imported |
Expand Down
Loading
Loading