verify
Verifies the tamper-evident hash chain for runId over entries with seq in [fromSeq, toSeq].
For each entry in the range, the verifier:
Re-encodes the stored entry to its canonical bytes (using the registered payload encoder).
Recomputes
SHA-256(canonical bytes).Compares the recomputed hash to the hash stored in the journal at append time (via HashStoringJournal.getStoredHash). A mismatch at seq
Nreturns VerifyResult.Broken.
Fail-soft policy
This function never throws. All error conditions are returned as VerifyResult.Broken:
fromSeq < 0ortoSeq < fromSeq→Broken(firstBadSeq = -1, expected = "valid range", actual = ...)No encoder registered (hashing disabled /
Hashing.None) →Broken(firstBadSeq = 0, expected = "<unsupported>", actual = "hashing disabled")sagaExecutornot yet called for this journal →Broken(firstBadSeq = 0, expected = "no codec attached", actual = "call sagaExecutor before verify")Malformed stored
prevHash(not 64 lowercase hex chars) →Broken(seq, expected = "valid prevHash", actual = "<bad value>")
Pagination
pageSize entries are processed per page. When the range spans more than one page, VerifyResult.Incomplete is returned with the next start seq. Callers can cover the full chain with:
var result: VerifyResult = journal.verify(runId, 0, Long.MAX_VALUE)
while (result is VerifyResult.Incomplete) {
result = journal.verify(runId, result.resumeFromSeq, Long.MAX_VALUE)
}Return
JournalOutcome.Ok wrapping a VerifyResult, or JournalOutcome.Err if the journal itself fails to return entries (storage error, not a tamper detection).
Parameters
The saga run to verify.
Inclusive start of the seq range (default 0 = beginning of chain).
Inclusive end of the seq range (default Long.MAX_VALUE = full chain).
Maximum number of entries to read per SagaJournal.since call.