-
-
Notifications
You must be signed in to change notification settings - Fork 19
Release1 august #733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release1 august #733
Changes from all commits
81f01b5
254bddf
3ed4851
cd523ce
8f8ac38
6981958
fc1bf44
6279fc9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,6 +95,7 @@ | |
| callbackMode: true, | ||
| separateAnimations: true, | ||
| memoryDebug: false, | ||
| showErrorBanners: false, | ||
| memoryMonitorInterval: 5000, | ||
| materialsDebug: false, | ||
| meshDebug: false, | ||
|
|
@@ -422,14 +423,14 @@ | |
| banner.style.left = "0"; | ||
| banner.style.right = "0"; | ||
| banner.style.padding = "12px"; | ||
| banner.style.background = "#3b0b0b"; | ||
| banner.style.color = "#ffb3b3"; | ||
| banner.style.background = "#511d91"; | ||
| banner.style.color = "#ffffff"; | ||
| banner.style.fontSize = "16px"; | ||
| banner.style.fontFamily = "'Asap', sans-serif"; | ||
| banner.style.zIndex = "20000"; | ||
| banner.style.textAlign = "center"; | ||
| banner.style.boxShadow = "0 2px 4px rgba(0, 0, 0, 0.4)"; | ||
| banner.style.borderBottom = "2px solid #d33"; | ||
| banner.style.borderBottom = "2px solid #3a1568"; | ||
| doc.body.prepend(banner); | ||
| }, | ||
| handlePhysicsOutOfMemory(error) { | ||
|
|
@@ -696,6 +697,10 @@ | |
| }); | ||
| }, | ||
| showRuntimeErrorBanner(message) { | ||
| if (!flock.showErrorBanners) { | ||
| flock.console?.error?.(message); | ||
| return; | ||
| } | ||
| const doc = flock.document ?? globalThis.document; | ||
| if (!doc?.body) return; | ||
| const bannerId = "runtime-error-banner"; | ||
|
|
@@ -708,14 +713,14 @@ | |
| banner.style.left = "0"; | ||
| banner.style.right = "0"; | ||
| banner.style.padding = "12px"; | ||
| banner.style.background = "#3b0b0b"; | ||
| banner.style.color = "#ffb3b3"; | ||
| banner.style.background = "#511d91"; | ||
| banner.style.color = "#ffffff"; | ||
| banner.style.fontSize = "16px"; | ||
| banner.style.fontFamily = "'Asap', sans-serif"; | ||
| banner.style.zIndex = "20000"; | ||
| banner.style.textAlign = "center"; | ||
| banner.style.boxShadow = "0 2px 4px rgba(0, 0, 0, 0.4)"; | ||
| banner.style.borderBottom = "2px solid #d33"; | ||
| banner.style.borderBottom = "2px solid #3a1568"; | ||
| banner.style.cursor = "pointer"; | ||
| banner.title = "Click to dismiss"; | ||
| banner.addEventListener("click", () => banner.remove()); | ||
|
|
@@ -769,6 +774,15 @@ | |
| sesScript.text = sesText; | ||
| doc.head.appendChild(sesScript); | ||
|
|
||
| // Re-wraps a host-realm fn into this realm; lockdown only tames this | ||
| // realm, so a raw host fn would leak the untamed Function via | ||
| // `.constructor` (sandbox escape). Must run before lockdown. | ||
| const wrapScript = doc.createElement("script"); | ||
| wrapScript.type = "text/javascript"; | ||
| wrapScript.text = | ||
| "window.__flockWrapHostFn = (fn) => (...args) => fn(...args);"; | ||
| doc.head.appendChild(wrapScript); | ||
|
|
||
| // lockdown the iframe realm | ||
| win.lockdown(); | ||
|
|
||
|
|
@@ -801,8 +815,9 @@ | |
| for (const [key, value] of Object.entries(whitelist)) { | ||
| const t = typeof value; | ||
| if (t === "function") { | ||
| // Bind to null so we don't leak host `this` | ||
| endowments[key] = value.bind(null); | ||
| // Wrap into the iframe realm: a host-realm fn leaks the untamed host | ||
| // Function via `.constructor` (sandbox escape). bind(null) drops host `this`. | ||
| endowments[key] = win.__flockWrapHostFn(value.bind(null)); | ||
| } else if (value == null || (t !== "object" && t !== "symbol")) { | ||
| // primitives only | ||
| endowments[key] = value; | ||
|
|
@@ -811,13 +826,15 @@ | |
| } | ||
| } | ||
|
|
||
| endowments.performance = { | ||
| now: win.performance.now.bind(win.performance), | ||
| }; | ||
| // win.Object, not a host `{}`: a host literal leaks host Function via | ||
| // obj.constructor.constructor. | ||
| endowments.performance = new win.Object(); | ||
| endowments.performance.now = win.performance.now.bind(win.performance); | ||
|
|
||
| endowments.requestAnimationFrame = win.requestAnimationFrame.bind(win); | ||
|
|
||
| endowments.Date = { now: win.Date.now.bind(win.Date) }; | ||
| endowments.Date = new win.Object(); | ||
| endowments.Date.now = win.Date.now.bind(win.Date); | ||
|
|
||
| // Undefine unwanted globals | ||
| // --- shadow unsafe / unneeded globals --- | ||
|
|
@@ -1323,6 +1340,10 @@ | |
| ); | ||
|
|
||
| flock.canvas.addEventListener("keydown", function (event) { | ||
| // Shortcut chords (Ctrl+Z undo, ⌘S…) belong to the app/browser, not | ||
| // gameplay — without this, undo on a focused canvas walks the player | ||
| // ("z"/"q" are bound to FORWARD/LEFT for AZERTY keyboards). | ||
| if (event.ctrlKey || event.metaKey || event.altKey) return; | ||
|
Comment on lines
+1343
to
+1346
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Verify the Babylon.js 8.56.0 camera modifier behavior used by this integration.
curl -fsSL https://raw.githubusercontent.com/BabylonJS/Babylon.js/8.56.0/packages/dev/core/src/Cameras/Inputs/freeCameraKeyboardMoveInput.ts | sed -n '106,158p'
curl -fsSL https://raw.githubusercontent.com/BabylonJS/Babylon.js/8.56.0/packages/dev/core/src/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.ts | sed -n '103,155p'Repository: flipcomputing/flock Length of output: 5068 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== locate flock.js and inspect relevant line range =="
fd -a '^flock\.js$' . | sed 's#^\./##'
FLOCK_PATH="$(fd '^flock\.js$' . | head -n 1)"
wc -l "$FLOCK_PATH"
sed -n '1300,1370p' "$FLOCK_PATH"
echo
echo "== search for Babylon keyboard/input setup in flock.js =="
rg -n "onKeyboardObservable|keyboard|camera|FreeCamera|ArcRotate|Canvas|addEventListener|addEventListener\\(" "$FLOCK_PATH" -C 3
echo
echo "== search package metadata for Babylon version/source path =="
rg -n "babylon|`@babylonjs`|Babylon|version" package.json package-lock.json pnpm-lock.yaml yarn.lock 2>/dev/null || trueRepository: flipcomputing/flock Length of output: 50375 Filter Ctrl and Alt chords before Babylon camera inputs update This canvas 🤖 Prompt for AI Agents |
||
| flock.canvas.currentKeyPressed = event.key; | ||
| flock.canvas.pressedKeys.add(event.key); | ||
| }); | ||
|
|
@@ -1350,6 +1371,16 @@ | |
| flock._hardResetCameraControls(flock.scene?.activeCamera); | ||
| }); | ||
|
|
||
| // macOS suppresses keyup for keys released while ⌘ is held, so both | ||
| // Babylon's camera keyboard input (_keys) and our pressedKeys set would | ||
| // keep them held until the next blur. Clear both when ⌘ comes up. | ||
| flock.canvas.addEventListener("keyup", (e) => { | ||
| if (e.key !== "Meta") return; | ||
| const kb = flock.scene?.activeCamera?.inputs?.attached?.keyboard; | ||
| if (kb?._keys) kb._keys.length = 0; | ||
| flock.canvas.pressedKeys?.clear(); | ||
| }); | ||
|
|
||
| flock.engineReady = true; | ||
| }, | ||
| setupGamepadCameraControls() { | ||
|
|
@@ -1605,15 +1636,15 @@ | |
| md.heightmapBody._pluginData.hpBodyId, | ||
| ); | ||
| } | ||
| } catch (e) { | ||
| /* ignore */ | ||
| } | ||
| try { | ||
| md.heightmapBody?.dispose(); | ||
| } catch {} | ||
| try { | ||
| md.heightmapShape?.dispose(); | ||
| } catch {} | ||
| md.heightmapBody = null; | ||
| md.heightmapShape = null; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -377,6 +377,10 @@ function parseProjectJsonResponse(response) { | |
| ); | ||
| } | ||
|
|
||
| if (projectText.length > 4 * 1024 * 1024) { | ||
| throw new Error("File content is too large"); | ||
| } | ||
|
Comment on lines
+380
to
+382
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- candidate file map ---'
ast-grep outline main/files.js --match '$_' --view concise 2>/dev/null | head -200 || true
printf '%s\n' '--- relevant source ---'
sed -n '320,420p' main/files.js
printf '%s\n' '--- response and size-limit usages ---'
rg -n -C 4 'response\.text|projectText\.length|File content is too large|Content-Length|fetch\(' main test tests 2>/dev/null || true
printf '%s\n' '--- repository test/config files ---'
git ls-files | rg '(^|/)(package\.json|.*test.*|.*spec.*|.*jest.*|.*vitest.*|.*playwright.*|.*cypress.*)' | head -200Repository: flipcomputing/flock Length of output: 9942 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- package and API test setup ---'
cat package.json
sed -n '1,240p' scripts/run-api-tests.mjs
sed -n '1,220p' playwright.config.js
printf '%s\n' '--- source context and test references ---'
sed -n '430,480p' main/files.js
rg -n -C 3 'fetchProjectJson|project=|File content is too large|file_too_large_alert|loadWorkspace' tests scripts test-*.js .github 2>/dev/null | head -240
printf '%s\n' '--- tracked change summary ---'
git diff --stat
git status --shortRepository: flipcomputing/flock Length of output: 11807 🏁 Script executed: #!/bin/bash
set -eu
node - <<'JS'
const LIMIT = 4 * 1024 * 1024;
const cases = [
{ name: "ASCII exactly at limit", text: "a".repeat(LIMIT) },
{ name: "ASCII one byte over", text: "a".repeat(LIMIT + 1) },
{ name: "2-byte UTF-8 exactly 4 MiB", text: "\u00e9".repeat(LIMIT / 2) },
{ name: "2-byte UTF-8 one byte over", text: "\u00e9".repeat(LIMIT / 2 + 1) },
{ name: "4-byte UTF-8 exactly 4 MiB", text: "\u{1f600}".repeat(LIMIT / 4) },
{ name: "4-byte UTF-8 one byte over", text: "\u{1f600}".repeat(Math.floor(LIMIT / 4) + 1) },
];
for (const { name, text } of cases) {
const utf8Bytes = new TextEncoder().encode(text).byteLength;
console.log(JSON.stringify({
name,
utf16CodeUnits: text.length,
utf8Bytes,
currentGuardRejects: text.length > LIMIT,
byteLimitRejects: utf8Bytes > LIMIT,
}));
}
JSRepository: flipcomputing/flock Length of output: 958 Enforce the size limit before buffering the response.
If this is a 4 MiB response limit, reject a known-large 🤖 Prompt for AI Agents |
||
|
|
||
| try { | ||
| return JSON.parse(projectText); | ||
| } catch (error) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -234,6 +234,13 @@ function initializeApp() { | |
|
|
||
| runCodeButton.addEventListener("click", executeCode); | ||
| stopCodeButton.addEventListener("click", stopCode); | ||
| // Clicking anywhere on the stopped overlay (not just the play button) starts | ||
| // the scene — matches the pointer cursor shown across the whole overlay. The | ||
| // inner button's click bubbles up here, and executeCode's isExecuting guard | ||
| // makes the resulting second call a no-op. | ||
|
Comment on lines
+237
to
+240
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Correct or remove the new comments. The new comments do not consistently describe the current implementation. Remove provenance-only comments.
As per coding guidelines, “Keep comments infrequent and include them only when genuinely noteworthy” and “Comments must reflect only the current state of the code.” 📍 Affects 9 files
🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| document | ||
| .getElementById("canvasStoppedOverlay") | ||
| ?.addEventListener("click", executeCode); | ||
| exportCodeButton.addEventListener("click", exportCode); | ||
|
|
||
| // Make open button work with keyboard | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: flipcomputing/flock
Length of output: 12530
🏁 Script executed:
Repository: flipcomputing/flock
Length of output: 4608
🏁 Script executed:
Repository: flipcomputing/flock
Length of output: 4752
🏁 Script executed:
Repository: flipcomputing/flock
Length of output: 203
🏁 Script executed:
Repository: flipcomputing/flock
Length of output: 26446
🏁 Script executed:
Repository: flipcomputing/flock
Length of output: 50375
🏁 Script executed:
Repository: flipcomputing/flock
Length of output: 50376
Add an endowment-escape regression test.
Run untrusted code that obtains a callable endowment with a computed
"constructor"property. Verify that it cannot execute generated source or access the hostwindowordocument. Test the wrapped function andperformance.now.🤖 Prompt for AI Agents
Source: Coding guidelines