fix: body weight ignores the kilograms or pounds setting #17
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 354 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.351
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #17"
general
weight: 0.35
ArunNGun
Fixes #5.
Confirmed
The report is accurate.
src/app/settings/page.tsxrendered the profile's body weight withsuffix="kg"hard-wired and wroteNumber(e.target.value)straight intoweightKg. It never readsettings.weightUnit.WeightCardwas the only component in the app honouring the setting.Stored data was never wrong, but the fix was a trap
The label said kilograms and the stored figure was kilograms, so the field was at least internally consistent and nobody's data is corrupt.
The hazard was for whoever fixed it. Changing the suffix to
lbwithout adding the conversion would store 180 kg for someone entering 180 pounds, and every mcg/kg dose derived from that profile would be out by a factor of 2.2. On this app that is not a cosmetic error.So the conversion is deliberately not written at the call site.
toDisplayWeightandfromDisplayWeightsit next tokgToLbandlbToKginoutcomes.ts, documented as a pair: a field displays through one and saves through the other, both or neither.WeightCardnow uses them as well, replacing its own inline copy, so there is one definition rather than two that can drift.Also fixed, not in the original report
src/app/report/page.tsxstated the weight change inkgregardless of the setting. Same omission, same fix. Worth catching here because that page is the one people hand to a doctor.Deliberately not changed
mcg/kgin the settings and profile blurbs. That is micrograms per kilogram of body weight, a dosing convention rather than a display of anyone's weight, andmcg/lbwould be wrong. The report asked for "all references that were kg", and this is the part of that which should stay.A pre-existing quirk left alone
The field writes to the store on every keystroke, so a trailing decimal point disappears as you type it. That behaviour is unchanged by this PR; the displayed value is now rounded to one decimal so that converting back and forth cannot leave
79.99999999in the box mid-edit.Gate
tsc --noEmitcleaneslintcleannext buildandBUILD_TARGET=static next buildboth succeed, 62 pages exportedThe two builds were run with the
next/fontGoogle Fonts calls stubbed in a throwaway copy of the tree, because the environment this was prepared in cannot reach fonts.googleapis.com. Worth one confirming run with network before merge.How to check it
1. Settings, set Weight in to Pounds.
2. The profile's body weight field should now read
lband show the converted figure.3. Switch back to Kilograms. The figure should return to what it was, because nothing stored has changed.
4. Report tab, the Weight change line should follow the same setting.