1.. _seed-0001: 2 3====================== 40001: The SEED Process 5====================== 6.. seed:: 7 :number: 1 8 :name: The SEED Process 9 :status: Accepted 10 :proposal_date: 2022-10-31 11 :cl: 116577 12 :authors: The Pigweed Team 13 :facilitator: Unassigned 14 15------- 16Summary 17------- 18SEEDs are the process through which substantial changes to Pigweed are proposed, 19reviewed, and decided by community stakeholders to collaboratively drive the 20project in a favorable direction. 21 22This document outlines the SEED process at a high level. Details about how SEEDs 23should be written and structured are described in :ref:`seed-0002`. 24 25---------- 26Motivation 27---------- 28As Pigweed and its community grow, it becomes important to ensure that the 29Pigweed team, Pigweed users, and other community stakeholders align on the 30future of the project. To date, development of Pigweed has primarily been 31driven by the core team, and community feedback has been mostly informal and 32undocumented. 33 34SEEDs are a formalized process for authoring, reviewing, and ratifying proposed 35changes to Pigweed. 36 37The SEED process has several goals. 38 39- Increase the visibility of proposed changes to Pigweed early on and allow 40 interested parties to engage in their design. 41 42- Maintain a public record of design decisions rendered during Pigweed's 43 development and the rationales behind them. 44 45- Ensure consistent API design across Pigweed modules through a formal team-wide 46 review process. 47 48Active SEEDs are discussed by the community through Gerrit code review comments 49as well as a SEEDs chatroom in Pigweed's Discord server. Decisions are 50ultimately rendered by a review committee of Pigweed team members. 51 52------------------------ 53When is a SEED required? 54------------------------ 55SEEDs should be written by any developer wishing to make a "substantial" change 56to Pigweed. Whether or not a change is considered "substantial" varies depending 57on what parts of Pigweed it touches and may change over time as the project 58evolves. Some general guidelines are established below. 59 60Examples of changes considered "substantial" include, but are not limited to: 61 62- Adding a new top-level module. 63 64- Modifying a widely-used public API. 65 66- A breaking update to typical Pigweed user workflows (bootstrap, build setup, 67 ``pw`` commands, etc.). 68 69- Changing any data interchange or storage protocol or format (e.g. transport 70 protocols, flash layout), unless the change is small and backwards compatible 71 (e.g. adding a field to an exchanged Protobuf message). 72 73- Changes to Pigweed's code policy, style guides, or other project-level 74 guidelines. 75 76- Whenever a Pigweed team member asks you to write a SEED. 77 78Conversely, the following changes would likely not require a SEED: 79 80- Fixing typos. 81 82- Refactoring internal module code without public API changes. 83 84- Adding minor parallel operations to existing APIs (e.g. 85 ``Read(ConstByteSpan)`` vs ``Read(const byte*, size_t)``). 86 87If you're unsure whether a change you wish to make requires a SEED, it's worth 88asking the Pigweed team in our Discord server prior to writing any code. 89 90------- 91Process 92------- 93Suppose you'd like to propose a new Pigweed RPC Over Smoke Signals protocol. 94 95#. If you haven't already, clone the Pigweed repository and set it up locally, 96 following the :ref:`docs-get-started-upstream` guide. 97 98#. Check out a clean Git branch off of ``main`` for your SEED. 99 100 .. code-block:: console 101 102 $ git checkout -b seed-rpc-smoke-signals 103 104#. From an activated Pigweed environment, run the command ``pw seed create`` to 105 interactively create a SEED. 106 107 This command will prompt you for a SEED number (use the default it provides 108 unless you have a specific reason not to), title, and list of authors. Using 109 these, it will generate a SEED document and add it to the build, as well as 110 automatically creating two CLs in Gerrit: one claiming your SEED number, and 111 the second being the actual CL in which your SEED will be reviewed. 112 113 .. code-block:: none 114 115 Created two CLs for SEED-5309: 116 117 - SEED-5309: Claim SEED number 118 <https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/999998> 119 120 - SEED-5309: Pigweed RPC Over Smoke Signals 121 <https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/999999> 122 123 .. warning:: 124 125 ``pw seed create`` will create and push Git commits for you. Make sure to 126 run it from a clean branch. 127 128#. Open the "Claim SEED number" CL and add GWSQ as a reviewer. Set 129 ``Pigweed-Auto-Submit`` to +1. This change will be approved promptly and 130 lock in your assigned SEED number. 131 132 .. image:: https://storage.googleapis.com/pigweed-media/seed/0001/seed-index-gerrit.png 133 134#. Fill out your proposal document, using the :ref:`SEED template<seed-0002>` as 135 a guide. 136 137 If your SEED requires additional resources such as images, place them within 138 a subdirectory named identically to your document without the ``.rst`` 139 extension. These should be listed as ``inputs`` in your SEED's GN doc group 140 target. 141 142 .. code-block:: 143 144 seed/ 145 ... 146 5309.rst 147 5309/ 148 state-diagram.svg 149 150 .. note:: 151 152 When your change is ready to merge, a Pigweed teammate will upload your 153 images to the Pigweed image CDN and ask you to delete your local images 154 and link your docs to the versions of the images that are hosted on the 155 image CDN. See :ref:`contrib-docs-website-images`. 156 157#. When you feel you have enough substantive content in your proposal to be 158 reviewed, push it up to Gerrit and switch the change from WIP to Active. 159 This will begin the open comments period. 160 161 Congrats! You are now a SEED author. 162 163#. The Pigweed team will now assign your SEED a SEED facilitator. The 164 facilitator will leave a comment on your SEED asking you to add their name 165 to the ``facilitator:`` entry in the header of your SEED. 166 167 The SEED facilitator is a member of the Pigweed team who will help move your 168 through the process. The SEED facilitator will be added as a reviewer on 169 your SEED and will be your primary point of contact on the Pigweed team. 170 171 Update the status of your SEED to ``"Open for Comments"`` and set the 172 assigned facilitator in its build target. 173 174 .. code-block:: 175 176 pw_seed("5309") { 177 changelist = 987654 178 title = "pw_rpc Over Smoke Signals" 179 status = "Open for Comments" 180 author = "Your Name" 181 facilitator = "Your Facilitator" 182 } 183 184#. Create a thread for your SEED in the ``#seed`` channel of Pigweed's 185 `Discord server <https://discord.gg/M9NSeTA>`_. 186 187#. Engage with reviewers to iterate on your proposal through its comment period. 188 189#. During the comment period, the facilitator may comment that your proposal has 190 received "Approval of Intent" and request in the SEED comments for interested 191 reviewers to identify themselves. 192 193 The SEED status should be changed to ``Intent Approved``. 194 195 At this point, initial implementation of the feature may begin landing in 196 Pigweed upstream. Any CLs prior to the SEED landing should CC both the 197 facilitator and other commenters who've indictated their interest in 198 reviewing. 199 200 All code landed during this period should be marked as experimental and 201 protected by visibility limitations. 202 203#. When a tentative decision has been reached, the facilitator will comment on 204 your proposal with a summary of the discussion and reasoning, moving it into 205 its Last Call phase (as described in the 206 :ref:`Lifecycle <seed-0001-lifecycle>` section). 207 208#. Following the conclusion of the Last Call period (one week from the start of 209 Last Call), the facilitator will sign off on the CL with a +2 vote, allowing 210 it to be submitted. Once a +2 has been given, the SEED author should update 211 the SEED index and submit the CL. 212 213 Before submitting, update your SEED's GN target to point to the local RST 214 file and to reflect its final status. 215 216 .. code-block:: 217 218 pw_seed("5309") { 219 sources = [ "5309.rst" ] 220 title = "pw_rpc Over Smoke Signals" 221 status = "Accepted" 222 author = "Your Name" 223 } 224 225--------------------------------------- 226The relationship between SEEDs and code 227--------------------------------------- 228Some common questions raised by participants in the SEED process revolve around 229how SEED proposals relate to implemented code. This section addresses several of 230those questions. 231 232When should implementation of a SEED proposal begin? 233==================================================== 234.. admonition:: TL;DR 235 236 The SEED's author can start writing code as soon as the intent of the 237 proposal is approved. 238 239Generally speaking, there are two stages of approval for the majority of SEED 240proposals. The first is approval of the *intent* of the SEED --- that is, 241stakeholders agree that it represents a problem that Pigweed should address, 242and the general outline of the solution is reasonable. 243 244Following this comes the approval of the specific details of the proposed 245solution. Depending on the nature of the SEED, this could range 246from higher-level component hierarchies and interactions down to concrete API 247design and precise implementation details. 248 249Once the intent of a SEED is approved, authors are free to begin implementing 250code for their proposal if they wish. This can serve as an additional reference 251for reviewers to aid their understanding of the proposal, and allow both the 252proposal and implementation to co-evolve throughout the review process. 253 254Code written alongside an active SEED can be reviewed and even merged into 255Pigweed, hidden behind experimental feature flags. 256 257At what point is the code related to a SEED considered usable? 258============================================================== 259.. admonition:: TL;DR 260 261 Code written for a SEED is considered experimental and unstable until the 262 SEED is fully approved. 263 264It is possible for code to be written, reviewed, and committed to Pigweed while 265its SEED is still in the review process. As these changes end up in Pigweed's 266main, it naturally raises the question of whether or not it is usable by other 267modules, or even external projects. 268 269Any code which is approved and submitted while its SEED remains active will be 270treated as experimental and hidden behind a feature flag. These flags will be 271configurable by other modules and downstream projects, allowing dependencies on 272experimental code. All experimental features are unstable and subject to 273potentially large changes at any time, so depending on them in non-experimental 274contexts is strongly discouraged. 275 276There may be rare circumstances where particularly time-sensitive code is 277required by projects with whom Pigweed works in close collaboration before a 278full SEED approval cycle can be completed. In these instances, the project may 279begin to depend on experimental code prematurely, and Pigweed will assist them 280with keeping up-to-date as it evolves. This type of usage is limited to only 281exceptional circumstances. In almost all cases, experimental code should be used 282at a project's own risk. 283 284Will approved SEEDs be updated in response to code changes? 285=========================================================== 286.. admonition:: TL;DR 287 288 Approved SEEDs will not be updated as code evolves. Use module documentation 289 as a current reference. 290 291SEED documents are intended to capture decisions made at a point in time with 292their justification. They are not living documents which reflect the current 293state of the codebase. Generally speaking, SEEDs will not be updated following 294their acceptance and will likely diverge from the actual code as time passes. 295Some SEEDs may even become entirely obsolete if the team revisited the issue and 296decided to move in a different direction, becoming purely a historical record of 297design decisions. 298 299There are exceptions when a SEED may be modified after it has been approved; 300typically, these will occur shortly after the approval if its implementer finds 301that an important detail was incorrect or missing. 302 303If a SEED/s content is obsolete or outdated, it should ideally be marked as 304such by adding a notice or warning to the top of the SEED. However, these 305indications are marked on a best-effort basis, so SEEDs should not be be used as 306the primary source of documentation for a Pigweed feature. 307 308Users should instead rely on module documentation for up-to-date 309information about the state of a Pigweed module or feature. SEEDs can be used as 310an additional resource to learn *why* something was designed the way that it is, 311but is never necessary to understand functionality or usage. 312 313-------------- 314SEED documents 315-------------- 316SEEDs are written as ReST documents integrated with the rest of Pigweed's 317documentation. They live directly within the core Pigweed repository, under a 318top-level ``seed/`` subdirectory. 319 320The structure of SEED documents themselves, their format, required sections, and 321other considerations are outlined in :ref:`seed-0002`. 322 323The first 100 SEEDs (0000-0100) are *Meta-SEEDs*. These are reserved for 324internal Pigweed usage and generally detail SEED-related processes. Unlike 325regular SEEDs, Meta-SEEDs are living documents which may be revised over time. 326 327.. _seed-0001-lifecycle: 328 329----------------------- 330The lifecycle of a SEED 331----------------------- 332A SEED proposal undergoes several phases between first being published and a 333final decision. 334 335:bdg-primary-line:`Draft` **The SEED is a work-in-progress and not yet ready 336for comments.** 337 338- The SEED exists in Gerrit as a Work-In-Progress (WIP) change. 339- Has an assigned SEED number and exists in the index. 340- Not yet ready to receive feedback. 341 342:bdg-primary-line:`Intent Approved` **The idea behind the SEED has been approved 343for further investigation.** 344 345- The SEED exists in Gerrit as a Work-In-Progress (WIP) change. 346- Has an assigned SEED number and exists in the index. 347- The main proposal is not yet fully written out, but may start receiving 348 preliminary rounds of feedback. 349 350:bdg-primary:`Open for Comments` **The SEED is soliciting feedback.** 351 352- The SEED has sufficient substance to be reviewed, as determined by its 353 author. 354- A thread for the SEED is created in Discord to promote the proposal and open 355 discussion. 356- Interested parties comment on the SEED to evaluate the proposal, raise 357 questions and concerns, and express support or opposition. 358- Back and forth discussion between the author and reviewers, resulting in 359 modifications to the document. 360- The SEED remains open for as long as necessary. Internally, Pigweed's review 361 committee will regularly meet to consider active SEEDs and determine when to 362 advance to them the next stage. 363- Open SEEDs are assigned facilitators in the core Pigweed team, who are 364 primarily responsible for engaging with the author to move the SEED through 365 its review process. 366 367:bdg-warning:`Last Call` **A tentative decision has been reached, but 368commenters may raise final objections.** 369 370- A tentative decision on the SEED has been made. The decision is issued at the 371 best judgement of the SEED's facilitator when they feel there has been 372 sufficient discussion on the tradeoffs of the proposal to do so. 373- Transition is triggered manually by its facilitator, with a comment on the 374 likely outcome of the SEED (acceptance / rejection). 375- On entering Last Call, the visibility of the SEED is widely boosted through 376 Pigweed's communication channels (Discord, mailing list, Pigweed Live, etc.) 377 to solicit any strong objections from stakeholders. 378- Typically, Last Call lasts for a set period of 7 calendar days, after which 379 the final decision is formalized. 380- If any substantial new arguments are raised during Last Call, the review 381 committee may decide to re-open the discussion, returning the SEED to a 382 commenting phase. 383 384:bdg-success:`Accepted` **The proposal is ratified and ready for 385implementation.** 386 387- The SEED is submitted into the Pigweed repository. 388- A tracking bug is created for the implementation, if applicable. 389- The SEED may no longer be modified (except minor changes such as typos). 390 Follow-up discussions on the same topic require a new SEED. 391 392:bdg-danger:`Rejected` **The proposal has been turned down.** 393 394- The SEED is submitted into the Pigweed repository to provide a permanent 395 record of the considerations made for future reference. 396- The SEED may no longer be modified. 397 398:bdg-secondary:`Deprecated` **The proposal was originally accepted and 399implemented but later removed.** 400 401- The proposal was once implemented but later undone. 402- The SEED's changelog contains justification for the deprecation. 403 404:bdg-info:`Superseded` **The proposal was originally accepted and implemented 405but significant portions were later overruled by a different SEED.** 406 407- A newer SEED proposal revisits the same topic and proposal and redesigns 408 significant parts of the original. 409- The SEED is marked as superseded with a reference to the newer proposal. 410 411:bdg-secondary-line:`On Hold` **The SEED is temporarily on pause due to other 412priorities, without a decision being made on its acceptance.** 413 414- The SEED has an assigned number, and a Gerrit CL with previous rounds of 415 feedback. The CL is switched to WIP. 416- The SEED is closed to additional feedback during the hold period. 417 418--------- 419Rationale 420--------- 421 422Document format 423=============== 424Three different documentation formats are considered for SEEDs: 425 426- **ReST:** Used for Pigweed's existing documentation, making it a natural 427 option. 428- **Google Docs:** The traditional way of writing SEED-like investigation and 429 design documents. 430- **Markdown:** Ubiquitous across open-source projects, with extensive tooling 431 available. 432 433Summary 434------- 435Based on the evaluated criteria, ReST documents provide the best overall SEED 436experience. The primary issues with ReST exist around contributor tooling, which 437may be mitigated with additional investment from the Pigweed team. 438 439The table below details the main criteria evaluated for each format, with more 440detailed explanations following. 441 442.. list-table:: 443 :widths: 55 15 15 15 444 :header-rows: 1 445 446 * - Criterion 447 - ReST 448 - Markdown 449 - Google Docs 450 * - Straightforward integration with existing docs 451 - ✅ 452 - ❌ 453 - ❌ 454 * - Indexable on `pigweed.dev <https://pigweed.dev>`_ 455 - ✅ 456 - ✅ 457 - ❌ 458 * - Auditable through source control 459 - ✅ 460 - ✅ 461 - ❌ 462 * - Archive of review comments and changes 463 - ✅ 464 - ✅ 465 - ❌ 466 * - Accessible to contributors 467 - ❌ 468 - ✅ 469 - ✅ 470 * - Extensive styling and formatting options 471 - ✅ 472 - ❌ 473 - ✅ 474 * - Easy sharing between Google and external contributors 475 - ✅ 476 - ✅ 477 - ❌ 478 479Integration 480----------- 481.. admonition:: Goal 482 483 SEED documents should seamlessly integrate with the rest of Pigweed's docs. 484 485As all of Pigweed's documentation is written using ReST, it becomes a natural 486choice for SEEDs. The use of other formats requires additional scaffolding and 487may not provide as seamless of an experience. 488 489Indexability 490------------ 491.. admonition:: Goal 492 493 Design decisions in SEEDs should be readily available for Pigweed users. 494 495`pigweed.dev <https://pigweed.dev>`_ has a search function allowing users to 496search the site for Pigweed-related keywords. As SEEDs contain design discussion 497and rationales, having them appear in these searches offers useful information 498to users. 499 500The search function is provided by Pigweed's Sphinx build, so only documents 501which exist as part of that (ReST / Markdown) are indexed. 502 503Auditability 504------------ 505.. admonition:: Goal 506 507 Changes to SEED documents should be reviewed and recorded. 508 509ReST and Markdown documents exist directly within Pigweed's source repository 510after being submitted, requiring any further changes to go through a code 511review process. 512 513Conversely, Google Docs may be edited by anyone with access, making them prone 514to unintentional modification. 515 516Archive of discussions 517---------------------- 518.. admonition:: Goal 519 520 Discussions during the review of a SEED should be well-archived for 521 future reference. 522 523ReST and Markdown documentation are submitted through Gerrit and follow the 524standard code review process. Review comments on the changes are saved in 525Gerrit and are easily revisited. Incremental updates to the SEED during the 526review process are saved as patch sets. 527 528Comments in Google Docs are more difficult to find once they are resolved, and 529document changes do not exist as clearly-defined snapshots, making the history 530of a SEED harder to follow. 531 532Accessibility 533------------- 534.. admonition:: Goal 535 536 SEEDs should be easy for contributors to write. 537 538Both Markdown and Google Docs are easy to write, familiar to many, and have 539extensive tooling available. SEED documents can be written outside of the 540Pigweed ecosystem using authors' preferred tools. 541 542ReST, on the other hand, is an unfamiliar and occasionally strange format, and 543its usage for SEEDs is heavily tied to Pigweed's documentation build. Authors 544are required to set up and constantly re-run this build, slowing iteration. 545 546Format and styling 547------------------ 548.. admonition:: Goal 549 550 SEED authors should have options for formatting various kinds of information 551 and data in their proposals. 552 553Markdown intentionally only offers limited control over document formatting, 554whereas ReST has a wide selection of directives and Google Docs functions as a 555traditional WYSIWYG editor, making them far more flexible. 556 557Sharing between Google and non-Google 558------------------------------------- 559.. admonition:: Goal 560 561 Both Google and non-Google contributors should easily be able to write and 562 review SEEDs. 563 564Due to security and legal concerns, managing ownership of Google Docs between 565internal and external contributors is nontrivial. 566 567Text documentation formats like Markdown and ReST live within the Pigweed 568repository, and as such follow the standard code contribution process. 569