Hello! I’m thinking of introducing versioning to t...
# general
Hello! I’m thinking of introducing versioning to the pants metrics json output. This will make it easier for consumers to keep up to date with changes when upgrading pants versions. I’m not sure this is the solution to the problem, bit I feel like it’s the best, to add a lint check that checks if one has changed the json format but not the version number. Is that fair? Or an integration test, maybe
What versioning are you thinking? What problem are you trying to solve? 🙂
The problem is “I, as a consumer of pants stats, don’t know how to keep track of changes to the json when upgrading pants versions”
The kind of versioning can be whatever, it’s just a way to signal upstream consumers “hey, you should check because there are changes to the json now”
Generally there are two things I want to know in terms of schema changes: 1. Have you removed anything I care about? 2. Is the absence of something a sign that there was no data, or that I was using something which produced the data which didn’t produce it 3. Is there new information I may want to consume? What specific problems are you hoping to address? :)
This specific case is the rename of a field, from
, so I guess a combination of 1 and 2
Aha, we’re making backwards incompatible changes! Ugh…
Honestly it feels like the problem here is that task names leaked into the public API without people giving much thought to that being an API, and if we’d been thinking about it we may have avoided that in some way?
I think in practice it’s okay for this to be the case, because I value the flexibility of changing task names with the usual deprecation cycle a lot more than spending 1-2 hours chasing down changes once in a while, but I’d still like to make that chasing easy, if that makes sense.
That said, it’s a good design exercise to come up with a way to make this better in a principled way
IIRC we current return the pants and stats versions as a
header - would that help solve what you’re looking to do?
🔥 1
👌 1
a graphql schema can be used to describe arbitrary json, and for metrics/reporting i think its use is extremely interesting because supporting it means we can do graphql queries against the data. i don't know what features graphql offers regarding versioning, if any.
and @gentle-wolf-58752 thanks!! i didn't know that!
👍 1
While there's nothing that prevents a GraphQL service from being versioned just like any other REST API, GraphQL takes a strong opinion on avoiding versioning by providing the tools for the continuous evolution of a GraphQL schema.
Why do most APIs version? When there's limited control over the data that's returned from an API endpoint, any change can be considered a breaking change, and breaking changes require a new version. If adding new features to an API requires a new version, then a tradeoff emerges between releasing often and having many incremental versions versus the understandability and maintainability of the API.
In contrast, GraphQL only returns the data that's explicitly requested, so new capabilities can be added via new types and new fields on those types without creating a breaking change. This has led to a common practice of always avoiding breaking changes and serving a versionless API.
the way that makes sense here is, if we can have a graphql schema against the metrics API, we can have an integration test which uses some tool to perform some graphql query (as above)