open-standards/jouleclaw/jouleclaw-rs/crates/jouleclaw-prereg/src
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Transaction Science eee7fbafe0 jouleclaw-prereg: pre-registration with blake3-locked data hash
Determinism-contract wave-5 item 1. The structural primitive that
closes p-hacking and silent data-leakage at the protocol level: the
analysis plan + held-out data hash are locked BEFORE the proposer
sees the data; downstream grading refuses against any data whose
hash isn't in a prior registration.

OSF Replication Recipe shape (the canonical artifact today — OSF
v4 + the Replication Recipe template). Preregistrations roughly
doubled 2012-2017; only ~3% of papers reference theirs. Wave-5
brief was explicit that the structural primitive is deployable
today; cultural adoption is the gap. This crate ships the
structural primitive.

Surface:
- `Preregistration { id, locked_at_unix_secs, analysis_plan_hash,
  held_out_data_hash, data_source: DataSource, graders, signed_by,
  metadata }`.
- `DataSource { File | Stream { stream_id, sample_count } |
  External(uri) }` — typed enum so the consumer can't silently
  hash a partial stream (the only place the contract can detect
  that lie).
- `hash_analysis_plan(&T) -> String` + `hash_data_bytes(&[u8])`
  helpers (blake3 hex, deterministic canonical serialization).
- `PreregStore` trait + `InMemoryPreregStore` + `FilePreregStore`
  (atomic rename writes, matching FileRunStore/FileTaskStore).
- `PreregGate` impl of `jouleclaw_gate::Gate` — denies advancement
  when claim data-hash + grader don't match the locked plan.

Honest scope (v1): the gate enforces protocol-level locking. We
do NOT enforce "the proposer didn't see the data" — no machine-
checkable solution exists. Hash + timestamp + consumer's
attestation chain (OSF DOI, GitHub commit hash, signed envelope)
is what we offer.

Also fixes the workspace-wide reqwest 0.13 feature rename in this
commit (rustls-tls → rustls; rustls-tls-native-roots →
rustls-native-certs) so the workspace builds — pre-existing drift
unblocked the ingest.

Adds 8 workspace member entries (prereg + pin + lab + formalize +
artifact + graph-mcp + the determinism-contract layer plus
workspace deps lock update for the new path deps).

13 tests cover: deterministic blake3 hashing of plan + data;
in-memory store register/get/list + duplicate-id error; file
store round-trip + unsafe-id rejection; PreregGate allows
matching data + approved grader; denies on data-hash mismatch;
denies on unregistered grader; denies on id mismatch; JSON
round-trip for Preregistration + DataSource; approves_grader
predicate.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
2026-05-31 05:37:56 -04:00
..
lib.rs jouleclaw-prereg: pre-registration with blake3-locked data hash 2026-05-31 05:37:56 -04:00