Hoist magic numbers and file-local constants to OpticsLabConstants - #76
Merged
Merged
Conversation
Wire constructors, query params, edit-panel ranges, and views to the central constant registry; alias wavelength/scale duplicates; remove the unused RayStubsProperty singleton leftover.
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Baton's security-audit step writes audit.json before npm run lint; Biome was failing on that ephemeral artifact's formatting.
veillette
marked this pull request as ready for review
July 23, 2026 19:13
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
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.
Summary
Continues the OpticsLab constants-hoisting work by moving remaining semantic magic numbers and duplicated file-local constants into
OpticsLabConstants.ts(and wiring model-layer aliases inOpticsConstants.ts).Already-defined constants now used at call sites
DEFAULT_REFRACTIVE_INDEX/DEFAULT_CAUCHY_B(Glass,SlabGlass,HalfPlaneGlass)PIXELS_PER_METERinRayTracerconvergence math (was bare/ 100)APERTURED_MIRROR_MAX_APERTURE_FRACTIONin apertured-mirror viewFALLBACK_RAY_WAVELENGTH_NMfor canvas/SVG wavelength fallbacks (was550)FONT_11PX,HANDLE_LINE_WIDTHNewly centralized constants
LENGTH_DEGENERATE_M,MAX_HISTORY_SIZE,DETECTOR_MAX_HITS,QUERY_DEFAULT_MAX_RAY_DEPTH, grating duty-cycle defaultGREEN_WAVELENGTH→ beam/grating defaults;CONT_SPECTRUM_DEFAULT_WL_MIN_NM→WAVELENGTH_MIN_NMOpticsConstantsaliasesPIXELS_PER_METER/BRIGHTNESS_MAX/DEFAULT_RAY_DENSITYCleanup
RayStubsProperty.ts(superseded by per-screenViewOptionsModel)DEFAULT_POINT_SOURCE_BRIGHTNESS(0.6), matching the factoryaudit.jsonfrom Biome (and gitignore it) sonpm run lintmatches the GitHub workflow order: security-audit → lint → checkVerification (same as Baton CI)
npm audit … > audit.jsonthennpm run lint— passnpm run check— passnpm test— 413 tests pass