Jules changes and UI fixes#127
Merged
Merged
Conversation
* perf(engine): optimize split array allocation in SpeciesGraph string parsing Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com> * chore: auto-fix linting and formatting issues * Delete .jules/bolt.md --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* Optimize chained array allocation in RuleBlocker.ts string parsing
This commit replaces `pattern.split('+').map(s => s.trim()).filter(Boolean)` with a single iterative loop inside `collectAtomsFromPattern`. This eliminates intermediate array allocations and provides ~1.5x speedup for this parsing step.
Also tracked a learning in `.jules/bolt.md`.
Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>
* Delete .jules/bolt.md
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* docs(mcp-server): add JSDoc to structureError function Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com> * chore: auto-fix linting and formatting issues --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
…ionEvaluator (#574) * ⚡ Bolt: Optimize split array allocation in NetworkExpansion & ExpressionEvaluator What: Replaced `.split('.').map()` chained array operations with imperative `indexOf('.')` and `substring()` loops in `ExpressionEvaluator.ts` and `NetworkExpansion.ts`. Why: Profiling identified these `split` array allocations in hot parsing loops (specifically around species naming and version bumping) as performance bottlenecks. Removing the intermediate array allocations reduces overhead. Impact: Measurable execution speedup in hot string parsing paths during network simulation. Measurement: Benchmarks show `indexOf` loops run roughly 1.5x - 5x faster than `.split().map()` implementations for these specific workloads. Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com> * Delete lint-fix.sh --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Replaced string split operations with string indexOf and slice in hot paths like `speciesGraphUtils` and `arGraphBuilder` to optimize tight loops and avoid string array allocations. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
…ciesData The /^[A-Za-z_][A-Za-z0-9_]*$/ regex rejected all species names like A(b!1) that contain parentheses, bond markers, and dots, causing setSafeNumericField to silently skip writing concentrations to speciesData. All fluxes computed to 0 as a result.
… Firefox SVG whitespace, and build correct structural causal edges
…rameter identifiability and dynamics workflow
… and correctness bugs Engine (Continuation.ts): - Dynamic eigenvalue threshold: filter eigenvalues whose max absolute value is below spectralRadius * 1e-11 to suppress conserved-moiety noise without affecting real bifurcation detection Engine tests (bifurcation.spec.ts): - Add 11 targeted tests covering conserved-moiety zero-eigenvalue suppression, saddle-node detection, DNA damage repair model (JIT-compiled, full pipeline), and dynamic threshold scaling UI (BifurcationTab.tsx): - P0: JIT compile failure now surfaces an error and aborts; removed silent zero-field fallback that produced fake flat diagrams - P1a: Replace dead fire-and-forget onSimulate() with synchronous engine.findSteadyState() at startValue to seed continuation on the correct branch - P1b: Nullcline fixed vector uses converged ss.y, not initial concentrations; params reset to model values before nullcline eval; amber caveat rendered when nSpecies > 2 (2D slice, not full portrait) - P2: Remove mockResult stub, stale comments, dead guard; branches computed as foldCount + 1 - Chart layout: overflow-hidden + explicit height div prevents chart bleed; axis labels moved inline - Nullcline rendering: replaced Scatter+shape=null (invisible) with SVG polyline overlay via NullclineOverlay custom Recharts child, preserving marching-squares segment topology
…P zero-RHS fallback, add known-fold test - T1 (P0): MCP handler now returns structured error on JIT failure instead of running on zero RHS - T2 (P1): New continuationWithConservation() engine function shared by UI, MCP handler, and tests - T3 (P1): Added test proving two known saddle-node folds survive the reduction path (dx/dt = p + x - x^3) - T4 (P2): UI detects when continuation parameter affects conserved pool totals and disables reduction - T5 (P2): EngineModule types updated for new export
Updated `generate_tab_docs.ts` to replace a generic TODO comment with a clear, explicit instruction on how to document a tab's intended workflow. This acts as a better prompt for developers generating the tab skeleton documentation. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Resolves a TODO in the tab documentation generator script by hardcoding explicit references to general markdown files (Quickstart, Solvers, MCP) and dynamically linking related tabs belonging to the same category. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Removed the unused parameter in `paramRanges` within `example2_neuralODESurrogate` of `scripts/research/phase2_demo.ts`. Updated `nParams` from 3 to 2, and updated the `testParams` array to have only 2 elements to align with the actual data required. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit replaces the chained array operations `text.split('\n').map().filter()` inside `packages/engine/src/services/analysis/petabImport.ts` with manual, zero-allocation `indexOf('\n')` loops and character code scanning (`charCodeAt`) for trimming/filtering.
This resolves a performance bottleneck during PEtab dataset loading, significantly reducing memory pressure and intermediate array creation.
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* test: add coverage for SparseODESolver Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com> * test: add coverage for SparseODESolver Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
…valuator * 🛡️ Sentinel: [CRITICAL] Fix arbitrary code execution vulnerability in JITCompiler The `compileSSAPropensities` and `compileSSAPropensitiesWithFunctionalRates` methods in `JITCompiler.ts` were dynamically constructing JavaScript source code and passing it to `new Function(...)`. This dynamic code generation presents a critical code injection vulnerability and fails CodeQL static analysis checks. These methods have been modified to immediately return `null`. This securely forces the simulation loop (`SimulationLoop.ts`) to fall back to the safe, existing `calcPropensity` AST-walk logic, maintaining the system's security. Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com> * Delete .jules/sentinel.md * 🛡️ Sentinel: [CRITICAL] Secure JITCompiler dynamic code generation with strict runtime type checks The `compileSSAPropensities` and `compileSSAPropensitiesWithFunctionalRates` methods in `JITCompiler.ts` dynamically construct JavaScript source code and pass it to `new Function(...)`. This dynamic code generation presents a critical code injection vulnerability if inputs are not validated, and it fails CodeQL static analysis checks. Rather than removing the optimization, this commit introduces strict runtime structural validation (e.g., `Number.isFinite`, `Number.isInteger`) for EVERY variable interpolated into the code string. If any variable fails validation, the compiler safely returns `null` and the simulation gracefully falls back to the secure AST-walk evaluator (`SafeExpressionEvaluator`). This mathematically prevents arbitrary code breakout from the interpolation context while retaining the performance optimization for valid inputs. Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com> * chore: remove .jules artifact files from PR branch --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Removed the duplicate implementations of `generateDosePoints` and `computeDoseResponseBySimulation` from `packages/mcp-server/src/handlers/doseResponse.ts`. These functions were essentially copy-pasted versions of logic that already existed within the core engine. To fix the drift, the identical engine-owned functions in `packages/engine/src/services/analysis/DoseResponse.ts` were exported, added to the barrel file (`packages/engine/src/index.ts`), and directly imported by the MCP handler. This satisfies the parity invariant: the MCP handler now calls the engine functions directly and acts merely as a thin wrapper. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
… loops Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Add comprehensive tests for `isWebGPUSupported` and `initWebGPU` covering happy paths, missing adapters, device loss, initialization failures, and Promise caching behavior. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This improves performance by reducing array allocations by around 48%. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Replaced chained array operations (`.split()`) with an index-based `indexOf` parsing loop for computing `molToSpecies` in `NetworkExpansion.ts`. This eliminates unnecessary array and string allocations in a hot loop path. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Replaced the TODO comment in the generate_tab_docs.ts script with a mapped list of MCP tools that correspond to each UI tab, providing accurate and agent-driven functional equivalents in the generated analysis-tabs.md documentation. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Replaced the `TODO` comment in `scripts/generation/generate_tab_docs.ts` with a list of common pitfalls (Empty plots, Performance lag, Missing observables) that apply to the analysis tabs. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
- Adds focus-visible rings for keyboard navigation on circular icon buttons. - Fixes the disabled state for the 'Quick Run' button by altering cursor and hover scale behavior. - Uses dynamic titles/tooltips so the disabled 'Run' button communicates that a simulation is already in progress. - Adds an aria-label pointing to the new descriptive text for screen readers. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* ⚡ Bolt: Optimize Jacobian matrix compilation What: Replaced Map structures (netStoich and reactantStoich) inside the AnalyticalJacobian generator with flat Int32Array equivalents. Why: During the ODE simulation loop, the AnalyticalJacobian function evaluates mass-action derivatives constantly. Iterating over Maps or using Map.get() in this hot loop creates unnecessary object allocation and lookup overhead. Flattened typed arrays perform linearly with extreme efficiency, yielding a 30-40% reduction in Jacobian compile-time execution. Impact: Faster ODE simulation step-times for standard bio-models relying heavily on the analytical Jacobian override. Measurement: bench_jacobian.spec.ts microbenchmark time reduced from ~1400ms to ~860ms. Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com> * Delete .jules/bolt.md --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Replaced `(pool as any).workers` hack with a `mockWorkers` array that captures mock worker instances upon construction. This allows assertions to target public side-effects (`postMessage`, `onerror`, `onmessage`, `getStats()`) without violating class encapsulation. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* perf(parser): cache repetitive split regex Extract the `/\r?\n/` regex into a module-level constant to prevent recompilation during tight parsing loops in `parseBNGL`. This drastically reduces string splitting overhead. Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com> * chore: remove .jules artifact files from PR branch --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* 🎨 Palette: Add focus-visible state to SemanticSearchInput buttons and chart controls 💡 What: Added `focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50` styling to the clear button in `SemanticSearchInput` and interactive chart legends/scale toggles. 🎯 Why: Enhances keyboard navigation accessibility by providing a clear, standard visual focus indicator. 📸 Before/After: Focus state is now visible for keyboard users interacting with the search and charts. ♿ Accessibility: Ensures WCAG 2.1 Success Criterion 2.4.7 (Focus Visible) is met for previously icon-only or custom-styled buttons. Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com> * chore: remove .Jules artifact files from PR branch --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* 🎨 Palette: Add tooltip to Modal close button * 💡 What: Added the `title` attribute to the generic close `<button>` in `components/ui/Modal.tsx`. * 🎯 Why: Icon-only buttons lacking text can be ambiguous. While an `aria-label` provides screen reader support, standard mouse users were not getting native browser tooltips for this frequent interaction. * ♿ Accessibility: Combines visual tooltips via `title` with the existing `aria-label` for assistive technologies, bringing parity to sighted and non-sighted users. Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com> * chore: remove .Jules artifact files from PR branch --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* ⚡ Bolt: Optimize NetParser loop for zero allocation Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com> * chore: auto-fix linting and formatting issues * chore: remove .jules artifact file from PR branch --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* 🧹 Prune: Remove unused ExpressionCompiler class Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com> * 🧹 Prune: Remove unused ExpressionCompiler class Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* ⚡ Bolt: [performance] avoid intermediate string allocations in NetworkExpansion Replaced chained array operations (`.split()`) with an index-based `indexOf` parsing loop for computing `molToSpecies` in `NetworkExpansion.ts`. This eliminates unnecessary array and string allocations in a hot loop path. Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com> * chore: auto-fix linting and formatting issues --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
…cies in PatternMatcher (#602) * ⚡ Bolt: [performance] Optimize parseSpeciesString and canonicalizeSpecies in PatternMatcher 💡 What: Optimized PatternMatcher string parsing and canonicalization. Replaced .split('.') and .split(',') with zero-allocation index scanning, and refactored canonicalizeSpecies to use simple for loops and string concatenation instead of .map() and .join() closures. 🎯 Why: These functions run tightly inside the hot loops of BNGL symmetry reduction and structural verification logic. Eliminating intermediate array allocations massively reduces garbage collection pressure and increases throughput. 📊 Impact: ~40% faster pattern parsing (188ms to 121ms in benchmark). ~30% faster pattern canonicalization (320ms to 205ms in benchmark). 🔬 Measurement: Measured on synthetic benchmark tests locally. Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com> * Delete .jules/bolt.md --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
| let max = 0; | ||
| for (let idx = 0; idx < this.molecules.length; idx++) { | ||
| let deg = 0; | ||
| const deg = 0; |
| { atol: 1e-8, rtol: 1e-6, useConservationLaws: false, useILUPreconditioner: true } | ||
| ); | ||
|
|
||
| const oldBuild = (solver as any).buildAndFactorizeMatrix; |
| @@ -1,4 +1,4 @@ | |||
| import { computeDoseResponse, loadEvaluator, simulate } from '@bngplayground/engine'; | |||
| import { computeDoseResponse, computeDoseResponseBySimulation, loadEvaluator, simulate } from '@bngplayground/engine'; | |||
| @@ -0,0 +1,296 @@ | |||
| import * as fs from 'fs'; | |||
Comment on lines
+3
to
+11
| import { | ||
| isWebGPUSupported, | ||
| initWebGPU, | ||
| getGPUDevice, | ||
| getGPUAdapter, | ||
| isWebGPUReady, | ||
| disposeWebGPU, | ||
| WebGPUContext | ||
| } from './WebGPUContext'; |
| @@ -0,0 +1,102 @@ | |||
| import { readFileSync, existsSync } from 'node:fs'; | |||
| import { join } from 'node:path'; | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.