Skip to content

Commit 34f9472

Browse files
ff137swcurran
andauthored
✨ Recoverable, event-driven revocation registry management (#3831)
* feat: Add granular revocation registry events - Implement retry mechanism for failed events - Add auto-recovery functionality - Improve event traceability and logging - Handle resource conflicts gracefully - Add configurable retry settings :art: Support passing uncompiled string to EventBus.subscribe Signed-off-by: ff137 <ff137@proton.me> :art: Signed-off-by: ff137 <ff137@proton.me> :construction: Signed-off-by: ff137 <ff137@proton.me> :art: Signed-off-by: ff137 <ff137@proton.me> :art: Signed-off-by: ff137 <ff137@proton.me> :bug: Fix required field Signed-off-by: ff137 <ff137@proton.me> :bug: Signed-off-by: ff137 <ff137@proton.me> :sparkles: Update handling of full registries Signed-off-by: ff137 <ff137@proton.me> :bug: Signed-off-by: ff137 <ff137@proton.me> :loud_sound: Signed-off-by: ff137 <ff137@proton.me> :sparkles: Failure payloads, retry_count handling, and Signed-off-by: ff137 <ff137@proton.me> :sparkles: Recovery manager and middleware wiring Signed-off-by: ff137 <ff137@proton.me> :loud_sound: Signed-off-by: ff137 <ff137@proton.me> :sparkles: Store full handling events too Signed-off-by: ff137 <ff137@proton.me> :art: New correlation_id for each successful request Signed-off-by: ff137 <ff137@proton.me> :art: Clear the set_active_registry_event option of correlation id Signed-off-by: ff137 <ff137@proton.me> :art: Fix correlation of full handling event Signed-off-by: ff137 <ff137@proton.me> :construction: Test async event bus Signed-off-by: ff137 <ff137@proton.me> :art: Rename "get or create" method; it just gets Signed-off-by: ff137 <ff137@proton.me> :sparkles: Shield methods that create resource on ledger Signed-off-by: ff137 <ff137@proton.me> :construction: Debug logging Signed-off-by: ff137 <ff137@proton.me> :bug: Fix default value for settings Signed-off-by: ff137 <ff137@proton.me> :construction: Debug deserializing Signed-off-by: ff137 <ff137@proton.me> :art: Remove rev_reg_def_private from payloads Write private def to temp key Signed-off-by: ff137 <ff137@proton.me> :sparkles: Handle resource already exists for RevList Signed-off-by: ff137 <ff137@proton.me> :art: Signed-off-by: ff137 <ff137@proton.me> :construction: Signed-off-by: ff137 <ff137@proton.me> :bug: pop correlation_id from set active registry options Signed-off-by: ff137 <ff137@proton.me> :art: Add retry sleep time Signed-off-by: ff137 <ff137@proton.me> :recycle: First upload tail file; skip TailsUpload request / response Signed-off-by: ff137 <ff137@proton.me> :art: Call notify issuer placeholder Signed-off-by: ff137 <ff137@proton.me> :bug: Fix recovery of private rev reg def Signed-off-by: ff137 <ff137@proton.me> :art: Remove unnecessary event and record type Signed-off-by: ff137 <ff137@proton.me> :sparkles: Only recover events older than some delay Signed-off-by: ff137 <ff137@proton.me> :art: Add descriptions to events Signed-off-by: ff137 <ff137@proton.me> :art: Improve state machine log traceability Signed-off-by: ff137 <ff137@proton.me> :art: Only mark profile recovered with no pending event Signed-off-by: ff137 <ff137@proton.me> :sparkles: Emit event if manual intervention required Signed-off-by: ff137 <ff137@proton.me> :wrench: Make retry count and sleep time configurable Signed-off-by: ff137 <ff137@proton.me> :art: Add request id, for traceability Signed-off-by: ff137 <ff137@proton.me> :sparkles: Retry all failed events if retryable, with expiry timestamps Signed-off-by: ff137 <ff137@proton.me> :loud_sound: Verbose logs for traceability Signed-off-by: ff137 <ff137@proton.me> :bug: Signed-off-by: ff137 <ff137@proton.me> :art: Signed-off-by: ff137 <ff137@proton.me> :bug: Add missing log arg Signed-off-by: ff137 <ff137@proton.me> :art: Signed-off-by: ff137 <ff137@proton.me> :art: Generate request_id with emitting full registry Signed-off-by: ff137 <ff137@proton.me> :art: Add options to RevListFinishedEvent Signed-off-by: ff137 <ff137@proton.me> :bug: Fix import Signed-off-by: ff137 <ff137@proton.me> :bug: Always call handlers outside of try blocks Signed-off-by: ff137 <ff137@proton.me> :recycle: Remove legacy in-between event: RevRegDefFinishedEvent Signed-off-by: ff137 <ff137@proton.me> :recycle: Refactor event storage type Keep events in requested state when being retried. Remove completed state -- success or failure is enough Signed-off-by: ff137 <ff137@proton.me> :art: Debug Signed-off-by: ff137 <ff137@proton.me> :bug: Fix updating event for retry Signed-off-by: ff137 <ff137@proton.me> :art: Make auto-recovery check disabled by default Signed-off-by: ff137 <ff137@proton.me> :art: Add config map for auto recovery `ACAPY_ENABLE_AUTO_REVOCATION_RECOVERY` maps to `anoncreds.revocation.auto_recovery_enabled`, such that it can be passed in wallet extra settings Signed-off-by: ff137 <ff137@proton.me> * :art: Fix type checking Signed-off-by: ff137 <ff137@proton.me> * :art: Signed-off-by: ff137 <ff137@proton.me> * :test_tube: Update tests Signed-off-by: ff137 <ff137@proton.me> * :art: Deduplicate Signed-off-by: ff137 <ff137@proton.me> * :white_check_mark: Test coverage for new revocation setup module Signed-off-by: ff137 <ff137@proton.me> * :test_tube: Expanded test coverage Signed-off-by: ff137 <ff137@proton.me> * :art: Fix SonarCloud issues Signed-off-by: ff137 <ff137@proton.me> * :art: Implement event age for cleanup of completed events Signed-off-by: ff137 <ff137@proton.me> * :test_tube: Test coverage for event storage Signed-off-by: ff137 <ff137@proton.me> * :test_tube: Expand test coverage; notify issuer if registry activation fails Signed-off-by: ff137 <ff137@proton.me> * :art: Deduplicate Signed-off-by: ff137 <ff137@proton.me> * :art: Simplify Signed-off-by: ff137 <ff137@proton.me> * :art: Fix mypy errors in revocation and _setup Signed-off-by: ff137 <ff137@proton.me> * :test_tube: More unit test coverage: middleware and event recovery Signed-off-by: ff137 <ff137@proton.me> * :truck: Move auto-recovery modules to own package Signed-off-by: ff137 <ff137@proton.me> * :art: Fix SonarCloud issues Signed-off-by: ff137 <ff137@proton.me> * :bug: Fix error handling for revocation methods accessed by routes Signed-off-by: ff137 <ff137@proton.me> * :art: Improve type handling in revocation routes Signed-off-by: ff137 <ff137@proton.me> * :test_tube: Fix tests Signed-off-by: ff137 <ff137@proton.me> * :art: Signed-off-by: ff137 <ff137@proton.me> * :memo: First-draft documentation of event-driven auto-recovery Signed-off-by: ff137 <ff137@proton.me> * :bug: Handle nested tuple in serializing nested object Signed-off-by: ff137 <ff137@proton.me> --------- Signed-off-by: ff137 <ff137@proton.me> Co-authored-by: Stephen Curran <swcurran@gmail.com>
1 parent 56a5543 commit 34f9472

28 files changed

Lines changed: 7729 additions & 637 deletions

acapy_agent/admin/server.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from aiohttp_apispec import setup_aiohttp_apispec, validation_middleware
1414
from uuid_utils import uuid4
1515

16+
from ..anoncreds.revocation.auto_recovery import revocation_recovery_middleware
1617
from ..config.injection_context import InjectionContext
1718
from ..config.logging import context_wallet_id
1819
from ..core.event_bus import Event, EventBus
@@ -381,6 +382,9 @@ async def setup_context(request: web.Request, handler):
381382
# Upgrade middleware needs the context setup
382383
middlewares.append(upgrade_middleware)
383384

385+
# Revocation registry event recovery middleware
386+
middlewares.append(revocation_recovery_middleware)
387+
384388
# Register validation_middleware last avoiding unauthorized validations
385389
middlewares.append(validation_middleware)
386390

0 commit comments

Comments
 (0)