Skip to content

Add policy section to docs#1127

Merged
apoelstra merged 1 commit intorust-bitcoin:masterfrom
tcharding:07-26-policy-docs
Nov 16, 2023
Merged

Add policy section to docs#1127
apoelstra merged 1 commit intorust-bitcoin:masterfrom
tcharding:07-26-policy-docs

Conversation

@tcharding
Copy link
Copy Markdown
Member

@tcharding tcharding commented Jul 26, 2022

In an effort to consolidate knowledge spread out over time in various places on GitHub add a Policy section to CONTRIBUTING.md.

Add initial sections on import statements, errors, rustdocs,attributes, and licensing.

@tcharding
Copy link
Copy Markdown
Member Author

tcharding commented Jul 26, 2022

Possible other candidate for inclusion, info on SPDX e.g.,

Files should start with license information as follows:

// SPDX-License-Identifier: CC0-1.0

@apoelstra
Copy link
Copy Markdown
Member

Neat! A good start. I'm sure others will chime in with things they think we ought to add.

We should require three ACKs for this PR.

apoelstra
apoelstra previously approved these changes Jul 26, 2022
Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK a954f0432a1dc63e71d7eb5018da39fb62c5ce9b

Copy link
Copy Markdown
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

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

Concept ACK, few suggestions.

CONTRIBUTING.md Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Error types should be non_exhaustive and have private fields unless you're very confident they won't change.
Error types should not commit to implementing traits they may not be able to implement int the future, especially Copy but possibly also Eq and Ord. They should however commit to Send and Sync.
If the error contains source implement Display using write_err!() macro.
If a function consumes costly-to-compute input (allocations are also considered costly) it should return it back in the error type.
Errors should have Error suffix and conditionally implement std::error::Error if they are public.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should we have a small set of derives that are used on all error types? Clone, Debug, PartialEq?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

They should however commit to Send and Sync

I don't know what action is required to achieve this, I imagine other readers of the doc may not either. Can you explain further please?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Debug is the only one I'd guarantee. Clone is very likely for most error types but there could be exception when we want to return a resource instead of consuming it. (OTOH &mut is probably better)

I don't know what action is required to achieve this

Not putting things like Cell or Rc into Error types. Sadly it could happen by accident without the compiler complaining and we may break the user code. Maybe we should have something like this:

// #[allow(unused)] may be required
trait AssertSendSync: Send + Sync {
}

// Perhaps we could also check other traits
macro_rules! check_pub_error {
    ($type:ty) => {
        impl AssertSendSync for $ty {}
    }
}

Copy link
Copy Markdown
Member Author

@tcharding tcharding Jul 28, 2022

Choose a reason for hiding this comment

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

Done! #1148 Now done in #1743

@tcharding
Copy link
Copy Markdown
Member Author

tcharding commented Jul 28, 2022

We should require three ACKs for this PR.

If/when bors comes about we should consider if there is some way to flag PRs that require more acks.

EDIT: I added a label manual merge, bors can check for it before merging. No pressure but is bors ready yet :)

@Kixunil
Copy link
Copy Markdown
Collaborator

Kixunil commented Jul 28, 2022

I'd like some rules that require more acks based on files changed or so, if we have any critical code or policies. Might be reasonably easy to add.

@tcharding tcharding force-pushed the 07-26-policy-docs branch from 4535f63 to 2ebecb4 Compare July 28, 2022 23:44
@tcharding tcharding added this to the 0.30.0 milestone Aug 5, 2022
@tcharding
Copy link
Copy Markdown
Member Author

Putting on ice until after release of 0.30.0

@tcharding tcharding marked this pull request as draft February 10, 2023 00:39
@Kixunil Kixunil modified the milestones: 0.30.0, 0.31.0 Feb 18, 2023
@tcharding tcharding marked this pull request as ready for review March 23, 2023 04:32
@tcharding
Copy link
Copy Markdown
Member Author

I'd like some rules that require more acks based on files changed or so, if we have any critical code or policies. Might be reasonably easy to add.

Just flagging that I took this PR off draft but have not actioned this comment of yours @Kixunil, not sure what to do about it?

@apoelstra
Copy link
Copy Markdown
Member

apoelstra commented Mar 23, 2023

Our current policy is roughly "if one of the 2 ACKers says that they want a 3rd ACK, then we do it". I wouldn't mind codifying this. But I can't think of a simple mechanical rule that would say "you need 3 ACKs if you touch this file" or something like that.

This PR is an example of something that would need 3 ACKs -- though I'm willing to accept @tcharding's PR opening as an implicit ACK, since otherwise it would be hard to get a third. (Unless @sanket1729 wants to chime in on this.)

@tcharding
Copy link
Copy Markdown
Member Author

changes in force push:

  • added "Attributes" section
  • fixed typos
  • Added to #[non_exhaustive] in error: // Add liberally; if the error type may ever have new variants added.

sanket1729
sanket1729 previously approved these changes Mar 23, 2023
Copy link
Copy Markdown
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

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

ACK 4d630e0ac386eb26a975429af590ea52219362b0

@tcharding tcharding marked this pull request as ready for review October 2, 2023 02:21
@tcharding tcharding force-pushed the 07-26-policy-docs branch 3 times, most recently from 119a0ea to 539b8ad Compare October 2, 2023 03:53
@tcharding
Copy link
Copy Markdown
Member Author

tcharding commented Oct 2, 2023

Removed the mention of check_pub_error, which is from #1743

apoelstra
apoelstra previously approved these changes Oct 2, 2023
Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 539b8ad2b9af34ed33113d6738d6e3779dfa7b5a

CONTRIBUTING.md Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This looks weird :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Dunno what I was doing when I wrote this, the ;s are wrong too. Fixed and force pushed, thanks.

apoelstra
apoelstra previously approved these changes Oct 3, 2023
Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK fe1e8aef8cd24b9695d0effe7fc442a2b8b4ddd0

sanket1729
sanket1729 previously approved these changes Oct 4, 2023
Copy link
Copy Markdown
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

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

ACK fe1e8aef8cd24b9695d0effe7fc442a2b8b4ddd0

@apoelstra
Copy link
Copy Markdown
Member

Since @Kixunil is around I'll let him ACK as well before merging.

@tcharding
Copy link
Copy Markdown
Member Author

On ice until next release.

@tcharding tcharding marked this pull request as draft October 10, 2023 21:41
@yancyribbens
Copy link
Copy Markdown
Contributor

Is it worth adding mention of how silent overflows should be handled (or not handled)? #2086

@apoelstra
Copy link
Copy Markdown
Member

I like the idea of having a project-wide overflow policy. But I have no idea what such a policy should be :). Feerates have different rules from amounts, which have different rules from sizes, etc.

In an effort to consolidate knowledge spread out over time in various
places on GitHub add a `Policy` section to `CONTRIBUTING.md`.

Add initial sections on import statements, errors, rustdocs,attributes,
and licensing.
@tcharding tcharding dismissed stale reviews from sanket1729 and apoelstra via 3bebecc October 30, 2023 21:03
@tcharding tcharding marked this pull request as ready for review October 30, 2023 21:03
Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 3bebecc

@tcharding
Copy link
Copy Markdown
Member Author

Can this go in?

@apoelstra
Copy link
Copy Markdown
Member

cc @sanket1729 @Kixunil we need a second ack here

Copy link
Copy Markdown
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

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

ACK 3bebecc

@apoelstra apoelstra merged commit 50fc63b into rust-bitcoin:master Nov 16, 2023
@tcharding tcharding deleted the 07-26-policy-docs branch May 22, 2024 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants