Coverage for node / src / stigmem_node / models / tombstones.py: 100%

40 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-05-25 01:49 +0000

1"""RTBF tombstone models.""" 

2 

3from __future__ import annotations 

4 

5from pydantic import BaseModel, Field 

6 

7 

8class TombstoneNotice(BaseModel): 

9 """Tombstone metadata surfaced to admin callers on time-travel queries. 

10 

11 Covered by Spec-X3-Time-Travel-Queries. 

12 """ 

13 

14 entity_uri: str 

15 tombstone_id: str 

16 legal_hold: bool 

17 tombstone_created_at: str 

18 

19 

20# --------------------------------------------------------------------------- 

21# RTBF Tombstones (Spec-X2-RTBF-Tombstones) 

22# --------------------------------------------------------------------------- 

23 

24 

25class TombstoneRecord(BaseModel): 

26 """Durable record directing every node to suppress facts about entity_uri. 

27 

28 Covered by Spec-X2-RTBF-Tombstones. 

29 """ 

30 

31 id: str 

32 entity_uri: str 

33 scope: str 

34 reason: str | None = None 

35 signed_by: str 

36 key_id: str = "" 

37 signature: str 

38 created_at: str 

39 legal_hold: bool = False 

40 

41 

42class TombstoneRevocationRecord(BaseModel): 

43 """Record reinstating a tombstoned entity (Spec-X2-RTBF-Tombstones).""" 

44 

45 id: str 

46 tombstone_id: str 

47 reason: str 

48 signed_by: str 

49 key_id: str = "" 

50 signature: str 

51 created_at: str 

52 

53 

54class TombstoneCreateRequest(BaseModel): 

55 entity_uri: str = Field(..., min_length=1) 

56 scope: str = Field("*") 

57 reason: str | None = None 

58 legal_hold: bool = False 

59 

60 

61class TombstoneRevokeRequest(BaseModel): 

62 reason: str = Field(..., min_length=1) 

63 

64 

65class TombstoneStatusResponse(BaseModel): 

66 tombstoned: bool 

67 tombstones: list[TombstoneRecord] 

68 revocations: list[TombstoneRevocationRecord] 

69 

70 

71class FederationTombstonesResponse(BaseModel): 

72 tombstones: list[TombstoneRecord] 

73 revocations: list[TombstoneRevocationRecord] 

74 cursor: str | None 

75