From 9aa6e8e7deb6decfec776a4e48f75253d18c7ac0 Mon Sep 17 00:00:00 2001 From: Mauve Signweaver Date: Mon, 27 Oct 2025 12:21:59 -0400 Subject: [PATCH] feat: Add optional reason for role changes --- proto/role/v1.proto | 1 + schema/role/v1.json | 4 ++++ test/fixtures/good-docs-completed.js | 16 ++++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/proto/role/v1.proto b/proto/role/v1.proto index 440013b7..0a020dcd 100644 --- a/proto/role/v1.proto +++ b/proto/role/v1.proto @@ -15,4 +15,5 @@ message Role_1 { bytes roleId = 5 [(required) = true]; optional uint32 fromIndex = 6 [(required) = true]; + optional string reason = 7; } diff --git a/schema/role/v1.json b/schema/role/v1.json index 3d6ce896..9b14a04f 100644 --- a/schema/role/v1.json +++ b/schema/role/v1.json @@ -17,6 +17,10 @@ "type": "integer", "minimum": 0, "description": "This is the index of the auth core that this role applies to (identified by the `docId`) to apply this role from. E.g. documents in the auth core assigned this role from this index will be evaluated according to this role." + }, + "reason": { + "type": "string", + "description": "This is an optional reason for why this role change was made. e.g. for blocking from the project or promoting to coordinator" } }, "required": ["schemaName", "roleId", "fromIndex"], diff --git a/test/fixtures/good-docs-completed.js b/test/fixtures/good-docs-completed.js index c8790e3d..52964d48 100644 --- a/test/fixtures/good-docs-completed.js +++ b/test/fixtures/good-docs-completed.js @@ -268,6 +268,22 @@ export const goodDocsCompleted = [ }, expected: {}, }, + { + doc: { + docId: cachedValues.docId, + versionId: cachedValues.versionId, + originalVersionId: cachedValues.originalVersionId, + schemaName: 'role', + createdAt: cachedValues.createdAt, + updatedAt: cachedValues.updatedAt, + links: [], + roleId: '6fd029a78243', + reason: 'Blocked forever', + fromIndex: 5, + deleted: false, + }, + expected: {}, + }, { doc: { docId: cachedValues.docId,