[codex] Extract light environment model#457
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR extracts all deterministic light-environment logic (option lists, picker bucket helpers, and scoring math) from
Confidence Score: 5/5Safe to merge — the refactor is a clean extraction with no logic changes; all public APIs are preserved and new tests verify both isolation and behavioural equivalence. All scoring math, bucket helpers, and option lists are moved verbatim into the model module. The stateful wrappers in light-env.js inject the same environment and screen state that the old functions used directly, so runtime behaviour is unchanged for every existing caller. New tests assert re-export identity, screen-aware vs. skipped-screen room severity, and source-text isolation invariants. No logic was altered. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[light-env.js\nfacade / storage / rendering] -->|imports pure logic| B[light-env-model.js\nstateless model]
A -->|imports evening helpers| C[light-env-evening.js]
B -->|imports evening helpers| C
A -->|re-exports option lists &\npicker helpers unchanged| D[Existing callers]
A -->|stateful wrappers\ninject getEnvironment / getScreensForRoom / isActiveToday| E[computeRoomSeverity\ncomputeDeficitAxes\ncomputeIndoorBurden]
B -->|pure state-free exports| F[computeRoomSeverityForRoom\ncomputeDeficitAxesForEnvironment\ncomputeIndoorBurdenForEnvironment]
F -->|used by| G[Tests / future AI-context callers]
E -->|delegates to| F
Reviews (2): Last reviewed commit: "Clarify light environment severity model" | Re-trigger Greptile |
Summary
js/light-env-model.js.js/light-env.jsas the state/storage/rendering facade with compatibility wrappers for existing callers.version.jsto1.8.285.Validation
node --check js/light-env.jsnode --check js/light-env-model.jsnode --check tests/test-light-env.jsnode tests/test-light-env.jsnode tests/test-correctness-phase2.js./run-tests.sh