🧪 add integration tests for idstack-learnings-delete#31
Conversation
Added integration tests for `idstack-learnings-delete` script in `test/integration-test.sh`. It tests successful deletion, handling missing files, non-existent keys, and missing arguments. Co-authored-by: savvides <1580637+savvides@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Code Review
This pull request introduces integration tests for the idstack-learnings-delete command, covering successful deletion by key and error handling for missing keys, arguments, or files. The reviewer suggested using a Python-based JSON parser instead of grep to verify the contents of the .idstack/learnings.jsonl file more robustly, preventing potential false positives.
| $IDSTACK_DIR/bin/idstack-learnings-log '{"skill":"test","type":"operational","key":"to-keep","insight":"keep me","confidence":9}' | ||
|
|
||
| check "deletes specific learning by key" \ | ||
| "$IDSTACK_DIR/bin/idstack-learnings-delete to-delete && ! grep -q 'to-delete' .idstack/learnings.jsonl && grep -q 'to-keep' .idstack/learnings.jsonl" |
There was a problem hiding this comment.
Using grep to verify the contents of a JSONL file is fragile and can lead to false positives or negatives if the search string (e.g., to-delete) appears in other fields like insight or skill. Since the script already uses python3 for JSON validation in other tests (e.g., lines 37, 57, 77), it is more robust to parse the JSON and verify the specific keys.
| "$IDSTACK_DIR/bin/idstack-learnings-delete to-delete && ! grep -q 'to-delete' .idstack/learnings.jsonl && grep -q 'to-keep' .idstack/learnings.jsonl" | |
| "$IDSTACK_DIR/bin/idstack-learnings-delete to-delete && python3 -c \"import json; keys = [json.loads(l)['key'] for l in open('.idstack/learnings.jsonl')]; assert 'to-delete' not in keys and 'to-keep' in keys\"" |
🎯 What: Added missing integration test for
idstack-learnings-delete.📊 Coverage: Tests successful deletion (happy path), handling missing arguments, missing keys, and missing learning file.
✨ Result: Improved test coverage for
bin/idstack-learnings-delete.PR created automatically by Jules for task 2258383791522170302 started by @savvides