Coverage for astrocyte/pipeline/retain_fsm/__init__.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.15.0, created at 2026-07-04 05:24 +0000

1"""M14: FSM-scaffolded retain pipeline. 

2 

3See ``docs/_design/m13-m14-roadmap.md`` §4 for the full design and 

4phase plan. 

5 

6M14.0 (this commit) ships the engine + context + checkpoint scaffold 

7plus three stub states (``INIT``, ``READ``, ``COMPLETE``). M14.1 

8through M14.5 fill in the real extraction / compile / wiki / supersedes 

9states. 

10 

11Public API:: 

12 

13 from astrocyte.pipeline.retain_fsm import ( 

14 RetainFSM, RetainContext, RetainServices, 

15 Complete, Failed, Parallel, 

16 FileCheckpoint, InMemoryCheckpoint, 

17 register_default_states, 

18 ) 

19 

20Usage:: 

21 

22 services = RetainServices(store=..., provider=...) 

23 fsm = RetainFSM(services) 

24 register_default_states(fsm) 

25 ctx = RetainContext(bank_id="b1", source_id="s1", md_text="...") 

26 ctx = await fsm.run(ctx, checkpoint=FileCheckpoint("./checkpoints")) 

27""" 

28 

29from astrocyte.pipeline.retain_fsm.checkpoint import ( 

30 Checkpoint, 

31 FileCheckpoint, 

32 InMemoryCheckpoint, 

33) 

34from astrocyte.pipeline.retain_fsm.context import ( 

35 RetainContext, 

36 RetainServices, 

37 StepLogEntry, 

38) 

39from astrocyte.pipeline.retain_fsm.engine import ( 

40 Complete, 

41 Failed, 

42 Parallel, 

43 RetainFSM, 

44 StateFunc, 

45) 

46from astrocyte.pipeline.retain_fsm.states import ( 

47 DEFAULT_STATES, 

48 register_default_states, 

49 state_complete, 

50 state_init, 

51 state_read, 

52) 

53 

54__all__ = [ 

55 "DEFAULT_STATES", 

56 "Checkpoint", 

57 "Complete", 

58 "Failed", 

59 "FileCheckpoint", 

60 "InMemoryCheckpoint", 

61 "Parallel", 

62 "RetainContext", 

63 "RetainFSM", 

64 "RetainServices", 

65 "StateFunc", 

66 "StepLogEntry", 

67 "register_default_states", 

68 "state_complete", 

69 "state_init", 

70 "state_read", 

71]