Quantum Wave Interference Code Review

Code Review Comments

Quantum Wave Interference

296 comments across 119 files, written in 30 commits between 2026-07-22 and 2026-08-05. These comments have since been addressed and removed from the working copy. Each entry links to the file as it stood in the commit that added the comment, so the surrounding code can be read in context.

The summary below is in two parts: themes drawn from the inline review comments, followed by themes drawn from the issues filed alongside them.

Entries marked Most significant say the most about the overall health of the codebase — how it is structured, and how carefully the accessibility layer was built. The rest are largely local fixes.

Themes

A qualitative grouping of the comments. Many comments touch more than one theme, so these overlap; the counts are approximate and are meant to show relative weight, not to partition the list.

Duplication and factoringMost significant

~40

The largest cluster by a wide margin. Near-identical code appears in paired classes across screens — HighIntensityScreenView and SingleParticlesScreenView layout, SceneModel and BaseSceneModel source/hit/snapshot/reset handling, renderDetectorScreenTexture and DetectorScreenTextureRenderer hit rendering, and several describer files. A related sub-theme is class size: BaseSceneModel (~900 lines), HighIntensityScreenView (~1000 lines), DetectorProbeNode, and GraphAccordionBox were each flagged as carrying too many responsibilities.

Missing, incomplete, or stale documentation

~35

Requests for JSDoc on non-obvious math and multi-step methods, plus a recurring ask to document units and coordinate frames — several model fields mix meters, millimeters, and view coordinates without saying which. Separately, a number of "used by X" / "matches Y" comments had already gone stale, and the recommendation was consistently to delete them rather than maintain them.

Dead and unreachable code

~20

Exports with no importers, fields assigned but never read, parameters threaded through but unused, options no caller passes, and guards that can never fire (for example hit-count checks above MAX_HITS). Mostly straightforward deletions.

Description-layer fragilityMost significant

~25

The accessibility work drew its own cluster. Recurring concerns: descriptions that depend on exact localized English strings and so break under translation; hard-coded counts ("4 zoom levels", "6 zoom levels") duplicated between constants and string patterns with nothing keeping them in sync; thresholds that silently depend on dot size, bin count, and hit maximums; and parallel mappings maintained by hand in two places. Several comments also questioned createContextResponseAlert where endCallback looked like the better fit.

Constructor signatures and options

~15

Constructors and helpers taking seven to ten positional arguments, several optional or nullable, at a single call site. The repeated recommendation was optionize with named options — or, where a helper only forwards its arguments to one Node, deleting the helper and letting the caller construct it directly.

Magic numbers and constants

~16

Unexplained literals (scaling factors chained three deep, 5, 100, 20), the same range or dimension rebuilt in four to six files, and constants whose relationship to each other is undocumented. The ask was usually a named shared constant, or a note explaining why the value is what it is.

Property design

~14

Three patterns recur: bidirectional DynamicProperty instances where every consumer treats the value as read-only; Properties that never change and could be plain values or view options; and manual link chains that would be clearer as a DerivedProperty, MappedProperty, or Multilink.

Narrowed structural model typesMost significant

~8

A single sustained architectural objection, raised in WaveVisualizableScene and repeated in MeasurementToolsLayerNode, WaveRegionNode, BarrierScreenDistanceIndicatorNode, and others. The intent — decoupling view code from the full model — was read as unachieved: fields end up duplicated and the types must be extended by hand. The recommendation was to accept the base model directly, or to extract genuine sub-models (tool visibility, barrier/slit state, measuring tape) that the groupings already suggest.

Model/view separation

~10

View concerns found in model files — positions initialized in view coordinates, display-polarity types used only by plots, accessible-state stepping driven from the model — and the mirror case of view files owning Properties the model should hold.

Correctness questions

~12

Comments that read as possible defects rather than style: a solver ignoring dt so frame rate affects the detector pattern; || defaulting that turns a legitimate 0 into a fallback; a drop-hits warning whose condition fires one iteration early; a PhET-iO-writable probe position that bypasses its bounds; listener-order dependencies in layout and reset; and a maxWidth update that could re-enter.

Opportunities in common codeMost significant

~12

Places where the sim works around a gap upstream rather than in itself: stable bounds for ToggleNode, column layout and child access in RectangularRadioButtonGroup, sound suppression in Dialog, response queuing in AccessibleValueHandler, and an unexported type in sun sliders. Worth routing to the owning repos.

PhET-iO, disposal, and assertions

~16

Classes living for the sim lifetime that should declare isDisposable: false; implementation details questioned as instrumented state; phetioReadOnly asymmetries between related Properties; and several spots where a silent fallback would be better as an affirm.

Colors, fonts, and performance

~7

Hard-coded fills that belong in QuantumWaveInterferenceColors as ProfileColorProperty instances, duplicated font and track dimensions, and three performance notes — per-cell object allocation during paint, and an accordion box updating its graph about ten times during construction.

Issues filed during the review

36 issues were opened alongside the inline comments — used where a point was too large for a code comment or spanned many files.

Architecture, duplication, and typingMost significant

Accessibility and description

Strings and Fluent i18n

Constants, colors, fonts, and units

Code style and unused code

Disposal and assertions

View and layout

Documentation and repo hygiene