Howdju / howdju

Monorepo for the Howdju crowdsourced fact checking and summarization platform
https://www.howdju.com
GNU Affero General Public License v3.0
5 stars 2 forks source link

Allow MediaExcerptRef properties to passthrough #717

Closed carlgieringer closed 3 months ago

carlgieringer commented 3 months ago

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 the justifictionBasis.entity is just {id: "the-id"} which evaluates to false.

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.)

github-actions[bot] commented 3 months ago

Changed-files coverage summary


=============================== Coverage summary ===============================
Statements   : 87.45% ( 202/231 )
Branches     : 69.57% ( 16/23 )
Functions    : 31.82% ( 7/22 )
Lines        : 87.39% ( 201/230 )
================================================================================