Closed carlgieringer closed 3 months ago
=============================== Coverage summary ===============================
Statements : 87.45% ( 202/231 )
Branches : 69.57% ( 16/23 )
Functions : 31.82% ( 7/22 )
Lines : 87.39% ( 201/230 )
================================================================================
This fixes a bug in prod where if the UI sends a CreateJustification having a CreateMediaExcerpt with an ID, the schema excludes all the other fields, leaving only the ID. This bug relates to the fact that
isOnlyRef
doesn't do what we intend here since the value of thejustifictionBasis.entity
is just{id: "the-id"}
which evaluates tofalse
.This issue may arise in other contexts where we accept a union of some CreateEntity and its Ref. A long-term fix would be to split the UI to have two different basis creation experiences: an initial read-only preexisting basis mode which sends just the ID and an editable new basis mode that omits the ID.
Another improvement would be to apply schema parsing on the client to strip out extraneous fields.
(I also included another minor change to our Postgres connection method to log when Postgres appears not to be running.)