Skip to content

Commit 7608199

Browse files
committed
feat: a report fact's own provenance and frozen_at on the envelope
Regenerated from the local stack on robosystems feature/fact-lineage-surface: FactLite gains provenance (the fact's own FactProvenance descriptor) and frozen_at; the GraphQL SDL snapshot carries InformationBlockFact.provenance and frozenAt; the regenerate-report and file-report descriptions follow the column freeze. Claude-Session: https://claude.ai/code/session_013UXnatpnbiixt1ZVHfdZAP
1 parent b59a994 commit 7608199

6 files changed

Lines changed: 156 additions & 13 deletions

File tree

‎robosystems_client/api/robo_ledger_reports/file_report.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ def sync_detailed(
112112
"""File Report
113113
114114
Transitions the Report's filing_status to 'filed' — locks the package. Allowed from 'draft' or
115-
'under_review'. Stamps filed_at + filed_by.
115+
'under_review', and only once the books are closed through every period the Report states. Stamps
116+
filed_at + filed_by.
116117
117118
**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
118119
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
@@ -160,7 +161,8 @@ def sync(
160161
"""File Report
161162
162163
Transitions the Report's filing_status to 'filed' — locks the package. Allowed from 'draft' or
163-
'under_review'. Stamps filed_at + filed_by.
164+
'under_review', and only once the books are closed through every period the Report states. Stamps
165+
filed_at + filed_by.
164166
165167
**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
166168
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
@@ -203,7 +205,8 @@ async def asyncio_detailed(
203205
"""File Report
204206
205207
Transitions the Report's filing_status to 'filed' — locks the package. Allowed from 'draft' or
206-
'under_review'. Stamps filed_at + filed_by.
208+
'under_review', and only once the books are closed through every period the Report states. Stamps
209+
filed_at + filed_by.
207210
208211
**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
209212
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
@@ -249,7 +252,8 @@ async def asyncio(
249252
"""File Report
250253
251254
Transitions the Report's filing_status to 'filed' — locks the package. Allowed from 'draft' or
252-
'under_review'. Stamps filed_at + filed_by.
255+
'under_review', and only once the books are closed through every period the Report states. Stamps
256+
filed_at + filed_by.
253257
254258
**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
255259
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.

‎robosystems_client/api/robo_ledger_reports/regenerate_report.py‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ def sync_detailed(
111111
) -> Response[ErrorResponse | OperationEnvelopeReportResponse]:
112112
"""Regenerate Report
113113
114-
Re-runs fact generation for an existing Report against the latest ledger state. Pass
115-
`period_start`/`period_end`/`periods` only if you want to change the reporting window.
114+
Rewrites a Report's live columns from the latest ledger state. A column whose period the books have
115+
closed is frozen and keeps its facts; an open column already follows the ledger on every read, so
116+
pass `period_start`/`period_end`/`periods` to change the reporting window, which drops the frozen
117+
facts of any window no column states.
116118
117119
**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
118120
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
@@ -155,8 +157,10 @@ def sync(
155157
) -> ErrorResponse | OperationEnvelopeReportResponse | None:
156158
"""Regenerate Report
157159
158-
Re-runs fact generation for an existing Report against the latest ledger state. Pass
159-
`period_start`/`period_end`/`periods` only if you want to change the reporting window.
160+
Rewrites a Report's live columns from the latest ledger state. A column whose period the books have
161+
closed is frozen and keeps its facts; an open column already follows the ledger on every read, so
162+
pass `period_start`/`period_end`/`periods` to change the reporting window, which drops the frozen
163+
facts of any window no column states.
160164
161165
**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
162166
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
@@ -194,8 +198,10 @@ async def asyncio_detailed(
194198
) -> Response[ErrorResponse | OperationEnvelopeReportResponse]:
195199
"""Regenerate Report
196200
197-
Re-runs fact generation for an existing Report against the latest ledger state. Pass
198-
`period_start`/`period_end`/`periods` only if you want to change the reporting window.
201+
Rewrites a Report's live columns from the latest ledger state. A column whose period the books have
202+
closed is frozen and keeps its facts; an open column already follows the ledger on every read, so
203+
pass `period_start`/`period_end`/`periods` to change the reporting window, which drops the frozen
204+
facts of any window no column states.
199205
200206
**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
201207
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
@@ -236,8 +242,10 @@ async def asyncio(
236242
) -> ErrorResponse | OperationEnvelopeReportResponse | None:
237243
"""Regenerate Report
238244
239-
Re-runs fact generation for an existing Report against the latest ledger state. Pass
240-
`period_start`/`period_end`/`periods` only if you want to change the reporting window.
245+
Rewrites a Report's live columns from the latest ledger state. A column whose period the books have
246+
closed is frozen and keeps its facts; an open column already follows the ledger on every read, so
247+
pass `period_start`/`period_end`/`periods` to change the reporting window, which drops the frozen
248+
facts of any window no column states.
241249
242250
**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
243251
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.

‎robosystems_client/graphql/schema.graphql‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4047,6 +4047,16 @@ type InformationBlockFact {
40474047
"""historical | in_scope"""
40484048
factScope: String!
40494049
factSetId: String
4050+
4051+
"""
4052+
The fact's own typed `FactProvenance` descriptor (discriminated on `origin`): a `pivot` names the accounts that foot to it, a `rollup` the concepts and weights it summed, a `derived` value its computations and the amounts by part. Null means unknown, never the set's descriptor.
4053+
"""
4054+
provenance: JSON
4055+
4056+
"""
4057+
When the fact's column froze: its period fully closed, so the value is the record. Null is a live column that follows the books.
4058+
"""
4059+
frozenAt: DateTime
40504060
}
40514061

40524062
"""

‎robosystems_client/models/__init__.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@
286286
)
287287
from .external_connection_config import ExternalConnectionConfig
288288
from .fact_lite import FactLite
289+
from .fact_lite_provenance_type_0 import FactLiteProvenanceType0
289290
from .fact_record import FactRecord
290291
from .fact_set_lite import FactSetLite
291292
from .fact_set_lite_provenance_type_0 import FactSetLiteProvenanceType0
@@ -1463,6 +1464,7 @@
14631464
"ExecuteEventBlockResponseQbErrorType0",
14641465
"ExternalConnectionConfig",
14651466
"FactLite",
1467+
"FactLiteProvenanceType0",
14661468
"FactRecord",
14671469
"FactSetLite",
14681470
"FactSetLiteProvenanceType0",

‎robosystems_client/models/fact_lite.py‎

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22

33
import datetime
44
from collections.abc import Mapping
5-
from typing import Any, TypeVar, cast
5+
from typing import TYPE_CHECKING, Any, TypeVar, cast
66

77
from attrs import define as _attrs_define
88
from attrs import field as _attrs_field
99

1010
from ..types import UNSET, Unset
1111

12+
if TYPE_CHECKING:
13+
from ..models.fact_lite_provenance_type_0 import FactLiteProvenanceType0
14+
15+
1216
T = TypeVar("T", bound="FactLite")
1317

1418

@@ -31,6 +35,12 @@ class FactLite:
3135
period_start (datetime.date | None | Unset):
3236
unit (str | Unset): Default: 'USD'.
3337
fact_set_id (None | str | Unset):
38+
provenance (FactLiteProvenanceType0 | None | Unset): The fact's own typed `FactProvenance` descriptor
39+
(discriminated on `origin`): a `pivot` names the accounts that foot to it, a `rollup` the concepts and weights
40+
it summed, a `derived` value its computations and the amounts by part. Null means unknown, never the set's
41+
descriptor.
42+
frozen_at (datetime.datetime | None | Unset): When the fact's column froze: its period fully closed, so the
43+
value is the record. Null is a live column that follows the books.
3444
"""
3545

3646
id: str
@@ -47,9 +57,13 @@ class FactLite:
4757
period_start: datetime.date | None | Unset = UNSET
4858
unit: str | Unset = "USD"
4959
fact_set_id: None | str | Unset = UNSET
60+
provenance: FactLiteProvenanceType0 | None | Unset = UNSET
61+
frozen_at: datetime.datetime | None | Unset = UNSET
5062
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
5163

5264
def to_dict(self) -> dict[str, Any]:
65+
from ..models.fact_lite_provenance_type_0 import FactLiteProvenanceType0
66+
5367
id = self.id
5468

5569
element_id = self.element_id
@@ -108,6 +122,22 @@ def to_dict(self) -> dict[str, Any]:
108122
else:
109123
fact_set_id = self.fact_set_id
110124

125+
provenance: dict[str, Any] | None | Unset
126+
if isinstance(self.provenance, Unset):
127+
provenance = UNSET
128+
elif isinstance(self.provenance, FactLiteProvenanceType0):
129+
provenance = self.provenance.to_dict()
130+
else:
131+
provenance = self.provenance
132+
133+
frozen_at: None | str | Unset
134+
if isinstance(self.frozen_at, Unset):
135+
frozen_at = UNSET
136+
elif isinstance(self.frozen_at, datetime.datetime):
137+
frozen_at = self.frozen_at.isoformat()
138+
else:
139+
frozen_at = self.frozen_at
140+
111141
field_dict: dict[str, Any] = {}
112142
field_dict.update(self.additional_properties)
113143
field_dict.update(
@@ -137,11 +167,17 @@ def to_dict(self) -> dict[str, Any]:
137167
field_dict["unit"] = unit
138168
if fact_set_id is not UNSET:
139169
field_dict["fact_set_id"] = fact_set_id
170+
if provenance is not UNSET:
171+
field_dict["provenance"] = provenance
172+
if frozen_at is not UNSET:
173+
field_dict["frozen_at"] = frozen_at
140174

141175
return field_dict
142176

143177
@classmethod
144178
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
179+
from ..models.fact_lite_provenance_type_0 import FactLiteProvenanceType0
180+
145181
d = dict(src_dict)
146182
id = d.pop("id")
147183

@@ -228,6 +264,40 @@ def _parse_fact_set_id(data: object) -> None | str | Unset:
228264

229265
fact_set_id = _parse_fact_set_id(d.pop("fact_set_id", UNSET))
230266

267+
def _parse_provenance(data: object) -> FactLiteProvenanceType0 | None | Unset:
268+
if data is None:
269+
return data
270+
if isinstance(data, Unset):
271+
return data
272+
try:
273+
if not isinstance(data, dict):
274+
raise TypeError()
275+
provenance_type_0 = FactLiteProvenanceType0.from_dict(data)
276+
277+
return provenance_type_0
278+
except (TypeError, ValueError, AttributeError, KeyError):
279+
pass
280+
return cast(FactLiteProvenanceType0 | None | Unset, data)
281+
282+
provenance = _parse_provenance(d.pop("provenance", UNSET))
283+
284+
def _parse_frozen_at(data: object) -> datetime.datetime | None | Unset:
285+
if data is None:
286+
return data
287+
if isinstance(data, Unset):
288+
return data
289+
try:
290+
if not isinstance(data, str):
291+
raise TypeError()
292+
frozen_at_type_0 = datetime.datetime.fromisoformat(data)
293+
294+
return frozen_at_type_0
295+
except (TypeError, ValueError, AttributeError, KeyError):
296+
pass
297+
return cast(datetime.datetime | None | Unset, data)
298+
299+
frozen_at = _parse_frozen_at(d.pop("frozen_at", UNSET))
300+
231301
fact_lite = cls(
232302
id=id,
233303
element_id=element_id,
@@ -243,6 +313,8 @@ def _parse_fact_set_id(data: object) -> None | str | Unset:
243313
period_start=period_start,
244314
unit=unit,
245315
fact_set_id=fact_set_id,
316+
provenance=provenance,
317+
frozen_at=frozen_at,
246318
)
247319

248320
fact_lite.additional_properties = d
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
from __future__ import annotations
2+
3+
from collections.abc import Mapping
4+
from typing import Any, TypeVar
5+
6+
from attrs import define as _attrs_define
7+
from attrs import field as _attrs_field
8+
9+
T = TypeVar("T", bound="FactLiteProvenanceType0")
10+
11+
12+
@_attrs_define
13+
class FactLiteProvenanceType0:
14+
""" """
15+
16+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
17+
18+
def to_dict(self) -> dict[str, Any]:
19+
20+
field_dict: dict[str, Any] = {}
21+
field_dict.update(self.additional_properties)
22+
23+
return field_dict
24+
25+
@classmethod
26+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
27+
d = dict(src_dict)
28+
fact_lite_provenance_type_0 = cls()
29+
30+
fact_lite_provenance_type_0.additional_properties = d
31+
return fact_lite_provenance_type_0
32+
33+
@property
34+
def additional_keys(self) -> list[str]:
35+
return list(self.additional_properties.keys())
36+
37+
def __getitem__(self, key: str) -> Any:
38+
return self.additional_properties[key]
39+
40+
def __setitem__(self, key: str, value: Any) -> None:
41+
self.additional_properties[key] = value
42+
43+
def __delitem__(self, key: str) -> None:
44+
del self.additional_properties[key]
45+
46+
def __contains__(self, key: str) -> bool:
47+
return key in self.additional_properties

0 commit comments

Comments
 (0)