feat(agent-journal): canonicalize evaluation receipts#127
Merged
Conversation
Add strict RFC 8785 JSON canonicalization and UTF-8 SHA-256 receipts for future provenance graphs, rejecting non-I-JSON and exotic mutable input. RED: npx vitest run packages/pi-agent-journal/__tests__/evaluation-receipts.test.ts Failure: the canonical receipt module was absent.
Reject proxies before traps execute and freeze depth, node, collection, string, and output ceilings so receipt generation fails closed under adversarial inputs without unbounded allocation or stack overflow. RED: npx vitest run packages/pi-agent-journal/__tests__/evaluation-receipts.test.ts Failure: object/array proxies were accepted and resource limits were absent.
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.
Summary
Future evaluation evidence can now be bound through deterministic RFC 8785 JSON and SHA-256 over the exact canonical UTF-8 bytes. Non-I-JSON values, proxies, accessors, hidden/symbol/inherited data, cycles, sparse arrays, custom prototypes, and unstable exotic inputs fail closed.
Receipt generation also has frozen depth, node, collection, string, and output ceilings, preventing stack exhaustion or unbounded memory work. The module remains evaluation-only, absent from product registration and package tarballs, and carries no acceptance semantics.
Validation
npm run check:cispecdocs_validate