Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template for design docs #601

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

brunoapimentel
Copy link
Contributor

@brunoapimentel brunoapimentel commented Aug 15, 2024

This PR aims to stablish a base template from which all design docs will be derived from. Currently, I'm keeping all the commits so the reviewers can go over the changes as the discussion progresses. Before this is changed to "ready to review", all examples will be dropped, and the commits remade.

Allowing the middle of the doc to be composed of free-form sections
greatly helps with reducing the nesting of titles.

Signed-off-by: Bruno Pimentel <[email protected]>
Copy link
Collaborator

@a-ovchinnikov a-ovchinnikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the mostly free-form approach proposed here.


## [Free-form sections]

## Decision
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about moving "Decision" up, right after "Overview"? If the doc is to be used as a quick reference it would be nice to have it closer to the problem statement. Also it looks like not every design requires a decision, "Implement as described here" seems to be implied by the type of the document, maybe it should be marked as [Optional]? Or maybe even made a part of free-form sections when there are several possible strategies? Overall it looks like "Context" will ultimately dictate the structure of everything that follows.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also it looks like not every design requires a decision, "Implement as described here" seems to be implied by the type of the document, maybe it should be marked as [Optional]?

Agreed. I would probably go as far as omitting the Decision section completely for now. Remember, we're dealing with design docs for package managers, so the decision inherently is to "implement support for one". We can add it optional in a follow-up patch, we may get clearer picture and overall better feeling of this once we start actively using the template.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can mark Decision as optional. I agree it feels very out of place for initial package manage designs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the "Decision" section here should be where we describe what we're going to implement given the "Context" described above. For a design, I would expect it to at a minimum include what is in-scope and out-of-scope.

We might just need a different word to describe it.

docs/designs/template-000.md Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filenames in the draft imply naming scheme with shared counter. This should probably be documented somewhere.


## Overview

## Context
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm struggling to justify presence of both Overview and Context. I think having just the former is enough for any necessary background information serving in fact as context for the rest of the document.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Overview" should serve the same function as an abstract in a paper: to give a brief summary of the main body of text. It is necessary because it provides means to skip or postpone reading of the entire doc. I think naming could be discussed, but having a TL;DR section is important.

Copy link
Member

@eskultety eskultety Aug 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it should be called abstract, because I think the definition of abstract is much stricter than that of an overview, what we're doing with these design docs wrt/ pkg manager background is also an overview.
The question still remains, should an abstract be mandatory for the original design docs? I can imagine them being mandatory for the obsolete/update docs, but not for the main document, the title kinda already hints at what it's about --> implemeting new backend.

I can be persuaded otherwise though as I'm a big fan of consistency, so I can see value in having as many fields as possible being mandatory...within reasonable limits, i.e. some fields don't IMO make sense to be mandatory always.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mandatory fields mean that these fields are applicable to all designs, determining a set of universally applicable ones would require significant effort to analyze all existing designs and distill out all common parts. There is also a big chance of introducing too many unnecessary fields. I've seen mandatory templates with more than half fields ending up being marked as "Non-applicable" which created lots of visual noise and made it easy to miss something important. In some cases it was more productive not to follow the template at all. I don't think it is a good idea to set rules which will not be followed (for whatever reason). I am also concerned with extra maintenance and cognitive load which mandatory fields introduce so would suggest keeping them to a reasonable minimum.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@a-ovchinnikov I agree with that reasoning so as long as we don't end up with all fields optional and their intent is clearly defined, we're good.


## Context

## Description
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description sounds quite vague to me when it comes to designs; Specification sounds more appropriate for the cause (also follows PEP doc nomenclature).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about "Design"? This is a design doc after all.

Copy link
Contributor Author

@brunoapimentel brunoapimentel Aug 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dropped this section in the following commit. The reason was that I felt it didn't add any value, but added one more level of nesting, which looks horrible IMO (compare the ruby design example in this commit and in the following one).


## [Free-form sections]

## Decision
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also it looks like not every design requires a decision, "Implement as described here" seems to be implied by the type of the document, maybe it should be marked as [Optional]?

Agreed. I would probably go as far as omitting the Decision section completely for now. Remember, we're dealing with design docs for package managers, so the decision inherently is to "implement support for one". We can add it optional in a follow-up patch, we may get clearer picture and overall better feeling of this once we start actively using the template.

docs/designs/template-000.md Outdated Show resolved Hide resolved
@@ -0,0 +1,9 @@
# Title
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In your example it is not clear to me what the actual file name should be, IOW the ruby example is named rubygems-001.md, but the actual title is "Initial Design for the Rubygems Package Manager", so we need to provide clear guideline on how the title should correlate with the actual file name in this directory (it's okay if we end up with a different template in a different docs directory serving a different purpose).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this was another stab I took to see how it would look like. I will definitely improve and write guidelines for it.

docs/designs/rubygems-001.md Outdated Show resolved Hide resolved
@@ -0,0 +1,9 @@
# Title

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the table I mentioned in the ruby example I'm missing a fairly crucial part for the template and those are fields like Updates/Updated by, Obsoletes/Obsoleted by as part of such table which will allow us to directly link related documents in a very visible way. Such fields of course should be marked as optional because you don't have an update doc until you really have one.
Continuining with the thought, we should also provide a guidance in this template on how update/obsolete works, IOW not only we'd link the update/obsolete doc, but if only a portion of the original doc is updated/obsoleted (i.e. not the whole doc), then the relevant sections/subsections should be marked e.g. with [UPDATED/OBSOLETED + link] for better visibility to the reader on which parts they should focus on. Naturally the suggested Last updated date field (recommended in another review comment) would be modified with each such modification to the original document, IOW we'd only permit metadata changes to the original doc, but not contents to keep the doc effectively immutable.

Something along ^^^^these lines should be mentioned in the template guide.

Copy link
Member

@eskultety eskultety Aug 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for a reference, when it comes to the docs header we can get inspired with probably the origins of ADR = RFCs --> https://www.rfc-editor.org/rfc/rfc5143, https://www.rfc-editor.org/rfc/rfc7322 just to name a few tiny examples dealing with format of the RFCs.

Other notable mention: https://www.rfc-editor.org/rfc/rfc7841#section-3

Comment on lines 527 to 547
### Scoping of the initial implementation
- design high-level code structure into multiple modules
- create a test repository that contains all the relevant use cases
- define models for RubyGems as the new package manager
- parse all gems from `Gemfile.lock`
- implement metadata parsing for the "main package"
- download all gems from rubygems.org
- download all gems from Git repositories
- validate path dependencies are relative to the project root
- inject the Bundler configuration needed for the offline install
- generate PURLs for all dependencies
- add integration and e2e tests
- add documentation

### Potential follow-up features
- implement checksum parsing and validation when prefetching from the registry
- downloading the Bundler version specified in the `Gemfile.lock`
- support for pre-compiled binaries (platforms other than `ruby`)
- Gemfile.lock checksum validation (blocked by pending official support)
- reporting dev dependencies
- proper support for plugins
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a summary of the implementation specification and as such is IMO redundant as it provides very little information compared to the specification section.

Copy link
Contributor Author

@brunoapimentel brunoapimentel Aug 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the summary is really... just a summary. It's a way to help the reader bring to mind all the info that was more thoroughly explained before. It can be optional as well, as I don't see it being useful for smaller docs.

There is also another benefit for this specific section here: clear separation of what's in scope and what's not. But maybe scoping doesn't belong to the design doc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also another benefit for this specific section here: clear separation of what's in scope and what's not. But maybe scoping doesn't belong to the design doc.

arguably it does, because a given pkg manager is a massive ecosystem with loads of variables and corner cases, so the design doc needs to outline what is being done and what's not, it just needs an appropriate format. I'd refrain from mentioning follow-ups as those IMO don't belong to a formal docs, one's imagination can be very wild when it comes to follow-ups so let the future decide what the follows are going to be. For the rest, an optional summary section would IMO be acceptable, worst case scenario, we'll decide it was wrong and drop it and propose a refined version of the template....RFC did the same...not once

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The follow-ups mentioned here are either things that were mentioned at some point in the design, but were marked as out-of-scope since we want to keep the implementation very basic. They are all features that have been similarly implemented in other package managers.

This is part of the summary, as I see it: "the design touches all these features, this is the subset we want to implement, and this is the subset we don't want to for the first version". Maybe we can just call the section as "out of the initial scope".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you never know if any of those follow-ups will ever make it to see the dawn of day, so for a technical doc we really only need to state what we're doing right now. Anything else is good for a presentation, but not for a formal design doc IMO, so please omit any follow-ups and not let anyone get hooked up on the possibility of implementing particular functionality. Then I'd agree that the summary of DOs could be the Decision.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about simply stating those as "out of scope"? I did that in the newer commits I pushed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like there's a benefit to it... it clearly states, in a summarized form, what the initial deliverable is.

Comment on lines 343 to 367
#### Out of scope

##### Plugins
Bundler has support for using [plugins](https://bundler.io/guides/bundler_plugins.html), which allows users to extend
Bundler's functionality in any way that they seem fit. Since this can open the possibility for security issues, plugins
will not be supported by Cachi2.

Since we're not proposing the direct usage of Bundler to fetch the dependencies, no other actions are needed in the
prefetch phase, existing plugin definitions will be ignored.

##### Pre-compiled binaries
For the initial implementation, we're aiming to provide support only for plain Ruby gems (which are idenfied as `ruby`
in the `PLATFORMS` section of the `Gemfile.lock`). Platforms that relate to specific architectures will contain
binaries that were pre-compiled for that architecture (see [Platforms](#platforms)).

The URL schema in the default rubygems registry seems to follow this format:

```ruby
# Plain Ruby Gem
"https://rubygems.org/gems/#{name}-#{version}.gem"

# Platform-specific Gem
"https://rubygems.org/gems/#{name}-#{version}-#{platform}.gem"
```

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this scoping you have here is actually the decision, because we're purposefully limiting the implementation, so either it stays part of the specification or we move it to the decision (I'm ambivalent on this at the moment based on a single example).

Comment on lines 26 to 39
### I. Ruby ecosystem overview

#### Development prerequisites
In order to execute the commands in the examples below, make sure you have the following packages installed in your
environment:

```bash
sudo dnf install rubygems rubygems-bundler
```

Or use the official Ruby image from Docker hub:
```bash
podman run --rm -it docker.io/library/ruby:3.3.3 bash
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole Ruby ecosystem overview (up to cachi2 impl.) is IMO the actual overview you want to have in this design doc instead of what it currently reads.

@slimreaper35 slimreaper35 mentioned this pull request Aug 19, 2024
4 tasks
- dropped the author/date table
- added updated by/obsoleted by examples
- renamed 'Overview' to 'Introduction'
- marked 'Context' as optional
- added a description to each section

Signed-off-by: Bruno Pimentel <[email protected]>
@@ -0,0 +1,23 @@
# Title

Updated by: [0000-this-doc-does-not-exist]()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to have back links too? I.e. "Updates: 9999-this-doc-does-not-exist"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we do.

@@ -0,0 +1,206 @@
# Go 1.21 toolchains

## Overview
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Overview/Introduction/?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I proposed the change of this section to Introducion based on what I saw from the RFC examples Erik linked. But looking at it again, I think it is even worse to convey the meaning of TL;DR we are expecting from this section.

But point taken, this is currently inconsistent.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, why not Abstract then? Ultimately, I don't care whether it's called Abstract or Introduction, but I think the content should be different, something on the lines of
"Add support for automatic Go toolchain fetching which was introduced in Go 1.21 to address the issue of frequent micro version bumps by some projects using cachi2 to build their software as well as address Go's new 'minimum required version' policy during builds."

Copy link
Contributor Author

@brunoapimentel brunoapimentel Aug 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Abstract sounds very adequate, although when I look the word up in online dictionaries, they describe it as a Summary, so that could be another option.

Copy link
Member

@eskultety eskultety left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're converging with this, maybe one more iteration :). Kudos for the inclusion of the Go sample, it's always better to have 2 different docs to compare.

@@ -0,0 +1,206 @@
# Go 1.21 toolchains

## Overview
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, why not Abstract then? Ultimately, I don't care whether it's called Abstract or Introduction, but I think the content should be different, something on the lines of
"Add support for automatic Go toolchain fetching which was introduced in Go 1.21 to address the issue of frequent micro version bumps by some projects using cachi2 to build their software as well as address Go's new 'minimum required version' policy during builds."


## Context

[What was the context for this doc? I can't think of anything important to mention here, and that's why I marked this section as optional in the template].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's because I believe what you currently have in the previous section is the context. For the intro, I think the whole thing needs to be reworded in the sense of why this document even exists which the current intro doesn't do, it just says what Go did in 1.21. It's missing though how this project is impacted requiring some changes this doc will describe.


[What was the context for this doc? I can't think of anything important to mention here, and that's why I marked this section as optional in the template].

## How it works
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is too free-form. I believe we need to standardize on this H2 heading. Also, I'm still fairly convinced that the paragraphs that follow this heading are the overview of the 1.21 changes that are relevant to the cause, it doesn't say anything about how we're going to solve it - that's good, because that will come later in Proposed solutions!

...
```

## Proposed solutions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think some standardization is needed also for ^this H2 heading, but I agree the rest of H3+ headings can be left free form and not limit the writer.

#### Disadvantages:
- potentially failing builds due to transitively incompatible (i.e. with indirect dependencies) `go` and `toolchain` versions set - but this is a user problem in general though, not cachi2's (mentioning it just in case)

## Decision
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good use of Decision!

Comment on lines +193 to +195
## Resources
- https://go.dev/doc/toolchain
- https://go.dev/ref/mod#environment-variables
Copy link
Member

@eskultety eskultety Aug 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know I wrote the content, in retrospec ^this should have somehow been part of References, no need for another section, admittedly I was trying to be unnecessarily formal, just an FYI.

- https://go.dev/doc/toolchain
- https://go.dev/ref/mod#environment-variables

## Apendix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly here, this should have been part of the broader context sections, or overview or whatever we end up calling it.


Explains the context outside the mere technical aspects of the design that existed when it was written. It must make clear what other influences where at play that affected the decisions that were taken. In case there is nothing relevant to mention about the context, this section can be skipped.

## [Free-form sections]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I responded to the Go sample, I don't think this main H2 section should be free-form, its subsections sure can be.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's concentrate this discussion in this thread.


## Decision/Outcome [pick one]

Document here what decision was made, or what outcome is expected out of the design that was created. In case several options were presented in the design, this section must clearly state which one was chosen and the reasons for it. In case of a new package manager design, or a completely new feature to an existing package manager, this section can only include a brief summary of what the implementation will cover, since it is implied that the decision.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Is the description of the intended content for these sections being purposefully done so that it can be rendered online? I mean, the only thing I expect from a template is to be copy-pasted, renamed, filled out and proposed. So, if we make these description commentaries, people can even keep those comments in their proposed doc and that information won't be rendered, just a bit of thinking out loud.

Comment on lines +18 to +19

The actual content of the design should be placed under one or more sections that can be named freely. Note that they should be level 2 headings (H2), but each section can also be subdivided by nested headings (H3, H4, H5 or H6) if needed. Only a single level 1 heading (H1) should exist, and it is strictly reserved for the title.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced there should be 1+ H2 headings for this, the design should be covered by a single H2 section and N subsections, otherwise we'll break the structure which we're trying to standardize somewhat I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this looks good on the template, as it is more standardized, but having a large document with many subsections forced into a H2 brings a horrible result, at least IMO. As an example, check the Ruby design in this commit, and how I changed it in the following ones. For smaller docs, I believe a single H2 works perfectly.

I am not sure what's the best option here. If nobody minds the excessive nesting (and the hard limit on the H5), then let's just make it a single H2.

(I even considered a separate template for new package manager designs, although I think I still prefer to keep things simple).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with many subsections forced into a H2 brings a horrible result

We can agree that it's a matter of taste. On the other hand...

If nobody minds the excessive nesting (and the hard limit on the H5)

... if we ever need to go past H5 then I guess we need to rethink whether a given design really needs it, I don't expect that to be a regular thing, but I might be wrong here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants