Skip to content

Follow-up fixes 2#5

Open
HashimTheArab wants to merge 153 commits intodf-mc:mainfrom
lactyy:rewrite
Open

Follow-up fixes 2#5
HashimTheArab wants to merge 153 commits intodf-mc:mainfrom
lactyy:rewrite

Conversation

@HashimTheArab
Copy link
Copy Markdown
Contributor

dont merge yet

lactyy added 30 commits January 23, 2026 02:20
lactyy and others added 20 commits March 27, 2026 05:55
- keep MPSD sessions usable when the remote close request fails
- only mark sessions closed after a successful remote leave/close
- make repeated successful Session.CloseContext calls idempotent
- sign xsapi requests using cached Microsoft server time instead of raw time.Now
- expose ServerTime from xal as the public bridge to the internal timestamp cache
- make top-level Client shutdown terminal once RTA close is attempted
- persist the first RTA close error and return it on later CloseContext calls
- keep subclient cleanup failures retryable instead of marking the client closed too early
- distinguish MPSD 200 OK from 204 No Content on session updates
- close the local Session handle after a successful leave without treating every successful PUT as a remote delete
- only clear cached session state and ETag when MPSD explicitly reports deletion
- factor shared Session finalization through closeLocked while keeping delete-specific cleanup separate

Constraint: rta.Conn.Close closes its internal state before returning any websocket close error
Constraint: MPSD uses 204 No Content to signal deletion as a result of PUT; 200 OK means the session body was updated
Rejected: Keep sync.Once-based xsapi CloseContext | masks retry semantics after subclient failures and mishandles terminal RTA close errors
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Do not make xsapi Client shutdown retryable after RTA close has been attempted unless rta.Conn.Close semantics change
Tested: go test ./...
Not-tested: direct unit simulation of non-nil rta.Close error in xsapi without a dedicated test seam
- add top-level xsapi close test that exercises retry semantics through a real presence failure path
- add mpsd and social tests proving unsubscribe failures preserve state for retry
- add session tests for 204 delete reporting, delete-on-no-content cleanup, and 200 close-with-synced-state behavior
- keep public snapshot isolation coverage at the Session API boundary
- remove the reflection-heavy clone helper test file
- replace scheduler- and sleep-based concurrent close timing with an explicit mutex gate
- drop unsafe private-field mutation from the xsapi close test

Constraint: tests should verify public behavior and package-local invariants without depending on private field layout
Rejected: keep clone helper reflection harness | broad but tightly coupled to struct shape and redundant with public snapshot coverage
Rejected: keep sleep-based concurrent close test | passes today but is scheduler-dependent
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Prefer boundary-level tests over private-field injection when retry behavior can be exercised through a real subclient path
Tested: go test ./...
Not-tested: none
- reject authenticated requests after xsapi client shutdown
- preserve request-body cleanup on the closed RoundTrip fast path
- keep CloseContext retryable when subclient cleanup fails
- default nil loggers in mpsd.New and social.New
- remove the unused internal.DecodeJSON helper
- prevent post-shutdown request races by separating shutdown serialization from lock-free closed-state checks

Constraint: CloseContext holds shutdown state while subclient cleanup may still traverse the shared transport
Rejected: Protect closed state with closeMu only | RoundTrip/TokenAndSignature would have to take the same lock and could deadlock during shutdown
Confidence: high
Scope-risk: narrow
Directive: Keep post-close request rejection at the shared xsapi transport boundary unless shutdown semantics are redesigned end-to-end
Tested: go test ./...
Tested: go test -race ./...
Not-tested: network-gated SISU/Xbox integration flows
…dling

- treat synchronized ETag `412` responses as retryable conflicts only for shared session writes
- handle MPSD missing-session `GET` as `204 No Content` and tear down the local session state
- treat conflict-followed-by-delete and bootstrap-delete paths as normal deleted-session outcomes
- keep wildcard update callers like `CloseContext` and `SetMemberCustomProperties` failing on `412`
- prevent stale session handles from unregistering replacement sessions by checking pointer identity
- tighten `mpsd/session.go` docs around `commit`, `synchronizedUpdate`, precondition modes, and helper behavior
- trim redundant tests and simplify remaining MPSD test boilerplate with small local helpers
@lactyy
Copy link
Copy Markdown
Collaborator

lactyy commented Apr 1, 2026

Implemented reconnect logic for RTA connections, since they seem to disconnect automatically after 2 hours.
After merging this PR, we can tag v2.0.0.

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.

2 participants