From 164eb83916996fb9c4ee9b880d95770598ef22b4 Mon Sep 17 00:00:00 2001 From: Richard Solomou Date: Fri, 24 Apr 2026 09:33:01 +0300 Subject: [PATCH] fix(examples): bypass cache when running a single example directly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the user invokes run-examples.sh with a name filter that resolves to exactly one match, they're running that example on purpose — caching the previous pass and skipping it is surprising. Batch runs and fuzzy filters matching multiple examples still use the cache. Generated-By: PostHog Code Task-Id: 8eea9ca1-1939-4c59-b12a-92784f5b7238 --- run-examples.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/run-examples.sh b/run-examples.sh index 93bbf1f..6ca0752 100755 --- a/run-examples.sh +++ b/run-examples.sh @@ -16,7 +16,7 @@ set -euo pipefail # ./run-examples.sh --install Install deps for all examples # ./run-examples.sh --rerun Force re-run (ignore cache), combinable with other flags # ./run-examples.sh --reset Clear the results cache -# ./run-examples.sh openai/embeddings Run a specific example (fuzzy match) +# ./run-examples.sh openai/embeddings Run a specific example (fuzzy match, bypasses cache) # ./run-examples.sh anthropic Run all examples matching "anthropic" SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" @@ -473,6 +473,8 @@ elif [[ -n "$MODE" && "$MODE" != --* ]]; then echo "Use --list to see all available examples." exit 1 elif [[ ${#MATCHED[@]} -eq 1 ]]; then + # Running a single example directly always bypasses the cache. + RERUN=1 run_example "${MATCHED[0]}" else echo "Running ${#MATCHED[@]} examples matching '$MODE':"