-
Notifications
You must be signed in to change notification settings - Fork 39
Add GOALS.md, revise contribution process, freshen up to use arewesafetycriticalyet.org #149
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
Changes from all commits
8c6f8bb
3b88428
dcaa1ef
82c82f5
e2dd57b
d778ac4
013d023
4597fff
44b678e
bb013e7
d8156f1
41dece1
6df268a
b44809c
90031a7
98cf4eb
834922a
ceb59f8
fe0ec65
c19f7f8
fd6cd37
7f24df3
20dafce
a8ae5eb
2ab8d72
b308aad
987fe03
f916049
f2aa7e2
ec2261d
bcf590a
4a72358
c58f9a1
79a6f82
9565f40
241a754
fbd3119
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,7 +1,122 @@ | ||||||||||||||||||||||||||||||||||||||||
| # Contributing to a Rust Foundation Project | ||||||||||||||||||||||||||||||||||||||||
| # Contributing to the coding guidelines | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Thank you for your interest in contributing to this Rust Foundation project. | ||||||||||||||||||||||||||||||||||||||||
| We are happy and excited to review and accept your pull requests. | ||||||||||||||||||||||||||||||||||||||||
| ## Table of Contents | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| - [Contributing to the coding guidelines](#contributing-to-the-coding-guidelines) | ||||||||||||||||||||||||||||||||||||||||
| - [Table of Contents](#table-of-contents) | ||||||||||||||||||||||||||||||||||||||||
| - [Contribution Workflow](#contribution-workflow) | ||||||||||||||||||||||||||||||||||||||||
| - [Note on Chapter Layout](#note-on-chapter-layout) | ||||||||||||||||||||||||||||||||||||||||
| - [0) Bring up the idea for discussion](#0-bring-up-the-idea-for-discussion) | ||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be helpful to also include the "optional" marker here. Can be done in a follow-up. |
||||||||||||||||||||||||||||||||||||||||
| - [1) Submit coding guideline issue](#1-submit-coding-guideline-issue) | ||||||||||||||||||||||||||||||||||||||||
| - [1.1) Finding the FLS ID](#11-finding-the-fls-id) | ||||||||||||||||||||||||||||||||||||||||
| - [2) Create a Draft with a Member](#2-create-a-draft-with-a-member) | ||||||||||||||||||||||||||||||||||||||||
| - [3) A Pull Request is generated](#3-a-pull-request-is-generated) | ||||||||||||||||||||||||||||||||||||||||
| - [4) Iterate on Feedback](#4-iterate-on-feedback) | ||||||||||||||||||||||||||||||||||||||||
| - [4.1) Apply changes to the Guideline's Issue](#41-apply-changes-to-the-guidelines-issue) | ||||||||||||||||||||||||||||||||||||||||
| - [4.2) Re-generate the Pull Request](#42-re-generate-the-pull-request) | ||||||||||||||||||||||||||||||||||||||||
| - [5) Your Guideline gets merged](#5-your-guideline-gets-merged) | ||||||||||||||||||||||||||||||||||||||||
| - [You just contributed a coding guideline!](#you-just-contributed-a-coding-guideline) | ||||||||||||||||||||||||||||||||||||||||
| - [Writing a guideline locally (less typical, not recommended)](#writing-a-guideline-locally-less-typical-not-recommended) | ||||||||||||||||||||||||||||||||||||||||
| - [Guideline template](#guideline-template) | ||||||||||||||||||||||||||||||||||||||||
| - [Before You Begin Contributing](#before-you-begin-contributing) | ||||||||||||||||||||||||||||||||||||||||
| - [Licenses](#licenses) | ||||||||||||||||||||||||||||||||||||||||
| - [Code of Conduct](#code-of-conduct) | ||||||||||||||||||||||||||||||||||||||||
| - [Contribution Process](#contribution-process) | ||||||||||||||||||||||||||||||||||||||||
| - [Issues](#issues) | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ## Contribution Workflow | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Here's a diagram of the overall process: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ```mermaid | ||||||||||||||||||||||||||||||||||||||||
| flowchart TD | ||||||||||||||||||||||||||||||||||||||||
| Start(["Start"]) --> Idea["Coding Guideline Idea"] | ||||||||||||||||||||||||||||||||||||||||
| Idea --> Zulip[/"(Optional)<br>0: Contributor brings <br> to discuss on Zulip"/] | ||||||||||||||||||||||||||||||||||||||||
| Zulip --> CreateIssue{{"1: Contributor creates <br> issue"}} | ||||||||||||||||||||||||||||||||||||||||
| CreateIssue --> Issue["Coding Guideline Issue"] | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| %% short local loops (no long edges) | ||||||||||||||||||||||||||||||||||||||||
| S2{{"2: Review started <br> by subcommittee <br> member in <= 14 days <br><br> Contributor updates accordingly"}} --> Issue | ||||||||||||||||||||||||||||||||||||||||
| Issue --> S2 | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Issue --> S3{{"3: Subcommitte member <br> assigns label<br>to generate PR"}} --> PR["Coding Guideline<br>Pull Request"] | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| S4{{"4: PR review started <br> by subcommittee member <br> in <= 14 days <br><br> Contributor discusses on PR"}} --> PR | ||||||||||||||||||||||||||||||||||||||||
| PR --> S4 | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| PR --> S5{{"5: Contributor applies <br> feedback to issue"}} --> Issue | ||||||||||||||||||||||||||||||||||||||||
| Issue --> S6{{"6: Subcommittee member <br> confirms changes;<br> regenerates PR"}} --> PR | ||||||||||||||||||||||||||||||||||||||||
| PR --> S7{{"7: Subcommittee member <br> approves & queues;<br>merges to main"}} --> Main[[main]] | ||||||||||||||||||||||||||||||||||||||||
| Main --> End(["8: End"]) | ||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ### Note on Chapter Layout | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| The Safety Critical Rust Coding guidelines has the same chapter layout as the [Ferrocene Language Specification](https://spec.ferrocene.dev/) (FLS). If you would like to contribute a new guideline, find a section from the FLS that interests you, then write a guideline in the corresponding chapter of these coding guidelines. | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ### 0) (Optional) Bring the idea up for discussion | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Have an idea for a coding guideline? Want to discuss it? | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| If you want to discuss the feasibility of a guideline or discuss it with others to ensure it's not too similar an existing guideline, drop by the [Safety-Critical Rust Consortium's Zulip stream](https://rust-lang.zulipchat.com/#narrow/channel/445688-safety-critical-consortium) and open a new topic. | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ### 1) Submit coding guideline issue | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| To add a new coding guideline, open a [coding guideline issue](https://github.com/rustfoundation/safety-critical-rust-coding-guidelines/issues/new?template=CODING-GUIDELINE.yml). | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| #### 1.1) Finding the FLS ID | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Note that the FLS ID should be filled according to the FLS paragraph ID for which the guideline is covering. One way to go about finding this is to inspect the page using your web browser. You'll be looking for something like: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ```html | ||||||||||||||||||||||||||||||||||||||||
| <p><span class="spec-paragraph-id" id="fls_4rhjpdu4zfqj">4.1:1</span> | ||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| You would then pull `fls_4rhjpdu4zfqj` to place in the FLS ID field. | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+67
to
+76
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Probably this step should go before the open a new issue step
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@plaindocs the comment here is a separate suggestion, right? (or more like, a topic to discuss) I think that's the case, but I'd rather ask to be sure :)
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeap, it's outside the suggestion block. But you need the ID to to open the issue we're telling you to do in the previous step. |
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ### 2) Create a Draft with a Member | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| A member of the Coding Guidelines Subcommittee should get you a first review with some feedback within 14 days of submission. You'll work with one or more members to flesh out the concept and ensure the guideline is well prepared. | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ### 3) A Pull Request is generated | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Once an issue has been well-developed enough, a subcommittee member will mark the issue with the label `sign-off: create pr from issue` to generate a pull request. You will see a GitHub Workflow trigger and a pull request will be automatically created. | ||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might want to add some points in the future what "well-developed" means. |
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ### 4) Iterate on Feedback | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| The generated Pull Request may attract additional feedback or simply be an easier place to suggest targeted edits. | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| As the contributor of the coding guideline and opener of the issue, you'll respond to comments, discuss, all the normal things on the pull request. | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| #### 4.1) Apply changes to the Guideline's Issue | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| If you agree with the suggested changes, then rather than making changes on the opened pull request, you will return to the original issue you opened via the coding guideline issue template, and make the updates there. | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| #### 4.2) Re-generate the Pull Request | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| When you have completed all feedback given to you, ping one of the subcommittee members. They will then remove and affix the label `sign-off: create pr from issue` to push the changes made in the issue to the already opened pull request. | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+92
to
+98
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this really what we want? Surely it's better to just iterate on the pull request?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit torn, frankly. For drive-by or infrequent contributors, asking them to learn ReStructured Text and edit that directly on the PR is a little rough. My thought process is that for those infrequent contributors, they are probably more familiar with Markdown and could be more comfortable with submitting that way again via the issue and letting the conversion happen for them to ReStructured Text.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's the hell docs folks have been living in for years, succinctly put :-D. I think editing rst is less of a big deal than creating it from scratch, especially if the edits are not super structural. I think as a drive by contributor if you suggested that workflow to me, I'd be outta here. But maybe that's just me.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It is a bit of back-and-forth that could be annoying to have to go back to the issue. That's possible. Tricky thing at that point is the branch was opened on this, the main repo, rather than on a contributor's fork. That puts a wrinkle in the whole process. 🤔
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oooh. That's a terrible workflow. (sorry)
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And presumably we can't open a branch on their fork automatically. 🤔
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think once the issue has been converted to a PR, there's no looking back. We should then continue working on the PR and maybe even close the issue (not sure on that one, though). |
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ### 5) Your Guideline gets merged | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Once the coding guideline contents have passed review, a subcommittee member will approve the pull request, and put it on the merge queue to be merged. | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ### You just contributed a coding guideline! | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| That's it! | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ## Writing a guideline locally (less typical, not recommended) | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| While it is possible to create guidelines locally and open pull requests yourself, we encourage contributors to make use of the process described above since it handled some of the fiddly details for you as a guideline writer. | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Generally speaking, pull requests for guidelines which do not follow the issue to pull request workflow described above will be closed with a recommendation to follow the workflow. | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+109
to
+113
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we don't want people to do this it might be better not to even mention it here?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here again, I'm torn. The issue => PR pipeline works like, 90% of the time, but as @felix91gr found, there are still some rough edges. I can imagine cases where that may be the only feasible path unless / until the issue => PR pipeline works for nearly all Markdown => RST conversion.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For sure, but I would tend to say that this doesn't really help. If you need to create it locally do that. But most folks won't and shouldn't, so we don't need to paragraphs of text to say that (unless we find ourselves inundated with PR....) You could add a single line in step one open issue saying if (and only if) you have formatting that doesn't work, open a PR locally... |
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ### Guideline template | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| We have a script `./generate_guideline_templates.py` which assumes you're using `uv` that can be run to generate the template for a guideline with properly randomized IDs. | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| You can the copy and paste this guideline from the command line into the correct chapter. | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+115
to
+119
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't really fit into the recommended flow, so I suggest we delete it.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I get it. See my comment here. We're still not 100% compatible Markdown => RST and this could give rise to instances where we want to allow this to be done. Perhaps I should put a bit of text to that effect in this spot to clarify under what circumstances that'd be fine. What do you think @plaindocs, @felix91gr? |
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| ## Before You Begin Contributing | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Goals | ||
|
|
||
| ## Elevator pitch | ||
|
|
||
| We will make Rust coding guidelines available within this repository. The coding guidelines will additionally be deployed to an accessible location on the internet. These coding guideliens will comply with relevant standards for various safety-critical industries such as: IEC 61508, ISO 26262, and DO 178. | ||
|
|
||
| ## Detailed | ||
|
|
||
| These coding guidelines will be a set of rules in the form of `do` / `do not do`, with examples covering all "general" aspects of the Rust programming language, e.g. enums, structs, traits, and so on. We will use the [FLS](https://rust-lang.github.io/fls/index.html) as a means to ensure we have a reasonable coverage of the language. | ||
|
|
||
| There will be an addendum which covers how various safety standards like ISO 26262 map onto the coding guidelines. | ||
|
|
||
| ## Criteria | ||
|
|
||
| * We produce coding guidelines that make a "best effort" attempt at cataloging common pieces (e.g. functions, arithmetic, unsafe) of the Rust programming language and how they fit into a safety-critical project | ||
| * We will use [MISRA Compliance: 2020](https://misra.org.uk/app/uploads/2021/06/MISRA-Compliance-2020.pdf) for categorization purposes: Mandatory, Required, Advisory, Disapplied. See section 5 of MISRA Compliance: 2020 for more details. | ||
| * We include a rationale with links to parts of the Rust Project and wider Rust community for guidance | ||
| * We will include linkage where appropriate to to various standards, e.g. CERT C, MISRA C, DO 178, ISO 26262 | ||
| * We will include practical recommendations on how to use this piece of the language using compliant and non-compliant examples | ||
| * We will develop an addendum matrix to 1. clarify which safety standards are supported 2. lower burden of users | ||
| * We will begin with DO 178 and ISO 26262 | ||
| * We will begin at either the **chapter** level or the **subsection** level for now, and may expand the granularity of the matrix's mapping later | ||
| * We will release the coding guidelines tagged with the versions of stable Rust that they support (e.g. `1.42`) | ||
| * We will find or create Clippy lints which will cover decidable guidelines | ||
|
|
||
| ### Criteria obtained by discussion with Tooling Subcommittee | ||
|
|
||
| * We will affix a label for each guideline, which describes whether said guideline is decidable or not (in the [theory of computation sense](https://en.wikipedia.org/wiki/Decidability_(logic))) | ||
| * We will include for each guideline a minimum of one compliant and one non-compliant example of code, to help illustrate its exact meaning and context. | ||
| * We will consider only the language reference / spec, not the tooling availability when writing the coding guidelines | ||
| * We aim to produce evidence-based guidelines, with statistics around human error when programming Rust, to support: | ||
| 1. What guidelines are written, and | ||
| 2. Why a specific suggestion was made | ||
| * We will produce the guidelines and a hash of their contents in a machine readable and consistent format, to make consumption simpler for tool vendors. These artifacts are: | ||
| * a `needs.json` containing the contents of the coding guidelines | ||
| * a `guidelines-ids.json` which has hashes of the guidelines' contents, which can be used to check against (and break) a tool vendor's build, until an audit is performed | ||
|
|
||
| # Explicit non-goals | ||
|
|
||
| * For the initial version to have complete coverage of the Rust programming language | ||
| * "Something" shipped to alleviate pressure at organizations is better than "nothing is available" | ||
| * An accepted means of delivering partially complete coding guidelines by IEC 61508 and other | ||
| similar safety standards is to subset the language. | ||
| * Language subsetting as defined in IEC 61508 and ISO 26262 may be used to prevent the usage | ||
| of certain language constructs which are not suitable for use in safety-critical systems. | ||
| * The same mechanism can be used to subset out portions of the Rust programming language for | ||
| which we do not yet have a sufficient degree of coverage via the coding guidelines. | ||
| * For a more detailed treatment, please see IEC 61508:2010-7, Annex C: "C.2.6.2 Coding standards" | ||
| for a breakdown in a table and "C.4.2 Language subsets" for rationale. | ||
| * A commented version of IEC 61508 is available [here](https://share.ansi.org/Shared%20Documents/News%20and%20Publications/Other%20Documents/IEC%2061508%20Commented%20Version.pdf) from ANSI. | ||
| * For any version to be conflict-free with various members' or their organizations' viewpoints | ||
| * Members and their organizations may take different stances on how The Rust Programming Language's constructs should be viewed and approached. This is **okay and expected**. | ||
| * We'd like to ship something that we can obtain broad consensus on. | ||
| * Worst case scenario: there may be a section here or there which a user may need to adjust in an internal version, which would then be downstreamed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think GH handles TOC automatically now in the README, so I think we can delete this whole section and the maintenance burden?
From main: