Un-key stage-cache rows written before the current key shape

CACHE_SHAPE_SINCE marks the last change that moved every cache key. The
run service's periodic sweep clears cache_key on rows of runs created
before it, which nothing can match any more. Their outputs stay.
This commit is contained in:
2026-10-15 10:54:22 +02:00
parent 6fa44bacf3
commit a95be36dba
5 changed files with 69 additions and 4 deletions
+8
View File
@@ -23,6 +23,7 @@ from collections import deque
from collections.abc import Callable, Iterator
from concurrent.futures import Future, ThreadPoolExecutor, wait
from contextlib import contextmanager
from datetime import UTC, datetime
from functools import lru_cache
from typing import Any, Literal, Protocol
@@ -166,6 +167,13 @@ class RunCacheLookup(Protocol):
"""What an equal execution produced, or None when there is no entry."""
#: When the current shape of a cache key landed: the last change to what a
#: fingerprint hashes (`FlowController`) or to how the key below reduces its
#: inputs that moved every key. A row written before it matches nothing now,
#: so the run service's sweep un-keys it. Move it forward with such a change.
CACHE_SHAPE_SINCE = datetime(2026, 8, 26, 19, 27, 10, tzinfo=UTC)
def run_cache_key(fingerprint: str, inputs: dict[str, Any], flow: str = "") -> str:
"""What this node, with these inputs, is known by.