Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework Update JSON encoders and decoders #3261

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Jan 7, 2024

  1. Rework Update JSON encoders and decoders

    This is an attempt to clarify the various `Encoder` and `Decoder` instances
    that make up `Encoder[Update]` and `Decoder[Update]` that are used by the
    `PullRequestRepository` for writing/reading updates to/from disk.
    
    I had a hard time understanding what was going on because
    * nearly all of the instances are implicit (for derivation) but only the
      instances for `Update` are used by other parts of the program
    * semi-derivation was mixed with manual modifications
    * decoders for compatibility with old caches depend on derivation and
      are defined ad-hoc
    
    In this change I tried to bring more clarity to these instances by
    * giving compatibility decoders their own name
    * forgoing semi-derivation and define all instances manually. IMHO this
      makes it easier to evolve them if there are compatibility constraints
      because of old caches
    * making every instance except `Encoder[Update]` and `Decoder[Update]`
      private and non-implicit
    * only testing them via the public `Encoder[Update]` and `Decoder[Update]`
      instances
    
    This might be a controversial change and I ackknowledge that one gains
    more understanding by doing this rework. I'm therefore biased that these
    changes actually clarify anything. I'm fine with letting this age for a
    while before merging to see if I still feel this is an improvement then.
    fthomas committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    026eb23 View commit details
    Browse the repository at this point in the history