Skip to content

fix(online): follow up on the merged online pull requests - #2484

Open
houko wants to merge 5 commits into
mainfrom
fix/followup-online-4
Open

houko wants to merge 5 commits into
mainfrom
fix/followup-online-4

Conversation

@houko

@houko houko commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Follow-up review of the online-4 bucket of pull requests merged by the merge train, checked against current main.

Reviewed pull requests

#2131 feat(liveops): add fail-closed age gate

Code, tests, note and changelog landed. The "Age gate and child mode" section in docs/en and docs/zh liveops.md was dropped by the merge train (the four liveops PRs below each appended a section at the same place and none survived). Restored.

#2135 feat(liveops): add purpose-based consent manager

Code and tests landed; the "Purpose-based consent" docs section was dropped. Restored.

#2136 feat(liveops): purge analytics on consent revoke

Landed intact. Bug: SetConsent(ConsentDenied) returned early when saving the denial failed. That path removes the stored grant and fails closed, but skipped the new ConsentRevoker.Purge, so events queued under the old grant stayed queued and would be delivered after a later grant. This PR purges there too and joins both errors. No test: core.Storage has no way to make a write that shrinks the value fail.

#2138 feat(liveops): add durable analytics batches

Code and tests landed; the "Durable analytics batches" docs section was dropped and is restored. Bugs fixed in BatchProvider.Send:

  • it ignored the Stat error and would dereference a nil FileInfo
  • it ignored read and rewrite errors while trimming
  • when the newest maxBytes began exactly at an event boundary, it still skipped to the next newline and dropped one whole event more than the limit required

A new test covers the off-by-one.

#2237 feat(liveops): add durable crash report pipeline

The queue, CrashUploader and docs landed. Its CrashReport.Fingerprint was superseded on main by the better frame-based one from feat/crash-fingerprint-1654, which is fine. The PR says Closes #1654, but the issue's acceptance is not met: there is no import of NSGo's pending cx.CrashReports(), no bounded count or size, no upload backoff, no cmd/crashd, no metadata defaults and no template wiring.

#2238 feat(liveops): add secure account session client

This duplicates #2120 for #1653. main kept #2120's liveops.Account (NewAccount(opts), NewAccountForScope), so #2238's code, which had a different NewAccount(cx, opts) (*Account, error) signature, is gone, along with its accounts.md client section and cloudsave.md link. This PR:

  • restores the client section in docs/en and docs/zh accounts.md for the API main has, and points cloudsave.md at it
  • documents ErrSignedOut
  • fixes a bug: after SignInEmail or Register, Token handed out the game-server token the sign-in returned even when AccountOptions.Audience named another service such as cloudsave, which refuses it. It now refreshes for the configured audience, with a test.

#2385 feat(liveops): add load funnel stage recorder

Code and tests landed; the "Load funnel" docs section was dropped. Restored.

#2208 feat(netplay): serve WebSocket on inherited listeners

OK.

#2216 feat(netplay): support persisted browser resume tokens

OK.

#2347 feat: add netplay reconnect supervisor

Its netplay.md paragraph was dropped and is restored. Bugs fixed in ReconnectSupervisor.Run:

  • Attempts carried over between runs, so after one run used up MaxAttempts, the next returned at once without calling connect
  • when every attempt failed it returned context.DeadlineExceeded, reporting a timeout that never happened and losing the connect error. It now returns the last error, wrapped.
  • it dialed even when the context had already ended
  • the backoff timer was not stopped on cancel

The type comment claimed it ran "off the caller's loop", but Run blocks and writes State/Attempts unsynchronized. The comment and docs now say to call it from its own goroutine and read them after it returns. New tests cover the fixed behavior. The PR says Closes #1577, but most of the issue is missing: network-change wake-ups, a Status signal, the overlay, WebSocket/loopback and GOOS=js tests, and screenshots.

#2420 fix(netplay): keep WebSocketTransport.Close quiet when its loops close

OK.

#2331 feat(portmap): add player host mapping contract

Code and tests landed. Its server.md relay-fallback section was dropped and is restored in portmap.md, where the package is documented. Other fixes:

  • SetProvider and Open raced on the package-level provider; it is now guarded by a RWMutex, with a concurrent test
  • added doc comments to UDP, TCP and the four sentinel errors
  • the package comment named a nonexistent OpenProvider interface; it now names Provider

Verification

  • go tool nsgo test ./pkg/online/liveops/... ./pkg/online/netplay/... ./pkg/online/portmap/... ./internal/repocheck/...: 475 passed, 0 failed
  • go tool nsgo check on each of the three packages
  • go run ./tools/changelog check

Screenshots: None

…ections

The merge train kept only one of the four sections #2131, #2135, #2138 and #2385 each appended to the end of liveops.md, and then lost that one too. Restore all four under Analytics in docs/en and docs/zh.
Run kept Attempts across runs, so a supervisor that had once used up MaxAttempts returned at once on its next Run without calling connect. It also returned context.DeadlineExceeded when every attempt failed, discarding the connect error and reporting a timeout that never happened, and dialed even when the context had already ended. Count from zero on every Run, check the context before each attempt, return the last connect error wrapped, and stop the backoff timer when the context ends.

Also restore the netplay.md paragraph #2347 added, which the merge train dropped, now describing the blocking behavior and that State and Attempts are only safe to read after Run returns.
SetProvider wrote the package-level provider that Open read with no synchronization, a data race whenever a platform installs its provider while a game opens a mapping. Guard it with a RWMutex and make the test restore the default through SetProvider. Add the missing doc comments on UDP, TCP and the four sentinel errors, and fix the package comment, which named an OpenProvider interface that does not exist.

Also restore the relay fallback guidance #2331 added to server.md, which the merge train dropped, in portmap.md where the package is documented.
…hole events

SetConsent returned early when saving ConsentDenied failed. That path already removes the stored grant and fails closed, but it skipped the ConsentRevoker purge #2136 added, so events queued under the old grant stayed queued and would be delivered after a later grant. Purge there too and join the two errors.

BatchProvider.Send ignored the Stat error and would dereference a nil FileInfo, ignored read and rewrite errors while trimming, and, when the newest maxBytes began exactly at an event boundary, still skipped to the next newline and dropped one whole event more than the limit required. Return the errors and only drop a leading partial event.
A sign-in returns a token for the game servers' audience, but Account.accept cached it as the token Token hands out whatever AccountOptions.Audience was, so an account configured for cloudsave gave CloudClient a token the cloud save service refuses, until it came close to expiring. Cache the sign-in token only when Audience is empty, and otherwise let the first Token call refresh for the configured audience.

#2238 and #2120 both added liveops.Account for #1653; main kept #2120's implementation and dropped the accounts.md client section and cloudsave.md link #2238 wrote, which described #2238's NewAccount(cx, opts) signature. Restore the section for the API main has, in docs/en and docs/zh, and document ErrSignedOut.
@github-actions github-actions Bot added size/M documentation Improvements or additions to documentation pkg/online bug Something isn't working labels Nov 29, 2026
@houko

houko commented Nov 29, 2026

Copy link
Copy Markdown
Contributor Author

Focused source checks are clean on current head 6240ff5 against origin/main 072b8df: liveops, netplay, and portmap nsgo check plus tests all pass. Current failures are the five known pinned-template jobs (idle, rhythm, rpg2d, towerdefense2d, visualnovel), with no source-local failure identified.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation pkg/online size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant