From 80787cd21d7a2f4b5ae6e0df763e47e5273f104d Mon Sep 17 00:00:00 2001 From: "Joseph T. French" Date: Sat, 10 Oct 2026 13:27:47 -0500 Subject: [PATCH] feat(ledger): event blocks carry the document they rest on get_event_block and list_event_blocks select documentId, so a caller can see the bill, receipt or statement an event cites. Set it through update_event_block's document_id ("" detaches). schema.graphql refreshed. Claude-Session: https://claude.ai/code/session_01AQkGGPDmpba9eBV9PkLTfv --- robosystems_client/graphql/generated/get_ledger_event_block.py | 1 + .../graphql/generated/list_ledger_event_blocks.py | 1 + robosystems_client/graphql/generated/operations.py | 2 ++ .../graphql/operations/ledger/GetLedgerEventBlock.graphql | 2 +- .../graphql/operations/ledger/ListLedgerEventBlocks.graphql | 2 +- robosystems_client/graphql/schema.graphql | 1 + tests/test_ledger_client.py | 3 +++ 7 files changed, 10 insertions(+), 2 deletions(-) diff --git a/robosystems_client/graphql/generated/get_ledger_event_block.py b/robosystems_client/graphql/generated/get_ledger_event_block.py index f47e44cd..06800b25 100644 --- a/robosystems_client/graphql/generated/get_ledger_event_block.py +++ b/robosystems_client/graphql/generated/get_ledger_event_block.py @@ -32,6 +32,7 @@ class GetLedgerEventBlockEventBlock(BaseModel): replaces_event_id: Optional[str] = Field(alias="replacesEventId") obligated_by_event_id: Optional[str] = Field(alias="obligatedByEventId") discharges_event_id: Optional[str] = Field(alias="dischargesEventId") + document_id: Optional[str] = Field(alias="documentId") created_at: str = Field(alias="createdAt") created_by: str = Field(alias="createdBy") diff --git a/robosystems_client/graphql/generated/list_ledger_event_blocks.py b/robosystems_client/graphql/generated/list_ledger_event_blocks.py index 01f3f90a..4d085464 100644 --- a/robosystems_client/graphql/generated/list_ledger_event_blocks.py +++ b/robosystems_client/graphql/generated/list_ledger_event_blocks.py @@ -32,6 +32,7 @@ class ListLedgerEventBlocksEventBlocks(BaseModel): replaces_event_id: Optional[str] = Field(alias="replacesEventId") obligated_by_event_id: Optional[str] = Field(alias="obligatedByEventId") discharges_event_id: Optional[str] = Field(alias="dischargesEventId") + document_id: Optional[str] = Field(alias="documentId") created_at: str = Field(alias="createdAt") created_by: str = Field(alias="createdBy") diff --git a/robosystems_client/graphql/generated/operations.py b/robosystems_client/graphql/generated/operations.py index 4c951c1b..affdf02a 100644 --- a/robosystems_client/graphql/generated/operations.py +++ b/robosystems_client/graphql/generated/operations.py @@ -630,6 +630,7 @@ replacesEventId obligatedByEventId dischargesEventId + documentId createdAt createdBy } @@ -1554,6 +1555,7 @@ replacesEventId obligatedByEventId dischargesEventId + documentId createdAt createdBy } diff --git a/robosystems_client/graphql/operations/ledger/GetLedgerEventBlock.graphql b/robosystems_client/graphql/operations/ledger/GetLedgerEventBlock.graphql index 8dbed6a0..0a3f321e 100644 --- a/robosystems_client/graphql/operations/ledger/GetLedgerEventBlock.graphql +++ b/robosystems_client/graphql/operations/ledger/GetLedgerEventBlock.graphql @@ -3,7 +3,7 @@ query GetLedgerEventBlock($id: String!) { id eventType eventCategory eventClass status occurredAt effectiveAt source externalId externalUrl amount currency description metadata dimensionIds agentId resourceType resourceElementId - replacedByEventId replacesEventId obligatedByEventId dischargesEventId + replacedByEventId replacesEventId obligatedByEventId dischargesEventId documentId createdAt createdBy } } diff --git a/robosystems_client/graphql/operations/ledger/ListLedgerEventBlocks.graphql b/robosystems_client/graphql/operations/ledger/ListLedgerEventBlocks.graphql index c82a5b74..81339d6a 100644 --- a/robosystems_client/graphql/operations/ledger/ListLedgerEventBlocks.graphql +++ b/robosystems_client/graphql/operations/ledger/ListLedgerEventBlocks.graphql @@ -23,7 +23,7 @@ query ListLedgerEventBlocks( id eventType eventCategory eventClass status occurredAt effectiveAt source externalId externalUrl amount currency description metadata dimensionIds agentId resourceType resourceElementId - replacedByEventId replacesEventId obligatedByEventId dischargesEventId + replacedByEventId replacesEventId obligatedByEventId dischargesEventId documentId createdAt createdBy } } diff --git a/robosystems_client/graphql/schema.graphql b/robosystems_client/graphql/schema.graphql index 783664e1..300c3410 100644 --- a/robosystems_client/graphql/schema.graphql +++ b/robosystems_client/graphql/schema.graphql @@ -1613,6 +1613,7 @@ type EventBlock { replacesEventId: String obligatedByEventId: String dischargesEventId: String + documentId: String createdAt: DateTime! createdBy: String! } diff --git a/tests/test_ledger_client.py b/tests/test_ledger_client.py index ffc106c6..6007549c 100644 --- a/tests/test_ledger_client.py +++ b/tests/test_ledger_client.py @@ -1181,6 +1181,7 @@ def test_list_event_blocks(self, mock_execute, mock_config, graph_id): "replacesEventId": None, "obligatedByEventId": None, "dischargesEventId": None, + "documentId": None, "createdAt": "2026-03-15T12:00:00Z", "createdBy": "user_1", } @@ -1236,6 +1237,7 @@ def test_get_event_block(self, mock_execute, mock_config, graph_id): "replacesEventId": None, "obligatedByEventId": None, "dischargesEventId": None, + "documentId": "doc_inv_9", "createdAt": "2026-03-15T12:00:00Z", "createdBy": "user_1", } @@ -1244,6 +1246,7 @@ def test_get_event_block(self, mock_execute, mock_config, graph_id): result = client.get_event_block(graph_id, "evt_1") assert result is not None assert result.id == "evt_1" + assert result.document_id == "doc_inv_9" variables = mock_execute.call_args[0][2] assert variables["id"] == "evt_1"