Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 35 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ current key state must already be KERIpy-accepted by this verifier; missing
keys leave delivery blocked pending correction. Omitting both retains verification-only operation.

Public `GET /v1/associations/{said}/status` returns stored `pending`, `rejected`,
`verified`, `accepted` or `revoked` status and any initial account observation.
`verifying`, `waiting`, `dead-letter`, `verified`, `accepted` or `revoked` status and any initial account observation.
Accepted/retired records also expose their current event’s delivery progress and
errors. Unknown SAIDs return 404.
GET requires no signature and performs no RPC or refresh.

The sender keeps one request in flight and spaces starts by at least one second,
including successes. Connection failures, timeouts, HTTP 408/429 and 5xx errors
including successes. Up to three attempts handle connection failures, timeouts, HTTP 408/429 and 5xx errors
(except 501/505) retry automatically with jittered backoff from 1–2 seconds to
150–300 seconds. A valid `Retry-After` is a minimum, even beyond that cap.
Cooldown applies to the whole destination and survives restart. Only the expected
Expand Down Expand Up @@ -71,7 +71,7 @@ account checks run, and Ethereum publication remains the oracle's responsibility
| `verification` | `coordinating`, `credentials`, `eoa`, `worker`, `rpc`: initial credential/wallet/account verification; `constants`, `schema_cache`, `errors` support that contract. |
| `associations` | `accepting`, `retiring`, `statusing`: application acceptance, verified association revocation and public stored status. |
| `delivery` | `authing`, `delivering`: signed transport/replay protection and webhook attempts, retry pacing and ACK policy. |
| `persistence` | `records`, `basing`: durable record schemas and atomic verification, acceptance/outbox and delivery transitions. |
| `persistence` | `records`, `basing`, `registry`: durable record schemas and atomic verification, acceptance/outbox and delivery transitions. |

These are sibling leaf component packages. Runtime composes them; workflow
components depend on persistence and KERIpy evidence, not on runtime or each
Expand All @@ -85,14 +85,23 @@ or unusable RPC responses leave unfinished work for retry. KERIpy acceptance is
separate from receipt of bytes; KELs, TELs, credentials and schemas live in the
KERIpy Habery/Reger stores, not in the work record.

Unfinished verification lives in `pending`; completed initial checks live in
`results` with a `verified` or `rejected` outcome. Completion writes the result
and removes pending work in one LMDB transaction. Duplicate Grants preserve the
first Grant and never re-enqueue completed work. Verified results retain the
wallet and initial account observation; they do not mean application acceptance,
webhook delivery or Ethereum endorsement. Restart rediscovers pending work.

`AcceptanceDoer` reads completed results and locally accepted issuance evidence
Each worker handles one item at a time. A native Grant notice is durably handed
into `grant-active.` before its native notification is removed. Replay creates
`pending.` verification work. The coordinator moves one candidate into
`verifying.` and charges its attempt before starting the EOA check. Missing
material or transient RPC errors move it to `waiting.` with a persisted UTC retry
deadline. A time-ordered deadline index selects the next due item; no work-history
scan or in-memory retry calendar exists. Completion atomically writes `results.`,
removes active work and, on success, queues `accepting.`.

Grant replay and verification each allow three attempts, five seconds apart.
Interrupted attempts count. Exhaustion retains diagnostics in `grant-dead.` or
`verification-dead.` until explicit operator retry. Definitively invalid proofs
produce a rejected result. Duplicate Grants preserve the original work and never
re-enqueue completed or dead-letter candidates. Restart resumes durable phases.
A verification result is not acceptance, webhook delivery or an Ethereum endorsement.

`AcceptanceDoer` takes one unfinished `accepting.` record and locally accepted issuance evidence
without repeating initial checks. Acceptance permanently binds the exact issuer/nonce
to one SAID, atomically with immutable facts and any configured outbox obligation.
Another SAID using that pair becomes locally `rejected` with `NONCE_REUSED`; its
Expand All @@ -105,24 +114,23 @@ Acceptance runs with or without webhooks. With no target, public `delivery` is n
enabling delivery later does not backfill events for locally accepted records.
Restart recovers results awaiting acceptance. KERIpy evidence lives in a separate
database and is not part of the application transaction. Missing evidence or
already-known revocation prevents first acceptance. Observation age does not
already-known revocation moves the acceptance to `acceptance-dead.` for inspection. Observation age does not
invalidate an accepted record.

`RetirementDoer` scans bounded pages of accepted records against locally accepted
association TEL state. KERIpy `rev`/`brv` retires only that SAID and atomically
creates its second event when an original delivery exists, preserving original issuance facts, observation and
webhook destination. Duplicate evidence and restart do not create more events or
revive retirement. A different association for the same wallet is untouched;
ownership selection belongs to the oracle.

IPEX Grant delivers supporting KEL/TEL artifacts; the Grant’s embedded
issuance or credential alone does not prove revocation. The existing shared parser
and escrows validate those artifacts. Retirement also recovers from stored KERIpy
state after restart, so it requires neither a retained cue nor another Grant.
Missing or escrowed evidence leaves accepted status unchanged. This local scan
performs no account/source reassessment or network refresh. Previously accepted
records still retire when webhook sending is disabled; their delivery obligations
remain stored for the original destination.
`VerifierReger` subclasses the pinned native registry at `putTel`, the final
accepted-TEL index write. It atomically writes a `verifier-revocations.` handoff
for `rev`/`brv` in that same registry environment. Native KERIpy validation and
escrows still decide whether an event is accepted. Unanchored evidence creates
no handoff.

`RetirementDoer` consumes one handoff, retires only its exact accepted association
and commits its immutable second delivery event before acknowledging the handoff.
Restart safely repeats either side of this two-store commit boundary. Completed
association history is never scanned. Revocation before acceptance is caught by
the final verification check and the local acceptance guard. Original issuance
facts, observation and destination are preserved; other associations for the
wallet are untouched. Previously accepted records still retire with sending
disabled, retaining any original delivery obligations.

`run_service()` owns shared stores through KERIpy context managers.
`VerifierService` borrows those stores and composes the HIO tasks. HIO stops
Expand Down
7 changes: 5 additions & 2 deletions adrs/0004-component-organization.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,15 @@ Retain one VerifierBaser and one application LMDB transaction boundary. Completi
writes results/removes pending work atomically. Acceptance and retirement each
commit association status and its immutable outbox event together. Event creation
stays beside these transitions; delivery sends stored bytes. KERIpy evidence
stores remain separate, with bounded recovery scans bridging commit gaps.
stores remain separate. Durable phase queues bridge commit gaps; the native
accepted-TEL index and its revocation handoff commit atomically in VerifierReger.
No completed-result or association-history scans schedule work.

Keep authentication separate from ACK policy, verification separate from
acceptance, and oracle ownership/chain publication outside this application.
Preserve the coordinator's native-state recheck after RPC waits and the existing
HIO task/store lifetime. Table names, record fields and wire formats do not change.
HIO task/store lifetime. The subsequent durable-phase refactor changes storage
without compatibility readers; the authenticated event format remains unchanged.

## Import migration

Expand Down
8 changes: 4 additions & 4 deletions adrs/0005-accepted-association-nonces.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ owns nonce syntax and signed commitments.
obligation in one native synchronous LMDB write transaction. Insert without
overwrite and inspect existing data in the same transaction. Inconsistent or
orphaned claims abort acceptance. Native LMDB supplies process coordination; no
application locks, threads, queues or additional environment are needed.
application locks, threads or additional environment are needed for nonce claims.

The typed `AcceptedNonce` record stores issuer, exact nonce and accepted SAID.
Komer's ordinary issuer.nonce key is unambiguous under the credential profile and
at most 173 bytes, within the pinned environment's 511-byte key limit. Hashing
or custom key encodings add no value. Standard name/base/head-dir selects the
existing application store. Persistent closure retains all claims.

KERIpy evidence and application state use separate transactions. A bounded
acceptance scan recovers completed verified results; invalid, pending or revoked
KERIpy evidence and application state use separate transactions. A dedicated
`accepting.` phase recovers completed verified results one at a time; invalid, pending or revoked
evidence cannot burn a nonce. Target-free acceptance still claims the nonce,
without an event. Later enabling delivery does not backfill those acceptances.

## Store and operational limits

The `issuer-nonce-ascii-v1` scope requires complete claim history. Startup rejects
The `durable-phases-v1` scope requires complete claim history. Startup rejects
pre-policy or inconsistent acceptance stores; it does not migrate, backfill or
recreate missing claims. The history audit currently holds accepted SAIDs in
memory. Uniqueness applies within one preserved verifier store, not globally
Expand Down
81 changes: 58 additions & 23 deletions docs/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ KERIpy options for a new identity only. The application store is bound to its
GEDA root and chain ID before workers start, including operation without webhook delivery.
Changing either requires separate stores. Existing stores with completed results
but no recorded scope are refused; preserve them and use fresh stores rather than guessing their original policy. Pre-policy stores are also refused: acceptance now requires permanent issuer/nonce
history under policy `issuer-nonce-ascii-v1`. Association nonces must contain
history under policy `durable-phases-v1`. Association nonces must contain
1–128 ASCII characters from `[A-Za-z0-9_-]`; no normalization is applied. Use a deliberate fresh store set; there is
no migration or backfill. Never reset accepted history to evade nonce rejection.
Enabling webhook delivery with the same root/chain remains supported, but does not
Expand Down Expand Up @@ -81,13 +81,51 @@ when the association had an original outbox obligation. Local-only acceptance
retires locally without an event.
Retiring an old association does not retire its replacement.

## Verification and intake failures

The service progresses one item per worker through dedicated durable phases:

| Work | Ready / active | Waiting | Manual intervention |
| --- | --- | --- | --- |
| Grant replay | native Noter / `grant-active.` | `grant-waiting.` with `grant-due.` deadline index | `grant-dead.` |
| Initial verification | `pending.` / `verifying.` | `waiting.` with `verification-due.` deadline index | `verification-dead.` |
| Acceptance | `accepting.` | none: local evidence was already verified | `acceptance-dead.` |
| Verified revocation | `verifier-revocations.` in the native registry | none | unexpected storage errors stop the worker and retain work |

Grant replay and verification allow three attempts with five-second UTC cooldowns.
The attempt commits before processing; an interruption consumes that attempt.
Due retries take precedence over fresh work. No batch paging, completed-history
scanning or in-memory retry timing participates. A missing Grant moves out of
native notifications so it cannot block later notices. Invalid Grants retain
diagnostics immediately; invalid credential proofs become terminal rejections.

Public association GET distinguishes `pending`, `verifying`, `waiting` and
`dead-letter`, including attempts and the next eligible time. Acceptance failures
show `phase: acceptance`. Grant failures can precede knowing the credential SAID;
inspect `grant-dead.` records in the local application store for their notice ID,
Grant attributes and reason. Correct the missing material or RPC configuration,
stop the service, and explicitly resume the affected phase:

```sh
eoa-verifier retry-grant "$NOTICE_ID" --name verifier --head-dir /var/lib/eoa-verifier
eoa-verifier retry-verification "$SAID" --name verifier --head-dir /var/lib/eoa-verifier
eoa-verifier retry-acceptance "$SAID" --name verifier --head-dir /var/lib/eoa-verifier
```

Retry renews only the selected operation's budget; it does not bypass validation,
revocation guards or nonce ownership. Known revocation cannot be repaired by retry.
These queues require fresh stores. There are no compatibility readers or migration.
The native `putTel` boundary is qualified against `gleif_keri==1.2.19`; upgrading
that dependency requires checking its accepted-event write order and requalifying.

## Delivery failures

Transient network/HTTP failures retry automatically with persisted destination
cooldown. Each attempt signs the same immutable event bytes anew. Only an expected
cooldown, up to `--webhook-max-attempts` (default three). Exhaustion moves the event
to the durable dead-letter queue. Each attempt signs the same immutable event bytes anew. Only an expected
authenticated HTTP 200 ACK completes it. Observation age never triggers refresh.
Malformed HTTP chunk framing closes the affected client without stopping sibling
tasks. RPC observations remain retryable; malformed webhook responses leave their
tasks. RPC observations use a three-attempt verification budget; malformed webhook responses leave their
events blocked and unacknowledged for correction and explicit resumption.
Permanent failures remain blocked until the cause is corrected; restart alone
does not unblock them. Inspect public status and fix peer keys, authorization,
Expand All @@ -98,28 +136,25 @@ Local operators can inspect `store.destinations.get(keys=(event.destination,))`
for the destination's failure count and `nextAttemptAt` (UTC Unix seconds). These
scheduling records remain durable and drive the sender; they are absent from public GET.

An embedding application can call `service.sender.request(event_id)`. For a
standalone process, stop it and use its installed Python to unblock the **current**
event with the same store coordinates, then restart. This preserves the event and destination cooldown, recording the
retry request as its current reason; it does not mark an ACK:

```python
from keri.db import dbing
from eoa_verifier.persistence.basing import VerifierBaser

with dbing.openLMDB(cls=VerifierBaser, name="verifier", base="",
headDirPath="/var/lib/eoa-verifier", temp=False) as store:
event_id = "<association-said>:<status-revision>" # From the public status response.
event = store.outbox.get(keys=(event_id,))
if event is None or event.acknowledged:
raise ValueError("event is unknown or already acknowledged")
status = store.associations.get(keys=(event.associationSaid,))
if status.eventId != event_id:
raise ValueError("only the current association event can resume")
store.delivery_result(event_id, error="operator requested retry after correction",
blocked=False)
Acceptance and delivery are distinct durable phases. `accepting.` contains only
unfinished acceptance; `delivery-ready.` and the single `delivery-active.` slot
contain unfinished outbound work. `delivery-dead.` retains exhausted/permanent
failures. Completed verification/results and immutable outbox history are not
scanned to discover delivery work. These are breaking storage changes; use fresh
stores rather than expecting backfill or migration.

After correcting the cause, stop the service and resume the current dead letter:

```sh
eoa-verifier retry-delivery "$EVENT_ID" --name verifier --head-dir /var/lib/eoa-verifier
```

Use the same name/base/head directory as startup, then restart. An embedding
application can call `service.sender.request(event_id)`. Both paths explicitly
requeue a dead letter and reset its bounded attempt budget, retaining immutable
event bytes and destination cooldown. They never mark an ACK. An obsolete event
remains ineligible for delivery even if an operator retries it.

Do not edit event bytes, delete replay records or clear accepted/revoked status to
retry delivery. There is no retry REST route. Undelivered revocation can leave a
downstream mapping active until delivery and withdrawal finish. Source-chain
Expand Down
Loading
Loading