Repository navigation
fix: safe save validation and mobile recovery - #6
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 965accfb09
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (archived) { | ||
| const copy = record.conflicts.find(item => item.id === archived.id); | ||
| if (!record.invalidLocal || !copy || candidate.buckets.sessions.merge2048) throw new Error("session_changed"); | ||
| if (!core.equal(record.payload, store.initial)) throw new Error("other_progress_changed"); |
There was a problem hiding this comment.
Permit recovery after the lobby refreshes daily-card state
In the actual arcade lobby flow, renderLobby() calls statText() for the daily-card game, which calls Storage.getCards() and automatically changes cards.date from the quarantined store's initial value. Consequently, by the time a user opens Merge 2048 and chooses either recovery action, record.payload no longer equals store.initial, this branch throws other_progress_changed, and the modal remains permanently pending even though the user made no conflicting gameplay changes. The recovery check needs to tolerate or preserve benign post-quarantine changes rather than requiring the entire payload to remain byte-for-byte initial.
Useful? React with 👍 / 👎.
| Storage.store.record.conflicts.slice().reverse().find(item => item.reason === "invalid_local" && | ||
| item.payload.buckets && item.payload.buckets.sessions && item.payload.buckets.sessions.merge2048); |
There was a problem hiding this comment.
Guard malformed archive roots before dereferencing
When Store.reload() quarantines a save whose root payload is null or missing—both valid corruption scenarios for this recovery path—it archives that value and resets the live payload. Opening Merge 2048 then evaluates item.payload.buckets here and throws a TypeError, so the game cannot start or offer recovery. Check that the archived payload and its nested objects exist before inspecting the session.
Useful? React with 👍 / 👎.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Scope
Verification
Rollout
Frontend protection ships before backend strict validation. No database migrations or paid resources.