[GH-ISSUE #49] Introduce canonical Evidence v2 records #36

Closed
opened 2026-10-15 18:20:16 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @morluto on GitHub (Jul 12, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/49

Problem

Evidence v1 hard-codes one provider and lacks stable identity, authority, execution environment, raw/normalized separation, and typed locations. It cannot safely support behavioral captures or additional providers.

Outcome

Introduce an intentionally breaking Evidence v2 contract with deterministic, provider-neutral identity.

Public contract

Evidence v2 contains:

  • evidence_id formatted as ev_<64 lowercase hex characters>
  • artifact hash, format, architecture, and non-identity local path
  • provider ID, name, and observed version or null
  • operation and normalized parameters
  • raw provider result when available and normalized result
  • observed | derived | inferred confidence
  • authority: shipped artifact, controlled replay, historical reference, external service, or analyst inference
  • typed source locations
  • execution environment
  • explicit limitations

Canonical JSON recursively sorts object keys, preserves array order, and rejects undefined/non-JSON values. ID calculation excludes the ID and local paths but includes all semantic evidence fields.

Acceptance criteria

  • Same semantic evidence at different local paths has the same ID.
  • Any semantic field change changes the ID.
  • No domain or contract schema hard-codes Hopper.
  • Direct observations and composed derivations receive correct confidence.
  • Evidence v1 inputs are rejected with an actionable version error.
  • CLI and MCP expose the same Evidence v2 schema.

Verification

Property tests cover canonical ordering, path independence, determinism, collisions across changed fields, malformed JSON, and provider identity.

Dependencies

Parent: #48. Blocks ledger, bundle, process-capture, and additional-provider work.

Non-goals

Persistence, bundle import/export, provider routing, or Evidence v1 compatibility.

Originally created by @morluto on GitHub (Jul 12, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/49 ## Problem Evidence v1 hard-codes one provider and lacks stable identity, authority, execution environment, raw/normalized separation, and typed locations. It cannot safely support behavioral captures or additional providers. ## Outcome Introduce an intentionally breaking Evidence v2 contract with deterministic, provider-neutral identity. ## Public contract Evidence v2 contains: - `evidence_id` formatted as `ev_<64 lowercase hex characters>` - artifact hash, format, architecture, and non-identity local path - provider ID, name, and observed version or null - operation and normalized parameters - raw provider result when available and normalized result - `observed | derived | inferred` confidence - authority: shipped artifact, controlled replay, historical reference, external service, or analyst inference - typed source locations - execution environment - explicit limitations Canonical JSON recursively sorts object keys, preserves array order, and rejects undefined/non-JSON values. ID calculation excludes the ID and local paths but includes all semantic evidence fields. ## Acceptance criteria - Same semantic evidence at different local paths has the same ID. - Any semantic field change changes the ID. - No domain or contract schema hard-codes Hopper. - Direct observations and composed derivations receive correct confidence. - Evidence v1 inputs are rejected with an actionable version error. - CLI and MCP expose the same Evidence v2 schema. ## Verification Property tests cover canonical ordering, path independence, determinism, collisions across changed fields, malformed JSON, and provider identity. ## Dependencies Parent: #48. Blocks ledger, bundle, process-capture, and additional-provider work. ## Non-goals Persistence, bundle import/export, provider routing, or Evidence v1 compatibility.
Author
Owner

@morluto commented on GitHub (Jul 17, 2026):

Implemented on main. src/domain/evidence.ts defines provider-neutral Evidence v2, canonical semantic identity, path-independent IDs, typed authority/environment/locations, and actionable rejection of Evidence v1. CLI and MCP workflows produce the same contract. tests/evidence.test.ts covers deterministic identity, semantic changes, malformed input, path independence, provider identity, and the v1 rejection path.

<!-- gh-comment-id:5001468386 --> @morluto commented on GitHub (Jul 17, 2026): Implemented on main. `src/domain/evidence.ts` defines provider-neutral Evidence v2, canonical semantic identity, path-independent IDs, typed authority/environment/locations, and actionable rejection of Evidence v1. CLI and MCP workflows produce the same contract. `tests/evidence.test.ts` covers deterministic identity, semantic changes, malformed input, path independence, provider identity, and the v1 rejection path.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#36
No description provided.