[P1] Removing Oxygen and then enabling the rebreather crashes the app #55
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Priority: P1
Type: bug
Source: full codebase review requested 2026-10-31 (reproduced against the production build of
2cac7cf)Location:
src/App.tsxRemove gas button and the circuit effect that createsccr-oxygen;src/planner/ProfilePlanner.tsx[gases]effect (gases.find(g => g.name === "Oxygen")!)Problem and evidence
Advanced Mode lets you remove "Oxygen" whenever nothing live uses it, which is the default in open circuit. Enabling the rebreather afterwards does two things:
ccr-oxygencylinder for the missing gas.gasisundefined. The next render readsc.gas.nameand throws.There is no error boundary, so the whole page goes blank.
Reproduction (Playwright, HEAD build):
#root.This is related to #20 (CCR oxygen accounting tied to a user-editable gas name), but here the result is a whole-app crash.
Suggested correction
Give the CCR oxygen supply a dedicated pure-O2 gas that does not depend on the editable list, or re-add Oxygen whenever the CCR oxygen cylinder is created. Remove the non-null lookups. Guard the Active cylinder handler against missing gases. (The error boundary is shared with the plan-restore issue.)
Acceptance criteria
Regression for both reproduction paths: no crash, the CCR oxygen supply stays valid, and the planner renders. pnpm verify passes.
Scope: maintenance of the educational simulator. Preserve historical R1 acceptance and operational-validation limits.