Skip to content

Migrate deprecated Js.* APIs, extract keyboard handlers, fix loose ends#28

Closed
hyperpolymath wants to merge 1 commit intomainfrom
claude/repo-situation-report-AnCfD
Closed

Migrate deprecated Js.* APIs, extract keyboard handlers, fix loose ends#28
hyperpolymath wants to merge 1 commit intomainfrom
claude/repo-situation-report-AnCfD

Conversation

@hyperpolymath
Copy link
Owner

Quick fixes:

  • Remove Chapel references from WORKPLAN (replaced by Zig solvers)
  • Update OPUS-TODO.adoc tracking table (P1 README partial, P2 mapBounded partial)
  • Triage stale 2026-02-22 session todos (detection cones done, knockdown still open)
  • Remove #/editor hash route stub from UMS main.js (editor deferred beyond MVP)
  • Bump ratatui 0.29→0.30 in escape-hatch Cargo.toml (resolves lru vuln)

Migrations:

  • Migrate ~945 deprecated Js.Dict/Console/log/String2/Array2/Math/Float/Int/ Promise/Nullable calls to @rescript/core equivalents across 67 files
  • Replace 7 Belt.Array.getExn calls with Belt.Array.getUnsafe (all bounds-checked)
  • Rewrite State.res deserializeState with JSON.Classify.classify
  • Extract 5 duplicated %raw keyboard handler blocks to new KeyboardNav.res utility (addKeydownHandler, removeKeydownHandler, removeFromRef, eventKey, preventDefault); refactor WorldBuilder, TrainingBase, TrainingMenuScreen, VictoryScreen, GameOverScreen to use it

Documentation:

  • Update LOOSE-ENDS.md with completion status for all resolved items
  • Update STATE.scm (v1.7.0→v1.8.0): completed-migrations section, updated critical-next-actions, new recent-changes entry

https://claude.ai/code/session_01Rxhv9LRQ1Xq5GWGx5CnYr7

Quick fixes:
- Remove Chapel references from WORKPLAN (replaced by Zig solvers)
- Update OPUS-TODO.adoc tracking table (P1 README partial, P2 mapBounded partial)
- Triage stale 2026-02-22 session todos (detection cones done, knockdown still open)
- Remove #/editor hash route stub from UMS main.js (editor deferred beyond MVP)
- Bump ratatui 0.29→0.30 in escape-hatch Cargo.toml (resolves lru vuln)

Migrations:
- Migrate ~945 deprecated Js.Dict/Console/log/String2/Array2/Math/Float/Int/
  Promise/Nullable calls to @rescript/core equivalents across 67 files
- Replace 7 Belt.Array.getExn calls with Belt.Array.getUnsafe (all bounds-checked)
- Rewrite State.res deserializeState with JSON.Classify.classify
- Extract 5 duplicated %raw keyboard handler blocks to new KeyboardNav.res
  utility (addKeydownHandler, removeKeydownHandler, removeFromRef, eventKey,
  preventDefault); refactor WorldBuilder, TrainingBase, TrainingMenuScreen,
  VictoryScreen, GameOverScreen to use it

Documentation:
- Update LOOSE-ENDS.md with completion status for all resolved items
- Update STATE.scm (v1.7.0→v1.8.0): completed-migrations section,
  updated critical-next-actions, new recent-changes entry

https://claude.ai/code/session_01Rxhv9LRQ1Xq5GWGx5CnYr7
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e5ed90be73

ℹ️ 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".

@hyperpolymath hyperpolymath enabled auto-merge (rebase) March 2, 2026 14:56
hyperpolymath added a commit that referenced this pull request Mar 2, 2026
Five screens had identical %raw keyboard event handler patterns
(addEventListener/removeEventListener/key extraction). Extract
into src/app/utils/KeyboardNav.res for reuse.

Part of #28.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request Mar 2, 2026
Refactor 5 screens to use the shared KeyboardNav module instead of
duplicated %raw addEventListener/removeEventListener/key blocks.

Files: GameOverScreen, VictoryScreen, WorldBuilder, TrainingBase,
TrainingMenuScreen.

Part of #28.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request Mar 2, 2026
Replace deprecated Js.Dict API with modern Dict equivalents:
- Js.Dict.empty() -> Dict.make()
- Js.Dict.get/set -> Dict.get/set
- Js.Dict.entries -> Dict.toArray
- Js.Dict.keys -> Dict.keysToArray
- Js.Dict.t<X> -> dict<X>

Part of #28.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request Mar 2, 2026
Replace deprecated Js.Dict API with modern Dict equivalents in
Coprocessor, Coprocessor_IO, DLCLoader, Kernel_Crypto, Kernel_Quantum,
and ResourceAccounting.

Part of #28.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request Mar 2, 2026
Replace deprecated Js.Dict in enemies/, screens/, multiplayer/,
popups/, player/, proven/, ui/, and utils/.

Part of #28.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request Mar 2, 2026
…ces)

Replace deprecated Js.Math API with modern Math equivalents:
- Js.Math.floor_float -> Math.floor
- Js.Math.sqrt/sin/cos/atan2 -> Math.*
- Js.Math.max_float/min_float -> Math.max/min
- Js.Math._PI -> Math.Constants.pi
- Js.Math.random -> Math.random
- Js.Math.abs_float -> Math.abs

Part of #28.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request Mar 2, 2026
Replace deprecated Js.String2 API with modern String equivalents:
- startsWith, length, includes, toLowerCase, toUpperCase

Part of #28.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request Mar 2, 2026
Replace deprecated Js.Json API with modern JSON equivalents:
- Js.Json.classify -> JSON.Classify.classify (with new variant names)
- Js.Json.string/number -> JSON.Encode.string/float
- Js.Json.object_/array -> JSON.Encode.object/array
- Js.Json.parseExn/stringify -> JSON.parseExn/stringify
- Js.Json.t -> JSON.t
- JSONString/JSONNumber/JSONObject/JSONArray -> String/Number/Object/Array

Part of #28.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request Mar 2, 2026
…ces)

Replace deprecated APIs:
- Js.Console.log/error -> Console.log/error
- Js.Float.toFixedWithPrecision -> Float.toFixedWithPrecision
- Js.Float.isFinite -> Float.isFinite

Part of #28.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request Mar 2, 2026
Chapel was removed from the project on 2026-02-27.

Part of #28.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
auto-merge was automatically disabled March 2, 2026 19:48

Pull request was closed

@hyperpolymath
Copy link
Owner Author

Completed (tracked src/ only)

12 commits pushed — all build clean (0 errors).

Summary of changes

Migration Files Occurrences
KeyboardNav utility extracted 5 screens + 1 new 5 duplicated %raw blocks eliminated
Js.DictDict 36 files ~178 occurrences
Js.MathMath 33 files 118 occurrences
Js.String2String 21 files 107 occurrences
Js.Array2Array 31 occurrences
Js.JsonJSON 1 file (DLCLoader) 53 occurrences
Js.FloatFloat 14 files 35 occurrences
Js.ConsoleConsole (included above)
Js.Global.setTimeoutsetTimeout 1 file 1 occurrence
Chapel removed from credits 1 file

Out of scope (untracked dirs)

These remain for a future issue once vm/, shared/ (non-git), main-game/ are committed:

  • Belt.Array.getExnArray.getUnsafe in vm/ (6 occurrences)
  • vm/lib/ocaml/State.res rewrite with JSON.Classify.classify
  • escape-hatch ratatui bump
  • UMS #/editor route stub

STATE.scm updated to v1.9.0.

@hyperpolymath hyperpolymath deleted the claude/repo-situation-report-AnCfD branch March 2, 2026 19:58
hyperpolymath added a commit that referenced this pull request Mar 2, 2026
…for migration period

- Update actions/upload-artifact, github/codeql-action, trufflesecurity/trufflehog,
  editorconfig-checker to current SHA pins
- Add SECURITY.md (required by OpenSSF Scorecard)
- Exclude legacy src/engine/ and src/app/ TypeScript from anti-pattern check
  (tracked in issue #28 for ReScript migration)
- Tolerate package-lock.json alongside deno.json during migration
- Tolerate tsconfig.json alongside rescript.json during migration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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