skip to content

How should a ride-hailing app's server signal a minimum-supported-version gate so that even a badly broken old build still obeys it?

level: middleimportance: must knowfreq 44%

answer

  1. the build reports its version
  2. two thresholds: soft and hard
  3. checked before any endpoint parsing
  4. one frozen shape, shipped in release one
  5. not 401, not 426

basics

~20 s

The app sends its build version on every request; below a hard floor, any call gets one frozen, distinct block response that the app checks before parsing the body. That contract ships in the first release and never changes.

solid answer

~50 s

Every request carries the app's build version, and the server holds two thresholds per platform in configuration: a **soft** floor that adds a non-blocking "update recommended" signal to normal responses, and a **hard** floor below which any endpoint answers with one dedicated block response. The block has a fixed, machine-readable shape, for example a problem-details body with a stable `type`, and the app's networking layer checks for it before any endpoint-specific parsing, so it still works when the build no longer understands the endpoint's real payload. A cheap launch-time config call carries the same verdict. The contract is frozen in the very first release: a build that never learned the signal cannot be gated gracefully. And it reuses no code the pipeline already acts on: a 401 starts a token refresh, and 426 means a protocol upgrade.

code

pseudocode · 18 lines
pseudocode
function handle_response(response):
    # runs before any endpoint-specific parsing
    if media_type_of(response) == "application/problem+json"
       and problem_type_of(response) == GATE_TYPE_UNSUPPORTED:
        show_update_block(problem_detail_of(response))
        return STOP
    if header_of(response, "App-Update") == "recommended":
        remember_soft_update_hint()
    return parse_for_endpoint(response)

function is_below(version, floor):
    # compare part by part as numbers, never as text
    for i in 0 .. 2:
        a = number(part_of(version, i))
        b = number(part_of(floor, i))
        if a != b:
            return a < b
    return false

go deeper

for a junior

Recall that the app reports its build version and the server decides, against a minimum version, whether to serve it, suggest an update or block it.

for a middle

Explain the contract: soft and hard floors in server configuration, one frozen block shape checked before endpoint parsing, and why it must ship in release one.

for a senior

Cover the edges: an active trip that must finish, numeric version comparison, offline builds, and why 401, 426 and Sunset cannot carry the gate.

for a principal

Own the hard floor as a policy: who may raise it, what traffic evidence is required first, and how it is tied to retiring old fields and endpoints.

## What the gate is for A **minimum supported version** is the server's statement of its support window: builds at or above it are served, builds below it are told to update. It is the only lever the server holds over code already on phones, and it is what lets old fields and endpoints eventually be removed. Whether and how the user is prompted is a release concern; the part decided here is the **gate's contract**: how the server says "you are below the line" so that every build understands it. ## Two thresholds, held by the server | | Soft floor | Hard floor | |---|---|---| | Effect on the build | Keeps working; may show a dismissible update suggestion | Stops at a block screen pointing to the update | | Signal | An extra header or field on normal responses | One dedicated block response from any endpoint | | Typical reasons | A feature the build lacks, a planned retirement ahead | A security fix, a contract the server can no longer serve, money shown wrongly | | Cost of using it | Little; easy to ignore | Riders who cannot or will not update are turned away | Both thresholds live in server-side configuration, set per platform because each platform's builds are numbered and released on their own schedule, and changeable without a deploy. ## A signal that survives a broken build The hard gate exists for the builds that are most out of date, so it has to work when nothing else in them does. Four properties do that: 1. **The build reports itself on every request.** The app sends its version and platform in a header, so any endpoint can apply the gate. HTTP's `User-Agent` exists partly so servers can tailor responses to a client's limitations; a dedicated header is also common. 2. **One frozen response shape.** For example a problem-details body (the `application/problem+json` format, whose `type` member is the primary identifier of the problem), always with the same `type` value, plus a human-readable message the build can show as is. 3. **Checked first.** The networking layer looks for that shape before handing the body to the endpoint's parser. A build below the floor may no longer understand the endpoint's payload; if parsing ran first, it would fail with a generic error and the block would never show. 4. **Also answered at launch.** A small config call made at start-up, with a response shape that never changes, returns the same verdict, so the gate shows before the rider is half-way through booking. The whole contract has to be in the **first** release. Builds shipped before it cannot recognise a block; for them the server can only refuse service, and they show whatever generic error they have. ## Codes and headers to avoid - **401** tells the client its credentials failed; a pipeline reacts by refreshing the token or signing the user out, which loops or loses the session rather than prompting an update. - **426 Upgrade Required** means "switch to a different protocol", and the server must name that protocol in an `Upgrade` header; it says nothing about app versions. - **`Sunset` and `Deprecation` headers** inform clients written to read them. A client that does not interpret `Sunset` simply finds the resource gone one day, so they cannot carry the gate for old builds. The exact status code is a house convention. What matters is that it is distinct from every code the pipeline already acts on, and that the `type` decides, not the code. ## Edges the contract must settle - **Version comparison is numeric, part by part.** Compared as text, "5.10.0" sorts before "5.9.0" and a current build gets blocked. - **An active trip finishes.** If the floor rises while a rider is mid-ride, trip status and payment for that ride should keep working; block at the next booking. - **Offline builds learn late.** The gate acts when the server answers; a build can cache the last verdict and apply it at the next launch, but a floor raised while a phone is offline reaches it only on its next successful call. - **Raising the hard floor is a business decision.** The traffic by build version shows how many riders a raise turns away before anyone changes the number.

  • The hard floor rises while a rider is in the middle of a trip. What should happen?
    Let the trip finish. Trip status, the driver's location and payment for that ride should stay served, and the block applies from the next booking. Cutting a rider off mid-trip strands them and leaves an unpaid ride, which costs far more than one more trip on an old build. That means the gate needs a short list of exempt calls, decided as part of its contract.
  • Why not decide the gate entirely on the device, from a floor baked into the build?
    A floor baked into a build is fixed when it ships, and a build cannot know that it has become too old. The server is the only party that learns, later, that a build is unsafe or that a contract is going away. So the device holds the handling and the server holds the number; the build can cache the last verdict between calls.

  • Return 401 to old builds so they sign out and pick up the update.
  • Answer old builds with 426 Upgrade Required to make them update.
  • We can add the gate handling in a later release when we need it.
  • A hard gate can ride inside each endpoint's normal response payload.
  • Compare version strings as text; they are already in order.