CreateOrUpdateLabels* becomes CreateLabels* #64
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Our dependency resolution algorithm prefers to select commits by the latest creation date, but that yields non-sensical results if we allow labels to get updated to point to older commits (which the current API permits).
For example, it is currently possible to use CreateOrUpdateLabels to construct a label history like [C1, C2, C1]. Semantically C1 should be the "latest" commit, but since it has a timestamp older than C2, our dependency resolution algorithm would prefer C2.
To avoid this scenario, we should not expose an endpoint to explicitly update the commit a label is pointing to. Instead, the only way to update a label is to use UploadService. This allows users to push the content they want to push (which can be identical content to a previous commit) and we can mint a new commit for them with a current created_at timestamp. In other words, the commit history from the example above would be [C1, C2, C3] where the content of C3 is identical to the content of C1.
The alternative to this is to keep the current API but document it as being an error to attempt to update a label to point to a commit with a created_at timestamp that is earlier than the existing commit the label points to. This alternative is implemented here: #66