Description
Completed single-player games are intermittently not saved to the player's profile. When the issue occurs, the game does not appear in recent games, its statistics are missing, and even the number of games played in the server-side profile is not incremented.
The relevant request appears to be:
POST /archive_singleplayer_game
The problem was initially noticed while an ad blocker was enabled. However, repeating the same test with the ad blocker still enabled successfully archived a subsequent game, so ad-block detection itself does not appear to be a deterministic cause.
Steps to reproduce
- Sign in to an OpenFront account.
- Start and complete a single-player game.
- Return to the home page or leave the end-game screen.
- Open the player profile and check recent games/statistics.
- Repeat several times.
Actual behavior
Intermittently:
archive_singleplayer_game does not successfully persist the game;
- the completed match is absent from the profile;
- match statistics are absent;
- the profile does not reflect that the game was played.
Other games under the same browser/ad-block configuration are saved correctly.
Expected behavior
Every completed single-player game should be archived exactly once and reflected in the authenticated player's profile, even if the player navigates away shortly after the match ends.
Possible implementation issue
In src/client/LocalServer.ts, endGame() invokes the async archive operation without awaiting it:
this.archiveGame(result.data);
Before the fetch starts, archiveGame() still needs to:
- retrieve the authorization header;
- serialize the game record;
- gzip-compress the payload.
Although the eventual request uses keepalive: true, navigation or page teardown may happen before the fetch is created. This could make the failure timing-dependent.
Additionally, the response status is currently not checked:
await fetch(`${getApiBase()}/archive_singleplayer_game`, ...);
A resolved HTTP response such as 401, 403, 413, 429, or 5xx would therefore not enter the catch block and would not produce a visible archive error.
Suggested improvements
- Ensure the archive operation is awaited or otherwise reliably queued before navigation/page teardown.
- Check
response.ok and log the response status/body on failure.
- Consider retrying transient failures or persisting an unsent archive locally for later retry.
- Show a visible saving/saved/failed state on the end-game screen.
Environment
- Web version:
https://openfront.io/
- Authenticated player profile
- Single-player mode
- Browser extension/ad blocker enabled during the initial failures, but the issue did not reproduce on every attempt with the same configuration.
Description
Completed single-player games are intermittently not saved to the player's profile. When the issue occurs, the game does not appear in recent games, its statistics are missing, and even the number of games played in the server-side profile is not incremented.
The relevant request appears to be:
The problem was initially noticed while an ad blocker was enabled. However, repeating the same test with the ad blocker still enabled successfully archived a subsequent game, so ad-block detection itself does not appear to be a deterministic cause.
Steps to reproduce
Actual behavior
Intermittently:
archive_singleplayer_gamedoes not successfully persist the game;Other games under the same browser/ad-block configuration are saved correctly.
Expected behavior
Every completed single-player game should be archived exactly once and reflected in the authenticated player's profile, even if the player navigates away shortly after the match ends.
Possible implementation issue
In
src/client/LocalServer.ts,endGame()invokes the async archive operation without awaiting it:Before the
fetchstarts,archiveGame()still needs to:Although the eventual request uses
keepalive: true, navigation or page teardown may happen before thefetchis created. This could make the failure timing-dependent.Additionally, the response status is currently not checked:
A resolved HTTP response such as
401,403,413,429, or5xxwould therefore not enter thecatchblock and would not produce a visible archive error.Suggested improvements
response.okand log the response status/body on failure.Environment
https://openfront.io/