Skip to content

Fuel target over the radio, track markers from the wheel, setup export, and a sign-in that is safe to go public - #306

Merged
kratofl merged 13 commits into
mainfrom
feat/fuel-target-markers-export-auth
Dec 4, 2026
Merged

kratofl merged 13 commits into
mainfrom
feat/fuel-target-markers-export-auth

Conversation

@kratofl

@kratofl kratofl commented Dec 4, 2026

Copy link
Copy Markdown
Owner

Five open issues, each its own commit, then the fixes from three rounds of fresh-context review.

For drivers

  • The engineer can radio a fuel target (Remote Dash manipulation #27). The pit wall's Radio tile has a Fuel per lap row next to Target lap. The driver's wheel shows a banner, and from the next line the figure replaces the plan's fuel per lap on the dash. It stays until the link ends. A driver on an older Sprint can't receive it, and the Send button says so up front (link level 5 → 6). In a race the fuel widget still shows the margin to the flag, as before.
  • Mark a spot while driving (Place Markers on track #18). Bind Mark this spot to a wheel button. A press drops a marker where the car is, and it shows up in Analysis as an editable note once the lap is filed. Presses in the garage or pit lane are ignored, and markers on a lap that is never filed are dropped. A radio banner on the wheel does not swallow the press.
  • Export a setup (Export setups to a location the driver picks #190). Setups → Export… writes the chosen version's .svm byte for byte to a place the driver picks. The game folder is refused, also through junctions and symlinks, and the file goes in by temp file plus rename. Sprint can't edit setups yet, so the export is the file as the game saved it. Versions Sprint kept before this change saved only their values, not the file, so they can't be exported, and the button says why.

For the API, before going public

  • Sign-out revokes the token on the server (API: signing out does not end a session — add token revocation or short-lived tokens #233). Each token carries a jti. signOut stores it until expiry, and the bearer hook refuses it on GraphQL, live ingest and the live stream. Only that device is signed out. The web and desktop both call it, and a slow database or a timed-out request can't drop the revocation. Already-open live connections stay open until they drop.
  • Sign-in and registration are rate-limited (API: rate-limit login and register before going public #234). login allows 20 a minute per address, 5 a minute per account from one address, and 50 an hour per account across all addresses, counted before the password check so a burst can't get past. An address the account signed in from in the last 30 days skips the per-account limit, so strangers can't lock the owner out. register allows 5 an hour per address.
  • The client address is trusted only from known proxies. CF-Connecting-IP counts only from loopback or SPRINT_TRUSTED_PROXIES. The web forwards it only with SPRINT_BEHIND_TUNNEL=true.

⚠️ Deploying this

Both compose files now pin a subnet (10.203.0.0/24 locally, 10.203.1.0/24 on Komodo) and fixed IPs for web and tunnel, so the trust list stays valid. An existing stack may need docker compose down (or Komodo Destroy, which keeps the volumes) before redeploying. If 10.203.x.x clashes with another network on the host, change it. Both cases are in docs/operations/deployment.md. Without the tunnel flag, all web visitors share one limit; that is documented there too.

Screenshots

README and driver-guide screenshots now come from the real recordings in app/recordings: Monza laps, real map and traces, release status bar. readme-shots.mjs captures a hidden run of the app on them and renders that capture in the preview harness. It switches away from the real game folder first, refuses a capture containing anything else, and cleans up even when the run crashes. Device, Dashes and the pit wall stay on the sample: no wheel attached, no laps shown, and the pit wall needs a live link.

Checks

  • API: 138 tests pass, build clean with warnings as errors.
  • Desktop: 1244 core, 234 host, 289 renderer and 398 TypeScript tests pass. The desktop solution builds clean with warnings as errors.
  • Every UI change was looked at in the preview harness, dark and light.

Not verified

  • Nothing ran in the real Electron app: the export save dialog, a wheel press while driving LMU, the fuel target between two PCs over the live link.
  • An exported .svm loaded in LMU.
  • The upgrade that adds the RevokedTokens table, against a real Postgres. Tests use the in-memory provider.
  • The pinned compose networks and the tunnel flow on a real Docker host behind Cloudflare.

Closes #18
Closes #27
Closes #190
Closes #233
Closes #234

🤖 Generated with Claude Code

kratofl and others added 13 commits December 4, 2026 13:09
Until now signing out only dropped the web cookie or the desktop's stored
token; the token itself kept working for up to 24 hours. Every token now
carries a jti, and the new signOut mutation stores it as revoked until the
token expires. The bearer middleware refuses revoked tokens on every request
(GraphQL, live ingest, live stream), so only the device that signed out is
affected. The web and the desktop both call signOut when the user signs out;
the desktop forgets the token first, so an unreachable server still leaves it
signed out.

Refs #233

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… guessing

login and register had no limits, so a public deployment invited password
guessing and account spam. login now allows 5 attempts a minute per email and
20 per client address, register 5 an hour per client address; one more gets a
GraphQL error with the code RATE_LIMITED. The limits live in the two
resolvers, since every mutation shares /graphql.

The client address comes from CF-Connecting-IP, believed only from a loopback
or private-network peer (the tunnel, the web), so nobody on the internet can
pick their own. The web passes the browser's address on, or every web
sign-in would count against the web server's. IPv6 clients are keyed by /64.

Refs #234

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A driver can now save any setup version Sprint kept as a .svm file
wherever they choose, to share it or to load later by copying it in.
Sprint keeps each version's original file byte for byte and writes
exactly that: comments, sections and index values untouched, since
Sprint edits no setup values yet. Versions captured before files were
kept say why they cannot be exported. The host turns away any
destination inside the game's install or setups folder before
Electron writes, so no export can change what the game loads.

Refs #190

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… aims at

The pit wall's Radio tile gets a fuel-per-lap stepper next to the target lap. What the engineer
sends shows as a radio banner on the wheel and, from the next line, replaces the plan's fuel per
lap on the dash (the fuel target widget outside a race and the lap review's fuel line), the same
way a radioed target lap replaces the plan's. It lasts while the link does; a newer one replaces it.

The link level goes to 6: a driver on an older Sprint would show the text but never put the figure
on the dash, so the engineer's side refuses to send it and says the driver needs to update.

Refs #27

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… afterwards

A wheel button set to "Mark this spot" drops a marker at the car's lap distance on the
lap being driven, so the driver can flag something mid-lap without stopping to remember
it. When that lap is filed, each marker becomes one of the driver's own lap notes
("Marked while driving"), editable like any note. Presses out of the car, in the garage
or pit lane, or with no lap running are ignored; a lap that is never filed takes its
markers with it.

Refs #18

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…p sample

The overview, plan, On track and Analysis shots drew the preview's invented
Spa race and a fictional friend. readme-shots.mjs now runs the real app on
the committed recordings (Monza and Le Mans, no real names), captures its
state, lap traces and plan targets mid-race, and draws that capture in the
preview, so the shots show real tracks and laps with release chrome. The run
reads setups and results from an empty stand-in folder, never the installed
game's. Device, dashes and pit wall stay on the sample: no wheel is attached,
Dashes shows no laps, and a pit wall needs a second linked Sprint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and sign-out always sticks

The API believed CF-Connecting-IP from any private-network peer, which the web
container always is and Docker's port proxy can make outsiders look like, so
anyone reaching a published port could state a fresh address per request and
skip the limits. It now believes the header only from loopback and the
addresses in SPRINT_TRUSTED_PROXIES: the compose files give the web and the
tunnel fixed addresses and list them. The web passes the browser's address on
only with SPRINT_BEHIND_TUNNEL=true; without it, web sign-ins share one client
address, as the deployment guide now says.

Five wrong guesses from anywhere locked an account for a minute. The tight
limit now counts per email and address, with a looser 50 an hour per email
against guessing from many addresses.

Two sign-outs at once could fail the expired-row cleanup and lose the
revocation. The token is now stored first, idempotently, and the cleanup runs
on its own. ValidateAndGetUserId, which skipped revocation, is gone; tests use
a helper.

Refs #233, #234

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ark this spot through a radio banner

A radioed target lap or fuel per lap was read back from the radio list, which keeps only the last
20 messages, so after 20 more calls the dash quietly fell back to the plan's figure. The targets
are now held on their own until a newer one arrives or the link ends.

A Mark this spot press while a radio message was on the wheel only acknowledged the message, so the
marker was lost; it now drops the marker and leaves the message up, like Ack runs as itself. The pit
wall's fuel Send is off up front, with the reason, for a driver whose Sprint cannot take a fuel
target, instead of failing after the press. Several presses within one frame now make one marker
rather than identical notes at the same spot.

Refs #27, #18

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The game-folder check compared path text, but the write follows
junctions, symlinks and subst drives, so a link could pass the check and
land the file in the game's setups. Electron now resolves the chosen
folder before asking the host, the host resolves its game folders through
links the same way, and the file goes in by renaming a temporary one over
it, so a link already at the target is replaced instead of written
through. Export also waits while one is under way, so a double click no
longer opens two save dialogs.

Refs #190

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… itself

If the app died mid-drive, a CDP call never settled and Node exited before
the cleanup ran, which could leave the run and its host behind. Calls now
fail when the window closes, the agent run exits or 30 s pass, so the run
and the build servers are always stopped (once, even on a signal during
cleanup). A missing sidebar page, Live Compare lap or qualifying target now
fails the capture instead of giving a wrong shot, and the Analysis shot opens
the race lap the capture names as fastest instead of a hard-coded lap 6.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… slow sign-out still sticks

Fifty wrong guesses an hour at one email, from anywhere, locked its owner out
for the rest of the hour. That limit now counts only wrong passwords, and an
address the account signed in from in the last 30 days skips it (remembered in
memory); the per-address limits still apply to it.

Sign-out stored the revocation with the request's cancellation, so a web that
gave up after 10 s could report "signed out" while the store was cancelled. It
is now stored regardless, and the expired-row cleanup after it is best effort:
a deadlock, timeout or cancellation there is logged instead of failing the
sign-out.

Refs #233, #234

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…heck follows links on a link's own path

The outbox sends a message again until it hears back, so a lost target could
arrive after a newer one and replace it on the driver's dash. Each target now
keeps its message id and only a higher id replaces it.

The game-folder check swapped a link for its target but never looked at the
folders on the target's path, so a second link there (C:\Games -> D:\Mount\Games
with D:\Mount -> E:\) left it comparing the wrong path. The walk now starts
again after each swap, and a folder that is still leading through links after
40 swaps refuses every destination.

Refs #27, #190

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…guesses cannot pass the limit

Counting only wrong passwords, after the check, let a botnet fire guesses at one
account all at once: none had failed yet, so about a thousand could get past the
limit of 50 an hour. Every attempt from an address the account has not signed in
from recently now takes its permit up front again, which makes 50 a hard cap.
An address the owner signed in from in the last 30 days still skips that limit,
so strangers' guesses cannot lock the owner out; a correct sign-in from a new
address now costs one of the 50.

Refs #233, #234

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kratofl kratofl added the type/feature Feature request or capability work label Dec 4, 2026
@kratofl
kratofl enabled auto-merge (squash) December 4, 2026 15:12
@kratofl
kratofl merged commit 610912d into main Dec 4, 2026
3 checks passed
@kratofl
kratofl deleted the feat/fuel-target-markers-export-auth branch December 4, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/feature Feature request or capability work

Projects

None yet

1 participant