Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Reviewer's GuideLanguage selection now uses per-invocation request tokens to make asynchronous loads last-selection-wins: stale successes remain cached but cannot update the active language or UI, while cached and active selections also supersede pending requests. New controlled-XHR tests cover ordering, cancellation, failures, caching, and retries. Sequence diagram for latest language selection during async loadssequenceDiagram
actor User
participant TranslationManager
participant XHR
participant Windows as GameWindows
User->>TranslationManager: setLanguage(languageA)
TranslationManager->>XHR: loadLanguage(languageA)
User->>TranslationManager: setLanguage(languageB)
TranslationManager->>XHR: loadLanguage(languageB)
XHR-->>TranslationManager: languageA response
TranslationManager->>TranslationManager: cache languageA
XHR-->>TranslationManager: languageB response
TranslationManager->>TranslationManager: apply languageB
TranslationManager->>Windows: _refreshAllWindows()
State diagram for language request supersessionstateDiagram-v2
[*] --> Pending
Pending --> Pending: setLanguage(language)
Pending --> Cached: stale successful load
Pending --> Active: latest successful load
Pending --> Pending: latest load failure
Active --> Pending: setLanguage(newLanguage)
Active --> Active: setLanguage(activeLanguage)
Cached --> Active: latest cached selection
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Confirmed defect
Out-of-order language-file responses can overwrite a newer language choice. Selecting the already-active language also leaves an older pending selection live, and a failed latest load can allow an older selection to apply unexpectedly.
Change
Give each setLanguage invocation a unique request token, including active/cached selections. Only the latest successful asynchronous selection may apply translations and refresh windows. Stale successful loads still populate the existing cache. No request cancellation or loadLanguage API changes.
Verification
Base:
83ceac969392e7ea1948652d0b2dd6d06233ddeb.Head:
aa91a9b72b80731cfe6e3071e8b31ad5c62658cd.Published tree:
695333552faad3c2f236de56664cafad6c6789cf, identical to the locally tested tree.Hosted CI run 42042252813 completed successfully for head
aa91a9b72b80731cfe6e3071e8b31ad5c62658cd. Node 18.20.8 and 20.20.2 each passed all 75 tests; Python 3.11.18 passed all 27 tests. Checkout logs confirm merge ref035ba0e4474d48eb606ba62fdae0beb8e47e46dc, whose parents are the exact head/base above and whose tree equals the tested head tree. This is verified merge-ref CI, not bare-head checkout. Existing action-runtime deprecation and dependency warnings remain. Tests use synthetic XHR responses; no real RPG Maker installation or browser acceptance is claimed. Existing dependency refresh #6 and installer #5 are independent and unchanged; this PR leaves the main lockfile and its known development-dependency findings unchanged. No credentials, live game files, user computer, deployment, merge or release used.Summary by cubic
Fixes a race condition in
TranslationManager.setLanguagewhere out-of-order async language-file responses could overwrite a newer selection, a failed latest load could let an older selection apply, and reselecting the active language left an older pending request live. EachsetLanguagecall now gets a unique request token, and only the latest successful async selection applies translations and refreshes windows; stale successful loads still populate the cache.Adds seven tests covering backward responses, reselecting the active language, cached selections superseding pending loads, failed loads, single selections, and retries.
Written for commit aa91a9b. Summary will update on new commits.
Summary by Sourcery
Prevent stale asynchronous language loads from overriding the latest language selection.
Bug Fixes:
Enhancements:
Tests: