Skip to content

Commit 62d2621

Browse files
authored
Merge branch 'main' into claude/issue-11-20251026-2132
2 parents 6db1a86 + 7a1780b commit 62d2621

File tree

37 files changed

+1510
-631
lines changed

37 files changed

+1510
-631
lines changed

.github/workflows/claude-on-test-failure.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ jobs:
110110
111111
If you detect such a loop (e.g., you see multiple similar bot comments or your own previous analysis comments):
112112
1. **DO NOT** post another analysis comment
113-
2. Instead, post a brief comment stating: "Loop detected: Multiple automated analysis comments found. Stopping to prevent further automated comments. Please review the existing analysis comments."
114-
3. Exit immediately without further action
113+
2. Exit immediately without further action
115114
116115
# Problems Encountered
117116
If you encounter any problems during your analysis (e.g., unable to fetch logs, tools not working), document them clearly so the team knows what limitations you faced.
@@ -157,7 +156,6 @@ jobs:
157156
actions: read
158157
159158
prompt: ${{ steps.analysis-prompt.outputs.PROMPT }}
160-
track_progress: true
161159
claude_args: |
162160
--allowed-tools mcp__repository-summary,mcp__code-search,mcp__github-research,WebSearch,WebFetch,Bash(make:*,git:*)
163161
--mcp-config /tmp/mcp-config/mcp-servers.json

key-value/key-value-aio/src/key_value/aio/stores/base.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from key_value.shared.errors import StoreSetupError
1515
from key_value.shared.type_checking.bear_spray import bear_enforce
1616
from key_value.shared.utils.managed_entry import ManagedEntry
17+
from key_value.shared.utils.sanitization import PassthroughStrategy, SanitizationStrategy
1718
from key_value.shared.utils.serialization import BasicSerializationAdapter, SerializationAdapter
1819
from key_value.shared.utils.time_to_live import prepare_entry_timestamps
1920
from typing_extensions import Self, override
@@ -69,6 +70,8 @@ class BaseStore(AsyncKeyValueProtocol, ABC):
6970
_setup_collection_complete: defaultdict[str, bool]
7071

7172
_serialization_adapter: SerializationAdapter
73+
_key_sanitization_strategy: SanitizationStrategy
74+
_collection_sanitization_strategy: SanitizationStrategy
7275

7376
_seed: FROZEN_SEED_DATA_TYPE
7477

@@ -78,13 +81,17 @@ def __init__(
7881
self,
7982
*,
8083
serialization_adapter: SerializationAdapter | None = None,
84+
key_sanitization_strategy: SanitizationStrategy | None = None,
85+
collection_sanitization_strategy: SanitizationStrategy | None = None,
8186
default_collection: str | None = None,
8287
seed: SEED_DATA_TYPE | None = None,
8388
) -> None:
8489
"""Initialize the managed key-value store.
8590
8691
Args:
8792
serialization_adapter: The serialization adapter to use for the store.
93+
key_sanitization_strategy: The sanitization strategy to use for keys.
94+
collection_sanitization_strategy: The sanitization strategy to use for collections.
8895
default_collection: The default collection to use if no collection is provided.
8996
Defaults to "default_collection".
9097
seed: Optional seed data to pre-populate the store. Format: {collection: {key: {field: value, ...}}}.
@@ -103,6 +110,9 @@ def __init__(
103110

104111
self._serialization_adapter = serialization_adapter or BasicSerializationAdapter()
105112

113+
self._key_sanitization_strategy = key_sanitization_strategy or PassthroughStrategy()
114+
self._collection_sanitization_strategy = collection_sanitization_strategy or PassthroughStrategy()
115+
106116
if not hasattr(self, "_stable_api"):
107117
self._stable_api = False
108118

@@ -117,6 +127,17 @@ async def _setup(self) -> None:
117127
async def _setup_collection(self, *, collection: str) -> None:
118128
"""Initialize the collection (called once before first use of the collection)."""
119129

130+
def _sanitize_collection_and_key(self, collection: str, key: str) -> tuple[str, str]:
131+
return self._sanitize_collection(collection=collection), self._sanitize_key(key=key)
132+
133+
def _sanitize_collection(self, collection: str) -> str:
134+
self._collection_sanitization_strategy.validate(value=collection)
135+
return self._collection_sanitization_strategy.sanitize(value=collection)
136+
137+
def _sanitize_key(self, key: str) -> str:
138+
self._key_sanitization_strategy.validate(value=key)
139+
return self._key_sanitization_strategy.sanitize(value=key)
140+
120141
async def _seed_store(self) -> None:
121142
"""Seed the store with the data from the seed."""
122143
for collection, items in self._seed.items():

0 commit comments

Comments
 (0)