Description
With the new Contracts feature, users want to be able to manage the set of contracts they have in their graph within their codebase. This fits in-line with the modern practice of managing configuration in code and using tools like Terraform. Users will be able to author (and create / update) contract configuration in the UI, but we expect the majority of users will want to keep contract configuration in a codebase and manage updates to their configuration in that codebase.
This issue is meant to outline the questions we need to answer in deciding on the scope of rover CLI changes, and is not meant to be a source of truth, but rather a home of conversation. The result of this issue should be a set of commands and a DSL that we will scope and build within rover over the next few weeks.
User stories and scale
We can expect users may have anywhere from one to dozens of contracts within their graph. The following user stories are a brief sketch of what users should be able to do using rover
- As a contract maintainer, I want to create one or more contracts in my graph via a CI process, upon merging to my
main branch in order to track changes to my contract in my codebase.
- As a contract maintainer, I want to update existing contracts in my graph via a CI process, upon merging to my
main branch
- As a contract maintainer, I want to create or update existing contracts in my graph manually using the CLI and have feedback before I take an action as to what it will do and confirmation that it has happened
- As a consumer, I want to be able to pull schemas for existing contracts in order to power local development workflows and other developer tools
Some ideas of management commands
We could define a contract noun. That might look something like this:
rover contract provision engine@ios --config ~/config.yaml
We could allow contract management at the graph level of the hierarchy. That might look something like this:
rover graph manage-contracts ~/contract-config-directory/
or, the single config at a time version:
rover graph manage-contract ~/contract-1.yaml
What does the DSL for Contract Configuration look like?
Currently, we are thinking this will be a YAML file for readability and better diffs in git. We expect that users will rarely author contract configurations by hand but will likely edit them by hand. We expect authorship to be an experience that is mostly UI-driven. A rough sketch of how this could look:
---
target-variant: prod-public
source-variant: production
filter:
includes:
- public
excludes:
- internal
Questions
What should the ref look like for a contract?
Because contracts will create defined variants (with some limitations), we could continue to use the @ symbol as a separator.
Should we have separate commands for creating and updating contract configurations?
Since users are using rover for automation, it would be most convenient that the command to create & update are the same. This would allow users to add one command that they do not need to change for both creating & updating the contract, much how "push" works
What should the hierarchy and the verb / noun structure look like?
If we think that we'll add much more surface area beneath contracts, then we should consider having a dedicated contract noun. If we think that the surface area will not grow much over time, it will probably be over-kill to have a dedicated noun. If we want a contract to feel like a normal variant, we should consider reusing the existing commands around variants.
Should we allow users to update multiple contracts at once?
We could go either way on this one. It would be convenient to not have to add a command but instead just add a file to a directory to create another contract. If this would be a large increase in scope, then we should start without it.
How should contract names and variants work side by side?
Contracts will be normal variants, with some exceptions.
- Users cannot publish a schema directly to a contract.
- Contract variants do not have subgraphs
- Contract variants have a "source" variant from which they are updated, upon publishing and applying filter rules
As such, you should imagine that graph fetch and graph check could continue to work for contracts, for instance.
Description
With the new Contracts feature, users want to be able to manage the set of contracts they have in their graph within their codebase. This fits in-line with the modern practice of managing configuration in code and using tools like Terraform. Users will be able to author (and create / update) contract configuration in the UI, but we expect the majority of users will want to keep contract configuration in a codebase and manage updates to their configuration in that codebase.
This issue is meant to outline the questions we need to answer in deciding on the scope of
roverCLI changes, and is not meant to be a source of truth, but rather a home of conversation. The result of this issue should be a set of commands and a DSL that we will scope and build withinroverover the next few weeks.User stories and scale
We can expect users may have anywhere from one to dozens of contracts within their graph. The following user stories are a brief sketch of what users should be able to do using
rovermainbranch in order to track changes to my contract in my codebase.mainbranchSome ideas of management commands
We could define a
contractnoun. That might look something like this:rover contract provision engine@ios --config ~/config.yamlWe could allow contract management at the
graphlevel of the hierarchy. That might look something like this:rover graph manage-contracts ~/contract-config-directory/or, the single config at a time version:
rover graph manage-contract ~/contract-1.yamlWhat does the DSL for Contract Configuration look like?
Currently, we are thinking this will be a YAML file for readability and better diffs in git. We expect that users will rarely author contract configurations by hand but will likely edit them by hand. We expect authorship to be an experience that is mostly UI-driven. A rough sketch of how this could look:
Questions
What should the ref look like for a contract?
Because contracts will create defined variants (with some limitations), we could continue to use the
@symbol as a separator.Should we have separate commands for creating and updating contract configurations?
Since users are using
roverfor automation, it would be most convenient that the command to create & update are the same. This would allow users to add one command that they do not need to change for both creating & updating the contract, much how "push" worksWhat should the hierarchy and the verb / noun structure look like?
If we think that we'll add much more surface area beneath contracts, then we should consider having a dedicated
contractnoun. If we think that the surface area will not grow much over time, it will probably be over-kill to have a dedicated noun. If we want a contract to feel like a normal variant, we should consider reusing the existing commands around variants.Should we allow users to update multiple contracts at once?
We could go either way on this one. It would be convenient to not have to add a command but instead just add a file to a directory to create another contract. If this would be a large increase in scope, then we should start without it.
How should contract names and variants work side by side?
Contracts will be normal variants, with some exceptions.
As such, you should imagine that
graph fetchandgraph checkcould continue to work for contracts, for instance.