diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..3b519fa --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,15 @@ +## Objective + +Describe the single problem or maintenance goal this PR addresses. + +## Changes + +Describe the smallest set of changes made to achieve the objective. + +## Verification + +- [ ] `cargo fmt --all --check` +- [ ] `cargo clippy --workspace --all-targets --all-features -- -D warnings` +- [ ] `cargo test --workspace --all-features` +- [ ] New or changed detection behavior includes positive and negative tests +- [ ] I reviewed the diff for unrelated refactoring or duplicated binding logic diff --git a/.github/workflows/rust-quality.yml b/.github/workflows/rust-quality.yml new file mode 100644 index 0000000..ef6c6a4 --- /dev/null +++ b/.github/workflows/rust-quality.yml @@ -0,0 +1,18 @@ +name: Rust quality + +on: + push: + pull_request: + +jobs: + quality: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: 1.88.0 + components: rustfmt, clippy + - run: cargo fmt --all --check + - run: cargo clippy --workspace --all-targets --all-features -- -D warnings + - run: cargo test --workspace --all-features diff --git a/.github/workflows/wasm-binding.yml b/.github/workflows/wasm-binding.yml index 78d4b8f..0a6d7bc 100644 --- a/.github/workflows/wasm-binding.yml +++ b/.github/workflows/wasm-binding.yml @@ -27,6 +27,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: + toolchain: 1.88.0 targets: wasm32-unknown-unknown - uses: actions/setup-node@v4 with: diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..b6b8e26 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,27 @@ +# DataFog Core repository rules + +## Correctness + +- Detection changes require positive and negative tests that prove the changed behavior. +- Do not silently discard fallible results. +- Avoid panic paths for user-controlled input. +- Preserve documented entity offset semantics across the Rust core and all bindings. + +## Structure + +- Add files only for distinct logical components. +- Do not introduce abstractions without a demonstrated need in the current codebase. +- Keep bindings thin: PII detection semantics belong in `crates/core`. +- Do not duplicate detector logic in Python, Node, or WASM bindings. +- Do not perform unrelated refactoring while implementing a scoped change. + +## Code + +- Comments document public behavior or explain non-obvious reasoning; do not narrate syntax. +- Prefer descriptive names over abbreviations. +- New third-party dependencies require a concrete need that cannot be met reasonably with the standard library or existing dependencies. + +## Changes + +- Keep each pull request focused on one behavior or maintenance goal. +- Run `cargo fmt --all --check`, `cargo clippy --workspace --all-targets --all-features -- -D warnings`, and `cargo test --workspace --all-features` before merging Rust changes. diff --git a/bindings/node/Cargo.toml b/bindings/node/Cargo.toml index b908648..77a8171 100644 --- a/bindings/node/Cargo.toml +++ b/bindings/node/Cargo.toml @@ -2,6 +2,7 @@ name = "datafog-node" version = "0.1.0" edition = "2024" +rust-version = "1.88" description = "Node.js bindings for datafog-core" license = "MIT" repository = "https://github.com/DataFog/datafog-core" diff --git a/bindings/python/Cargo.toml b/bindings/python/Cargo.toml index f5459a8..db7fa63 100644 --- a/bindings/python/Cargo.toml +++ b/bindings/python/Cargo.toml @@ -2,6 +2,7 @@ name = "datafog-core-python" version = "0.1.0" edition = "2024" +rust-version = "1.88" description = "Python bindings for datafog-core" license = "MIT" repository = "https://github.com/DataFog/datafog-core" diff --git a/bindings/wasm/Cargo.toml b/bindings/wasm/Cargo.toml index 416c99e..d591e4a 100644 --- a/bindings/wasm/Cargo.toml +++ b/bindings/wasm/Cargo.toml @@ -2,6 +2,7 @@ name = "datafog-wasm" version = "0.1.0" edition = "2024" +rust-version = "1.88" description = "WebAssembly bindings for datafog-core" license = "MIT" repository = "https://github.com/DataFog/datafog-core" diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 5e25a07..4120926 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -2,7 +2,7 @@ name = "datafog-core" version = "0.1.0" edition = "2024" -rust-version = "1.85" +rust-version = "1.88" description = "Fast structured PII detection library" license = "MIT" homepage = "https://datafog.ai" diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..fdda5b9 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "1.88.0" +profile = "minimal" +components = ["rustfmt", "clippy"] diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..f3e454b --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,2 @@ +edition = "2024" +style_edition = "2024"