[runtime] add flow trace ids to signed receipts#47
Merged
Conversation
Why: multi-step runtime flows need a stable trace id and unique per-step receipt ids without breaking signing or verification. Contract impact: additive receipt/response fields only; existing signing and verify behavior preserved
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.
Motivation
trace_idwhile each step has a uniquereceipt_idand all proof fields remain verifiable and present in signed receipts.Description
trace_idwithmakeTraceId()and create unique per-step IDs viamakeFlowReceiptId(), and accept these inmakeReceipt({ ..., traceId, receiptId })so they are included inmetadataandmetadata.proofwhere appropriate (server.mjs).signReceiptEd25519Sha256from@commandlayer/runtime-coreunchanged, then mirror the runtime-levelreceipt_id/trace_idintoreceipt.metadataandreceipt.metadata.proofafter signing to keep verification consistent (server.mjs).wrapReceiptResponseto returntrace_id, an orderedstepslist of{ step, receipt }, andfinal_receiptwhile still returning the existingreceiptandruntime_metadatato remain backward compatible (server.mjs,README.md).trace_id, uniquereceipt_idper step, and unchanged signature/hash verification (runtime/tests/runtime-signing.test.mjs,tests/smoke.mjs).Testing
npm run check, which passed successfully.npm run test:unit, which passed all tests (19 tests, all OK) including updated signing/chain assertions.node tests/smoke.mjs, which passed and confirmed the frontend-facingtrace_id,steps,final_receipt, per-stepreceipt_idformat, and successful/verifychecks.Codex Task