[PR #13] [MERGED] tests: give the camera vm context the globals the viewer uses at load #72

Closed
opened 2026-11-26 20:16:42 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/13
Author: @wavehs
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism

Base: main ← Head: tests-viewer-vm-globals


📝 Commits (1)

  • 1ffabec tests: give the camera vm context the globals the viewer uses at load

📊 Changes

1 file changed (+5 additions, -0 deletions)

View changed files

📝 tests/test_viewer_streaming.cjs (+5 -0)

📄 Description

Claimed in the coordination issue as: none — the original project's coordination issue was lost with its repository, and this repository has no such issue yet. No open pull request touches tests/test_viewer_streaming.cjs.

Depends on: none.

What and why

viewer/index.html calls loadWorld() at module scope; it creates an AbortController and arms a setTimeout. The Shift/Ctrl camera test runs the viewer in a vm context whose sandbox does not provide either, so the context throws before the camera is returned:

not ok 16 - Shift speeds the camera up and Ctrl slows it down, on either side of the keyboard
  error: 'AbortController is not defined'

On Node 20 it then fails on setTimeout once AbortController is added. This is why the viewer-tests job fails on every pull request, including #5-#11, whose diffs do not touch the viewer:

2026-11-24T01:28:53.3954203Z   ReferenceError [Error]: AbortController is not defined

A vm context has only what the sandbox gives it, on Node 24 as on Node 20, so the test now provides the two globals. The timers never fire: the manifest this context gets has no chunks to stream, and the test only steps one frame explicitly.

Tested

macOS 15 arm64 (Apple M3 Pro), Node 20.20.2, no browser and no game data:

tree node --test tests/test_*.cjs
main@30daa6958 67 pass, 1 fail (the test above)
this commit 68 pass, 0 fail

Node 24 is what CI runs; the missing globals are the same there (the CI log above is Node 24). Not run: a browser, any GPU or game data.

AI-assisted: yes.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not applicable: test-only.)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/13 **Author:** [@wavehs](https://github.com/wavehs) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `tests-viewer-vm-globals` --- ### 📝 Commits (1) - [`1ffabec`](https://github.com/ubiquitarianism/leonida/commit/1ffabec4553265ec9ea80b6640f9e6269c338d7d) tests: give the camera vm context the globals the viewer uses at load ### 📊 Changes **1 file changed** (+5 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_viewer_streaming.cjs` (+5 -0) </details> ### 📄 Description Claimed in the coordination issue as: none — the original project's coordination issue was lost with its repository, and this repository has no such issue yet. No open pull request touches `tests/test_viewer_streaming.cjs`. Depends on: none. ### What and why `viewer/index.html` calls `loadWorld()` at module scope; it creates an `AbortController` and arms a `setTimeout`. The Shift/Ctrl camera test runs the viewer in a `vm` context whose sandbox does not provide either, so the context throws before the camera is returned: ``` not ok 16 - Shift speeds the camera up and Ctrl slows it down, on either side of the keyboard error: 'AbortController is not defined' ``` On Node 20 it then fails on `setTimeout` once `AbortController` is added. This is why the `viewer-tests` job fails on every pull request, including #5-#11, whose diffs do not touch the viewer: ``` 2026-11-24T01:28:53.3954203Z ReferenceError [Error]: AbortController is not defined ``` A `vm` context has only what the sandbox gives it, on Node 24 as on Node 20, so the test now provides the two globals. The timers never fire: the manifest this context gets has no chunks to stream, and the test only steps one frame explicitly. ### Tested macOS 15 arm64 (Apple M3 Pro), Node 20.20.2, no browser and no game data: | tree | `node --test tests/test_*.cjs` | |---|---| | `main@30daa6958` | 67 pass, 1 fail (the test above) | | this commit | 68 pass, 0 fail | Node 24 is what CI runs; the missing globals are the same there (the CI log above is Node 24). Not run: a browser, any GPU or game data. AI-assisted: yes. ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (Not applicable: test-only.) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:16:42 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#72
No description provided.