Skip to content

Commit 218edec

Browse files
visahakclaude
andcommitted
fix(recall): harden frontmatter parsing and stdin validation
- Catch UnicodeDecodeError in _parse_frontmatter_only - Reject files missing closing --- delimiter - Validate stdin JSON is a dict before accessing keys - Add e2e marker to manifest retrieval tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5bd41e3 commit 218edec

4 files changed

Lines changed: 13 additions & 4 deletions

File tree

platform-integrations/claude/plugins/evolve-lite/lib/entity_io.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,16 @@ def _parse_frontmatter_only(path):
248248
return {}
249249

250250
frontmatter_lines = []
251+
found_closing = False
251252
for line in handle:
252253
if line.strip() == "---":
254+
found_closing = True
253255
break
254256
frontmatter_lines.append(line)
255-
except OSError:
257+
except (OSError, UnicodeDecodeError):
258+
return {}
259+
260+
if not found_closing:
256261
return {}
257262

258263
return _parse_frontmatter_lines(frontmatter_lines)

platform-integrations/claude/plugins/evolve-lite/skills/recall/scripts/retrieve_entities.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,15 @@ def format_entities(entities):
4141
def main():
4242
try:
4343
input_data = json.load(sys.stdin)
44-
log(f"Input keys: {list(input_data.keys())}")
4544
except json.JSONDecodeError as e:
4645
log(f"Failed to parse JSON input: {e}")
4746
return
4847

48+
if not isinstance(input_data, dict):
49+
log(f"Expected JSON object, got {type(input_data).__name__}")
50+
return
51+
52+
log(f"Input keys: {list(input_data.keys())}")
4953
prompt = input_data.get("prompt", "")
5054
if prompt:
5155
log(f"Prompt preview: {prompt[:120]}")

tests/platform_integrations/test_claude_retrieve_manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import pytest
1010

11-
pytestmark = pytest.mark.platform_integrations
11+
pytestmark = [pytest.mark.platform_integrations, pytest.mark.e2e]
1212

1313
_REPO_ROOT = Path(__file__).parent.parent.parent
1414
CLAUDE_RETRIEVE_SCRIPT = _REPO_ROOT / "platform-integrations/claude/plugins/evolve-lite/skills/recall/scripts/retrieve_entities.py"

tests/platform_integrations/test_codex_retrieve_manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import pytest
1010

11-
pytestmark = pytest.mark.platform_integrations
11+
pytestmark = [pytest.mark.platform_integrations, pytest.mark.e2e]
1212

1313
_REPO_ROOT = Path(__file__).parent.parent.parent
1414
CODEX_RETRIEVE_SCRIPT = _REPO_ROOT / "platform-integrations/codex/plugins/evolve-lite/skills/recall/scripts/retrieve_entities.py"

0 commit comments

Comments
 (0)