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

11 statements  

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

1"""Fact provenance models.""" 

2 

3from __future__ import annotations 

4 

5from pydantic import BaseModel 

6 

7 

8class ProvenanceEntry(BaseModel): 

9 """One entry in a fact's derived_from chain. 

10 

11 exists=False means the referenced entity is tombstoned or the fact is otherwise 

12 inaccessible. Shape is identical in both cases so 

13 callers cannot distinguish tombstone from unauthorized. 

14 """ 

15 

16 hash: str 

17 fact_id: str | None = None 

18 entity: str | None = None 

19 exists: bool 

20 

21 

22class ProvenanceResponse(BaseModel): 

23 """Response for GET /v1/facts/:id/provenance.""" 

24 

25 fact_id: str 

26 cid: str | None = None 

27 derived_from: list[ProvenanceEntry] 

28