Feature/feature migration#77
Conversation
… code maintainability - Updated high scores management to include synchronization with remote API. - Simplified immersive mode entry by utilizing arcade-engine's immersive mode function. - Replaced hardcoded event names with constants from arcade-engine for user options changes. - Migrated logging functionality to use arcade-engine's runtime logger, enhancing logging capabilities. - Refactored screen wake lock management to leverage arcade-engine's implementation. - Streamlined storage reset functions to utilize arcade-engine's storage management utilities. - Enhanced UI scaling functions by incorporating arcade-engine's zoom and viewport scaling methods. - Updated user options management to utilize arcade-engine's user options store, improving persistence and normalization. - Improved test assertions for rendering functions to ensure accurate behavior.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 89ed6e966d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR updates the project to rely more heavily on arcade-engine by upgrading the dependency and migrating several locally-owned utilities (user options persistence/normalization, filter settings, wake lock, immersive mode, exit handling, achievement notifications, and logging) to engine-provided implementations. It also refactors the high score server to use the engine’s newer run receipt + validation APIs.
Changes:
- Bump
arcade-engineto^2.41.1and project version to32.0.0. - Replace local implementations (filter settings, log levels/logger, wake lock, app exit event, achievement notification rendering, scaling helpers) with
arcade-engineequivalents. - Refactor
server/high-score-server.mjsto use new run receipt issuance + validation utilities fromarcade-engine/high-scores.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/game/user-options.ts | Migrates user option persistence/normalization to arcade-engine’s user options store. |
| src/game/ui-scale.ts | Uses arcade-engine viewport/zoom scaling helpers instead of local clamp/math. |
| src/game/types.ts | Re-exports filter/log-level-related types from arcade-engine instead of local modules. |
| src/game/systems/tests/systems.test.ts | Updates rendering assertions to follow the new achievement notification rendering path. |
| src/game/storage-reset.ts | Uses arcade-engine storage namespace/key removal helpers with error callbacks. |
| src/game/screen-wake-lock.ts | Removes local Screen Wake Lock implementation (now sourced from arcade-engine). |
| src/game/menus/tests/menus.test.ts | Switches filter preset source to arcade-engine. |
| src/game/menus.ts | Switches filter + log-level menu data/helpers to arcade-engine exports. |
| src/game/logger.ts | Replaces local logger implementation with arcade-engine runtime logger factory. |
| src/game/log-levels.ts | Removes local log level definitions/helpers (now sourced from arcade-engine). |
| src/game/index.ts | Updates event name usage to userOptionsChangedEventName from arcade-engine. |
| src/game/immersive-mode.ts | Delegates fullscreen/orientation behavior to arcade-engine immersive mode helper. |
| src/game/high-scores.ts | Adjusts high score saving flow (including optional sync) around the engine manager. |
| src/game/filter-settings.ts | Removes local filter preset/settings definitions (now sourced from arcade-engine). |
| src/game/app-exit.ts | Removes local app-exit event/utility (now sourced from arcade-engine). |
| src/game/achievement-notifications.ts | Replaces local popup rendering/animation with AchievementNotificationRenderer from arcade-engine. |
| src/game/tests/screen-wake-lock.test.ts | Updates tests to import wake lock helpers from arcade-engine. |
| src/components/TimePilotGame.tsx | Updates app-exit, filter settings, wake lock, and options-changed event wiring to engine exports. |
| src/components/tests/TimePilotGame.test.tsx | Updates app-exit event name import to engine export. |
| server/high-score-server.mjs | Refactors server run issuance/validation to engine receipt APIs; removes custom HMAC token logic. |
| package.json | Bumps app version + arcade-engine dependency version. |
| package-lock.json | Locks updated package versions (app + arcade-engine). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request introduces several significant refactorings and dependency updates to improve maintainability, modularity, and to leverage new features from the
arcade-enginepackage. The most important changes include updating dependencies, refactoring the high score server to use new receipt and validation mechanisms, migrating event names and utility functions toarcade-engine, and replacing the local achievement notification renderer with the one provided byarcade-engine.Dependency and API Updates:
arcade-enginedependency from^2.34.1to^2.41.1and bumped the project version to32.0.0inpackage.jsonto access new APIs and features. [1] [2]High Score Server Refactor:
server/high-score-server.mjsto use the new high score run receipt and validation APIs fromarcade-engine/high-scores, replacing custom token signing and validation logic withcreateHighScoreServerRunReceiptandvalidateHighScoreServerRunReceipt. This improves security and maintainability. [1] [2] [3] [4] [5] [6] [7] [8]Event and Utility Function Migration:
appExitBlockedEvent,exitInstalledApp, and screen wake lock utilities) with the corresponding exports fromarcade-enginethroughout the codebase, includingsrc/components/TimePilotGame.tsx, its tests, and other modules. [1] [2] [3] [4] [5] [6] [7]Achievement Notification Refactor:
src/game/achievement-notifications.tsto use theAchievementNotificationRendererfromarcade-engine, removing the local implementation of notification rendering, animation, and layout logic. This reduces code duplication and ensures consistent notification appearance. [1] [2] [3] [4] [5]Cleanup and Removal of Redundant Code:
arcade-engine. [1] [2] [3]These changes collectively modernize the codebase, reduce technical debt, and make it easier to maintain by relying on well-tested, centralized utilities from
arcade-engine.