← Back to Pull requests

fix: body weight ignores the kilograms or pounds setting #17

Closed
unknown closed this pull request without merging on Aug 21, 2026 05:04 UTC
View on GitHub
unknown unknown commented on Aug 19, 2026 16:35 UTC
Author

Fixes #5.

Confirmed

The report is accurate. src/app/settings/page.tsx rendered the profile's body weight with suffix="kg" hard-wired and wrote Number(e.target.value) straight into weightKg. It never read settings.weightUnit. WeightCard was 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 lb without 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. toDisplayWeight and fromDisplayWeight sit next to kgToLb and lbToKg in outcomes.ts, documented as a pair: a field displays through one and saves through the other, both or neither. WeightCard now 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.tsx stated the weight change in kg regardless 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/kg in the settings and profile blurbs. That is micrograms per kilogram of body weight, a dosing convention rather than a display of anyone's weight, and mcg/lb would 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.99999999 in the box mid-edit.

Gate

  • tsc --noEmit clean

  • eslint clean

  • 967 tests, 5 of them new, passing in UTC, America/New_York and Europe/Ljubljana

  • next build and BUILD_TARGET=static next build both succeed, 62 pages exported
  • The two builds were run with the next/font Google 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 lb and 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.

    Diff: 354 lines (+265 / -89) across 4 files Reviewer: ArunNGun Review duration: 2188m
    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
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.5% (MEDIUM) · Higher = larger blast radius
    42.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.8% · Safe to merge
    16.8%
    Repository