Skip to content

Fix static build missing 3D subway assets#36

Open
SohniSwatantra wants to merge 2 commits intomainfrom
codex/fix-bug-in-express-train-simulation
Open

Fix static build missing 3D subway assets#36
SohniSwatantra wants to merge 2 commits intomainfrom
codex/fix-bug-in-express-train-simulation

Conversation

@SohniSwatantra
Copy link
Copy Markdown
Owner

@SohniSwatantra SohniSwatantra commented Nov 10, 2025

Summary

  • include the NYC subway 3D engine scripts and optimized map image in the static build output so the hero animation can load
  • ensure Netlify deployments have the assets required for the live express train simulation overlay

Testing

  • python -m unittest test_app.py

Codex Task

Summary by CodeRabbit

  • New Features

    • Adds a graceful fallback to a static hero view when 3D/WebGL is unavailable, including probing for capability and disabling 3D particle effects when active.
  • Style

    • Introduces fallback-specific styling (background, badges, titles, hidden canvas/particles) to present a coherent static visual.
  • Chores

    • Updated build to include additional static assets for deployment.

@netlify
Copy link
Copy Markdown

netlify bot commented Nov 10, 2025

Deploy Preview for glittering-pony-d34e1a ready!

Name Link
🔨 Latest commit 8beff4e
🔍 Latest deploy log https://app.netlify.com/projects/glittering-pony-d34e1a/deploys/6912456ce699de00085098bf
😎 Deploy Preview https://deploy-preview-36--glittering-pony-d34e1a.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 10, 2025

Walkthrough

Adds new static assets to the build list and implements a non‑WebGL fallback path for the 3D hero: 3d-engine now probes WebGL, can activate a static fallback UI, and exposes fallback state; style.css adds visual rules for the fallback mode.

Changes

Cohort / File(s) Summary
Static Asset List Expansion
build_static.py
Added four files to the static copy list: nyc_subway_map.png, nyc_subway_map_optimized.jpg, 3d-engine.js, 3d-engine-scene-data.js. No control‑flow changes.
3D Engine — WebGL probe & fallback
3d-engine.js
Added WebGL capability probe hasWebGLSupport(), activateFallback(reason) and fallbackActive state; setupRenderer() now returns boolean and is guarded with try/catch; initialization respects renderer success and conditionally disables 3D particle field; exposes window.JulesAI3D.fallbackActive.
Fallback styling
style.css
Added .hero-visual-stage--fallback styles and related rules to hide canvas/particles, update HUD/badge/title/subtitle colors and hover behavior for the static fallback presentation.

Sequence Diagram(s)

sequenceDiagram
    participant Browser
    participant DOM as Document
    participant Scene as JulesSubwayScene
    participant Renderer as WebGLRenderer
    participant UI as Page UI (HUD / Particles)

    Browser->>DOM: DOMContentLoaded
    DOM->>Scene: new JulesSubwayScene().init()
    Scene->>Scene: hasWebGLSupport()
    alt WebGL available
        Scene->>Renderer: setupRenderer() (try)
        Renderer-->>Scene: success (true)
        Scene->>Scene: createScene(), loadAssets()
        Scene-->>UI: window.JulesAI3D.fallbackActive = false
        UI->>UI: init HeroParticleField
    else WebGL missing or renderer failed
        Scene->>Scene: activateFallback(reason)
        Scene-->>UI: window.JulesAI3D.fallbackActive = true
        UI->>UI: apply .hero-visual-stage--fallback styles
        UI->>UI: skip HeroParticleField init
    end
    Scene->>Browser: ready / render loop (if active)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review 3d-engine.js changes (renderer creation try/catch, hasWebGLSupport probe, activateFallback, init flow) — highest priority.
  • Verify styling interactions in style.css for accessibility and visual regressions.
  • Confirm build_static.py additions match actual asset files and deployment paths.

Poem

🐰 I hopped through code with eager paws,
When WebGL snoozes I pause the cause.
A static map, a gentle glow,
The HUD still shines where pixels slow.
Hooray — the subway hums below! 🚇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides a clear summary and testing method, but lacks most required template sections like Type of Change, Related Issues, and comprehensive Testing details. Add the Type of Change section, link related issues, expand testing with configuration details, and complete the checklist items where applicable.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main objective: ensuring 3D subway assets are included in the static build output.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/fix-bug-in-express-train-simulation

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5324f2e and 19c1687.

📒 Files selected for processing (1)
  • build_static.py (1 hunks)

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
3d-engine.js (1)

178-208: WebGL detection is thorough; consider relaxing performance requirements.

The hasWebGLSupport() method comprehensively probes for WebGL availability and properly cleans up test contexts. However, line 192 uses failIfMajorPerformanceCaveat: true, which will fail on systems where the browser detects significant performance degradation compared to software rendering.

While this ensures optimal performance, it might exclude users who could still benefit from a functional (if slower) 3D experience. Consider whether this restriction aligns with your accessibility and user experience goals—relaxing this flag could expand compatibility.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 19c1687 and 8beff4e.

📒 Files selected for processing (2)
  • 3d-engine.js (5 hunks)
  • style.css (1 hunks)
🔇 Additional comments (5)
style.css (1)

819-855: Fallback styling implementation looks solid.

The new .hero-visual-stage--fallback rules provide a graceful degradation path when WebGL is unavailable. The approach correctly:

  • Removes 3D transforms and uses a static gradient + image background
  • Hides the canvas and particle elements with display: none !important
  • Adjusts text colors for improved contrast against the darker fallback background
  • Suppresses decorative pseudo-elements that rely on 3D effects

The scoping ensures these styles only apply when the fallback class is active, preserving the primary 3D experience when available.

3d-engine.js (4)

49-49: Fallback detection and initialization flow is well-structured.

The implementation correctly identifies multiple failure scenarios:

  • Missing canvas element
  • Unavailable Three.js library
  • Unsupported WebGL

Each failure path calls activateFallback() and returns early to prevent attempting 3D initialization. The setupRenderer() return value is properly checked before proceeding with scene setup.

Also applies to: 59-67, 92-117


156-176: Proper error handling for renderer initialization.

Wrapping the WebGLRenderer creation in try/catch ensures that initialization failures are caught and handled gracefully. The method returns a boolean to signal success/failure, allowing the caller to make informed decisions about proceeding with scene setup.


210-238: Fallback activation and UI updates are well-implemented.

The activateFallback() method properly:

  • Guards against duplicate activation
  • Adds the CSS fallback class to enable static styling
  • Marks the canvas as aria-hidden="true" for accessibility
  • Updates UI text (badge, subtitle, title) to communicate the fallback state to users

The inclusion of a reason parameter provides useful context for the fallback, which is reflected in the subtitle text.


746-780: DOMContentLoaded integration correctly propagates fallback state.

The initialization flow properly:

  • Detects existing fallback state from the DOM
  • Updates fallback state after scene initialization (since init() may activate fallback)
  • Conditionally creates the particle field only when fallback is inactive
  • Exposes the fallback state on the public window.JulesAI3D API

This ensures that the particle field is not created when 3D rendering is unavailable, preventing unnecessary DOM manipulation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant