[GH-ISSUE #50] Add an in-memory evidence ledger and deterministic bundle model #38

Closed
opened 2026-10-15 18:20:19 +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/50

Problem

Individual evidence records are reproducible but investigations cannot collect, deduplicate, or export them coherently.

Outcome

Add a session-owned in-memory ledger and a deterministic bundle domain model.

Scope

  • Record each successful public analysis result exactly once.
  • Deduplicate by Evidence v2 ID.
  • Track artifact, provider, environment, scenario, and capture manifests.
  • Sort exported records and manifests by stable identity.
  • Clear the ledger when its owning session closes.
  • Never record failed calls as successful evidence.

Acceptance criteria

  • Direct and enhanced calls add exactly one record; composed internal calls do not create duplicates.
  • Repeated identical calls deduplicate.
  • Switching targets retains earlier evidence until session close.
  • Cancellation and failures leave the ledger unchanged.
  • Bundle serialization is byte-stable for equivalent ledger contents.
  • Memory and record-count bounds return typed truncation/limit errors rather than evicting evidence silently.

Verification

Tests cover deduplication, switching, concurrent calls, cancellation, session shutdown, deterministic ordering, limits, and multi-provider manifests.

Dependencies

Parent: #48. Requires canonical Evidence v2 records.

Non-goals

Database persistence, cloud synchronization, or filesystem import/export.

Originally created by @morluto on GitHub (Jul 12, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/50 ## Problem Individual evidence records are reproducible but investigations cannot collect, deduplicate, or export them coherently. ## Outcome Add a session-owned in-memory ledger and a deterministic bundle domain model. ## Scope - Record each successful public analysis result exactly once. - Deduplicate by Evidence v2 ID. - Track artifact, provider, environment, scenario, and capture manifests. - Sort exported records and manifests by stable identity. - Clear the ledger when its owning session closes. - Never record failed calls as successful evidence. ## Acceptance criteria - Direct and enhanced calls add exactly one record; composed internal calls do not create duplicates. - Repeated identical calls deduplicate. - Switching targets retains earlier evidence until session close. - Cancellation and failures leave the ledger unchanged. - Bundle serialization is byte-stable for equivalent ledger contents. - Memory and record-count bounds return typed truncation/limit errors rather than evicting evidence silently. ## Verification Tests cover deduplication, switching, concurrent calls, cancellation, session shutdown, deterministic ordering, limits, and multi-provider manifests. ## Dependencies Parent: #48. Requires canonical Evidence v2 records. ## Non-goals Database persistence, cloud synchronization, or filesystem import/export.
Author
Owner

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

Implemented on main. src/application/EvidenceLedger.ts owns bounded session records, deduplication, residual-unknown revisions, deterministic bundle projection/import, atomic conflict checks, and clearing at session close. BinarySession owns the ledger across target changes. Evidence/session tests cover deduplication, bounds, atomic conflict rejection, and lifecycle behavior.

<!-- gh-comment-id:5001468717 --> @morluto commented on GitHub (Jul 17, 2026): Implemented on main. `src/application/EvidenceLedger.ts` owns bounded session records, deduplication, residual-unknown revisions, deterministic bundle projection/import, atomic conflict checks, and clearing at session close. `BinarySession` owns the ledger across target changes. Evidence/session tests cover deduplication, bounds, atomic conflict rejection, and lifecycle behavior.
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#38
No description provided.