audit fixes, repo restructure, and documentation

Soundness and performance audit (17 fixes):
- See AUDIT.md for full details and @claude comments in code

Repo restructure:
- Inline json-ptr and json-patch submodules as regular directories
- Remove cbor submodule, replace serde_cbor with ciborium
- Rename patch-db/ -> core/, patch-db-macro/ -> macro/,
  patch-db-macro-internals/ -> macro-internals/, patch-db-util/ -> util/
- Purge upstream CI/CD, bench, and release cruft from json-patch
- Remove .gitmodules

Test fixes:
- Fix proptest doesnt_crash (unique file paths, proper close/cleanup)
- Add PatchDb::close() for clean teardown

Documentation:
- Add README.md, ARCHITECTURE.md, CONTRIBUTING.md, CLAUDE.md, AUDIT.md
- Add TSDocs to TypeScript client exports

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matt Hill
2026-02-23 19:06:42 -07:00
parent 05c93290c7
commit 86b0768bbb
46 changed files with 5744 additions and 95 deletions

17
macro/Cargo.toml Normal file
View File

@@ -0,0 +1,17 @@
[package]
name = "patch-db-macro"
version = "0.1.0"
authors = ["Aiden McClelland <me@drbonez.dev>"]
edition = "2018"
description = "macros for defining typed patch dbs"
license = "MIT"
repository = "https://github.com/Start9Labs/patch-db"
[lib]
proc-macro = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
patch-db-macro-internals = { path = "../macro-internals" }
syn = "1.0.62"
proc-macro2 = "1.0.1"

2
macro/rustfmt.toml Normal file
View File

@@ -0,0 +1,2 @@
group_imports = "StdExternalCrate"
imports_granularity = "Module"

10
macro/src/lib.rs Normal file
View File

@@ -0,0 +1,10 @@
extern crate proc_macro;
use proc_macro::TokenStream;
use syn::{parse_macro_input, DeriveInput};
#[proc_macro_derive(HasModel, attributes(model))]
pub fn model(item: TokenStream) -> TokenStream {
let item = parse_macro_input!(item as DeriveInput);
patch_db_macro_internals::build_model(&item).into()
}