From 443434d56938bcadbcafd45e527fba3d958fefe7 Mon Sep 17 00:00:00 2001 From: larssand Date: Tue, 8 Sep 2026 17:26:55 +0200 Subject: [PATCH] fix status and roadmap --- CHANGELOG.md | 8 ++ README.md | 10 +++ README.sv.md | 10 +++ ROADMAP.md | 79 +++++++++++++++++++ docs/javascript-architecture.md | 9 +++ index.html | 6 ++ package.json | 1 + src/app.js | 80 +++++++++++++++++++- src/runtime_services.js | 19 ++++- src/styles.css | 9 +++ src/sync_status.js | 8 ++ tests/browser_smoke.js | 130 ++++++++++++++++++++++++++++++++ tests/run.js | 1 + tests/sync_status.test.js | 39 ++++++++++ 14 files changed, 401 insertions(+), 8 deletions(-) create mode 100644 ROADMAP.md create mode 100644 src/sync_status.js create mode 100644 tests/browser_smoke.js create mode 100644 tests/sync_status.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 1521aad..42d3731 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,16 @@ The application version is maintained in `package.json` and displayed in the adm ## Unreleased +### Added + +- A prioritized ROADMAP.md with completion checklists. +- Server/save status, last load/save times, stale/offline warnings and manual retry of local changes. +- Isolated browser regression checks for class/driver/car creation and editing, retained drafts, reload persistence and offline save recovery (`npm run test:browser`). + ### Fixed +- New browser profiles connect to the page origin rather than assuming backend port 8081. + - Correct chronological sorting of zero-padded times and deterministic ordering of distinct numeric-looking driver/car names. Name and identifier columns are explicitly treated as text. - OBS race-info and standings panels wrap on narrow sources. Driver names retain space and timing fields wrap instead of overflowing. diff --git a/README.md b/README.md index b6ef9dd..fa1a288 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # RC RaceCore +Planned work and completion checklists are tracked in [ROADMAP.md](ROADMAP.md). + The running version is shown at the bottom of the menu and comes from `package.json`. Changes are recorded in [CHANGELOG.md](CHANGELOG.md). English README. Swedish version: [`README.sv.md`](README.sv.md) @@ -833,3 +835,11 @@ The repository includes `rc-race-sound-pack/`. `sound_manifest.json` is the sour Effects are asynchronous and never awaited by decoder processing. Critical speech interrupts lower-priority speech; short passing effects may overlap. Missing WAV files are ignored safely. A driver or car may select `pass_01.wav` through `pass_08.wav`; until those optional files exist under `rc-race-sound-pack/sounds/effects/`, playback falls back to `transponder_pass.wav`. Implemented automatic hooks include passings, personal/meeting best, fastest lap, historical class track record, leader and position changes, pit entry/exit, 60/30/10 seconds remaining, final lap/time expired, finish, winner, and podium. Penalty announcements reuse the existing judging correction action. + +## Reliability checks and save status + +The menu shows server connection, pending changes, saving, confirmed saves and save failures. It also shows the latest successful data load/save times. A visible warning indicates a lost or stale server connection; a successful health check does not clear a failed save. Use **Retry** to resend local changes. Server connection and decoder connection are separate indicators. Keep the tab open while changes are unsaved. + +New browser profiles use the page origin (including its port) as the default backend URL. An explicitly configured backend URL takes precedence. + +Run `npm test` for logic and API regression tests. Run `npm run test:browser` (Windows PowerShell: `npm.cmd run test:browser`) for real create/edit/reload checks of classes, drivers and cars, draft retention during background polling, and offline-save/retry behavior. Chrome, Chromium or Edge must be installed; set `CHROME_PATH` if its executable is not found automatically. The runner creates a temporary server database and browser profile and removes them on exit. It does not use your normal race data or start a decoder. See ROADMAP.md for workflows not yet covered. diff --git a/README.sv.md b/README.sv.md index e652c12..159de78 100644 --- a/README.sv.md +++ b/README.sv.md @@ -1,5 +1,7 @@ # RC RaceCore +Planerade förbättringar och avbockningsbara delmål finns i [ROADMAP.md](ROADMAP.md). + Versionen som körs visas längst ned i menyn och hämtas från `package.json`. Ändringar dokumenteras i [CHANGELOG.md](CHANGELOG.md). RC timing app med sponsor-eventflöde (delade bilar/transpondrar mellan olika heat/finaler), AMMC WebSocket och lokal SQLite-lagring på Windows. @@ -822,3 +824,11 @@ Repot innehåller `rc-race-sound-pack/`. `sound_manifest.json` är källan för Effekter körs asynkront och väntas aldrig in av decoderflödet. Kritiska utrop avbryter lägre prioriterat tal; korta passing-ljud får överlappa. Saknade WAV-filer ignoreras säkert. En förare eller bil kan välja `pass_01.wav` till `pass_08.wav`; tills dessa valfria filer finns i `rc-race-sound-pack/sounds/effects/` används `transponder_pass.wav` som fallback. Automatiska hooks omfattar passering, person-/meetingbästa, snabbaste varv, historiskt klass-banrekord, ledar- och positionsbyte, depå in/ut, 60/30/10 sekunder kvar, sista varv/tiden slut, finish, vinnare och podium. Penalty-utrop återanvänder domarvyns befintliga korrigeringsåtgärd. + +## Driftsäkerhet och sparstatus + +Menyn visar serveranslutning, väntande ändringar, pågående sparning, bekräftad sparning och sparfel. Där visas även senaste lyckade hämtning/sparning. En synlig varning visar tappad eller inaktuell serveranslutning; en lyckad anslutningskontroll tar inte bort ett sparfel. Klicka **Försök igen** för att skicka lokala ändringar igen. Serveranslutning och decoderanslutning har separata indikatorer. Behåll fliken öppen medan ändringar är osparade. + +Nya webbläsarprofiler använder sidans adress inklusive port som standard för backend. En uttryckligen konfigurerad backend-adress går före standardvärdet. + +Kör `npm test` för logik- och API-tester. Kör `npm run test:browser` (Windows PowerShell: `npm.cmd run test:browser`) för riktiga skapa/redigera/ladda-om-tester av klasser, förare och bilar, bibehållna formulärutkast under bakgrundsuppdatering samt offline-sparning och nytt sparförsök. Chrome, Chromium eller Edge måste finnas installerat; sätt `CHROME_PATH` om programmet inte hittas automatiskt. Testet skapar en tillfällig serverdatabas och webbläsarprofil och tar bort dem efteråt. Dina ordinarie racedata används inte och ingen decoder startas. ROADMAP.md visar vilka flöden som ännu saknar täckning. diff --git a/ROADMAP.md b/ROADMAP.md new file mode 100644 index 0000000..829a094 --- /dev/null +++ b/ROADMAP.md @@ -0,0 +1,79 @@ +# RC RaceCore Roadmap + +Track work here with checkboxes. Check off a task only after implementation and verification. Record user-visible changes under `Unreleased` in [CHANGELOG.md](CHANGELOG.md). Priorities below are a working order, not release-date commitments. + +## Existing foundation + +- [x] Race Day, preflight checks and heat queue. +- [x] Automatic SQLite backups and local restore command. +- [x] Isolated session replay. +- [x] Training statistics, personal mobile profiles and car-change markers. +- [x] Interactive list sorting and OBS display modes. +- [x] Visible application version and changelog. + +Verified 2026-09-08: 122 logic/API tests and the register/offline browser smoke suite passed on Linux with Chrome. Checked items below describe that coverage; other platforms and workflows remain open. + +## 1. Reliability and browser regression tests + +Acceptance: real create/edit/save flows persist after reload; background updates do not discard edits. Tests use isolated data, never the installation's database. + +- [x] Add a repeatable browser smoke-test command with temporary database/profile. +- [x] Cover create/edit/save for classes, drivers and cars, including reload verification. +- [x] Verify register form drafts remain intact during background version polling. +- [ ] Cover sponsor events and race setup edits. +- [ ] Cover team creation, membership changes, editing and deletion. +- [ ] Cover session types, lap limits and start/finish controls. +- [ ] Cover browser sorting, popup overlays, and compact OBS layout automatically. +- [ ] Add Windows and Linux CI runs for supported runtimes. + +## 2. Connection and save status + +Acceptance: users can distinguish server contact, pending edits, an active save and a failed save; a health check never falsely confirms a failed write. + +- [x] Show pending, saving, saved and failed state in the main interface. +- [x] Show last successful data load/save times. +- [x] Warn when the server connection is lost or its status becomes stale. +- [x] Offer manual retry for unsaved changes without discarding local edits. +- [x] Verify save failure/reconnection in a real browser. +- [ ] Extend stale-data feedback to the personal mobile profile. +- [ ] Review concurrent writes, reconnect recovery and multiple controllers editing the same race. + +## 3. Clearer practice follow-up + +Acceptance: a driver receives a short, encouraging summary based on their own class-specific data, with one useful next goal. + +- [ ] Add an end-of-practice summary: pace, consistency, progress and achieved goals. +- [ ] Suggest one next training goal using existing calculations. +- [ ] Keep summaries separate by class and explain insufficient sample sizes. +- [ ] Include the summary in the personal mobile profile. +- [ ] Add coach/parent reward follow-up without turning practice into a public ranking. + +## 4. Results archive + +- [ ] Search completed sessions by date, class and driver without Race Setup. +- [ ] Show standings, lap history and penalties together. +- [ ] Reuse existing PDF/export functions from the archive. +- [ ] Define what remains available after deleting a race. + +## 5. More natural race speech + +- [ ] Optional backend-generated neural speech. +- [ ] Cache announcements and driver names before race day. +- [ ] Keep credentials on the backend, outside exports and public responses. +- [ ] Invalidate cached speech when language, voice or pronunciation changes. +- [ ] Provide provider status and a pre-generate action. +- [ ] Verify offline fallback and that playback never delays timing. + +## 6. Permissions and mobile Race Control + +- [ ] Define Admin, Race Director, Speaker and Read-only capabilities. +- [ ] Enforce permissions on server endpoints, not only in the UI. +- [ ] Keep public overlays and training links restricted. +- [ ] Build compact mobile controls for start/stop, track call, flags and next heat. +- [ ] Test concurrent control and accidental repeated commands. + +## Documentation maintenance + +- [ ] Update the architecture's module/dependency inventory as modules change. +- [ ] Complete state/settings/SQLite contracts and critical form-to-controller mappings. +- [ ] Consolidate older future-work notes so this file remains the primary roadmap. diff --git a/docs/javascript-architecture.md b/docs/javascript-architecture.md index 08db8ef..c4b7579 100644 --- a/docs/javascript-architecture.md +++ b/docs/javascript-architecture.md @@ -2652,3 +2652,12 @@ The application currently has no authentication or role model. Race-control soun ### 20.8 Tests `tests/race_audio.test.js` covers normalization, language/event mapping, custom-file fallback, critical interruption, start-light order, random delay, and tone/timestamp callback order. Existing decoder, runtime persistence, audio fallback, race timing, and server integration suites remain the regression boundary. + +## Reliability status and browser checks (2026-09) + +- `src/sync_status.js` exports pure `getSyncStatus(backend, dirty, now)`. Its precedence is active writes, write failure, pending local changes, connection availability/staleness, then saved/connected. It does not mutate race state or initiate network calls. +- `src/runtime_services.js` records active state writes in `backend.pendingWrites`, keeps `writeError` distinct from contact status, records `lastSavedAt` only after a successful state POST, and records `lastLoadedAt` after applying a backend state response. A failed POST leaves local dirty/version tracking intact. +- Existing app-version polling reports server contact through an optional `onContact` callback. `src/app.js` updates `lastContactAt`/`connectionChecked` and renders status text once per second without rebuilding forms. Contact older than 15 seconds is stale. Decoder connectivity remains separate. +- `index.html` owns `syncStatus`, `syncStatusLabel`, `syncStatusDetail`, `syncStatusRetry`, and `syncWarning`. Retry uses the existing full-state POST when local changes or write errors exist. Successful full-state synchronization at the current local version clears the passing error too. Keep the page open when unsaved changes exist; this is not a new durable offline queue or a multi-controller conflict-resolution mechanism. +- `tests/sync_status.test.js` verifies status precedence and state-write failure/retry. `tests/browser_smoke.js` drives Chrome/Chromium/Edge over its local debugging protocol with Node's WebSocket API. It launches an isolated server using `RC_TIMING_DATA_DIR` and a temporary browser profile. `CHROME_PATH` overrides discovery. `RC_BROWSER_NO_SANDBOX=1` is an explicit opt-in for restricted test environments; normal runs keep the browser sandbox enabled. +- The browser suite covers register CRUD creation/editing (not deletion), drafts through two version polls, reload persistence, failed offline saves and retry. Session/team flows and CI platform coverage remain tracked in ROADMAP.md. diff --git a/index.html b/index.html index 2dc0dc0..7a41ab1 100644 --- a/index.html +++ b/index.html @@ -24,6 +24,11 @@