Skip to content

bug(idaptik-ums): EditorEngine.res is the compiled .mjs output misnamed as the .res source #116

@hyperpolymath

Description

@hyperpolymath

Surface

idaptik-ums/src/editor/EditorEngine.res (and its sibling files in the same dir) contain JavaScript syntax with a literal // Generated by ReScript, PLEASE EDIT WITH CARE header — meaning they are the compiled .res.mjs outputs renamed to .res rather than the original ReScript sources.

Evidence — first 20 lines of the file:

// SPDX-License-Identifier: AGPL-3.0-or-later
// Generated by ReScript, PLEASE EDIT WITH CARE
//
// EditorEngine.res.mjs — Pure computation helpers for the IDApTIK UMS editor.
// ...
import * as EditorModel from "./EditorModel.res.mjs";

function toolLabel(tool) {
  if (typeof tool === "string") {
    switch (tool) {
      case "Select":
        return "Select";
      ...

typeof x === "string", tool.TAG, ES-style import * as — all JavaScript, not ReScript.

Why this matters

When rescript build is run against idaptik-ums/rescript.json (which lists src as a source dir), the compiler fails with:

Syntax error!
  idaptik-ums/src/editor/EditorEngine.res:15:9-11
   15 │ import * as EditorModel from "./EditorModel.res.mjs";
  Did you forget to write an expression here?

…and the build never produces idaptik-ums/src/App.res.mjs. This was masked previously by the soft-fail || echo in the Playwright workflow's sub-build step, then surfaced once PR #114 wired up the sub-build properly. PR #114 has since pivoted to skip the sub-build entirely (vite optimizeDeps.entries scoped to root index.html) because Playwright doesn't actually need idaptik-ums anyway.

Root cause hypothesis

58fe350a (2026-03-22) "feat: AGPL-3.0-or-later license, hub i18n keys, quit fix" or c26463fe (same day) "feat: complete Belt→Core, Js.*→modern, Tauri→Gossamer migration" likely overwrote the original .res source with the compiled .res.mjs content during a global rename pass. Worth checking git show 58fe350a~1:idaptik-ums/src/editor/EditorEngine.res to recover the genuine ReScript source.

Affected files

All .res files in idaptik-ums/src/editor/ and likely idaptik-ums/src/ should be audited for the // Generated by ReScript header. Likely candidates:

  • idaptik-ums/src/App.res
  • idaptik-ums/src/editor/EditorEngine.res
  • idaptik-ums/src/editor/EditorModel.res
  • idaptik-ums/src/editor/EditorCanvas.res
  • idaptik-ums/src/editor/EditorCmd.res

(any file with // Generated by ReScript in the first 5 lines is impacted)

Fix recipe

For each affected file:

  1. Recover the original .res source from before the corrupt-overwrite commit (likely 58fe350a~1 or earlier; bisect to confirm)
  2. Restore it as the .res source
  3. Re-run cd idaptik-ums && deno run --node-modules-dir=auto --allow-read --allow-write --allow-env --allow-run npm:rescript@12.2.0 and confirm clean build

Once green, PR #114's vite optimizeDeps.entries scoping can be removed (or left as a defensive scope — your call) and the Tauri webview entry will be exercised properly again.

Cross-references

Severity

Low blast radius for the SPA (Playwright tests + main game route '/' are unaffected). High blast radius for the Tauri webview shell (the entire UMS editor UI is unbuildable). Filed as a P2 follow-up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions