Skip to content

feat: evidence carrier types and schemas#414

Merged
jithinraj merged 1 commit intomainfrom
feat/evidence-carrier-types
Feb 23, 2026
Merged

feat: evidence carrier types and schemas#414
jithinraj merged 1 commit intomainfrom
feat/evidence-carrier-types

Conversation

@jithinraj
Copy link
Member

Summary

  • Ships PeacEvidenceCarrier pure types in @peac/kernel (Layer 0, zero runtime) and Zod schemas + shared helpers in @peac/schema (Layer 1)
  • Implements computeReceiptRef() (SHA-256 of compact JWS via WebCrypto) with runtime portability guard (Node >= 20, CF Workers, Deno, Bun)
  • Adds validateCarrierConstraints() for transport-aware size enforcement and verifyReceiptRefConsistency() for DD-129 tamper detection
  • Ships 8 conformance fixtures (5 valid, 3 invalid) in specs/conformance/fixtures/carrier/
  • Exports PEAC_RECEIPT_HEADER canonical constant ("PEAC-Receipt") per DD-127

Design Decisions

  • DD-124: PeacEvidenceCarrier, CarrierAdapter<T,U>, CarrierMeta types in kernel; Zod schemas + helpers in schema
  • DD-127: CARRIER_TRANSPORT_LIMITS per-transport size constants (MCP 64KB, A2A 64KB, HTTP 8KB headers)
  • DD-129: verifyReceiptRefConsistency() async check: sha256(receipt_jws) === receipt_ref

Key Types

export type ReceiptRef = `sha256:${string}`;
export type CarrierFormat = 'embed' | 'reference';

export interface PeacEvidenceCarrier {
  receipt_ref: ReceiptRef;
  receipt_jws?: string;
  policy_binding?: string;
  actor_binding?: string;
  // ... additional optional fields
}

export interface CarrierAdapter<TInput, TOutput> {
  extract(input: TInput): { receipts: PeacEvidenceCarrier[]; meta: CarrierMeta } | null;
  attach(output: TOutput, carriers: PeacEvidenceCarrier[], meta?: CarrierMeta): TOutput;
  validateConstraints(carrier: PeacEvidenceCarrier, meta: CarrierMeta): CarrierValidationResult;
}

Test plan

  • Kernel carrier types compile with zero runtime deps (11 tests)
  • Zod schemas validate all 8 fixtures (5 valid, 3 invalid)
  • computeReceiptRef() produces deterministic sha256:<hex64> output
  • validateCarrierConstraints() enforces transport size limits from CarrierMeta
  • verifyReceiptRefConsistency() detects tampered JWS (DD-129)
  • WebCrypto runtime guard throws clear error on missing crypto.subtle
  • pnpm build && pnpm lint && pnpm typecheck:core && pnpm test passes (77/77 build, 4246 tests)
  • guard.sh and check-planning-leak.sh pass

Ship PeacEvidenceCarrier types (Layer 0, zero runtime) and Zod schemas
with shared computeReceiptRef() helper (Layer 1). Includes carrier
conformance fixtures (5 valid, 3 invalid) and verifyReceiptRefConsistency()
for DD-129 async extraction enforcement.

- kernel: PeacEvidenceCarrier, CarrierAdapter<T,U>, CarrierMeta types
- kernel: PEAC_RECEIPT_HEADER canonical constant (DD-127)
- schema: ReceiptRefSchema, CompactJwsSchema, PeacEvidenceCarrierSchema
- schema: computeReceiptRef() with WebCrypto runtime guard
- schema: validateCarrierConstraints() transport-aware validation
- schema: verifyReceiptRefConsistency() for tamper detection
- schema: CARRIER_TRANSPORT_LIMITS per-transport size constants
- conformance: 8 carrier fixtures in specs/conformance/fixtures/carrier/
- conformance: carrier category registered in manifest and tracking
@jithinraj jithinraj changed the title feat: evidence carrier types, schemas, and conformance fixtures (DD-124) feat: evidence carrier types, schemas, and conformance fixtures Feb 23, 2026
@jithinraj jithinraj changed the title feat: evidence carrier types, schemas, and conformance fixtures feat: evidence carrier types, schemas Feb 23, 2026
@jithinraj jithinraj changed the title feat: evidence carrier types, schemas feat: evidence carrier types and schemas Feb 23, 2026
@jithinraj jithinraj merged commit c5c9f4d into main Feb 23, 2026
7 checks passed
jithinraj added a commit that referenced this pull request Feb 23, 2026
Evidence Carrier Contract + A2A Mapping release.

- Bump all 65 workspace packages to 0.11.1
- CHANGELOG entry for Evidence Carrier Contract, A2A mapping,
  MCP _meta carrier, ACP/UCP/x402 carrier adoption, discovery profile
- AGENTS.md: v0.11.1 carrier format, A2A metadata example
- Normative specs: EVIDENCE-CARRIER-CONTRACT.md, A2A-RECEIPT-PROFILE.md,
  MCP-EVIDENCE-PROFILE.md
- Registry: a2a, ucp, stripe entries (version 0.10.0)

PRs: #414-#421 (8 merged)
Design decisions: DD-124 through DD-131
jithinraj added a commit that referenced this pull request Feb 23, 2026
Evidence Carrier Contract + A2A Mapping release.

- Bump all 65 workspace packages to 0.11.1
- CHANGELOG entry for Evidence Carrier Contract, A2A mapping,
  MCP _meta carrier, ACP/UCP/x402 carrier adoption, discovery profile
- AGENTS.md: v0.11.1 carrier format, A2A metadata example
- Normative specs: EVIDENCE-CARRIER-CONTRACT.md, A2A-RECEIPT-PROFILE.md,
  MCP-EVIDENCE-PROFILE.md
- Registry: a2a, ucp, stripe entries (version 0.10.0)
- Spec fixes: embed-only HTTP in v0.11.1, MCP dual-legacy wording,
  softened RFC 9711 analogy, DD-129 producer/consumer split,
  Node >= 20 runtime vs >= 22 dev baseline, fixture description clarity,
  removed duplicate UCP registry entry

PRs: #414-#421 (8 merged)
Design decisions: DD-124 through DD-131
jithinraj added a commit that referenced this pull request Feb 23, 2026
Evidence Carrier Contract + A2A Mapping release.

- Bump all 65 workspace packages to 0.11.1
- CHANGELOG entry for Evidence Carrier Contract, A2A mapping,
  MCP _meta carrier, ACP/UCP/x402 carrier adoption, discovery profile
- AGENTS.md: v0.11.1 carrier format, A2A metadata example
- Normative specs: EVIDENCE-CARRIER-CONTRACT.md, A2A-RECEIPT-PROFILE.md,
  MCP-EVIDENCE-PROFILE.md
- Registry: a2a, ucp, stripe entries (version 0.10.0)
- Spec fixes: embed-only HTTP in v0.11.1, MCP dual-legacy wording,
  softened RFC 9711 analogy, DD-129 producer/consumer split,
  Node >= 20 runtime vs >= 22 dev baseline, fixture description clarity,
  removed duplicate UCP registry entry

PRs: #414-#421 (8 merged)
Design decisions: DD-124 through DD-131
jithinraj added a commit that referenced this pull request Feb 23, 2026
* test(smoke): MCP carrier e2e round-trip

Full flow: issue -> computeReceiptRef -> attachReceiptToMeta ->
extractReceiptFromMetaAsync -> verifyLocal. No network calls, no clock
dependencies; uses deterministic key material for reproducible failures.

Tests:
- Full round-trip with offline verification
- Tampered receipt_ref detection (DD-129)
- Legacy org.peacprotocol/receipt extraction with receipt_ref computation
- Round-trip carrier field preservation
- Null return for missing _meta

Also re-enables tests/smoke in vitest config and adds @peac/mappings-mcp
alias for root-level test resolution.

* chore(release): v0.11.1

Evidence Carrier Contract + A2A Mapping release.

- Bump all 65 workspace packages to 0.11.1
- CHANGELOG entry for Evidence Carrier Contract, A2A mapping,
  MCP _meta carrier, ACP/UCP/x402 carrier adoption, discovery profile
- AGENTS.md: v0.11.1 carrier format, A2A metadata example
- Normative specs: EVIDENCE-CARRIER-CONTRACT.md, A2A-RECEIPT-PROFILE.md,
  MCP-EVIDENCE-PROFILE.md
- Registry: a2a, ucp, stripe entries (version 0.10.0)
- Spec fixes: embed-only HTTP in v0.11.1, MCP dual-legacy wording,
  softened RFC 9711 analogy, DD-129 producer/consumer split,
  Node >= 20 runtime vs >= 22 dev baseline, fixture description clarity,
  removed duplicate UCP registry entry

PRs: #414-#421 (8 merged)
Design decisions: DD-124 through DD-131
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant