Findings Ledger Replay & Determinism Harness (LEDGER-29-008)

Audience: Findings Ledger Guild · QA Guild · Policy Guild
Purpose: Define the reproducible harness for 5 M findings/tenant replay tests and determinism validation required by LEDGER-29-008.

1. Goals

2. Architecture

Fixtures (.ndjson) → Harness Runner → Ledger Writer API → Postgres Ledger DB
                                     ↘ Projector (same DB) ↘ Metrics snapshot

3. CLI usage

dotnet run --project tools/LedgerReplayHarness \
  -- --fixture fixtures/ledger/tenant-a.ndjson \
     --connection "Host=postgres;Username=stellaops;Password=***;Database=findings_ledger" \
     --tenant tenant-a \
     --maxParallel 8 \
     --report out/harness/tenant-a-report.json

Options:

OptionDescription
--fixturePath to NDJSON file (supports multiple).
--connectionPostgres connection string (writer + projector share).
--tenantTenant identifier; harness ensures partitions exist.
--maxParallelBatch concurrency (default 4).
--reportOutput path for report JSON; .sig generated alongside.
--metrics-endpointOptional Prometheus scrape URI for live metrics snapshot.

4. Verification steps

  1. Hash validation: Recompute event_hash for each appended event and ensure matches fixture.
  2. Sequence integrity: Confirm gapless sequences per chain; harness aborts on mismatch.
  3. Projection determinism: Compare projector-derived cycle_hash with expected value from fixture metadata.
  4. Performance: Capture P50/P95 latencies for ledger_write_latency_seconds and ensure targets (<120 ms P95) met.
  5. Resource usage: Sample CPU/memory via dotnet-counters, Stella Ops telemetry, or host metrics and store in report.
  6. Merkle root check: Rebuild Merkle tree from events and ensure root equals database ledger_merkle_roots entry.

5. Output report schema

{
  "tenant": "tenant-a",
  "fixtures": ["fixtures/ledger/tenant-a.ndjson"],
  "eventsWritten": 5123456,
  "durationSeconds": 1422.4,
  "latencyP95Ms": 108.3,
  "projectionLagMaxSeconds": 18.2,
  "cpuPercentMax": 72.5,
  "memoryMbMax": 3580,
  "merkleRoot": "3f1a…",
  "status": "pass",
  "timestamp": "2025-11-13T11:45:00Z"
}

The harness writes harness-report.json plus harness-report.json.sig (DSSE) and metrics-snapshot.prom for archival.

6. CI integration

7. Air-gapped execution


Draft prepared 2025-11-13 for LEDGER-29-008. Update when CLI options or thresholds change.