Skip to content

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

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

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

Conversation

@houko

@houko houko commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Follow-up review of the online pull requests the merge train landed together (realtime, records, social, steamworks). Several second attempts at one issue were dropped by the later merge of the first draft; this restores them and fixes defects in the merged code.

#2075 feat(online): add realtime notification core

Landed, but its merge overwrote #2222's hardened notifications.go and test with this first draft. See #2222.

#2222 feat(realtime): add notification inbox core

Dropped by the #2075 merge. Restored: stable JSON field names on Notification, field and content size limits, a private copy of the content, an idempotent unsubscribe function (calling it twice used to panic on closing a closed channel), and the offline-drop and history-cursor tests. Added: content that is not valid JSON is refused (the PR claimed JSON validation but had none), the copy test now checks the stored content instead of the caller's slice, and ErrNotFound and Notify's limits are documented.

#2091 feat(online): add authoritative records core

Landed intact. Problems fixed here:

It closed #1676 without meeting its acceptance (no SQL stores, storetest, HTTP service, YAML collection config or cmd/recordsd); reported for reopening.

#2070 feat(social): add party lifecycle core

Landed (the reconcile commit renamed Member to PartyMember). Fixed: a party kept Pending after a member joined or left, so a ticket built for the old members stayed in force; Join and Leave now clear it. Join returns the party for a member already in it instead of ErrPartyFull.

#2073 feat(social): add chat channel core

Landed, but its merge overwrote #2221's membership and block checks. See #2221.

#2078 feat(social): add group role core

Landed intact. Fixed:

  • Join overwrote an existing role, so an owner calling Join on its closed group became Requested and the group had no owner. An existing role is now kept.
  • Promote set Admin on any target, letting an admin demote the owner and making accounts outside the group admins. Only a Member can be promoted now.
  • Leave deleted a banned account's entry, which lifted the ban. A banned account stays banned.
  • MaxMembers counted requests and bans; it now counts owners, admins and members, as documented.
  • Create returned the store's own *Group, which callers could mutate unsynchronized; it returns a copy.

There is still no Ban, Kick, Accept or Demote call, so the documented ban state cannot be reached through the API.

#2090 feat(social): add friend and block graph

Landed, but its merge overwrote #2229's version. See #2229. Fixed in the graph itself:

  • Block wrote a blocked edge on both sides, so the blocked account could call Unblock and lift the block. A block is now a directed edge only the blocker removes, Block still removes the friendship or invitation on the other side, and Blocked checks both directions (chat uses it as Chat.Blocks).
  • AddFriend for an existing friend downgraded the friendship to an invitation; it is now a no-op.
  • Accepting an invitation skipped MaxFriends for both accounts.

#2221 feat(social): enforce chat membership and blocks

Dropped by the #2073 merge, although #1687 was closed on it. Restored the group-member check and the two-way DM block check (Chat.Blocks), plus the docs and note. Added: a DM channel only takes messages from its two accounts, Send and Edit refuse content that is not valid JSON, and Edit applies MaxBytes, which it skipped. #1687's acceptance is not met (no admin edit/delete, per-sender rate limit, Report, typing/read events, SQL stores or concurrent paging tests); reported for reopening.

#2229 feat(social): add friend and block graph

Dropped by the #2090 merge. Restored RemoveFriend (now leaving blocks in place, so it cannot be used to lift one) and the MaxPendingInvites check, with its tests.

#2100 feat(steamworks): add shared lifecycle client

Duplicate of the Steamworks client #1976 had already shipped for #1763; the reconcile commit correctly deleted its client.go, but the merge left behind a five-line docs/en|zh/steamworks.md describing the deleted client (replacing the full guide), duplicate "shared lifecycle" sections in modding.md and presence.md, a changelog fragment and an architecture note for the removed client. This restores the full guides, drops the duplicate sections and the fragment, and archives the note as superseded by the steamworks-client note.

Verification

  • go tool nsgo test ./pkg/online/social/... ./pkg/online/records/... ./pkg/online/realtime/... ./pkg/online/steamworks/... ./pkg/online/presence/...: 45 passed
  • go tool nsgo test ./internal/repocheck/...: 37 passed, 1 skipped
  • go tool nsgo check ./pkg/online/...
  • bun run verify-notes, go run ./changelog check (tools module)

Screenshots: None

The merge of #2100 replaced the full docs/en and docs/zh Steamworks guides with a five-line summary of a duplicate Client that the reconcile commit later deleted, and added a changelog fragment and architecture note for that removed client. Restore both guides from main before the merge, drop the stale fragment (the client already shipped in 0.4.0), drop the duplicate modding sections, and archive the note as superseded by the steamworks-client note.
#2222 bounded notification fields, copied content, gave Notification stable JSON field names, made the unsubscribe function idempotent and tested offline drops and history cursors; the later merge of #2075 overwrote both files with its first draft. Restore that version, refuse content that is not valid JSON, and make the copy test check the stored content instead of the caller's slice.
The section #2100 appended to presence.md repeats the SteamConfig.Client paragraph above it and was written for the duplicate Client the reconcile commit removed; drop it in both languages, as the modding sections were.
…2073 merge

#2221 made Send refuse a group message from an account that has not joined the channel and a direct message when either account blocks the other; the later merge of #2073 overwrote chat.go, chat_test.go and the chat docs with the first draft, so neither check reached main although #1687 was closed on them. Restore both checks, also refuse a direct message from an account that is not one of the channel's two accounts, make Send and Edit refuse content that is not valid JSON, and make Edit apply MaxBytes, which it skipped.
…s with the blocker

#2229 added RemoveFriend and enforced MaxPendingInvites; the later merge of #2090 overwrote friends.go and its test with the first draft, so MaxPendingInvites was documented but never checked and there was no way to cancel, decline or end a friendship. Restore both, with RemoveFriend leaving blocks alone.

Fix the graph's own defects too: Block wrote a blocked edge on both sides, so the blocked account could call Unblock and lift the block; a block is now a directed edge only the blocker can remove, and Blocked checks both directions. Calling AddFriend for an existing friend downgraded the friendship to an invitation, and accepting an invitation skipped MaxFriends for both accounts.
…ting the owner

Join overwrote the role of an account already in the group, so an owner who called Join on its closed group became Requested and the group was left without an owner. Promote set Admin on any target, which let an admin demote the owner and made accounts outside the group admins. Leave deleted a banned account's entry, which lifted the ban, and MaxMembers counted requests and bans although the docs say it caps members.

Join now keeps an existing role, Promote only promotes a Member, a banned account stays banned on Leave, MaxMembers counts owners, admins and members, and Create returns a copy instead of the store's own group.
…ange

A party kept Pending after a member joined or left, so a matchmaking ticket built for the old members stayed in force; #1688 requires any membership change to cancel it. Join and Leave now clear Pending, and Join returns the party for a member already in it before refusing a full or closed party.
…server-only

Apply checked every put against the stored state before writing any, so a transaction with two puts of the same new record at Expected 0 passed both checks and wrote version 2; it also accepted records without an owner, collection or key, values that are not JSON, and treated any negative expected version as unconditional without saying so. Apply now refuses those with ErrInvalid and documents AnyVersion (-1), as #1676 specifies.

Get and List read Private and OwnerRead records the same way, so the owner could read a record marked Private. Private now means server code only (reader Server), as #1676's read none permission does, and the exported errors and permissions have doc comments.
@github-actions github-actions Bot added size/L documentation Improvements or additions to documentation area/agents 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 ad862c2 against origin/main 072b8df: realtime, records, and social 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

area/agents bug Something isn't working documentation Improvements or additions to documentation pkg/online size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Online: server-authoritative player records on Postgres and SQLite, with permissions, versions and multi-record transactions

1 participant