-
Notifications
You must be signed in to change notification settings - Fork 58
Fix revocation badge #1822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix revocation badge #1822
Changes from all commits
75779bd
2a35099
4c94fd2
1d39417
a8bba60
2f438bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,15 +19,10 @@ | |
| EVENT_LISTENER_PATTERN as INDY_SCHEMA_EVENT_PATTERN, | ||
| ) | ||
|
|
||
| # Try to import ANONCREDS_SCHEMA_FINISHED_EVENT, but handle the case where it doesn't exist | ||
| # (e.g., if using an older version of acapy that doesn't have this event yet) | ||
| try: | ||
| from acapy_agent.anoncreds.events import ( | ||
| SCHEMA_FINISHED_EVENT as ANONCREDS_SCHEMA_FINISHED_EVENT, | ||
| ) | ||
| except (ImportError, AttributeError): | ||
| # If the event doesn't exist, we'll only subscribe to Indy events | ||
| ANONCREDS_SCHEMA_FINISHED_EVENT = None | ||
| # Import the AnonCreds schema finished event | ||
| from acapy_agent.anoncreds.events import ( | ||
| SCHEMA_FINISHED_EVENT as ANONCREDS_SCHEMA_FINISHED_EVENT, | ||
| ) | ||
|
|
||
| LOGGER = logging.getLogger(__name__) | ||
|
|
||
|
|
@@ -274,13 +269,12 @@ async def sync_created(self, profile: Profile): | |
| def subscribe(bus: EventBus): | ||
| # Subscribe to Indy schema events | ||
| bus.subscribe(INDY_SCHEMA_EVENT_PATTERN, schemas_event_handler) | ||
| # Subscribe to AnonCreds schema events if available | ||
| # Explicitly compile as literal pattern to ensure it's a Pattern object, not a string | ||
| if ANONCREDS_SCHEMA_FINISHED_EVENT: | ||
| bus.subscribe( | ||
| re.compile(re.escape(ANONCREDS_SCHEMA_FINISHED_EVENT)), | ||
| schemas_event_handler, | ||
| ) | ||
| # Subscribe to AnonCreds schema finished events | ||
| # Use exact match pattern - escape special chars and anchor to start/end | ||
| bus.subscribe( | ||
| re.compile(f"^{re.escape(ANONCREDS_SCHEMA_FINISHED_EVENT)}$"), | ||
| schemas_event_handler, | ||
| ) | ||
|
Comment on lines
269
to
+277
|
||
|
|
||
|
|
||
| def _normalize_schema_event_payload(event: Event) -> dict: | ||
|
|
@@ -292,10 +286,7 @@ def _normalize_schema_event_payload(event: Event) -> dict: | |
| payload = event.payload | ||
|
|
||
| # Check event topic to determine if it's AnonCreds or Indy | ||
| if ( | ||
| ANONCREDS_SCHEMA_FINISHED_EVENT | ||
| and event.topic == ANONCREDS_SCHEMA_FINISHED_EVENT | ||
| ): | ||
| if event.topic == ANONCREDS_SCHEMA_FINISHED_EVENT: | ||
| # AnonCreds event: SchemaFinishedPayload NamedTuple | ||
| if hasattr(payload, "schema_id"): | ||
| return { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -589,46 +589,14 @@ export const useGovernanceStore = defineStore('governance', () => { | |||||||||||||||||||||||||||||||||
| .then((res) => { | ||||||||||||||||||||||||||||||||||
| result = res.data; | ||||||||||||||||||||||||||||||||||
| console.log(result); | ||||||||||||||||||||||||||||||||||
| // Schema finished event will be handled by the backend event handler | ||||||||||||||||||||||||||||||||||
| // which will automatically add it to storage | ||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||
| .then(async () => { | ||||||||||||||||||||||||||||||||||
| // Extract schema_id from response | ||||||||||||||||||||||||||||||||||
| const schemaId = result?.schema_state?.schema_id; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (!schemaId) { | ||||||||||||||||||||||||||||||||||
| console.warn('No schema_id found in response, cannot verify storage'); | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Wait a bit for event handler to complete (if it runs) | ||||||||||||||||||||||||||||||||||
| await new Promise((resolve) => setTimeout(resolve, 1500)); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Refresh the stored schema list | ||||||||||||||||||||||||||||||||||
| // Wait a moment for the backend event handler to process and store the schema | ||||||||||||||||||||||||||||||||||
| await new Promise((resolve) => setTimeout(resolve, 500)); | ||||||||||||||||||||||||||||||||||
| // Refresh the schema list to show the newly created schema | ||||||||||||||||||||||||||||||||||
| await listStoredSchemas(); | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+596
to
599
|
||||||||||||||||||||||||||||||||||
| // Wait a moment for the backend event handler to process and store the schema | |
| await new Promise((resolve) => setTimeout(resolve, 500)); | |
| // Refresh the schema list to show the newly created schema | |
| await listStoredSchemas(); | |
| // Poll for a short period to give the backend event handler time | |
| // to process and store the schema before refreshing the list. | |
| const maxAttempts = 10; | |
| const delayMs = 500; | |
| for (let attempt = 0; attempt < maxAttempts; attempt++) { | |
| // Refresh the schema list to show the newly created schema | |
| await listStoredSchemas(); | |
| // If more attempts remain, wait before the next poll | |
| if (attempt < maxAttempts - 1) { | |
| await new Promise((resolve) => setTimeout(resolve, delayMs)); | |
| } | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR title is focused on a UI revocation badge fix, but this change also upgrades
acapy-agentfrom an RC to1.5.0(plus corresponding Docker image/lockfile changes) and adjusts schema event subscription behavior. If these are required for the badge fix, it would help to mention that in the PR description; otherwise consider splitting the dependency/runtime upgrade into a separate PR to keep scope and rollback surface smaller.