IntermediateAbout 12 min

    Encoding & Schema Evolution

    Read the full article on Substack

    7 min read.

    Send records between old and new code with tag-based encoding: add a field safely, see a reused tag corrupt data, and keep unknown fields through a rolling upgrade.

    Think of it this way: Field tags are like numbered boxes on a paper form. An old clerk who gets a newer form with an extra box 3 just ignores box 3. A new clerk reading an old form leaves box 3 at its default. But if box 2 used to mean email and now means phone, every old form gets misread without anyone noticing.

    Waiting
    Waiting

    Version 2 of the app adds an age field with tag 3. Old and new code will run side by side for a while.

    1/6

    Check your understanding

    Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.

    Safe or unsafe schema change?

    Sort

    Sort each change to a Protobuf-style schema by whether old and new code can keep talking.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    Safe

    Drop items here

    Breaks compatibility

    Drop items here
    6 pieces left to place

    Quiz

    11 questions
    Question 1 of 11
    Score: 0

    Backward compatibility means…

    Done with this lesson?

    Sign in free to keep your progress, streak and quiz scores.

    Keep going