Skip to content

Only include the major version in the Tus-Resumable header #96

@Acconut

Description

@Acconut

In an unrelated discussion (#79 (comment)), @ruv left an interesting link (https://www.mnot.net/blog/2012/12/04/api-evolution) which drew my attention towards how we address versioning inside the tus protocol. The current state is that we have the Tus-Version header which indicates which versions of the protocol is supported by the Server and the Tus-Resumable header which indicates which version the Client or the Server used in its request or response. My concern in this proposal is mostly about later one. Currently, the specification defines it as following:

The value MUST be the version of the protocol used by the Client or the Server.

Since v1.0.0 has been the only released version which included the Tus-Resumable header, handling versions has been relatively easy as its value was always 1.0.0. However as we are approaching the 1.1 release, this may introduce a few issues:

As some Clients will be updated to use the new 1.1 version, Server may still only accept the previous 1.0 version. Since the Server is allowed to reject unsupported version, an upload will not be possible. For these scenarios, tus has provided the Tus-Version header which allows the Client to know which versions it may use. In this example, the Client should downgrade to using 1.0, but this negotiation step results in a overhead which could be avoidable.

Furthermore, including the entire version in the Tus-Resumable header is also rather useless. Let me try to explain this point:

  • If we publish a new patch release, which just fixes a misspelled word or phrase, neither Client nor Server care about this, since the actual meaning of the specification must not have changed (according to SemVer).
  • If we publish a new minor release, which adds a new feature, we must make this new feature a new optional extension or else it would be a breaking change and this is not allowed in a minor release. Furthermore, versions can not be used as an indicator for which extensions are supported by the Server, as the are optional. For these situation, we introduced the Tus-Extension header which cares this exact information.
  • If we publish a new major release, we have introduced a backwards-incompatible change and both Client and Server implementation need to be aware of this situation.

What I wanted to say with this enumeration is that the only important piece of information inside the version for the Client and Server, is the major number. Therefore, I propose to change the Tus-Resumable header to only include the major part of the version, such as 1.0.0 or 2.0.0. At the moment, this does not introduce a breaking change as we only released 1.0.0. Alongside with this, the Tus-Version header should only list the major versions supported by the Server.

This also follows the advice Mark Nottingham gave in his blog post (https://www.mnot.net/blog/2012/12/04/api-evolution):

Keep Compatible Changes Out of Names

I recommend you read to it. It's a great piece in my mind.

To summarize the advantages:

  • Eliminate possible negotiation step in most situations
  • Simpler Server and Client implementations due to simpler versioning rules
  • Future-proof implementations which are compatible to newer version without making changes.

In the end, I am looking forward to hearing some feedback (@kvz @bhstahl @vayam).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions