{"canonical_url":"https://engineer.company/glossary/backward-compatibility/","content_markdown":"# Backward compatibility\n\n## What it is\n\nBackward compatibility means a newer version maintains the behaviour needed by\nsupported consumers of an earlier version. The scope depends on the thing being\nchanged. An API can support clients that were written against the previous\ncontract. A library can preserve important call signatures and results. A\nstorage format can give new software a way to read records produced before an\nupgrade.\n\nCompatibility has several layers. A field can retain its wire type and still\nchange its meaning. A number that represented seconds could begin representing\nmilliseconds. A query that always returned a stable order could shift to an\norder that affects the client's pagination. Choose the behaviour that callers\ncan rely on and check it through the actual boundary. A durable record of what\nis supported helps reviewers decide whether a change is compatible.\n\nState the direction each check covers. A consumer built before a change might\nhave to run with a newer service. During a release, the newer consumer might\nalso call an older service. The second situation is a separate requirement that\ndepends on the deployment sequence. Testing the supported combinations gives the\nword compatible a concrete meaning for the product.\n\n## Why it matters\n\nClients can outlive the release that introduced them. A mobile application might\nremain installed for months. A partner might refresh its generated client only\nafter a scheduled review. Stored records can be years old when a service needs\nto replay them. Changes that look local in the source can affect users who have\nnever installed the latest software.\n\nBackward-compatible steps help during gradual releases. A service can accept\nboth an old request form and a new one while its consumers move. The new\nrepresentation can become the default once the supported clients understand it.\nKeep the overlap deliberate. Test how readers and writers behave during it and\ngive the older behaviour a clear support policy.\n\nA compatibility rule also lets a team choose what a release promises. A\npublished client library can list which versions of the API it supports. An\ninternal service can set a shorter overlap when every consumer is controlled by\nthe same organisation. Both arrangements require evidence. An assumption about\nwho can deploy quickly is weaker than a record of the versions still used on the\nreal route.\n\n## What it looks like in practice\n\nImagine an order API that adds a delivery estimate. Keep an older client binary\nor a fixture that uses its original deserializer. Send it a normal response from\nthe new service. Confirm that the old behaviour remains useful and that a client\nthat already understands the new field handles it as intended. Also test the\ncase where the field is missing. A client that fails without it may need a\nrelease ordering decision.\n\nConsider a coded status or enumeration as a separate case. A consumer might\nhandle every previously known status in a closed list. An extra value can\nrequire a clear fallback or a new version even if the wire encoding permits it.\nTest the old client with the new value and verify what a user sees. This catches\ncompatibility problems that are invisible when only the newest generated types\nare exercised.\n\nEngineer's\n[typed API migration case study](/portfolio/migrated-the-api-to-huma-v2-at-100-parity/)\ndescribes migrating handlers gradually, publishing their descriptions and\nchecking agreement between the registered routes and the OpenAPI output. That\noffers a concrete place to start for a reader working on an API. A compatibility\ncheck can add fixtures for the older clients' requests and interpretations, so\nthe new service shows what its published contract means across releases.\n\nRecord the exact version pairing as part of the result. A test can use a\npreviously published client with the candidate server and a persisted record\nproduced by the older writer. After a change, read back what the fixture stored\nand compare the relevant fields. These tests support an explanation of what\nchanges and how the product handles its existing consumers.\n\n## Where it goes wrong\n\nA change can preserve types while changing a business rule. An omitted field\nmight gain a different default. A success response can be sent before an\noperation becomes durable when older clients expected it to be complete. Include\nexamples that specify meaning, timing and failure behaviour. A reviewer needs\nthose details to tell whether the product's compatibility promise still holds.\n\nLook for assumptions outside the obvious client. A dashboard can read stored\nvalues directly and a batch job can use a response body to decide which retries\nare safe. An interface document may describe only the route, so inventory both\nthe formal consumers and the integrations actually observed. Run at least one\nexisting caller through a full operation, from sending the first request to\nobserving its stored outcome. The sequence can reveal a change in state or\ntiming even when each individual response still looks valid.\n\nA team may also infer compatibility from a version number. Semantic versioning\ngives a naming policy for releases with a public API, but a number does not test\nthe relevant behaviours. Pair an agreed version policy with fixtures from\nsupported versions. Add a transition path when data can remain in storage after\nthe software that created it is gone. Keep the commitment discoverable where\ncallers decide whether to upgrade.\n\nFinally, give a compatibility promise an intentional end. If a representation is\nno longer needed, make its retirement visible, confirm its remaining use and\ntest the supported replacement. If an important consumer cannot follow the\nscheduled change, the team can choose a longer overlap or a new interface\nversion. A good decision leaves a support window people understand and concrete\nevidence about what the current product can still read and serve.\n\n## Further reading\n\n- [Google AIP-180 on backwards compatibility](https://google.aip.dev/180).\n  Explains wire, source and semantic compatibility for APIs.\n- [Protocol Buffers guidance for updating message types](https://protobuf.dev/programming-guides/proto3/#updating).\n  Describes changes and their effects on encoded messages.\n- [Semantic Versioning 2.0.0](https://semver.org/). Defines version-number\n  conventions around a declared public API.\n\n\u003chttps://engineer.company/glossary/backward-compatibility/\u003e\n","date_modified":"2026-11-25T07:18:46Z","description":"Look for changes in defaults, values and semantics, and test old consumers against the new implementation.","formats":{"gemtext":"https://engineer.company/glossary/backward-compatibility/index.gmi","gopher":"https://engineer.company/glossary/backward-compatibility/gophermap","html":"https://engineer.company/glossary/backward-compatibility/","json":"https://engineer.company/glossary/backward-compatibility/index.json","markdown":"https://engineer.company/glossary/backward-compatibility/index.md","pdf":"https://engineer.company/glossary/backward-compatibility/index.pdf"},"kind":"page","language":"en","title":"What is backward compatibility?","url":"https://engineer.company/glossary/backward-compatibility/","version":1}