Skip to content

Carry your history to the next machine - #21

Merged
nicodes merged 1 commit into
mainfrom
terminal-play-continuity
Aug 4, 2026
Merged

Carry your history to the next machine#21
nicodes merged 1 commit into
mainfrom
terminal-play-continuity

Conversation

@nicodes

@nicodes nicodes commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

  • record every finished run locally and queue it for the account; the queue drains whenever there is a session and a network
  • merge the account's record back in on startup and after signing in, raising values only
  • mark a library game the marketplace has moved past, comparing the installed manifest's version with the catalog's
  • fix a score-file bug: a new high replaced the whole entry, so finishing a game erased the timestamp that starting it had just written

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 does scores.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

  • gofmt, go vet ./..., go vet ./sdk/...
  • go test -race -count=1 -timeout 10m ./... ./sdk/...
  • GOWORK=off go build ./... and GOWORK=off go vet ./...
  • new coverage for the queue (bounded, survives a restart, retries under the same id, drops what can never be delivered), the merge (never lowers, introduces a game this machine has not played, does not adopt the account's version), and the shell (syncs at startup, after a run and after signing in; marks an outdated install and stays quiet when it cannot know)

🤖 Generated with Claude Code

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>
@nicodes
nicodes merged commit 6790edc into main Aug 4, 2026
2 checks passed
@nicodes
nicodes deleted the terminal-play-continuity branch August 4, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant