Coverage for src/invariant/store/null.py: 100.00%

1"""NullStore: No-op artifact store. Every operation executes; nothing is cached."""

2

3 from typing import Any

4

5 from invariant.store.base import ArtifactStore

6

7

8 class NullStore(ArtifactStore):

9 """Store that never caches. exists() always returns False; put() is a no-op.

10

11 Use for execution correctness tests where cache behavior is irrelevant.

12 Stats are not updated (remains no-op).

13 """

14

15 def exists(self, op_name: str, digest: str) -> bool:

16 """Always return False; nothing is ever cached."""

17 return False

18

19 def get(self, op_name: str, digest: str) -> Any:

20 """Raise KeyError. Should never be called since exists() always returns False."""

21 raise KeyError(

22 f"Artifact with op_name '{op_name}' and digest '{digest}' not found"

23 )

24

25 def put(self, op_name: str, digest: str, artifact: Any) -> None:

26 """No-op; nothing is stored."""

27 pass