← Back to Pull requests

feat: optionally group identical sealed vials on Stock #18

Closed
unknown closed this pull request without merging on Aug 21, 2026 05:28 UTC
View on GitHub
unknown unknown commented on Aug 21, 2026 05:11 UTC
Author

What

Six sealed vials of the same compound and strength are six identical rows saying the same thing. This collapses them into one line with the totals.

It is a different way to read the same fridge rather than a better one, so it is a setting and it is off by default. Settings, Defaults, Group identical vials on Stock.

Only sealed vials group

Two reconstituted vials of one compound differ in exactly the things that decide what you do next: their concentration and their beyond-use date. Folding those together would hide the figures the page exists to show, so Open stays one row per vial regardless of the setting.

What a grouped row says

  • doses left across the whole group, and mass in total

  • cost added up, with in total on the label so it is not misread as a unit price

  • the soonest expiry in the group, not whichever vial happened to come first in the array
  • Two decisions that could have gone the lazy way:

    Mixed currencies report nothing. Adding 40 dollars to 3000 rupees produces a number with no meaning. If the priced vials in a group do not share a currency, no total is shown.

    Unpriced vials are counted, not ignored. A group of five where two have no price reads ... · 2 without a price, so a total is never read as covering more than it does.

    The buttons still act on one vial

    Reconstitute one and Delete one, always the oldest in the group, which is the order a person reaches into a fridge in. A single click can never remove six vials. The labels change only when the row stands for more than one.

    Where the logic lives

    groupSealedVials is in inventory.ts with the rest of the vial arithmetic, and the page does no grouping of its own. 13 tests cover the grouping key, ordering and stability, the soonest expiry, the currency rule, the unpriced count, and that non-sealed vials are left alone.

    Gate

  • tsc --noEmit clean

  • eslint clean

  • 988 tests, 13 of them new, passing in UTC, America/Chicago and Europe/Ljubljana

  • next build and BUILD_TARGET=static next build both succeed
  • 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.

    Data

    groupIdenticalVials is an optional boolean on Settings, absent on every existing install, which is what makes the default off without a migration.

    The branch sits directly on current main and is independent of #16 and #13.

    Diff: 323 lines (+242 / -81) across 4 files Reviewer: ArunNGun Review duration: 16m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.42) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 323 lines diff across 4 files
    0.42
    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%
    56%
    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.346
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #18"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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.0% (MEDIUM) · Higher = larger blast radius
    42.0%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 18.1% · Safe to merge
    18.1%
    Repository