Skip to content

fix: surface silently swallowed errors across storage, physics, and AI paths - #5

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1784376326-error-handling
Open

fix: surface silently swallowed errors across storage, physics, and AI paths#5
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1784376326-error-handling

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Several catch blocks discarded their error entirely (empty bodies or // ignore), so failures like corrupted localStorage, failed physics-joint creation, or unsupported media recording produced no diagnostics — the app just silently fell back or did nothing. This PR keeps the existing fallback behavior but makes each failure observable via console.warn/console.error/console.debug with contextual prefixes (matching the existing [Module] … convention already used in DataCollector/registry), and hardens two spots that could propagate uncaught.

No control-flow/behavior change except where noted; all fallbacks are preserved.

Changes

  • sceneStorage.ts / physicsSettingsStore.ts / AuthProvider.tsx — parse failures of stored JSON previously catch { return null/{} } silently. Now logged before falling back:

    - } catch { return null }
    + } catch (err) {
    +   console.warn('[sceneStorage] failed to load stored scene, discarding it:', err)
    +   return null
    + }

    AuthProvider also logs when fetchCurrentUser() rejects and the session is force-signed-out (previously .catch(() => …) gave no clue whether it was a network blip or a real auth failure).

  • physicsSettingsStore.ts — the subscribe persistence localStorage.setItem(...) was unguarded and could throw (quota/private mode) out of a store update. Now wrapped in try/catch + warn.

  • SandboxJoints.tsxcreateJoint returned null on any Rapier error with no trace. Now warns with joint type/id and both body ids:

    [SandboxJoints] failed to create "motor" joint (j3) between b1 and b2: <err>
    
  • AiAgentPanel.tsx — message-history load/save/clear, AI-config load, malformed SSE lines, and tool-argument JSON parsing all swallowed errors. Now logged (warn for storage, debug for per-line/per-config so streams stay quiet).

  • agentTools.tsparseVector logs (debug) when a string arg isn't valid JSON before returning the default.

  • RecordingExporter.tsexportRecordingAsWebM returned early silently on empty frames / missing 2D context, and new MediaRecorder(...) could throw uncaught when vp9 is unsupported. Now each early-out logs, MediaRecorder construction is wrapped in try/catch, and an onerror handler is attached.

Verification

  • npm run build — passes
  • npm test — 50/50 pass

Note: npm run lint has 20 pre-existing prettier/prettier errors on main (in files/lines untouched here, e.g. api/ai/chat.ts, api/_lib/crypto.ts, sandboxStore.ts); this PR introduces no new lint errors. Left untouched to keep the change focused.

Link to Devin session: https://app.devin.ai/sessions/a45689948d484748af6ad5389e0bc065
Requested by: @Zyz555444

…I paths

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@CodeSky0 CodeSky0 self-assigned this Jul 18, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@vercel

vercel Bot commented Jul 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
phyverse Ready Ready Preview, Comment Jul 18, 2026 12:06pm

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Smoke test — PR #5 (logging / error-handling) ✅ no regressions found

Ran the branch locally (Node 22, Vite dev server) and exercised the golden paths through the UI, comparing against base 7826d3c.

Results
Path Result
Landing loads clean ✅ pass
Sandbox canvas + add Box/Sphere ✅ pass
Joint creation via UI (Spring) ✅ pass (no silent no-op/crash)
Recording Record→Stop controls ✅ pass (no crash)
Settings persist across reload ✅ pass (allowSleep:false persisted)
Saved scene reloads from localStorage ✅ pass (Box+Sphere+joint restored)

The new logging introduced no uncaught errors on the paths tested.

Sandbox with joint + recording

⚠️ Two PRE-EXISTING failures (reproduced on base — NOT caused by this PR)
  • Sandbox "Run" crashes into the error boundary: TypeError: ...reading 'coSetFriction' / Cannot set properties of undefined (setting 'dt') at PhysicsWorld.setTimestep. Reproduced identically on base 7826d3c. This blocked runtime testing of live physics, joint constraint behavior, and recording export.
  • TransformControls console-error flood on multi-select (drei gizmo). Reproduced identically on base.

Same flood on base branch

Tested by Devin — https://app.devin.ai/sessions/a45689948d484748af6ad5389e0bc065

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.

1 participant