Skip to content

Show the marks for a vial that is past its date - #143

Merged
suskozaver merged 1 commit into
ArunNGun:betafrom
suskozaver:marks-survive-the-date
Oct 2, 2026
Merged

suskozaver merged 1 commit into
ArunNGun:betafrom
suskozaver:marks-survive-the-date

Conversation

@suskozaver

Copy link
Copy Markdown
Collaborator

Reported with screenshots: marks disappear from the daily overview the day a vial goes past its beyond-use date, while the Stock page goes on showing them correctly. Reported as patronising, and it is, but nobody decided it.

One predicate answering two questions

vialUsable means two things at once:

  • there is nothing here to take: finished, discarded, on order, empty
  • this is past its date

The first is a fact about whether a vial can supply anything. The second is a warning. Every reader of that predicate inherits both meanings whether it wants them or not, and marksForDose wanted only the first. Marks are what the syringe would read; they follow from the concentration; a date does not change a concentration.

Stock was right by accident. A row calls marksFromVial on its own vial and never asks the picker, so it never inherited the second meaning. Two screens answering the same question by different paths is how the disagreement became visible at all.

The fix

The marks fall back to the freshest made-up vial that is only disqualified by its date, which is the one in the fridge door. Only reconstituted vials, since marksFromVial answers for no other kind: a sealed powder has no concentration to read. An expired vial with nothing left in it, or one that was finished or thrown away, still says nothing.

Deliberately narrow, and worth your decision

What the app will draw from, what it counts as stock, and what a logged dose is attributed to are untouched. They read the same predicate for its other meaning.

So the complaint will come back one step later: the reporter can now read the dose off the overview and still cannot select that vial in the log form, which means logging it moves no stock. Whether a vial past its beyond-use date should still be allowed to supply a dose is your call rather than a bug fix, which is why it is not in here. Say the word and it is a small change in two places.

06-traps.md has the general shape: a predicate that combines a capability with a warning will be read by somebody who wanted only one of them.

Checks

npx tsc --noEmit clean, npx next lint clean, 1736 tests pass (10 new).

Reported with screenshots: marks disappear from the daily overview the
day a vial goes past its beyond-use date, while the Stock page goes on
showing them correctly. Reported as patronising, and it is, but nobody
decided it.

vialUsable means two things at once. There is nothing here to take,
which is finished, discarded, on order or empty. And this is past its
date, which is a warning. Every reader inherits both meanings whether
it wants them or not, and marksForDose wanted only the first: marks are
what the syringe would read, they follow from the concentration, and a
date does not change a concentration.

Stock was right by accident. A row calls marksFromVial on its own vial
and never asks the picker, so it never inherited the second meaning.

The marks now fall back to the freshest made-up vial that is only
disqualified by its date, which is the one in the fridge door. Only
reconstituted vials, since marksFromVial answers for no other kind: a
sealed powder has no concentration to read. An expired vial with
nothing left in it, or one that was finished or thrown away, still says
nothing.

Deliberately narrow. What the app will draw from, what it counts as
stock, and what a logged dose is attributed to are all untouched. Those
are the same predicate read for its other meaning, and whether a vial
past its date should still supply a dose is the owner's decision rather
than a bug fix. Worth saying that the complaint will return one step
later: the reporter can now read the dose and still cannot log it
against that vial.

The general shape is in 06-traps.md: a predicate that combines a
capability with a warning will be read by somebody who wanted only one
of them.
@vercel

vercel Bot commented Oct 2, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Arun's projects Team on Vercel.

A member of the Team first needs to authorize it.

@suskozaver
suskozaver merged commit 0affbad into ArunNGun:beta Oct 2, 2026
1 of 2 checks passed
@suskozaver
suskozaver deleted the marks-survive-the-date branch October 2, 2026 14:22
suskozaver pushed a commit that referenced this pull request Oct 3, 2026
#143 did not work, and the way it failed is worth more than the fix.

It gave the marks a fallback of their own: when no vial is drawable,
read the freshest open one past its date. It passed every test and did
nothing on the screen it was written for, because the person checking
it had four sealed vials of the same compound in the fridge. Sealed
vials are drawable, so the picker returned one, the fallback never ran,
and a sealed vial has no concentration to read.

Worse, that same picker had been drawing his one-tap dose that morning
out of a sealed vial nobody had made up. An existing test required it:
"skips an expired open vial and reaches for the sealed one". It is
reversed here, deliberately, and says why.

The owner's decision, given in as many words: the dose comes out of the
open vial in his hand, and the marks show. So it is now one rule in one
place.

drawableVials is the list the log form offers and the picker chooses
from. It holds anything with something left to take that is either
within its date or already open. An open vial past its beyond-use date
is still the one in the fridge door; a sealed one past the
manufacturer's date stays out, because nobody is midway through it and
breaking into one is not the app's call.

pickVialForDose reaches for an open vial within date first, then an
open one past its date, the freshest by the date it passed, and only
then a sealed one. marksForDose reads whatever the picker returns and
has no rule of its own any more; the fallback from #143 is gone.

The log form lists the same vials the picker chooses from, so it can
never pre-select something its own dropdown does not contain, and a
vial past its date says so in its option.

Stock figures are unchanged in meaning: available is what is within
date, and the rest is reported as expired. Only the nudge to
reconstitute stops firing when an open vial past its date is what the
next dose will come from, since it would otherwise contradict the
picker.

Checked against the reporter's own export: the picker now returns his
open Retatrutide vial, and the marks read 30, which is 1.5 mg at
5000 mcg/mL on a U-100 barrel.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant