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

Add deprecation checklist document for Substrate #1583

Merged
merged 11 commits into from
Nov 3, 2023
76 changes: 76 additions & 0 deletions substrate/docs/deprecation-process.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Deprecation Process

This deprecation process makes sense while we don’t use [SemVer](https://semver.org/).
After that, this process will most likely change.
As deprecation and removal of existing code can happen on any release, we need to be mindful that external builders
could be impacted by the changes we make.
The deprecation process tries to mitigate this impact, while still keeping the developer experience, the DevEx, as
smooth as possible.

To start a deprecation process a new issue with the label `I11-deprecation` needs to be created for correct tracking.
Then these are the actions to take:
the-right-joyce marked this conversation as resolved.
Show resolved Hide resolved

## Hard deprecate by adding a warning message

The warning message shall include a removal month and year, which is suggested to be 6 months after the deprecation
notice is released.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would not recommend to set this time frame as a rule, it's good if your team is so organised that they know when they'll be ready to deprecate the code, but in some cases we can't really tell when this is gonna happen.. instead it's deprecated as soon as there's a replacement ready to merge

Copy link
Contributor Author

Choose a reason for hiding this comment

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

instead it's deprecated as soon as there's a replacement ready to merge

Yes, absolutely. The 6 months period is for the removal of the deprecated code, not for the deprecation itself.
When a piece of code is deprecated, it should be technically possible to be removed straight away. This period is for the downstream developers to have time to update their code. They should know when to expect the removal to happen.
Also, this timeframe (6 months or whatever was chosen) is only a lower bound, that's why the notice should look like [DEPRECATED] will be removed after [DATE]. This means that we are free to remove a code in 7 or 8 months even if we said that it will be removed after 6 months from now, but we shall not remove it before those 6 months.

This means that the code will be removed in a release within that month (or after, but never before). Please use this
template, doing so makes it easy to search through the code base:

```rust
#[deprecated(note = "[DEPRECATED] will be removed after [DATE]. [ALTERNATIVE]")]
```
`[ALTERNATIVE]` won't always be possible but offer it if it is.

E.g.
```rust
#[deprecated(note = "`GenesisConfig` will be removed after December 2023. Use `RuntimeGenesisConfig` instead.")]
```

Some pieces of code cannot be labeled as deprecated, like [reexports](https://github.com/rust-lang/rust/issues/30827)
or [dispatchables](https://github.com/paritytech/polkadot-sdk/issues/182#issuecomment-1691684159), for instance.
In cases like that we can only make a visible enough comment, and make sure that we [announce the deprecation properly](#announce-the-deprecation-and-removal).

## Remove usage of the deprecated code in the code base

Just make sure that we are not using the deprecated code ourselves.
If you added the deprecation warning from the previous step, this can be done by making sure that warning is not shown
when building the code.

## Update examples and tutorials

juangirini marked this conversation as resolved.
Show resolved Hide resolved
Make sure that the rust docs are updated.
We also need [https://docs.substrate.io/](https://docs.substrate.io/) to be updated accordingly. The repo behind it is
[https://github.com/substrate-developer-hub/substrate-docs](https://github.com/substrate-developer-hub/substrate-docs).

## Announce the deprecation and removal

**At minimum they should be noted in the release log.** Please see how to document a PR [here](https://github.com/paritytech/polkadot-sdk/blob/master/docs/CONTRIBUTING.md#documentation).
Sometimes the release note is not enough.
Copy link
Contributor

Choose a reason for hiding this comment

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

do we want to say here where else this should be mentioned then?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You should tie this into https://forum.parity.io/t/pr-documentation-prdoc/2065?

that post isn't public, that's why I have linked to the documentation section of the CONTRIBUTING doc, which is a summary of it

Copy link
Contributor Author

@juangirini juangirini Sep 18, 2023

Choose a reason for hiding this comment

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

do we want to say here where else this should be mentioned then?

good point, maybe someone from devrel can help us here? @sacha-l @aaronbassett

Make sure you are as loud as you need to be for the magnitude of the breaking change. Some breaking changes have a
bigger impact than others.

## Removal version is planned

Depending on the removal date indicated in the deprecation warning in the [first step](#hard-deprecate-by-adding-a-warning-message),
juangirini marked this conversation as resolved.
Show resolved Hide resolved
the nature and the importance of the change, it might make sense to coordinate the release with other developers and
with the Release team.

## Deprecated code is removed

The deprecated code finally gets removed.
Don’t forget to [announce this accordingly](#announce-the-deprecation-and-removal).

✅ In order to not forget any of these steps, consider using this template in your deprecation issue:

```markdown
### Tasks

- [ ] Deprecate code by adding a warning message
- [ ] Remove usage of the deprecated code in the code base
- [ ] Update examples and tutorials
- [ ] Announce code deprecation
- [ ] Plan removal version
- [ ] Announce code removal
- [ ] Remove deprecated code
```