Skip to content

Commit e05bd1f

Browse files
authored
feat: Improve data_privacy UX (#89)
* In middle of rework. * Refactoring plan. * Cleanup before reworking macro * Change #[classified] macro to implement its own derives. * More design work. * Implement derives. * Fix impl issues and make it work with std. * Update main app example and also log entire type. * Re-enable tests. * Align macro crate with existing structure. * Also align data privacy with Rust Guidelines and clean up module structure. * Move macros into module for documentation. * Rename wrapper and improve UX working with DataClasses * Fix some rendering bugs and more UX. * Move out integration tests. * Fix more tests and warnings. * Fix documentation. * Fix clippy * Format. * Fix doc tests. * Increase coverage. * Condense derive tests. * Also allow for compile error tests. * Remove `RedactedToString` derive, since it was replaced by blanket trait impl. * Format again. * Remove outdated snapshot tests. * Fix CI complaints. * More CI complaints. * Disable various tests for miri.
1 parent b688c87 commit e05bd1f

File tree

73 files changed

+3435
-3094
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+3435
-3094
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Please see each crate's change log below:
55
- [`bytesbuf`](./crates/bytesbuf/CHANGELOG.md)
66
- [`data_privacy`](./crates/data_privacy/CHANGELOG.md)
77
- [`data_privacy_macros`](./crates/data_privacy_macros/CHANGELOG.md)
8+
- [`data_privacy_macros_impl`](./crates/data_privacy_macros_impl/CHANGELOG.md)
89
- [`fundle`](./crates/fundle/CHANGELOG.md)
910
- [`fundle_macros`](./crates/fundle_macros/CHANGELOG.md)
1011
- [`fundle_macros_impl`](./crates/fundle_macros_impl/CHANGELOG.md)

Cargo.lock

Lines changed: 32 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ repository = "https://github.com/microsoft/oxidizer"
2525

2626
# local dependencies
2727
bytesbuf = { path = "crates/bytesbuf", default-features = false, version = "0.1.0" }
28-
data_privacy = { path = "crates/data_privacy", default-features = false, version = "0.6.0" }
29-
data_privacy_macros = { path = "crates/data_privacy_macros", default-features = false, version = "0.4.0" }
28+
data_privacy = { path = "crates/data_privacy", default-features = false, version = "0.7.0" }
29+
data_privacy_macros = { path = "crates/data_privacy_macros", default-features = false, version = "0.7.0" }
30+
data_privacy_macros_impl = { path = "crates/data_privacy_macros_impl", default-features = false, version = "0.7.0" }
3031
fundle = { path = "crates/fundle", default-features = false, version = "0.3.0" }
3132
fundle_macros = { path = "crates/fundle_macros", default-features = false, version = "0.3.0" }
3233
fundle_macros_impl = { path = "crates/fundle_macros_impl", default-features = false, version = "0.3.0" }

README.md

Lines changed: 54 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ These are the crates built out of this repo:
2727
- [`bytesbuf`](./crates/bytesbuf/README.md) - Manipulate sequences of bytes for efficient I/O.
2828
- [`data_privacy`](./crates/data_privacy/README.md) - Mechanisms to classify, manipulate, and redact sensitive data.
2929
- [`data_privacy_macros`](./crates/data_privacy_macros/README.md) - Macros for the `data_privacy` crate.
30+
- [`data_privacy_macros_impl`](./crates/data_privacy_macros_impl/README.md) - Macros for the `data_privacy` crate.
3031
- [`fundle`](./crates/fundle/README.md) - Compile-time safe dependency injection for Rust.
3132
- [`fundle_macros`](crates/fundle_macros/README.md) - Macros for the `fundle` crate.
3233
- [`fundle_macros_impl`](crates/fundle_macros_impl/README.md) - Macros for the `fundle` crate.
@@ -53,12 +54,15 @@ The `add-crate` script does the following:
5354

5455
- Adds an entry for the crate to the top-level [CHANGELOG.md](./CHANGELOG.md) file.
5556

56-
- Prepares a `README.md` file for the crate, setup for use with [`cargo-rdme`](https://docs.rs/cargo-rdme/latest/cargo_rdme/)
57+
- Prepares a `README.md` file for the crate, setup for use with [
58+
`cargo-rdme`](https://docs.rs/cargo-rdme/latest/cargo_rdme/)
5759
with a set of appropriate CI badges.
5860

59-
- Creates an empty `CHANGELOG.md` file for the crate, which will later get populated by the `scripts\release-crate.ps1` script.
61+
- Creates an empty `CHANGELOG.md` file for the crate, which will later get populated by the `scripts\release-crate.ps1`
62+
script.
6063

61-
- Creates placeholder `logo.png` and `favicon.ico` files for the crate, which you're expected to replace with legit crab-themed
64+
- Creates placeholder `logo.png` and `favicon.ico` files for the crate, which you're expected to replace with legit
65+
crab-themed
6266
logo and icon.
6367

6468
### Publishing Crates
@@ -71,8 +75,9 @@ this simple process:
7175

7276
2. Create a branch off of main.
7377

74-
3. Run `./scripts/release-crate.ps1 <crate_name> [new_version]` to bump a crate's version and update the crate's `CHANGELOG.md` file.
75-
Run the script many times if you want to release several crates in the same PR.
78+
3. Run `./scripts/release-crate.ps1 <crate_name> [new_version]` to bump a crate's version and update the crate's
79+
`CHANGELOG.md` file.
80+
Run the script many times if you want to release several crates in the same PR.
7681

7782
4. Create a PR like normal to push changes out.
7883

@@ -86,12 +91,12 @@ features. We expect our Rust code to be fully documented in the normal Rust way,
8691
automation processes:
8792

8893
- The `README.md` file in each crate's directory is auto-generated from the crate-level documentation.
89-
We use the [`cargo-rdme`](https://crates.io/crates/cargo-rdme) tool which reads the crate docs, patches links, and
90-
then inserts the results into the `README.md` file. A pull request gate ensures the `README.md` file
91-
always reflects the latest crate documentation.
94+
We use the [`cargo-rdme`](https://crates.io/crates/cargo-rdme) tool which reads the crate docs, patches links, and
95+
then inserts the results into the `README.md` file. A pull request gate ensures the `README.md` file
96+
always reflects the latest crate documentation.
9297

9398
- The `CHANGELOG.md` file in each crate's directory is auto-generated from the commits to a crate's directory by the
94-
`scripts/release-crate.ps1` script.
99+
`scripts/release-crate.ps1` script.
95100

96101
To generate documentation locally with all features enabled (including feature-gated items), run:
97102

@@ -107,30 +112,31 @@ and open it in your default browser.
107112
We have two primary workflows:
108113

109114
- `main`. Runs on all pull requests and commits to the main branch. This
110-
performs quite a bit of validation to ensure high-quality outcomes. Any issues
111-
found by this workflow blocks the pull request from being merged.
115+
performs quite a bit of validation to ensure high-quality outcomes. Any issues
116+
found by this workflow blocks the pull request from being merged.
112117

113118
- `nightly`. Runs nightly on the main branch. This executes repo-wide mutation testing
114-
(as opposed to the main workflow which does incremental testing). Any issues
115-
found by this workflow result in an issue being opened reporting the problem.
119+
(as opposed to the main workflow which does incremental testing). Any issues
120+
found by this workflow result in an issue being opened reporting the problem.
116121

117122
### Pull Request Gates
118123

119124
We strive to deliver high-quality code and as such, we've put in place a number of PR gates, described here:
120125

121126
- **Build**. We build all the crates in the repo for Windows and Linux.
122-
We use [`cargo-hack`](https://crates.io/crates/cargo-hack) to iterate through
123-
different crate feature combinations to make sure everything builds properly.
127+
We use [`cargo-hack`](https://crates.io/crates/cargo-hack) to iterate through
128+
different crate feature combinations to make sure everything builds properly.
124129

125130
- **Testing**. We run `cargo test --all-features` to run every normal test and documentation test in the repo.
126131

127-
- **Code Coverage**. We calculate code coverage for the whole repo using [`cargo-llvm-cov`](https://crates.io/crates/cargo-llvm-cov).
128-
We capture coverage for Windows and Linux, with `--all-features` and `--no-features`. Coverage is collected using
129-
the nightly Rust compiler which makes it possible to use `coverage(off)` annotations in the source code to suppress
130-
coverage collection for a chunk of code. We require 100% coverage for any checked in code.
132+
- **Code Coverage**. We calculate code coverage for the whole repo using [
133+
`cargo-llvm-cov`](https://crates.io/crates/cargo-llvm-cov).
134+
We capture coverage for Windows and Linux, with `--all-features` and `--no-features`. Coverage is collected using
135+
the nightly Rust compiler which makes it possible to use `coverage(off)` annotations in the source code to suppress
136+
coverage collection for a chunk of code. We require 100% coverage for any checked in code.
131137

132138
- **Mutation Testing**. We use [`cargo-mutants`](https://crates.io/crates/cargo-mutants) to help maintain
133-
high test quality.
139+
high test quality.
134140

135141
- **Source Linting**. We run Clippy with most warnings enabled and all treated as errors.
136142

@@ -139,27 +145,36 @@ high test quality.
139145
- **Source Formatting**. We ensure the source code complies with the Rust standard format.
140146

141147
- **Dependency Auditing**. We use [`cargo-audit`](https://aka.ms/crates.io/crates/cargo-audit) to be alerted of
142-
any security vulnerabilities in our dependencies.
148+
any security vulnerabilities in our dependencies.
143149

144150
- **Unsafe Verification**. We use Miri to verify that our unsafe code doesn't induce undefined behaviors.
145151

146152
- **External Type Exposure**. We use [`cargo-external-types`](https://crates.io/crates/cargo-external-types) to track
147-
which external types our crates depend on. Exposing a 3P type from a crate creates a coupling between the crate and the exporter
148-
of the type which can be problematic over time. This check is there to prevent unintentional exposure. If the exposure is intentional,
149-
it's a simple matter of adding an exclusion for it to the crate's `Cargo.toml` file.
150-
151-
- **Default Features**. We use [`cargo-ensure-no-default-features`](https://crates.io/crates/cargo-ensure-no-default-features) to make
152-
sure the dependencies pulled in by the top-level Cargo.toml are all annotated with `default-features = false`. Individual crates that use
153-
these dependencies are then responsible for stating exactly which features they need. This is designed to minimize build times for
154-
our customers.
155-
156-
- **Cyclic Dependencies**. We use [`cargo-ensure-no-cyclic-deps`](https://crates.io/crates/cargo-ensure-no-cyclic-deps) to ensure the
157-
crates in the repo don't create funny referential cycles using `dev-dependencies`. Things break or get difficult when these cycles exist.
158-
159-
- **Unneeded Dependencies**. We use [`cargo-udeps`](https://crates.io/crates/cargo-udeps) to ensure our crates don't have superfluous
160-
dependencies.
161-
162-
- **PR Title**. Every PR submitted to this repo must follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
153+
which external types our crates depend on. Exposing a 3P type from a crate creates a coupling between the crate and
154+
the exporter
155+
of the type which can be problematic over time. This check is there to prevent unintentional exposure. If the exposure
156+
is intentional,
157+
it's a simple matter of adding an exclusion for it to the crate's `Cargo.toml` file.
158+
159+
- **Default Features**. We use [
160+
`cargo-ensure-no-default-features`](https://crates.io/crates/cargo-ensure-no-default-features) to make
161+
sure the dependencies pulled in by the top-level Cargo.toml are all annotated with `default-features = false`.
162+
Individual crates that use
163+
these dependencies are then responsible for stating exactly which features they need. This is designed to minimize
164+
build times for
165+
our customers.
166+
167+
- **Cyclic Dependencies**. We use [`cargo-ensure-no-cyclic-deps`](https://crates.io/crates/cargo-ensure-no-cyclic-deps)
168+
to ensure the
169+
crates in the repo don't create funny referential cycles using `dev-dependencies`. Things break or get difficult when
170+
these cycles exist.
171+
172+
- **Unneeded Dependencies**. We use [`cargo-udeps`](https://crates.io/crates/cargo-udeps) to ensure our crates don't
173+
have superfluous
174+
dependencies.
175+
176+
- **PR Title**. Every PR submitted to this repo must follow
177+
the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
163178
specification. We use these PR titles as part of our automatic change log generation logic.
164179

165180
- **License Headers**. We ensure all source files have the requisite license header. The headers are described in
@@ -173,5 +188,6 @@ dependencies.
173188
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
174189
trademarks or logos is subject to and must follow
175190
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
176-
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
191+
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft
192+
sponsorship.
177193
Any use of third-party trademarks or logos are subject to those third-party's policies.

0 commit comments

Comments
 (0)