fix(profile): let the third gender value through every surface that handles it

The profile validator has accepted MALE, FEMALE and OTHER for a long
time, but the published contract documented two, and a client written
against that contract had no way to know the third existed. The profile
PATCH is one write, so a rejected gender took every sibling field with
it - a time-format change lost to a field the person never touched.

Gender now clears on an empty string, the same contract every other
profile field documents, and an unsupported value is refused with a
message that names the field and its accepted values instead of the
validator's own prose. Onboarding validated against a narrower enum
than the profile schema and 422'd the whole submission; its form could
not record the third value at all.

The rest is the same defect in other clothes. The Strain model scored
an unanswered or OTHER account on the male Banister coefficients; it
now uses the midpoint of both published models, matching every other
sex-split formula here. The dashboard snapshot emitted null for an
account that answered OTHER, which is indistinguishable from no answer.
Three casts asserted a two-value type over a three-value column. All of
them now carry the stored value and narrow once, at the boundary of a
reference table that genuinely has no third row, through one named
helper in src/lib/profile/sex.ts.

Refs #645
This commit is contained in:
Marc-André Bombeck committed 2026-07-26 17:09:03 +02:00
1 parent 0ce510fa68
commit f74efc44aa
28 files changed
+388 -39

No files matched your search

+5
View File
@@ -13272,11 +13272,13 @@ components:
- type: string
- type: "null"
gender:
description: Stored gender. Null or an empty string clears it; an omitted field is left untouched.
anyOf:
- type: string
enum:
- MALE
- FEMALE
- OTHER
- type: "null"
displayName:
anyOf:
@@ -24028,6 +24030,7 @@ components:
enum:
- MALE
- FEMALE
- OTHER
- type: "null"
heightCm:
anyOf:
@@ -24139,6 +24142,7 @@ components:
enum:
- MALE
- FEMALE
- OTHER
- type: "null"
heightCm:
anyOf:
@@ -26037,6 +26041,7 @@ components:
enum:
- MALE
- FEMALE
- OTHER
- type: "null"
glucoseUnit:
anyOf: