Investigated whether two admin browsers open at once can overwrite each other's changes, per an explicit request to report the risk before making bigger changes. Found that POST /api/state always replaces the entire stored document with a client's in-memory copy, with no version check and no per-field merge - and a browser only ever pushes, never re-fetching server state after page load except on the Overlay view. An idle browser's next save, even an unrelated edit, could silently revert another browser's more recent changes, worst case a live race's in-progress results. Two scoped fixes instead of the bigger optimistic-locking rework (that needs real UX decisions about conflicting saves, deferred separately): 1. server.js now remembers which session results were just written by a real live decoder passing (/api/passings) and protects that key for 15 seconds against being reverted by a stale full-state save, while still applying the rest of that save normally. 2. Every non-Overlay view now quietly refreshes its data in the background every 15 seconds (skipped while a local edit is pending), without ever calling renderView(), so it can never discard an open, unsaved edit form - shrinking how stale a browser's next save can be from hours to seconds. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
34 lines
1.1 KiB
JSON
34 lines
1.1 KiB
JSON
{
|
|
"name": "rc-racecore",
|
|
"version": "1.4.3",
|
|
"private": true,
|
|
"description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence",
|
|
"engines": {
|
|
"node": ">=22 <27",
|
|
"npm": ">=10"
|
|
},
|
|
"allowScripts": {
|
|
"better-sqlite3": true
|
|
},
|
|
"scripts": {
|
|
"preinstall": "node scripts/preinstall.js",
|
|
"postinstall": "node scripts/verify-install.js",
|
|
"start": "node scripts/serverctl.js start",
|
|
"start:fg": "node server.js",
|
|
"stop": "node scripts/serverctl.js stop",
|
|
"status": "node scripts/serverctl.js status",
|
|
"restart": "node scripts/serverctl.js restart",
|
|
"verify": "node scripts/verify-install.js",
|
|
"backup:restore": "node scripts/restore-backup.js",
|
|
"audit:prod": "npm audit --omit=dev",
|
|
"test": "node --experimental-default-type=module tests/run.js",
|
|
"test:browser": "node --experimental-default-type=module tests/browser_smoke.js",
|
|
"setup:windows": "powershell -NoProfile -ExecutionPolicy Bypass -File windows/setup.ps1"
|
|
},
|
|
"dependencies": {
|
|
"better-sqlite3": "^12.11.1",
|
|
"express": "5.2.1",
|
|
"qrcode": "^1.5.4"
|
|
}
|
|
}
|