feat(domain): add operational evidence ledger#238
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
Adds a domain-layer “operational evidence ledger” to produce deterministic, reconstructable event hash chains (with metadata redaction) to support later reconstruction/audit workflows.
Changes:
- Introduces
operational-evidence-ledgerdomain module for canonical payload building, deterministic hashing, chain linking, and verification. - Adds Vitest coverage for determinism, linking, redaction, and broken-chain detection.
- Documents the ledger and links it from the repository README.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Adds a new “Operational evidence ledger” capability section and points to the new doc. |
| docs/operational-evidence-ledger.md | Documents purpose, scope, event types, hash model, and privacy posture. |
| packages/domain/src/operational-evidence-ledger.ts | Implements payload redaction/canonicalization, event hashing, chain building, and chain verification. |
| packages/domain/src/index.ts | Re-exports ledger APIs/types from the domain package entrypoint. |
| packages/domain/src/tests/operational-evidence-ledger.test.ts | Adds unit tests for determinism, redaction, and verification behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+236
to
+245
| return inputs.map((input) => { | ||
| const event = buildOperationalEvidenceEvent({ | ||
| ...input, | ||
| previousHash: input.previousHash ?? previousHash, | ||
| }); | ||
|
|
||
| previousHash = event.hash; | ||
|
|
||
| return event; | ||
| }); |
Comment on lines
+94
to
+98
| function isSensitiveMetadataKey(key: string): boolean { | ||
| const normalized = key.toLowerCase(); | ||
|
|
||
| return SENSITIVE_METADATA_KEY_PARTS.some((part) => normalized.includes(part)); | ||
| } |
Comment on lines
+222
to
+228
| return { | ||
| ...payload, | ||
| eventId: `oev_${hash.slice(0, 32)}`, | ||
| payloadHash, | ||
| previousHash, | ||
| hash, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a domain-level operational evidence ledger for reconstructable event chains.
This introduces canonical operational evidence events, sensitive metadata redaction, deterministic payload hashes, event hashes, previousHash linking and chain verification.
The implementation is storage-agnostic and does not introduce a database migration. It prepares the codebase for later evidence bundle export, intake/consent/decision reconstruction and higher-assurance legal or expert review workflows.