Skip to content

Add Pure Local Sensors experiment + first-load UX improvements and fixes#4

Open
shaal wants to merge 1 commit into
mainfrom
pure-local-sensors-experiment
Open

Add Pure Local Sensors experiment + first-load UX improvements and fixes#4
shaal wants to merge 1 commit into
mainfrom
pure-local-sensors-experiment

Conversation

@shaal
Copy link
Copy Markdown
Owner

@shaal shaal commented May 25, 2026

This PR introduces a 'Pure Local Sensors' experiment mode along with several first-load UX improvements and bug fixes.

Key changes

  • New 'Pure Local Sensors' mode (?pure-local=1): Forces lf and lr track-orientation features to zero so the brain only receives the 7 raw ray readings + speed. Useful for testing embodied/local-only driving.
  • Toggle added to the 🧪 Experiments panel with live URL sync and a convenient 'Restart training' helper button for clean comparisons.
  • First-load experience improvements: Advanced experimental panels now start collapsed, the ▶️ Start Training button is more prominent, and a one-time helpful hint appears after the first click.
  • Fixed visual regression where the A/B HUD (#ab-hud) produced stray dark horizontal lines on first load and after repeated A/B enable/disable cycles. Now uses a robust CSS class (.ab-hud-visible) + early-hide safeguards.
  • New ELI15 chapter explaining the pure-local experiment.
  • Planning documents added under docs/plans/ for future Reinforcement Learning mode and policy capability enhancements (memory, anticipation, capacity).
  • Accuracy fixes across several ELI15 chapters.

All changes were validated with headed browser sessions via agent-browser CLI.

The Triangle track preset changes from earlier experiments have been reverted (kept at the original 4 checkpoints).

Summary by CodeRabbit

Release Notes

  • New Features

    • Added first-time onboarding hint on pause
    • New "Pure local sensors" diagnostic experiment mode to test sensor-only vs. track-aware training
    • Enhanced seed source display with archive percentage
    • Improved first-load UI polish for A/B comparison and experiments panel
  • Documentation

    • Updated neural network architecture details (244 weights, 10→16→4)
    • New documentation explaining the pure local sensors experiment
    • Added planning documents for future policy enhancements
  • Styling

    • A/B HUD visibility improvements
    • First-load discovery styling for A/B toggle and seed sources

Review Change Stack

- Introduce 'Pure Local Sensors' mode (?pure-local=1) that zeros lf/lr track-orientation features so the brain only receives raw rays + speed.
- Add toggle in the 🧪 Experiments panel with URL sync and restart helper.
- Improve first-load experience: collapse advanced panels, prominent Start button, one-time helpful hint after first start.
- Fix visual bug where #ab-hud (A/B HUD) leaked dark horizontal lines on first load and after A/B toggle cycles (now uses robust .ab-hud-visible class + early hide).
- Add dedicated ELI15 chapter for the pure-local experiment.
- Add planning documents under docs/plans/ for future RL mode and policy capability enhancements.
- Various ELI15 accuracy fixes and supporting screenshots for validation.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

📝 Walkthrough

Walkthrough

This PR expands the car's neural network from 92 to 244 weights (6→8→4 to 10→16→4), introduces a pure local sensors diagnostic experiment that disables track-proximity features, adds first-time UX polish for A/B and experiments panels, and includes strategic planning for future policy enhancements and reinforcement learning modes.

Changes

Feature and Architecture Update

Layer / File(s) Summary
Neural Network Architecture Update (92 → 244 weights)
AI-Car-Racer/eli15/chapters/neural-network.js, AI-Car-Racer/eli15/chapters/...
All educational chapters updated to document the expanded 10→16→4 network: revised titles, ASCII diagrams, weight calculations, and cross-file line references in lineage, sensors, what-is-this-project, why-cars-crash, and guided tour.
Pure Local Sensors Feature (Core)
AI-Car-Racer/car.js, AI-Car-Racer/eli15/chapters/pure-local-experiment.js, AI-Car-Racer/eli15/index.js, AI-Car-Racer/sim-worker.js
car.js detects pureLocalSensors flag and gates checkpoint-direction feature computation; new chapter documents the diagnostic mode; registry and worker updated to receive/store flag from init message.
Pure Local Sensors UI Integration
AI-Car-Racer/main.js, AI-Car-Racer/uiPanels.js
Main.js parses URL params, sets flag, creates on-screen indicator, and patches metrics tracking; uiPanels.js wires experiments panel checkbox with URL persistence, restart helper, and auto-open logic.
First-Time UX Polish
AI-Car-Racer/main.js, AI-Car-Racer/buttonResponse.js, AI-Car-Racer/style.css, AI-Car-Racer/uiPanels.js
Auto-boot hides A/B HUD and collapses experiments panel; pause screen shows one-time onboarding hint; A/B toggle and enable/disable handlers manage visibility class and discoverability amber tint; inline styles cleaned.
Seed Source Archive Highlight
AI-Car-Racer/style.css, AI-Car-Racer/uiPanels.js
One-time visual highlight (amber background with transition) when archive-recall count first becomes non-zero; seed-sources display now includes computed archive percentage.
Planning Documentation
docs/plans/enhancing-policy-capabilities.md, docs/plans/reinforcement-learning-mode.md
Two living documents outline future policy enhancements (temporal memory, anticipation, capacity) for difficult tracks and a proposed reinforcement-learning-mode as alternative to genetic algorithms, including phased implementation and open design questions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • shaal/VrumVector#2: Modifies experiments panel UI wiring in uiPanels.js; this PR's "Pure local sensors" row and auto-open behavior extend that same experiments-disclosure restructuring.

Poem

🐰 A rabbit's verse on the neural expansion:

Ten inputs now where six lived before,
Sixteen hidden neurons explore,
Two hundred forty weights so light,
Pure local mode tests what's right,
First-time polish, seeds on display—
Vrum! Vrum! goes the better way. 🚗

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main changes: introducing a Pure Local Sensors experiment and implementing first-load UX improvements and bug fixes, which matches the substantial changes across the codebase.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pure-local-sensors-experiment

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AI-Car-Racer/uiPanels.js`:
- Around line 1846-1851: The btn.onclick handler only calls
restartBatch/restartBatch on window which restarts the batch but doesn't clear
the worker's init state, so the worker may keep the old "pure-local" sensor
mode; update the handler (btn.onclick) to first invalidate the worker init state
(e.g. clear a workerInitialized flag or call the existing
workerInitReset/initInvalidation function used elsewhere) and/or send a
reset/init-invalid message to the worker before invoking restartBatch or
window.restartBatch so the worker will re-run its init and receive the correct
sensor mode.
- Around line 1814-1820: The calls to updatePureLocalRestartHelper(...) may run
before the function is assigned to window.updatePureLocalRestartHelper, causing
a ReferenceError; change those call sites to safely reference the function via
window (e.g., check typeof window.updatePureLocalRestartHelper === 'function'
before invoking) — specifically update the two call sites that pass (on,
expPureLocalRow) and the initial-state block that checks window.pureLocalSensors
to call window.updatePureLocalRestartHelper only when it exists, leaving the
later assignment window.updatePureLocalRestartHelper = function(...) unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d2a07e6d-5a6a-4131-a8d4-f374af531252

📥 Commits

Reviewing files that changed from the base of the PR and between 4be75d7 and 2025d44.

⛔ Files ignored due to path filters (14)
  • docs/validation/screenshots/ab-hud-toggle-fix.png is excluded by !**/*.png
  • docs/validation/screenshots/first-load-after-fix.png is excluded by !**/*.png
  • docs/validation/screenshots/first-load-fixed-abhud.png is excluded by !**/*.png
  • docs/validation/screenshots/triangle-checkpoints-left-focus-annotated.png is excluded by !**/*.png
  • docs/validation/screenshots/triangle-checkpoints-left-focus.png is excluded by !**/*.png
  • docs/validation/screenshots/triangle-v2-left-focus-annotated.png is excluded by !**/*.png
  • docs/validation/screenshots/triangle-v2-left-focus.png is excluded by !**/*.png
  • docs/validation/screenshots/two-lines.jpg is excluded by !**/*.jpg
  • docs/validation/screenshots/vv-after-start.png is excluded by !**/*.png
  • docs/validation/screenshots/vv-first-load.png is excluded by !**/*.png
  • docs/validation/screenshots/vv-headed-03-triangle-10cps-annotated.png is excluded by !**/*.png
  • docs/validation/screenshots/vv-headed-03-triangle-10cps.png is excluded by !**/*.png
  • docs/validation/screenshots/vv-improved-first-load.png is excluded by !**/*.png
  • two-lines.jpg is excluded by !**/*.jpg
📒 Files selected for processing (16)
  • AI-Car-Racer/buttonResponse.js
  • AI-Car-Racer/car.js
  • AI-Car-Racer/eli15/chapters/lineage.js
  • AI-Car-Racer/eli15/chapters/neural-network.js
  • AI-Car-Racer/eli15/chapters/pure-local-experiment.js
  • AI-Car-Racer/eli15/chapters/sensors.js
  • AI-Car-Racer/eli15/chapters/what-is-this-project.js
  • AI-Car-Racer/eli15/chapters/why-cars-crash.js
  • AI-Car-Racer/eli15/index.js
  • AI-Car-Racer/eli15/tour.js
  • AI-Car-Racer/main.js
  • AI-Car-Racer/sim-worker.js
  • AI-Car-Racer/style.css
  • AI-Car-Racer/uiPanels.js
  • docs/plans/enhancing-policy-capabilities.md
  • docs/plans/reinforcement-learning-mode.md

Comment thread AI-Car-Racer/uiPanels.js
Comment on lines +1814 to +1820
updatePureLocalRestartHelper(on, expPureLocalRow);
});

// Initial state for restart helper
if (window.pureLocalSensors) {
updatePureLocalRestartHelper(true, expPureLocalRow);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify call order and identifier usage around helper initialization.
rg -n -C2 'updatePureLocalRestartHelper|window\.updatePureLocalRestartHelper|window\.pureLocalSensors' AI-Car-Racer/uiPanels.js

Repository: shaal/VrumVector

Length of output: 1037


Fix ReferenceError: call window.updatePureLocalRestartHelper (or guard) before use

In AI-Car-Racer/uiPanels.js, the code calls updatePureLocalRestartHelper(...) at lines 1814 and 1819, but the function is only defined later as window.updatePureLocalRestartHelper = function(...) { ... } at line 1832. This mismatch can throw a runtime ReferenceError when those call sites run; replace/guard the calls to reference window.updatePureLocalRestartHelper (e.g., check typeof window.updatePureLocalRestartHelper === 'function') to wire the restart helper safely.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@AI-Car-Racer/uiPanels.js` around lines 1814 - 1820, The calls to
updatePureLocalRestartHelper(...) may run before the function is assigned to
window.updatePureLocalRestartHelper, causing a ReferenceError; change those call
sites to safely reference the function via window (e.g., check typeof
window.updatePureLocalRestartHelper === 'function' before invoking) —
specifically update the two call sites that pass (on, expPureLocalRow) and the
initial-state block that checks window.pureLocalSensors to call
window.updatePureLocalRestartHelper only when it exists, leaving the later
assignment window.updatePureLocalRestartHelper = function(...) unchanged.

Comment thread AI-Car-Racer/uiPanels.js
Comment on lines +1846 to +1851
btn.onclick = () => {
if (typeof restartBatch === 'function') {
restartBatch();
} else if (typeof window.restartBatch === 'function') {
window.restartBatch();
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Restart helper should invalidate worker init before restarting.

The helper currently restarts the batch only, but pure-local is sent to the worker only during init. Without invalidating init state first, the restart can keep the old sensor mode active.

💡 Suggested fix
           if (btn) {
             btn.onclick = () => {
+              if (typeof invalidateWorkerInit === 'function') {
+                invalidateWorkerInit();
+              } else if (typeof window.invalidateWorkerInit === 'function') {
+                window.invalidateWorkerInit();
+              }
               if (typeof restartBatch === 'function') {
                 restartBatch();
               } else if (typeof window.restartBatch === 'function') {
                 window.restartBatch();
               }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@AI-Car-Racer/uiPanels.js` around lines 1846 - 1851, The btn.onclick handler
only calls restartBatch/restartBatch on window which restarts the batch but
doesn't clear the worker's init state, so the worker may keep the old
"pure-local" sensor mode; update the handler (btn.onclick) to first invalidate
the worker init state (e.g. clear a workerInitialized flag or call the existing
workerInitReset/initInvalidation function used elsewhere) and/or send a
reset/init-invalid message to the worker before invoking restartBatch or
window.restartBatch so the worker will re-run its init and receive the correct
sensor mode.

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