Carry your history to the next machine - #21
Merged
Conversation
Every finished run is recorded locally and queued for the account. The queue drains when there is a session and a network — which may be now, may be after you sign in, and may be next week — so an arcade played with no account is not an arcade that played for nothing. Both directions only ever raise a value: the registry merges with max() and so does the local file. A high set here and a higher one set elsewhere both survive, and the two can disagree, sync in either order, or never sync without anything being lost but the sharing. A queued run keeps one id across every attempt to deliver it, which is what lets the registry count it once however many times a flaky connection sends it. A run the registry will never accept is dropped rather than blocking the queue behind it forever. The library now marks a game the marketplace has moved past, comparing the installed manifest's version with the catalog's — and says nothing when either is unknown, because not knowing is not evidence of an update. Also fixes a score file bug this made visible: submitting a new high replaced the whole entry, so finishing a game erased the timestamp that starting it had just written and took it off the recently-played list. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Round 1.2 of the termcade-be roadmap. Needs aviorstudio/termcade-be#18, which adds the endpoints this calls.
Why nothing can be lost
Both directions only ever raise a value — the registry merges with
max()and so doesscores.Merge. A high set on one machine and a higher one set on another both survive, so the two can disagree, sync in either order, or never sync, and the worst outcome is that a score stays where it was set. Playing never waits on any of it: the local file stays authoritative for playing, and the arcade with no account and no network is a supported way to use this rather than an error state.A queued run keeps one id across every attempt to deliver it, which is what lets the registry count it once however many times a flaky connection sends it. A run the registry will never accept — a game gone from the catalog — is dropped rather than blocking the queue behind it forever, and its score was already local anyway. The queue is capped at 500 runs; the oldest go first, and what is lost there is a play count rather than a record.
Compatibility
The score file goes to v3. A v2 file loads unchanged — an absent queue is an empty one — and is rewritten as v3 on the next save, so an older binary reading a newer file sees the scores it knows and ignores the queue.
Everything new is additive against the registry. An arcade pointed at a deployment without aviorstudio/termcade-be#18 gets errors from the two new endpoints, treats them as an unreachable marketplace, keeps its queue, and plays exactly as it does today.
Verification
go vet ./...,go vet ./sdk/...go test -race -count=1 -timeout 10m ./... ./sdk/...GOWORK=off go build ./...andGOWORK=off go vet ./...🤖 Generated with Claude Code