Skip to content

🧪 Add tests for idstack-learnings-delete#41

Open
savvides wants to merge 1 commit into
mainfrom
add-tests-idstack-learnings-delete-2773664691298862766
Open

🧪 Add tests for idstack-learnings-delete#41
savvides wants to merge 1 commit into
mainfrom
add-tests-idstack-learnings-delete-2773664691298862766

Conversation

@savvides

@savvides savvides commented Jun 6, 2026

Copy link
Copy Markdown
Owner

🎯 What: The testing gap for idstack-learnings-delete script was addressed. It previously lacked test coverage in the test suite.
📊 Coverage: Test coverage includes the following scenarios: returns error if no arguments provided, returns error if no file exists, returns error if key not found, deletes the most recent entry with the key when there are duplicates, and deletes a specific learning (success case).
Result: The test/integration-test.sh now fully tests idstack-learnings-delete catching regressions and real bugs. Test coverage improved.


PR created automatically by Jules for task 2773664691298862766 started by @savvides

This adds tests for the idstack-learnings-delete command in test/integration-test.sh to cover edge cases, successful deletion, and more.

Co-authored-by: savvides <1580637+savvides@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds integration tests for the idstack-learnings-delete utility, covering error cases (no arguments, missing file, key not found) and deletion behavior (handling duplicates and specific keys). The review feedback suggests enhancing these tests by verifying that the data file remains unmodified on failed deletions, asserting the exact content of remaining entries, testing the deletion of the last remaining item, and cleaning up an unused import in the Python assertion helper.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread test/integration-test.sh
Comment on lines +133 to +134
check "returns error if key not found" \
"! $IDSTACK_DIR/bin/idstack-learnings-delete missingkey"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When a delete operation fails (e.g., because the key was not found), it is important to verify that the underlying data file remains unmodified and is not corrupted or cleared.

We can enhance this test by asserting that the line count of .idstack/learnings.jsonl remains exactly 3 after the failed delete attempt.

Suggested change
check "returns error if key not found" \
"! $IDSTACK_DIR/bin/idstack-learnings-delete missingkey"
check "returns error if key not found" \
"! $IDSTACK_DIR/bin/idstack-learnings-delete missingkey && [ \$(wc -l < .idstack/learnings.jsonl | tr -d ' ') -eq 3 ]"

Comment thread test/integration-test.sh
Comment on lines +139 to +140
check "deletes a specific learning" \
"$IDSTACK_DIR/bin/idstack-learnings-delete key2 && python3 -c \"import json,sys; lines=[json.loads(l) for l in open('.idstack/learnings.jsonl')]; assert len(lines)==1 and lines[0]['key']=='key1'\""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This suggestion introduces three improvements:

  1. Robustness: Verifies the insight field of the remaining entry to ensure the correct item was preserved.
  2. Edge Case Coverage: Adds a new test case to verify that deleting the last remaining entry in the file works correctly and leaves the file empty (or deleted), which is a common edge case for file-based deletion scripts.
  3. Cleanliness: Removes the unused sys import from the Python one-liner.
Suggested change
check "deletes a specific learning" \
"$IDSTACK_DIR/bin/idstack-learnings-delete key2 && python3 -c \"import json,sys; lines=[json.loads(l) for l in open('.idstack/learnings.jsonl')]; assert len(lines)==1 and lines[0]['key']=='key1'\""
check "deletes a specific learning" \
"$IDSTACK_DIR/bin/idstack-learnings-delete key2 && python3 -c \"import json; lines=[json.loads(l) for l in open('.idstack/learnings.jsonl')]; assert len(lines)==1 and lines[0]['key']=='key1' and lines[0]['insight']=='one'\""
check "deletes the last remaining learning" \
"$IDSTACK_DIR/bin/idstack-learnings-delete key1 && [ ! -s .idstack/learnings.jsonl ]"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant